From 671df54e4dcf0675c335483d26f7f6ff9baaf76a Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 12 Jan 2016 23:48:19 +0100 Subject: 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. --- demux/demux_mf.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'demux/demux_mf.c') diff --git a/demux/demux_mf.c b/demux/demux_mf.c index b41bf87aa3..a91d13dff2 100644 --- a/demux/demux_mf.c +++ b/demux/demux_mf.c @@ -165,7 +165,7 @@ static void demux_seek_mf(demuxer_t *demuxer, double rel_seek_secs, int flags) if (flags & SEEK_FACTOR) newpos += rel_seek_secs * (mf->nr_of_files - 1); else - newpos += rel_seek_secs * mf->sh->video->fps; + newpos += rel_seek_secs * mf->sh->codec->fps; if (newpos < 0) newpos = 0; if (newpos >= mf->nr_of_files) @@ -199,7 +199,7 @@ static int demux_mf_fill_buffer(demuxer_t *demuxer) demux_packet_t *dp = new_demux_packet(data.len); if (dp) { memcpy(dp->buffer, data.start, data.len); - dp->pts = mf->curr_frame / mf->sh->video->fps; + dp->pts = mf->curr_frame / mf->sh->codec->fps; dp->keyframe = true; demux_add_packet(mf->sh, dp); } @@ -291,7 +291,6 @@ static const char *probe_format(mf_t *mf, char *type, enum demux_check check) static int demux_open_mf(demuxer_t *demuxer, enum demux_check check) { - sh_video_t *sh_video = NULL; mf_t *mf; if (strncmp(demuxer->stream->url, "mf://", 5) == 0 && @@ -317,12 +316,12 @@ static int demux_open_mf(demuxer_t *demuxer, enum demux_check check) // create a new video stream header struct sh_stream *sh = demux_alloc_sh_stream(STREAM_VIDEO); - sh_video = sh->video; + struct mp_codec_params *c = sh->codec; - sh->codec = codec; - sh_video->disp_w = 0; - sh_video->disp_h = 0; - sh_video->fps = demuxer->opts->mf_fps; + c->codec = codec; + c->disp_w = 0; + c->disp_h = 0; + c->fps = demuxer->opts->mf_fps; demux_add_sh_stream(demuxer, sh); @@ -346,7 +345,7 @@ static int demux_control_mf(demuxer_t *demuxer, int cmd, void *arg) switch (cmd) { case DEMUXER_CTRL_GET_TIME_LENGTH: - *((double *)arg) = (double)mf->nr_of_files / mf->sh->video->fps; + *((double *)arg) = (double)mf->nr_of_files / mf->sh->codec->fps; return DEMUXER_CTRL_OK; default: -- cgit v1.2.3