Commit e2cdb06f authored by François Cartegnie's avatar François Cartegnie 🤞

demux: libmp4: read rotation atom

parent b6968b7d
......@@ -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;
}
}
}
......
......@@ -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 },
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment