From f197198ca3e79b923e5d0ae66fec847737ee1f41 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 19 Nov 2013 22:36:33 +0100 Subject: player: add --merge-files option --- mpvcore/player/misc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'mpvcore/player/misc.c') diff --git a/mpvcore/player/misc.c b/mpvcore/player/misc.c index be42d76447..548e2c7967 100644 --- a/mpvcore/player/misc.c +++ b/mpvcore/player/misc.c @@ -32,6 +32,7 @@ #include "mpvcore/mp_common.h" #include "mpvcore/resolve.h" #include "mpvcore/encode.h" +#include "mpvcore/playlist.h" #include "mpvcore/input/input.h" #include "audio/out/ao.h" @@ -184,3 +185,25 @@ void stream_dump(struct MPContext *mpctx) } } } + +void merge_playlist_files(struct playlist *pl) +{ + if (!pl->first) + return; + char *edl = talloc_strdup(NULL, "edl://"); + for (struct playlist_entry *e = pl->first; e; e = e->next) { + if (e != pl->first) + edl = talloc_strdup_append_buffer(edl, ";"); + // Escape if needed + if (e->filename[strcspn(e->filename, "=%,;\n")] || + bstr_strip(bstr0(e->filename)).len != strlen(e->filename)) + { + // %length% + edl = talloc_asprintf_append_buffer(edl, "%%%d%%", strlen(e->filename)); + } + edl = talloc_strdup_append_buffer(edl, e->filename); + } + playlist_clear(pl); + playlist_add_file(pl, edl); + talloc_free(edl); +} -- cgit v1.2.3