diff options
author | wm4 <wm4@nowhere> | 2015-10-01 21:57:35 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-10-01 21:57:35 +0200 |
commit | ae7212963ee55c11cf025beccf86c55c1d898128 (patch) | |
tree | 6adadbe4f48b29847a3719c6dbdce4b1d2a3d625 /demux/demux_cue.c | |
parent | 24f34c9e8e4131b0b01b7bf08eaa8b5095286631 (diff) | |
download | mpv-ae7212963ee55c11cf025beccf86c55c1d898128.tar.bz2 mpv-ae7212963ee55c11cf025beccf86c55c1d898128.tar.xz |
cue: read more metadata
Make handling of metadata slightly more generic, and add reading of the
"PERFORMER" fields. There are some more fields, but for now let's leave
it at this.
TRACK-specific PERFORMER fields have to be read from the per-chapter
metadata (somewhat obscure).
Fixes #2328.
Diffstat (limited to 'demux/demux_cue.c')
-rw-r--r-- | demux/demux_cue.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/demux/demux_cue.c b/demux/demux_cue.c index ed3d3d83f3..43420573ec 100644 --- a/demux/demux_cue.c +++ b/demux/demux_cue.c @@ -38,7 +38,7 @@ #define PROBE_SIZE 512 struct priv { - bstr data; + struct cue_file *f; }; static void add_source(struct timeline *tl, struct demuxer *d) @@ -150,15 +150,8 @@ static void build_timeline(struct timeline *tl) add_source(tl, tl->demuxer); - struct cue_file *f = mp_parse_cue(p->data); - if (!f) { - MP_ERR(tl, "CUE: error parsing input file!\n"); - goto out; - } - talloc_steal(ctx, f); - - struct cue_track *tracks = f->tracks; - size_t track_count = f->num_tracks; + struct cue_track *tracks = p->f->tracks; + size_t track_count = p->f->num_tracks; if (track_count == 0) { MP_ERR(tl, "CUE: no tracks found!\n"); @@ -224,10 +217,8 @@ static void build_timeline(struct timeline *tl) }; chapters[i] = (struct demux_chapter) { .pts = timeline[i].start, - .metadata = talloc_zero(tl, struct mp_tags), + .metadata = mp_tags_dup(tl, tracks[i].tags), }; - // might want to include other metadata here - mp_tags_set_str(chapters[i].metadata, "title", tracks[i].title); starttime += duration; } @@ -261,9 +252,18 @@ static int try_open_file(struct demuxer *demuxer, enum demux_check check) struct priv *p = talloc_zero(demuxer, struct priv); demuxer->priv = p; demuxer->fully_read = true; - p->data = stream_read_complete(s, demuxer, 1000000); - if (p->data.start == NULL) + + bstr data = stream_read_complete(s, p, 1000000); + if (data.start == NULL) return -1; + p->f = mp_parse_cue(data); + talloc_steal(p, p->f); + if (!p->f) { + MP_ERR(demuxer, "error parsing input file!\n"); + return -1; + } + + mp_tags_merge(demuxer->metadata, p->f->tags); return 0; } |