[libav-devel] [PATCH 1/8] matroska: Warn when metadata references a non-existent element

Anton Khirnov anton at khirnov.net
Mon Nov 30 09:16:02 CET 2015


Quoting Luca Barbato (2015-11-01 04:07:41)
> Avoid some confusion when the information is not present.
> 
> Bug-Id: 902
> ---
>  libavformat/matroskadec.c | 43 +++++++++++++++++++++++++++++++++++++------
>  1 file changed, 37 insertions(+), 6 deletions(-)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index 8296a41..bdf2eb4 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -1276,24 +1276,55 @@ static void matroska_convert_tags(AVFormatContext *s)
>      for (i = 0; i < matroska->tags.nb_elem; i++) {
>          if (tags[i].target.attachuid) {
>              MatroskaAttachment *attachment = matroska->attachments.elem;
> -            for (j = 0; j < matroska->attachments.nb_elem; j++)
> +            int found = 0;
> +            for (j = 0; j < matroska->attachments.nb_elem; j++) {
>                  if (attachment[j].uid == tags[i].target.attachuid &&
> -                    attachment[j].stream)
> +                    attachment[j].stream) {
>                      matroska_convert_tag(s, &tags[i].tag,
>                                           &attachment[j].stream->metadata, NULL);
> +                    found = 1;
> +                }
> +            }
> +            if (!found) {
> +                av_log(NULL, AV_LOG_WARNING,
> +                       "The tags at index %d refer to a "

s/at index/with UID/

otherwise looks ok

-- 
Anton Khirnov


More information about the libav-devel mailing list