[vlc-devel] [vlc-commits] demux: libmp4: read rotation atom

Steve Lhomme robux4 at ycbcr.xyz
Wed Mar 14 08:59:31 CET 2018


Fixes #19656 ?


Le 13/03/2018 à 22:23, Francois Cartegnie a écrit :
> vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Mar 13 21:56:54 2018 +0100| [e2cdb06fbf12c47d65d141bf6ccee4b00f47fea6] | committer: Francois Cartegnie
>
> demux: libmp4: read rotation atom
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e2cdb06fbf12c47d65d141bf6ccee4b00f47fea6
> ---
>
>   modules/demux/mp4/heif.c   | 10 ++++++++++
>   modules/demux/mp4/libmp4.c | 10 ++++++++++
>   modules/demux/mp4/libmp4.h |  7 +++++++
>   3 files changed, 27 insertions(+)
>
> diff --git a/modules/demux/mp4/heif.c b/modules/demux/mp4/heif.c
> index abfce47390..f2a066a5bc 100644
> --- a/modules/demux/mp4/heif.c
> +++ b/modules/demux/mp4/heif.c
> @@ -304,6 +304,16 @@ static int DemuxHEIF( demux_t *p_demux )
>                           fmt.video.i_sar_den = p_prop->data.p_pasp->i_vertical_spacing;
>                       }
>                       break;
> +                case ATOM_irot:
> +                    switch( p_prop->data.p_irot->i_ccw_degrees % 360 )
> +                    {
> +                        default:
> +                        case 0:   fmt.video.orientation = ORIENT_NORMAL ; break;
> +                        case 90:  fmt.video.orientation = ORIENT_ROTATED_90; break;
> +                        case 180: fmt.video.orientation = ORIENT_ROTATED_180 ; break;
> +                        case 270: fmt.video.orientation = ORIENT_ROTATED_270 ; break;
> +                    }
> +                    break;
>               }
>           }
>       }
> diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
> index 46c3c84892..8198d0d561 100644
> --- a/modules/demux/mp4/libmp4.c
> +++ b/modules/demux/mp4/libmp4.c
> @@ -3874,6 +3874,15 @@ static int MP4_ReadBox_colr( stream_t *p_stream, MP4_Box_t *p_box )
>       MP4_READBOX_EXIT( 1 );
>   }
>   
> +static int MP4_ReadBox_irot( stream_t *p_stream, MP4_Box_t *p_box )
> +{
> +    MP4_READBOX_ENTER( MP4_Box_data_irot_t, NULL );
> +    MP4_GET1BYTE( p_box->data.p_irot->i_ccw_degrees );
> +    p_box->data.p_irot->i_ccw_degrees &= 0x03;
> +    p_box->data.p_irot->i_ccw_degrees *= 90;
> +    MP4_READBOX_EXIT( 1 );
> +}
> +
>   static int MP4_ReadBox_meta( stream_t *p_stream, MP4_Box_t *p_box )
>   {
>       const uint8_t *p_peek;
> @@ -4850,6 +4859,7 @@ static const struct
>       { ATOM_btrt,    MP4_ReadBox_btrt,         0 }, /* codecs bitrate stsd/????/btrt */
>       { ATOM_keys,    MP4_ReadBox_keys,         ATOM_meta },
>       { ATOM_colr,    MP4_ReadBox_colr,         0 },
> +    { ATOM_irot,    MP4_ReadBox_irot,         0 }, /* heif */
>   
>       /* XiphQT */
>       { ATOM_vCtH,    MP4_ReadBox_Binary,       ATOM_wave },
> diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
> index 45409ef923..60fb4a4f86 100644
> --- a/modules/demux/mp4/libmp4.h
> +++ b/modules/demux/mp4/libmp4.h
> @@ -391,6 +391,7 @@ typedef int64_t stime_t;
>   #define ATOM_gsst VLC_FOURCC( 'g', 's', 's', 't' )
>   #define ATOM_gstd VLC_FOURCC( 'g', 's', 't', 'd' )
>   #define ATOM_colr VLC_FOURCC( 'c', 'o', 'l', 'r' )
> +#define ATOM_irot VLC_FOURCC( 'i', 'r', 'o', 't' )
>   #define ATOM_SmDm VLC_FOURCC( 'S', 'm', 'D', 'm' )
>   #define ATOM_CoLL VLC_FOURCC( 'C', 'o', 'L', 'L' )
>   
> @@ -675,6 +676,11 @@ typedef struct MP4_Box_data_colr_s
>       };
>   } MP4_Box_data_colr_t;
>   
> +typedef struct
> +{
> +    uint16_t i_ccw_degrees;
> +} MP4_Box_data_irot_t;
> +
>   typedef struct MP4_Box_data_sample_soun_s
>   {
>       uint8_t  i_reserved1[6];
> @@ -1757,6 +1763,7 @@ typedef union MP4_Box_data_s
>       MP4_Box_data_ctts_t *p_ctts;
>       MP4_Box_data_cslg_t *p_cslg;
>       MP4_Box_data_colr_t *p_colr;
> +    MP4_Box_data_irot_t *p_irot;
>   
>       MP4_Box_data_sbgp_t *p_sbgp;
>       MP4_Box_data_sgpd_t *p_sgpd;
>
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits



More information about the vlc-devel mailing list