summaryrefslogtreecommitdiffstats
path: root/video
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
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')
-rw-r--r--video/decode/dec_video.c16
-rw-r--r--video/decode/vd_lavc.c25
2 files changed, 21 insertions, 20 deletions
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index 9409ce146f..821aa2bda4 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -168,7 +168,7 @@ bool video_init_best_codec(struct dec_video *d_video, char* video_decoders)
struct mp_decoder_entry *decoder = NULL;
struct mp_decoder_list *list =
- mp_select_video_decoders(d_video->header->codec, video_decoders);
+ mp_select_video_decoders(d_video->header->codec->codec, video_decoders);
mp_print_decoders(d_video->log, MSGL_V, "Codec list:", list);
@@ -196,7 +196,7 @@ bool video_init_best_codec(struct dec_video *d_video, char* video_decoders)
MP_VERBOSE(d_video, "Selected video codec: %s\n", d_video->decoder_desc);
} else {
MP_ERR(d_video, "Failed to initialize a video decoder for codec '%s'.\n",
- d_video->header->codec ? d_video->header->codec : "<unknown>");
+ d_video->header->codec->codec);
}
if (d_video->header->missing_timestamps) {
@@ -242,7 +242,7 @@ struct mp_image *video_decode(struct dec_video *d_video,
int drop_frame)
{
struct MPOpts *opts = d_video->opts;
- bool avi_pts = d_video->header->video->avi_dts && opts->correct_pts;
+ bool avi_pts = d_video->header->codec->avi_dts && opts->correct_pts;
struct demux_packet packet_copy;
if (packet && packet->dts == MP_NOPTS_VALUE) {
@@ -264,7 +264,7 @@ struct mp_image *video_decode(struct dec_video *d_video,
double prev_codec_pts = d_video->codec_pts;
double prev_codec_dts = d_video->codec_dts;
- if (d_video->header->video->avi_dts)
+ if (d_video->header->codec->avi_dts)
drop_frame = 0;
MP_STATS(d_video, "start decode video");
@@ -339,7 +339,7 @@ int video_reconfig_filters(struct dec_video *d_video,
{
struct MPOpts *opts = d_video->opts;
struct mp_image_params p = *params;
- struct sh_video *sh = d_video->header->video;
+ struct mp_codec_params *c = d_video->header->codec;
// While mp_image_params normally always have to have d_w/d_h set, the
// decoder signals unknown bitstream aspect ratio with both set to 0.
@@ -364,10 +364,10 @@ int video_reconfig_filters(struct dec_video *d_video,
break;
}
- if (use_container && sh->par_w > 0 && sh->par_h) {
+ if (use_container && c->par_w > 0 && c->par_h) {
MP_VERBOSE(d_video, "Using container aspect ratio.\n");
- p.p_w = sh->par_w;
- p.p_h = sh->par_h;
+ p.p_w = c->par_w;
+ p.p_h = c->par_h;
}
if (opts->movie_aspect >= 0) {
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) {