Commit cc3e88a2 authored by Andrew Stone's avatar Andrew Stone Committed by Anton Khirnov

mov: update AVFormatContext.event_flags with METADATA_UPDATED whenever metadata changes.

Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent fa3a5dd4
...@@ -80,6 +80,7 @@ static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb, ...@@ -80,6 +80,7 @@ static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb,
snprintf(buf, sizeof(buf), "%d", current); snprintf(buf, sizeof(buf), "%d", current);
else else
snprintf(buf, sizeof(buf), "%d/%d", current, total); snprintf(buf, sizeof(buf), "%d/%d", current, total);
c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
av_dict_set(&c->fc->metadata, key, buf, 0); av_dict_set(&c->fc->metadata, key, buf, 0);
return 0; return 0;
...@@ -96,6 +97,7 @@ static int mov_metadata_int8_bypass_padding(MOVContext *c, AVIOContext *pb, ...@@ -96,6 +97,7 @@ static int mov_metadata_int8_bypass_padding(MOVContext *c, AVIOContext *pb,
avio_r8(pb); avio_r8(pb);
snprintf(buf, sizeof(buf), "%d", avio_r8(pb)); snprintf(buf, sizeof(buf), "%d", avio_r8(pb));
c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
av_dict_set(&c->fc->metadata, key, buf, 0); av_dict_set(&c->fc->metadata, key, buf, 0);
return 0; return 0;
...@@ -107,6 +109,7 @@ static int mov_metadata_int8_no_padding(MOVContext *c, AVIOContext *pb, ...@@ -107,6 +109,7 @@ static int mov_metadata_int8_no_padding(MOVContext *c, AVIOContext *pb,
char buf[16]; char buf[16];
snprintf(buf, sizeof(buf), "%d", avio_r8(pb)); snprintf(buf, sizeof(buf), "%d", avio_r8(pb));
c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
av_dict_set(&c->fc->metadata, key, buf, 0); av_dict_set(&c->fc->metadata, key, buf, 0);
return 0; return 0;
...@@ -124,6 +127,7 @@ static int mov_metadata_gnre(MOVContext *c, AVIOContext *pb, ...@@ -124,6 +127,7 @@ static int mov_metadata_gnre(MOVContext *c, AVIOContext *pb,
if (genre < 1 || genre > ID3v1_GENRE_MAX) if (genre < 1 || genre > ID3v1_GENRE_MAX)
return 0; return 0;
snprintf(buf, sizeof(buf), "%s", ff_id3v1_genre_str[genre-1]); snprintf(buf, sizeof(buf), "%s", ff_id3v1_genre_str[genre-1]);
c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
av_dict_set(&c->fc->metadata, key, buf, 0); av_dict_set(&c->fc->metadata, key, buf, 0);
return 0; return 0;
...@@ -242,6 +246,7 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len) ...@@ -242,6 +246,7 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len)
snprintf(key2, sizeof(key2), "%s-%s", key, language); snprintf(key2, sizeof(key2), "%s-%s", key, language);
av_dict_set(&c->fc->metadata, key2, buf, 0); av_dict_set(&c->fc->metadata, key2, buf, 0);
} }
c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
return av_dict_set(&c->fc->metadata, key, buf, 0); return av_dict_set(&c->fc->metadata, key, buf, 0);
} }
...@@ -346,6 +351,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -346,6 +351,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_read(pb, str, str_size); avio_read(pb, str, str_size);
str[str_size] = 0; str[str_size] = 0;
} }
c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
av_dict_set(&c->fc->metadata, key, str, 0); av_dict_set(&c->fc->metadata, key, str, 0);
if (*language && strcmp(language, "und")) { if (*language && strcmp(language, "und")) {
snprintf(key2, sizeof(key2), "%s-%s", key, language); snprintf(key2, sizeof(key2), "%s-%s", key, language);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment