summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-17 14:43:26 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-17 14:43:26 +0200
commitc079da5073167b5e7e959af12ef157e71bde0015 (patch)
tree65e084a372ae7e9e441a1e7713941a803dc19f1f /libavformat
parentfadfbb354b30f018338c66712bfe5a6b58970b9a (diff)
parent0bca0283ccded5e32da143a462168ad1988a58fd (diff)
Merge commit '0bca0283ccded5e32da143a462168ad1988a58fd'
* commit '0bca0283ccded5e32da143a462168ad1988a58fd': riff: do not write empty INFO tags Conflicts: tests/ref/fate/vsynth1-cljr tests/ref/fate/vsynth1-ffvhuff tests/ref/fate/vsynth1-h261 tests/ref/fate/vsynth1-h263 tests/ref/fate/vsynth1-h263-obmc tests/ref/fate/vsynth1-h263p tests/ref/fate/vsynth1-huffyuv tests/ref/fate/vsynth1-jpegls tests/ref/fate/vsynth1-mjpeg tests/ref/fate/vsynth1-mpeg4-adap tests/ref/fate/vsynth1-mpeg4-adv tests/ref/fate/vsynth1-mpeg4-error tests/ref/fate/vsynth1-mpeg4-nr tests/ref/fate/vsynth1-mpeg4-qpel tests/ref/fate/vsynth1-mpeg4-qprd tests/ref/fate/vsynth1-mpeg4-rc tests/ref/fate/vsynth1-mpeg4-thread tests/ref/fate/vsynth1-msmpeg4 tests/ref/fate/vsynth1-msmpeg4v2 tests/ref/fate/vsynth1-rgb tests/ref/fate/vsynth1-wmv1 tests/ref/fate/vsynth1-wmv2 tests/ref/fate/vsynth1-yuv tests/ref/fate/vsynth2-cljr tests/ref/fate/vsynth2-ffvhuff tests/ref/fate/vsynth2-h261 tests/ref/fate/vsynth2-h263 tests/ref/fate/vsynth2-h263-obmc tests/ref/fate/vsynth2-h263p tests/ref/fate/vsynth2-huffyuv tests/ref/fate/vsynth2-jpegls tests/ref/fate/vsynth2-mjpeg tests/ref/fate/vsynth2-mpeg4-adap tests/ref/fate/vsynth2-mpeg4-error tests/ref/fate/vsynth2-mpeg4-nr tests/ref/fate/vsynth2-mpeg4-qpel tests/ref/fate/vsynth2-mpeg4-qprd tests/ref/fate/vsynth2-mpeg4-rc tests/ref/fate/vsynth2-mpeg4-thread tests/ref/fate/vsynth2-msmpeg4 tests/ref/fate/vsynth2-msmpeg4v2 tests/ref/fate/vsynth2-rgb tests/ref/fate/vsynth2-wmv1 tests/ref/fate/vsynth2-wmv2 tests/ref/fate/vsynth2-yuv tests/ref/lavf/avi tests/ref/seek/h261_avi tests/ref/seek/h263_avi tests/ref/seek/h263p_avi tests/ref/seek/lavf_avi tests/ref/seek/mjpeg_avi tests/ref/seek/mpeg4_adap_avi tests/ref/seek/mpeg4_error_avi tests/ref/seek/mpeg4_nr_avi tests/ref/seek/mpeg4_qpel_avi tests/ref/seek/mpeg4_qprd_avi tests/ref/seek/mpeg4_rc_avi tests/ref/seek/mpeg4_thread_avi tests/ref/seek/msmpeg4_avi tests/ref/seek/msmpeg4v2_avi tests/ref/seek/wmv1_avi tests/ref/seek/wmv2_avi Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/riff.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 3923275698..a919f3f1f9 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -799,6 +799,19 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
return 0;
}
+static int riff_has_valid_tags(AVFormatContext *s)
+{
+ int i;
+ AVDictionaryEntry *t = NULL;
+
+ for (i = 0; *ff_riff_tags[i]; i++) {
+ if ((t = av_dict_get(s->metadata, ff_riff_tags[i], NULL, AV_DICT_MATCH_CASE)))
+ return 1;
+ }
+
+ return 0;
+}
+
void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
{
int len = strlen(str);
@@ -819,9 +832,14 @@ void ff_riff_write_info(AVFormatContext *s)
int64_t list_pos;
AVDictionaryEntry *t = NULL;
+ ff_metadata_conv(&s->metadata, ff_riff_info_conv, NULL);
+
+ /* writing empty LIST is not nice and may cause problems */
+ if (!riff_has_valid_tags(s))
+ return;
+
list_pos = ff_start_tag(pb, "LIST");
ffio_wfourcc(pb, "INFO");
- ff_metadata_conv(&s->metadata, ff_riff_info_conv, NULL);
for (i = 0; *ff_riff_tags[i]; i++) {
if ((t = av_dict_get(s->metadata, ff_riff_tags[i], NULL, AV_DICT_MATCH_CASE)))
ff_riff_write_info_tag(s->pb, t->key, t->value);