av: Correctly populate the codec context with the defaults

This commit is contained in:
Sebastian Dröge 2012-12-05 19:25:37 +01:00
parent d840211412
commit 2d7ebf9514
4 changed files with 20 additions and 8 deletions

View file

@ -131,8 +131,11 @@ gst_ffmpegauddec_class_init (GstFFMpegAudDecClass * klass)
static void
gst_ffmpegauddec_init (GstFFMpegAudDec * ffmpegdec)
{
GstFFMpegAudDecClass *klass =
(GstFFMpegAudDecClass *) G_OBJECT_GET_CLASS (ffmpegdec);
/* some ffmpeg data */
ffmpegdec->context = avcodec_alloc_context3 (NULL);
ffmpegdec->context = avcodec_alloc_context3 (klass->in_plugin);
ffmpegdec->opened = FALSE;
gst_audio_decoder_set_drainable (GST_AUDIO_DECODER (ffmpegdec), TRUE);
@ -294,7 +297,7 @@ gst_ffmpegauddec_set_format (GstAudioDecoder * decoder, GstCaps * caps)
gst_ffmpegauddec_close (ffmpegdec);
/* and reset the defaults that were set when a context is created */
avcodec_get_context_defaults3 (ffmpegdec->context, NULL);
avcodec_get_context_defaults3 (ffmpegdec->context, oclass->in_plugin);
}
/* get size and so */

View file

@ -166,8 +166,11 @@ gst_ffmpegaudenc_class_init (GstFFMpegAudEncClass * klass)
static void
gst_ffmpegaudenc_init (GstFFMpegAudEnc * ffmpegaudenc)
{
GstFFMpegAudEncClass *klass =
(GstFFMpegAudEncClass *) G_OBJECT_GET_CLASS (ffmpegaudenc);
/* ffmpeg objects */
ffmpegaudenc->context = avcodec_alloc_context3 (NULL);
ffmpegaudenc->context = avcodec_alloc_context3 (klass->in_plugin);
ffmpegaudenc->opened = FALSE;
gst_audio_encoder_set_drainable (GST_AUDIO_ENCODER (ffmpegaudenc), TRUE);
@ -243,7 +246,7 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
}
/* set defaults */
avcodec_get_context_defaults3 (ffmpegaudenc->context, NULL);
avcodec_get_context_defaults3 (ffmpegaudenc->context, oclass->in_plugin);
/* if we set it in _getcaps we should set it also in _link */
ffmpegaudenc->context->strict_std_compliance = -1;

View file

@ -240,8 +240,11 @@ gst_ffmpegviddec_class_init (GstFFMpegVidDecClass * klass)
static void
gst_ffmpegviddec_init (GstFFMpegVidDec * ffmpegdec)
{
GstFFMpegVidDecClass *klass =
(GstFFMpegVidDecClass *) G_OBJECT_GET_CLASS (ffmpegdec);
/* some ffmpeg data */
ffmpegdec->context = avcodec_alloc_context3 (NULL);
ffmpegdec->context = avcodec_alloc_context3 (klass->in_plugin);
ffmpegdec->picture = avcodec_alloc_frame ();
ffmpegdec->opened = FALSE;
ffmpegdec->skip_frame = ffmpegdec->lowres = 0;
@ -366,7 +369,7 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
gst_ffmpegviddec_close (ffmpegdec);
/* and reset the defaults that were set when a context is created */
avcodec_get_context_defaults3 (ffmpegdec->context, NULL);
avcodec_get_context_defaults3 (ffmpegdec->context, oclass->in_plugin);
}
/* set buffer functions */

View file

@ -219,8 +219,11 @@ gst_ffmpegvidenc_class_init (GstFFMpegVidEncClass * klass)
static void
gst_ffmpegvidenc_init (GstFFMpegVidEnc * ffmpegenc)
{
GstFFMpegVidEncClass *klass =
(GstFFMpegVidEncClass *) G_OBJECT_GET_CLASS (ffmpegenc);
/* ffmpeg objects */
ffmpegenc->context = avcodec_alloc_context3 (NULL);
ffmpegenc->context = avcodec_alloc_context3 (klass->in_plugin);
ffmpegenc->picture = avcodec_alloc_frame ();
ffmpegenc->opened = FALSE;
@ -398,7 +401,7 @@ gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder,
}
/* set defaults */
avcodec_get_context_defaults3 (ffmpegenc->context, NULL);
avcodec_get_context_defaults3 (ffmpegenc->context, oclass->in_plugin);
/* if we set it in _getcaps we should set it also in _link */
ffmpegenc->context->strict_std_compliance = -1;