summaryrefslogtreecommitdiffstats
path: root/video/decode/vd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-12 23:48:19 +0100
committerwm4 <wm4@nowhere>2016-01-12 23:48:19 +0100
commit671df54e4dcf0675c335483d26f7f6ff9baaf76a (patch)
tree6a206ddf489474150fffa2eac651b5e8915b969c /video/decode/vd_lavc.c
parent81f3b3aafe72e5ca9ac79d29246e70dce76ebca9 (diff)
downloadmpv-671df54e4dcf0675c335483d26f7f6ff9baaf76a.tar.bz2
mpv-671df54e4dcf0675c335483d26f7f6ff9baaf76a.tar.xz
demux: merge sh_video/sh_audio/sh_sub
This is mainly a refactor. I'm hoping it will make some things easier in the future due to cleanly separating codec metadata and stream metadata. Also, declare that the "codec" field can not be NULL anymore. demux.c will set it to "" if it's NULL when added. This gets rid of a corner case everything had to handle, but which rarely happened.
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r--video/decode/vd_lavc.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 614ec787ec..f47e72a1cd 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -352,6 +352,7 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
struct vd_lavc_params *lavc_param = vd->opts->vd_lavc_params;
bool mp_rawvideo = false;
struct sh_stream *sh = vd->header;
+ struct mp_codec_params *c = sh->codec;
assert(!ctx->avctx);
@@ -414,23 +415,23 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
// Do this after the above avopt handling in case it changes values
ctx->skip_frame = avctx->skip_frame;
- avctx->codec_tag = sh->codec_tag;
- avctx->coded_width = sh->video->disp_w;
- avctx->coded_height = sh->video->disp_h;
- avctx->bits_per_coded_sample = sh->video->bits_per_coded_sample;
+ avctx->codec_tag = c->codec_tag;
+ avctx->coded_width = c->disp_w;
+ avctx->coded_height = c->disp_h;
+ avctx->bits_per_coded_sample = c->bits_per_coded_sample;
- mp_lavc_set_extradata(avctx, sh->extradata, sh->extradata_size);
+ mp_lavc_set_extradata(avctx, c->extradata, c->extradata_size);
if (mp_rawvideo) {
- avctx->pix_fmt = imgfmt2pixfmt(sh->codec_tag);
+ avctx->pix_fmt = imgfmt2pixfmt(c->codec_tag);
avctx->codec_tag = 0;
- if (avctx->pix_fmt == AV_PIX_FMT_NONE && sh->codec_tag)
+ if (avctx->pix_fmt == AV_PIX_FMT_NONE && c->codec_tag)
MP_ERR(vd, "Image format %s not supported by lavc.\n",
- mp_imgfmt_to_name(sh->codec_tag));
+ mp_imgfmt_to_name(c->codec_tag));
}
- if (sh->lav_headers)
- mp_copy_lav_codec_headers(avctx, sh->lav_headers);
+ if (c->lav_headers)
+ mp_copy_lav_codec_headers(avctx, c->lav_headers);
/* open it */
if (avcodec_open2(avctx, lavc_codec, NULL) < 0)
@@ -506,8 +507,8 @@ static void update_image_params(struct dec_video *vd, AVFrame *frame,
.gamma = avcol_trc_to_mp_csp_trc(ctx->avctx->color_trc),
.chroma_location =
avchroma_location_to_mp(ctx->avctx->chroma_sample_location),
- .rotate = vd->header->video->rotate,
- .stereo_in = vd->header->video->stereo_mode,
+ .rotate = vd->header->codec->rotate,
+ .stereo_in = vd->header->codec->stereo_mode,
};
if (opts->video_rotate < 0) {