From f4a1ee36583acd78621b0b3437f02eb25373efd2 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 3 Aug 2017 02:07:58 -0700 Subject: [PATCH] deps/media-playback: Add concat playback support Allows using a makeshift playlist file with media playback. --- deps/media-playback/media-playback/media.c | 5 ++++- deps/media-playback/media-playback/media.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/deps/media-playback/media-playback/media.c b/deps/media-playback/media-playback/media.c index e6922b012..f6459e6ea 100644 --- a/deps/media-playback/media-playback/media.c +++ b/deps/media-playback/media-playback/media.c @@ -407,7 +407,7 @@ static bool mp_media_reset(mp_media_t *m) ? av_rescale_q(seek_pos, AV_TIME_BASE_Q, stream->time_base) : seek_pos; - if (!m->is_network) { + if (!m->is_network && !m->is_concat) { int ret = av_seek_frame(m->fmt, 0, seek_target, seek_flags); if (ret < 0) { blog(LOG_WARNING, "MP: Failed to seek: %s", @@ -689,6 +689,9 @@ bool mp_media_init(mp_media_t *media, if (path && *path) media->is_network = !!strstr(path, "://"); + if (format && *format) + media->is_concat = strcmp(format, "concat") == 0; + static bool initialized = false; if (!initialized) { av_register_all(); diff --git a/deps/media-playback/media-playback/media.h b/deps/media-playback/media-playback/media.h index e7c39c695..9c53d56f7 100644 --- a/deps/media-playback/media-playback/media.h +++ b/deps/media-playback/media-playback/media.h @@ -63,6 +63,7 @@ struct mp_media { struct mp_decode v; struct mp_decode a; bool is_network; + bool is_concat; bool has_video; bool has_audio; bool is_file;