diff mbox series

[FFmpeg-devel,2/4] avcodec/asfdec_o: Export metadata that applies to the whole file

Message ID 20201112173328.742491-2-andreas.rheinhardt@gmail.com
State Accepted
Commit bf4909f0a3ed0155343a64cd6611a6fe4ecd5c8d
Headers show
Series [FFmpeg-devel,1/4] avformat/asfdec_o: Don't segfault with lots of attached pics
Related show


Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 12, 2020, 5:33 p.m. UTC
The ASF specification of Metadata Objects' stream number is as follows:

"Specifies whether the entry applies to a specific digital media stream
or whether it applies to the whole file. A value of 0 in this field
indicates that it applies to the whole file; otherwise, the entry
applies only to the indicated stream number and must be between 1 and

Yet the asf_o demuxer (the one originating from Libav) has always
treated such metadata as if it applied to a stream even though no stream
with a stream number may exist in a valid ASF file. This is fixed in
this commit; it affected e.g. the file
wma_with_metadata_library_object_tag_trimmed.wma from the FATE suite.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
The other ASF demuxer btw applies all per-stream metadata to the whole

 libavformat/asfdec_o.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series


diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index 0a7e47d8cc..2dcbc16332 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -596,7 +596,8 @@  static int asf_read_metadata_obj(AVFormatContext *s, const GUIDParseTable *g)
         } else {
             if (st_num < ASF_MAX_STREAMS) {
                 if ((ret = process_metadata(s, name, name_len, val_len, type,
-                                            &asf->asf_sd[st_num].asf_met)) < 0) {
+                                            st_num ? &asf->asf_sd[st_num].asf_met
+                                                   : &s->metadata)) < 0) {