Commit 2186305a authored by Ilkka Ollakka's avatar Ilkka Ollakka

avcodec: set codec_id and codec_type in context also

it's checked to match from r19973 on libavcodec
parent ec24ba1a
......@@ -96,6 +96,9 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
return VLC_ENOMEM;
}
p_codec->type = CODEC_TYPE_AUDIO;
p_context->codec_type = CODEC_TYPE_AUDIO;
p_context->codec_id = i_codec_id;
p_sys->p_context = p_context;
p_sys->p_codec = p_codec;
p_sys->i_codec_id = i_codec_id;
......
......@@ -279,6 +279,7 @@ int OpenEncoder( vlc_object_t *p_this )
p_sys->i_buffer_out = 0;
p_sys->p_context = p_context = avcodec_alloc_context();
p_sys->p_context->codec_id = p_sys->p_codec->id;
p_context->debug = config_GetInt( p_enc, "ffmpeg-debug" );
p_context->opaque = (void *)p_this;
......@@ -426,6 +427,8 @@ int OpenEncoder( vlc_object_t *p_this )
return VLC_EGENERIC;
}
p_context->codec_type = CODEC_TYPE_VIDEO;
p_context->width = p_enc->fmt_in.video.i_width;
p_context->height = p_enc->fmt_in.video.i_height;
......@@ -584,6 +587,7 @@ int OpenEncoder( vlc_object_t *p_this )
if( i_codec_id == CODEC_ID_MP3 && p_enc->fmt_in.audio.i_channels > 2 )
p_enc->fmt_in.audio.i_channels = 2;
p_context->codec_type = CODEC_TYPE_AUDIO;
p_enc->fmt_in.i_codec = VLC_CODEC_S16N;
p_context->sample_rate = p_enc->fmt_out.audio.i_rate;
p_context->channels = p_enc->fmt_out.audio.i_channels;
......
......@@ -196,6 +196,9 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
if( ( p_dec->p_sys = p_sys = calloc( 1, sizeof(decoder_sys_t) ) ) == NULL )
return VLC_ENOMEM;
p_codec->type = CODEC_TYPE_VIDEO;
p_context->codec_type = CODEC_TYPE_VIDEO;
p_context->codec_id = i_codec_id;
p_sys->p_context = p_context;
p_sys->p_codec = p_codec;
p_sys->i_codec_id = i_codec_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment