2
// libavg - Media Playback Engine.
3
// Copyright (C) 2003-2011 Ulrich von Zadow
5
// This library is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation; either
8
// version 2 of the License, or (at your option) any later version.
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Lesser General Public License for more details.
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with this library; if not, write to the Free Software
17
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
// Current versions can be found at www.libavg.de
22
#ifndef _VideoWriterThread_H_
23
#define _VideoWriterThread_H_
27
#include "../base/WorkerThread.h"
28
#include "../graphics/Bitmap.h"
29
#include "../video/WrapFFMpeg.h"
31
#include <boost/shared_ptr.hpp>
32
#include <boost/thread.hpp>
39
class AVG_API VideoWriterThread : public WorkerThread<VideoWriterThread> {
41
VideoWriterThread(CQueue& CmdQueue, const std::string& sFilename, IntPoint size,
42
int frameRate, int qMin, int qMax);
43
virtual ~VideoWriterThread();
45
void encodeYUVFrame(BitmapPtr pBmp);
46
void encodeFrame(BitmapPtr pBmp);
53
// Called by base class
55
virtual void deinit();
57
void setupVideoStream();
58
void openVideoCodec();
60
AVFrame* createFrame(::PixelFormat pixelFormat, IntPoint size);
62
void convertRGBImage(BitmapPtr pSrcBmp);
63
void convertYUVImage(BitmapPtr pSrcBmp);
64
void writeFrame(AVFrame* pFrame);
66
std::string m_sFilename;
72
AVOutputFormat* m_pOutputFormat;
73
AVFormatContext* m_pOutputFormatContext;
74
AVStream* m_pVideoStream;
75
SwsContext* m_pFrameConversionContext;
76
AVFrame* m_pConvertedFrame;
77
unsigned char* m_pPictureBuffer;
78
unsigned char* m_pVideoBuffer;
79
int m_VideoBufferSize;
80
PixelFormat m_StreamPixelFormat;