avformat/asfdec_o: Export metadata that applies to the whole file

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
127."

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>
This commit is contained in:
Andreas Rheinhardt 2020-11-12 17:57:37 +01:00
parent e83f27a21a
commit bf4909f0a3

View File

@ -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) {
av_freep(&name);
break;
}