summaryrefslogtreecommitdiffstats
path: root/demux/demux_mf.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 /demux/demux_mf.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 'demux/demux_mf.c')
-rw-r--r--demux/demux_mf.c17
1 files changed, 8 insertions, 9 deletions
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: