summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rw-r--r--video/decode/vd_lavc.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 9801361cb2..9a8aa41888 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -297,16 +297,10 @@ static int init_avctx(sh_video_t *sh, const char *decoder, struct hwdec *hwdec)
avctx->flags |= lavc_param->bitexact;
- avctx->coded_width = sh->disp_w;
- avctx->coded_height = sh->disp_h;
avctx->workaround_bugs = lavc_param->workaround_bugs;
if (lavc_param->gray)
avctx->flags |= CODEC_FLAG_GRAY;
avctx->flags2 |= lavc_param->fast;
- avctx->codec_tag = sh->format;
- if (sh->gsh->lavf_codec_tag)
- avctx->codec_tag = sh->gsh->lavf_codec_tag;
- avctx->stream_codec_tag = sh->video.fccHandler;
avctx->idct_algo = lavc_param->idct_algo;
avctx->error_concealment = lavc_param->error_concealment;
avctx->debug = lavc_param->debug;
@@ -332,6 +326,14 @@ static int init_avctx(sh_video_t *sh, const char *decoder, struct hwdec *hwdec)
// Do this after the above avopt handling in case it changes values
ctx->skip_frame = avctx->skip_frame;
+ avctx->codec_tag = sh->format;
+ avctx->coded_width = sh->disp_w;
+ avctx->coded_height = sh->disp_h;
+
+ // demux_avi only
+ avctx->stream_codec_tag = sh->video.fccHandler;
+
+ // demux_mkv, demux_avi, demux_asf
if (sh->bih)
set_from_bih(avctx, sh->format, sh->bih);
@@ -340,6 +342,9 @@ static int init_avctx(sh_video_t *sh, const char *decoder, struct hwdec *hwdec)
avctx->codec_tag = 0;
}
+ if (sh->gsh->lav_headers)
+ mp_copy_lav_codec_headers(avctx, sh->gsh->lav_headers);
+
/* open it */
if (avcodec_open2(avctx, lavc_codec, NULL) < 0) {
mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not open codec.\n");