summaryrefslogtreecommitdiff
path: root/libavformat/oggparsevorbis.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-14 00:04:42 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-14 00:05:49 +0200
commita8db787932ad71ac4f77b61357b695c3b35a283d (patch)
treee629c6cefe3230012fdbcf145f522b13b1fcc367 /libavformat/oggparsevorbis.c
parenta90364d001eb8289e1c423bf9884bb0affc3f662 (diff)
parentdb68ef898a3802e51b6f41fd600d0d46d058e3f8 (diff)
Merge commit 'db68ef898a3802e51b6f41fd600d0d46d058e3f8'
* commit 'db68ef898a3802e51b6f41fd600d0d46d058e3f8': ogg: update event_flags with STREAM_/METADATA_UPDATED whenever metadata changes. Conflicts: libavformat/oggparsevorbis.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oggparsevorbis.c')
-rw-r--r--libavformat/oggparsevorbis.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index 8103d9dbb1..5e34be5378 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -71,12 +71,25 @@ static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val)
return 1;
}
+int ff_vorbis_stream_comment(AVFormatContext *as, AVStream *st,
+ const uint8_t *buf, int size)
+{
+ int updates = ff_vorbis_comment(as, &st->metadata, buf, size, 1);
+
+ if (updates > 0) {
+ st->event_flags |= AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
+ }
+
+ return updates;
+}
+
int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
const uint8_t *buf, int size,
int parse_picture)
{
const uint8_t *p = buf;
const uint8_t *end = buf + size;
+ int updates = 0;
unsigned n, j;
int s;
@@ -158,6 +171,7 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
continue;
}
} else if (!ogm_chapter(as, tt, ct)) {
+ updates++;
if (av_dict_get(*m, tt, NULL, 0)) {
av_dict_set(m, tt, ";", AV_DICT_APPEND);
}
@@ -178,7 +192,7 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
ff_metadata_conv(m, NULL, ff_vorbiscomment_metadata_conv);
- return 0;
+ return updates;
}
/*
@@ -256,8 +270,8 @@ static int vorbis_update_metadata(AVFormatContext *s, int idx)
/* New metadata packet; release old data. */
av_dict_free(&st->metadata);
- ret = ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7,
- os->psize - 8, 1);
+ ret = ff_vorbis_stream_comment(s, st, os->buf + os->pstart + 7,
+ os->psize - 8);
if (ret < 0)
return ret;