diff options
author | wm4 <wm4@nowhere> | 2013-11-19 22:23:41 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-19 22:38:27 +0100 |
commit | 50837129b231ae9a811abac2767af5fa6ced621b (patch) | |
tree | 6989334045414d4dc93d46f7c12ed1f2118dd169 /demux/demux_edl.c | |
parent | 469e488308bcb215f1038cc3e4d9399361599532 (diff) | |
download | mpv-50837129b231ae9a811abac2767af5fa6ced621b.tar.bz2 mpv-50837129b231ae9a811abac2767af5fa6ced621b.tar.xz |
timeline: add new EDL format
Edit Decision Lists (EDL) allow combining parts from multiple source
files into one virtual file. MPlayer had an EDL format (which sucked),
which mplayer2 tried to improve with its own format (which sucked). As
logic demands, mpv introduces its very own format (which sucks).
The new format should actually be much simpler and easier to use, and
its implementation is simpler and smaller too.
Diffstat (limited to 'demux/demux_edl.c')
-rw-r--r-- | demux/demux_edl.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/demux/demux_edl.c b/demux/demux_edl.c index 5c6afa2d9b..dd6c660f74 100644 --- a/demux/demux_edl.c +++ b/demux/demux_edl.c @@ -25,18 +25,19 @@ #include "demux.h" #include "stream/stream.h" +static bool test_header(struct stream *s, char *header) +{ + return bstr_equals0(stream_peek(s, strlen(header)), header); +} + +// Note: the real work is handled in tl_mpv_edl.c. static int try_open_file(struct demuxer *demuxer, enum demux_check check) { struct stream *s = demuxer->stream; if (check >= DEMUX_CHECK_UNSAFE) { - const char header[] = "mplayer EDL file"; - const int len = sizeof(header) - 1; - char buf[len]; - if (stream_read(s, buf, len) < len) - return -1; - if (strncmp(buf, header, len)) + if (!test_header(s, "mplayer EDL file") && + !test_header(s, "mpv EDL v0\n")) return -1; - stream_seek(s, 0); } demuxer->file_contents = stream_read_complete(s, demuxer, 1000000); if (demuxer->file_contents.start == NULL) @@ -46,7 +47,7 @@ static int try_open_file(struct demuxer *demuxer, enum demux_check check) const struct demuxer_desc demuxer_desc_edl = { .name = "edl", - .desc = "mplayer2 edit decision list", + .desc = "Edit decision list", .type = DEMUXER_TYPE_EDL, .open = try_open_file, }; |