diff options
author | wm4 <wm4@nowhere> | 2013-07-02 12:18:04 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-02 12:19:16 +0200 |
commit | 3f3ffd0de4943a1ce8e5dd1fbf457bcba989fc2b (patch) | |
tree | f46693b5285f97bc3a24cfed58194caf669b8766 /demux/demux.c | |
parent | e00621ac4605e96c9452f4d65216d0019f7e55cb (diff) | |
download | mpv-3f3ffd0de4943a1ce8e5dd1fbf457bcba989fc2b.tar.bz2 mpv-3f3ffd0de4943a1ce8e5dd1fbf457bcba989fc2b.tar.xz |
core: update metadata during playback, allow streams to export metadata
STREAM_CTRL_GET_METADATA will be used to poll for streamcast metadata.
Also add DEMUXER_CTRL_UPDATE_INFO, which could in theory be used by
demux_lavf.c. (Unfortunately, libavformat is too crappy to read metadata
mid-stream for mp3 or ogg, so we don't implement it.)
Diffstat (limited to 'demux/demux.c')
-rw-r--r-- | demux/demux.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/demux/demux.c b/demux/demux.c index b66f5e3e61..a5d3211b0a 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -976,6 +976,7 @@ static struct demuxer *open_given_type(struct MPOpts *opts, } add_stream_chapters(demuxer); demuxer_sort_chapters(demuxer); + demux_info_update(demuxer); return demuxer; } else { // demux_mov can return playlist instead of mov @@ -1227,6 +1228,18 @@ char *demux_info_get(demuxer_t *demuxer, const char *opt) return NULL; } +void demux_info_update(struct demuxer *demuxer) +{ + demux_control(demuxer, DEMUXER_CTRL_UPDATE_INFO, NULL); + // Take care of stream metadata as well + char **meta; + if (stream_control(demuxer->stream, STREAM_CTRL_GET_METADATA, &meta) > 0) { + for (int n = 0; meta[n + 0]; n += 2) + demux_info_add(demuxer, meta[n + 0], meta[n + 1]); + talloc_free(meta); + } +} + int demux_control(demuxer_t *demuxer, int cmd, void *arg) { |