Skip to content

Instantly share code, notes, and snippets.

@j0sh
Created April 28, 2014 18:32
Show Gist options
  • Select an option

  • Save j0sh/11380203 to your computer and use it in GitHub Desktop.

Select an option

Save j0sh/11380203 to your computer and use it in GitHub Desktop.
Set codec ID in the codec context by default.
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 2e41ce4..9e5f08a 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -84,6 +84,7 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
s->av_class = &av_codec_context_class;
s->codec_type = codec ? codec->type : AVMEDIA_TYPE_UNKNOWN;
+ s->codec_id = codec ? codec->id : AV_CODEC_ID_NONE;
s->codec = codec;
av_opt_set_defaults(s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment