Commit a5e1acf9 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

MP4: fill the orientation flag in video_format_t

Ref #2882
parent 70f87448
......@@ -736,6 +736,8 @@ static int MP4_ReadBox_tkhd( stream_t *p_stream, MP4_Box_t *p_box )
if (rotation < 0)
rotation += 360.;
p_box->data.p_tkhd->f_rotation = rotation;
#ifdef MP4_VERBOSE
MP4_ConvertDate2Str( s_creation_time, p_box->data.p_mvhd->i_creation_time );
MP4_ConvertDate2Str( s_modification_time, p_box->data.p_mvhd->i_modification_time );
......
......@@ -341,6 +341,7 @@ typedef struct MP4_Box_data_tkhd_s
int32_t i_matrix[9];
int32_t i_width;
int32_t i_height;
float f_rotation;
} MP4_Box_data_tkhd_t;
......
......@@ -105,6 +105,7 @@ typedef struct
/* display size only ! */
int i_width;
int i_height;
float f_rotation;
/* more internal data */
uint64_t i_timescale; /* time scale for this track only */
......@@ -1568,6 +1569,20 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
p_track, i_sample_description_index, i_chunk );
p_demux->p_sys->f_fps = (float)p_track->fmt.video.i_frame_rate /
(float)p_track->fmt.video.i_frame_rate_base;
/* Rotation */
switch( (int)p_track->f_rotation ) {
case 90:
p_track->fmt.video.orientation = ORIENT_ROTATED_90;
break;
case 180:
p_track->fmt.video.orientation = ORIENT_ROTATED_180;
break;
case 270:
p_track->fmt.video.orientation = ORIENT_ROTATED_270;
break;
}
break;
case AUDIO_ES:
......@@ -2325,6 +2340,7 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
p_track->i_track_ID = p_tkhd->data.p_tkhd->i_track_ID;
p_track->i_width = p_tkhd->data.p_tkhd->i_width / 65536;
p_track->i_height = p_tkhd->data.p_tkhd->i_height / 65536;
p_track->f_rotation = p_tkhd->data.p_tkhd->f_rotation;
if( p_tref )
{
......
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