summaryrefslogtreecommitdiffstats
path: root/demux/demux_mf.c
diff options
context:
space:
mode:
Diffstat (limited to 'demux/demux_mf.c')
-rw-r--r--demux/demux_mf.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/demux/demux_mf.c b/demux/demux_mf.c
index ab703c0ced..a91d13dff2 100644
--- a/demux/demux_mf.c
+++ b/demux/demux_mf.c
@@ -24,7 +24,7 @@
#include "osdep/io.h"
-#include "talloc.h"
+#include "mpv_talloc.h"
#include "common/msg.h"
#include "options/options.h"
#include "options/path.h"
@@ -39,7 +39,7 @@
typedef struct mf {
struct mp_log *log;
- struct sh_video *sh;
+ struct sh_stream *sh;
int curr_frame;
int nr_of_files;
char **names;
@@ -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->fps;
+ newpos += rel_seek_secs * mf->sh->codec->fps;
if (newpos < 0)
newpos = 0;
if (newpos >= mf->nr_of_files)
@@ -199,9 +199,9 @@ 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->fps;
+ dp->pts = mf->curr_frame / mf->sh->codec->fps;
dp->keyframe = true;
- demux_add_packet(demuxer->streams[0], dp);
+ demux_add_packet(mf->sh, dp);
}
}
talloc_free(data.start);
@@ -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 &&
@@ -316,15 +315,17 @@ static int demux_open_mf(demuxer_t *demuxer, enum demux_check check)
mf->curr_frame = 0;
// create a new video stream header
- struct sh_stream *sh = new_sh_stream(demuxer, STREAM_VIDEO);
- sh_video = sh->video;
+ struct sh_stream *sh = demux_alloc_sh_stream(STREAM_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;
- mf->sh = sh_video;
+ demux_add_sh_stream(demuxer, sh);
+
+ mf->sh = sh;
demuxer->priv = (void *)mf;
demuxer->seekable = true;
@@ -344,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->fps;
+ *((double *)arg) = (double)mf->nr_of_files / mf->sh->codec->fps;
return DEMUXER_CTRL_OK;
default: