AVCodecEncoder should not know the format
This commit is contained in:
@@ -54,25 +54,6 @@ AVCodecEncoder::AVCodecEncoder(uint32 codecID, int bitRateScale)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AVCodecEncoder::AVCodecEncoder(const media_format& format)
|
|
||||||
:
|
|
||||||
Encoder(),
|
|
||||||
fBitRateScale(1), // TODO: is it OK?
|
|
||||||
fCodecID(CodecID(-1)),
|
|
||||||
fCodec(NULL),
|
|
||||||
fOwnContext(avcodec_alloc_context3(NULL)),
|
|
||||||
fContext(fOwnContext),
|
|
||||||
fCodecInitStatus(CODEC_INIT_NEEDED),
|
|
||||||
fFrame(avcodec_alloc_frame()),
|
|
||||||
fSwsContext(NULL),
|
|
||||||
fFramesWritten(0)
|
|
||||||
{
|
|
||||||
TRACE("AVCodecEncoder::AVCodecEncoder()\n");
|
|
||||||
_Init();
|
|
||||||
SetUp(&format);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AVCodecEncoder::_Init()
|
AVCodecEncoder::_Init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ public:
|
|||||||
AVCodecEncoder(uint32 codecID,
|
AVCodecEncoder(uint32 codecID,
|
||||||
int bitRateScale);
|
int bitRateScale);
|
||||||
|
|
||||||
AVCodecEncoder(const media_format& format);
|
|
||||||
|
|
||||||
virtual ~AVCodecEncoder();
|
virtual ~AVCodecEncoder();
|
||||||
|
|
||||||
virtual status_t AcceptedFormat(
|
virtual status_t AcceptedFormat(
|
||||||
|
|||||||
@@ -159,7 +159,15 @@ FFmpegPlugin::NewEncoder(const media_codec_info& codecInfo)
|
|||||||
Encoder*
|
Encoder*
|
||||||
FFmpegPlugin::NewEncoder(const media_format& format)
|
FFmpegPlugin::NewEncoder(const media_format& format)
|
||||||
{
|
{
|
||||||
return new(std::nothrow)AVCodecEncoder(format);
|
for (size_t i = 0; i < gEncoderCount; i++) {
|
||||||
|
media_format destFormat;
|
||||||
|
if (format.type == gEncoderTable[i].output_type) {
|
||||||
|
return new(std::nothrow)AVCodecEncoder(
|
||||||
|
gEncoderTable[i].codec_info.sub_id,
|
||||||
|
gEncoderTable[i].bit_rate_scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user