summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-14 14:22:14 +0200
committerwm4 <wm4@nowhere>2014-07-14 14:34:14 +0200
commitc129e3f666a4d3f562f32e633293cf9bbb13c3ac (patch)
tree5c03e6b1e0127d2e6b72fa168ea0dce8294ca122
parentac71cb86116c470067d7f03ad2f41f137cbe2dbd (diff)
downloadmpv-c129e3f666a4d3f562f32e633293cf9bbb13c3ac.tar.bz2
mpv-c129e3f666a4d3f562f32e633293cf9bbb13c3ac.tar.xz
demux_lavf: don't let metadata update mess up ogm playback
For OGG audio files, we usually merge the per-stream metadata back to the file-global metadata. Don't do that for OGM, because with OGM most metadata is actually per-stream.
-rw-r--r--demux/demux_lavf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index e4d2cce2ec..4688bf9db7 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -107,6 +107,7 @@ typedef struct lavf_priv {
int num_streams;
int cur_program;
char *mime_type;
+ bool merge_track_metadata;
} lavf_priv_t;
struct format_hack {
@@ -603,10 +604,11 @@ static void add_new_streams(demuxer_t *demuxer)
static void update_metadata(demuxer_t *demuxer, AVPacket *pkt)
{
#if HAVE_AVCODEC_METADATA_UPDATE_SIDE_DATA
+ lavf_priv_t *priv = demuxer->priv;
int md_size;
const uint8_t *md;
md = av_packet_get_side_data(pkt, AV_PKT_DATA_METADATA_UPDATE, &md_size);
- if (md) {
+ if (md && priv->merge_track_metadata) {
AVDictionary *dict = NULL;
av_packet_unpack_dictionary(md, md_size, &dict);
if (dict) {
@@ -748,6 +750,7 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check)
// Often useful with OGG audio-only files, which have metadata in the audio
// track metadata instead of the main metadata.
if (demuxer->num_streams == 1) {
+ priv->merge_track_metadata = true;
for (int n = 0; n < priv->num_streams; n++) {
if (priv->streams[n])
mp_tags_copy_from_av_dictionary(demuxer->metadata, avfc->streams[n]->metadata);