[libav-devel] [PATCH] avcodec: Make sure codec_type is set by avcodec_get_context_defaults2

Anton Khirnov anton at khirnov.net
Thu Nov 3 12:28:55 CET 2011


On Thu,  3 Nov 2011 11:41:35 +0200, Martin Storsjö <martin at martin.st> wrote:
> This function used to set codec_type. With the current fallback
> implementation based on avcodec_get_context_defaults3, codec_type
> won't be set to the value passed in, but will be set to
> AVMEDIA_TYPE_UNKNOWN. Legacy callers of this function might expect
> this field to be set to the value passed in.
> ---
>  libavcodec/options.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/libavcodec/options.c b/libavcodec/options.c
> index fdc8a71..a08ed98 100644
> --- a/libavcodec/options.c
> +++ b/libavcodec/options.c
> @@ -539,6 +539,7 @@ static const AVClass av_codec_context_class = {
>  #if FF_API_ALLOC_CONTEXT
>  void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
>      avcodec_get_context_defaults3(s, NULL);
> +    s->codec_type = codec_type;
>  }
>  #endif
>  
> -- 
> 1.7.3.1
> 

Ok

-- 
Anton Khirnov


More information about the libav-devel mailing list