[FFmpeg-devel] [PATCH 2/3] avformat/matroskadec: support parsing Chroma Location elements

Michael Niedermayer michael at niedermayer.cc
Tue Oct 18 04:00:44 EEST 2016


On Sat, Oct 15, 2016 at 12:40:55PM -0300, James Almer wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavformat/matroskadec.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index acf1ccb..cfe4692 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -1826,6 +1826,10 @@ static int mkv_parse_video_color(AVStream *st, const MatroskaTrack *track) {
>      if (track->video.color.range != AVCOL_RANGE_UNSPECIFIED &&
>          track->video.color.range <= AVCOL_RANGE_JPEG)
>          st->codecpar->color_range = track->video.color.range;
> +    if (track->video.color.chroma_siting_horz && track->video.color.chroma_siting_vert)
> +        st->codecpar->chroma_location =
> +            avcodec_chroma_pos_to_enum((track->video.color.chroma_siting_horz - 1) << 7,
> +                                       (track->video.color.chroma_siting_vert - 1) << 7);

does this need some validity check ? (i didnt immedeatly see any check)
<< 7 could overflow without check

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161018/a3c7cf64/attachment.sig>


More information about the ffmpeg-devel mailing list