1 #ifndef _ENCODERFFMPEG_H
2 #define _ENCODERFFMPEG_H
5 * Copyright (C) 2005-2013 Team XBMC
8 * This Program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
13 * This Program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with XBMC; see the file COPYING. If not, see
20 * <http://www.gnu.org/licenses/>.
25 #include "DllAvFormat.h"
26 #include "DllAvCodec.h"
27 #include "DllAvUtil.h"
28 #include "DllSwResample.h"
30 class CEncoderFFmpeg : public CEncoder
34 virtual ~CEncoderFFmpeg() {}
35 bool Init(const char* strFile, int iInChannels, int iInRate, int iInBits);
36 int Encode(int nNumBytesRead, uint8_t* pbtStream);
38 void AddTag(int key, const char* value);
41 DllAvCodec m_dllAvCodec;
42 DllAvUtil m_dllAvUtil;
43 DllAvFormat m_dllAvFormat;
44 DllSwResample m_dllSwResample;
46 AVFormatContext *m_Format;
47 AVCodecContext *m_CodecCtx;
51 AVSampleFormat m_InFormat;
52 AVSampleFormat m_OutFormat;
53 /* From libavformat/avio.h:
54 * The buffer size is very important for performance.
55 * For protocols with fixed blocksize it should be set to this
57 * For others a typical size is a cache page, e.g. 4kb.
59 unsigned char m_BCBuffer[4096];
60 static int avio_write_callback(void *opaque, uint8_t *buf, int buf_size);
61 static int64_t avio_seek_callback(void *opaque, int64_t offset, int whence);
62 void SetTag(const CStdString tag, const CStdString value);
65 unsigned int m_NeededFrames;
66 unsigned int m_NeededBytes;
68 unsigned int m_BufferSize;
69 AVFrame *m_BufferFrame;
70 uint8_t *m_ResampledBuffer;
71 unsigned int m_ResampledBufferSize;
72 AVFrame *m_ResampledFrame;
73 bool m_NeedConversion;
78 #endif // _ENCODERFFMPEG_H