cbs_mpeg2: Improve checks for invalid values
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 22 May 2019 01:04:32 +0000 (03:04 +0200)
committerMark Thompson <sw@jkqxz.net>
Tue, 28 May 2019 22:59:29 +0000 (23:59 +0100)
commit9c3f2a8894a66d6b5b9285caa25f91fbfca7b3bc
tree29895d8300511513362fe0ed953e2b5daeb012b5
parentcfe4389d477064b0424590a7b3e1ec94059db2fd
cbs_mpeg2: Improve checks for invalid values

MPEG-2 contains several elements that mustn't be zero according to the
specifications: horizontal/vertical_size_value, aspect_ratio_information,
frame_rate_code, the quantiser matrices, the colour_description
elements, picture_coding_type, the f_code[r][s] values and
quantiser_scale_code. It is now checked that the invalid values don't
occur.

The colour_description elements are treated specially in this regard:
Given that there are files in the wild which use illegal values for the
colour_description elements (some of them created by mpeg2_metadata),
they will be corrected to the value meaning "unknown" (namely 2) during
reading. This has been done in such a way that trace_headers will
nevertheless report the original value, together with a message about
the fixup.

Furthermore, the trace_headers output of user_data has been beautified.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/cbs_mpeg2.c
libavcodec/cbs_mpeg2_syntax_template.c