+ codec_ctx = avcodec_alloc_context3(codec);
+ if (!codec_ctx) {
+ av_log(log_ctx, AV_LOG_ERROR, "Failed to alloc video decoder context\n");
+ ret = AVERROR(ENOMEM);
+ goto end;
+ }
+
+ ret = avcodec_parameters_to_context(codec_ctx, par);
+ if (ret < 0) {
+ av_log(log_ctx, AV_LOG_ERROR, "Failed to copy codec parameters to decoder context\n");
+ goto end;
+ }
+