Commit 3c5ab022 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

mp4: reindent and regroup

parent 9ad094db
...@@ -1528,10 +1528,62 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, ...@@ -1528,10 +1528,62 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
p_pasp = MP4_BoxGet( p_sample, "pasp" ); p_pasp = MP4_BoxGet( p_sample, "pasp" );
if( p_track->fmt.i_cat == AUDIO_ES && ( p_track->i_sample_size == 1 || p_track->i_sample_size == 2 ) ) /* */
switch( p_track->fmt.i_cat )
{ {
MP4_Box_data_sample_soun_t *p_soun; case VIDEO_ES:
p_track->fmt.video.i_width = p_sample->data.p_sample_vide->i_width;
p_track->fmt.video.i_height = p_sample->data.p_sample_vide->i_height;
p_track->fmt.video.i_bits_per_pixel =
p_sample->data.p_sample_vide->i_depth;
/* fall on display size */
if( p_track->fmt.video.i_width <= 0 )
p_track->fmt.video.i_width = p_track->i_width;
if( p_track->fmt.video.i_height <= 0 )
p_track->fmt.video.i_height = p_track->i_height;
/* Find out apect ratio from display size */
if( p_track->i_width > 0 && p_track->i_height > 0 &&
/* Work-around buggy muxed files */
p_sample->data.p_sample_vide->i_width != p_track->i_width )
{
p_track->fmt.video.i_sar_num = p_track->i_width * p_track->fmt.video.i_height;
p_track->fmt.video.i_sar_den = p_track->i_height * p_track->fmt.video.i_width;
}
if( p_pasp && p_pasp->data.p_pasp->i_horizontal_spacing > 0 &&
p_pasp->data.p_pasp->i_vertical_spacing > 0 )
{
p_track->fmt.video.i_sar_num = p_pasp->data.p_pasp->i_horizontal_spacing;
p_track->fmt.video.i_sar_den = p_pasp->data.p_pasp->i_vertical_spacing;
}
/* Support for cropping (eg. in H263 files) */
p_track->fmt.video.i_visible_width = p_track->fmt.video.i_width;
p_track->fmt.video.i_visible_height = p_track->fmt.video.i_height;
/* Frame rate */
TrackGetESSampleRate( &p_track->fmt.video.i_frame_rate,
&p_track->fmt.video.i_frame_rate_base,
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;
break;
case AUDIO_ES:
p_track->fmt.audio.i_channels =
p_sample->data.p_sample_soun->i_channelcount;
p_track->fmt.audio.i_rate =
p_sample->data.p_sample_soun->i_sampleratehi;
p_track->fmt.i_bitrate = p_sample->data.p_sample_soun->i_channelcount *
p_sample->data.p_sample_soun->i_sampleratehi *
p_sample->data.p_sample_soun->i_samplesize;
p_track->fmt.audio.i_bitspersample =
p_sample->data.p_sample_soun->i_samplesize;
if( ( p_track->i_sample_size == 1 || p_track->i_sample_size == 2 ) )
{
MP4_Box_data_sample_soun_t *p_soun;
p_soun = p_sample->data.p_sample_soun; p_soun = p_sample->data.p_sample_soun;
if( p_soun->i_qt_version == 0 ) if( p_soun->i_qt_version == 0 )
...@@ -1581,7 +1633,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, ...@@ -1581,7 +1633,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
p_soun->i_qt_version = 0; p_soun->i_qt_version = 0;
} }
} }
else if( p_track->fmt.i_cat == AUDIO_ES && p_sample->data.p_sample_soun->i_qt_version == 1 ) else if( p_sample->data.p_sample_soun->i_qt_version == 1 )
{ {
MP4_Box_data_sample_soun_t *p_soun = p_sample->data.p_sample_soun; MP4_Box_data_sample_soun_t *p_soun = p_sample->data.p_sample_soun;
...@@ -1604,61 +1656,9 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, ...@@ -1604,61 +1656,9 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
} }
} }
/* */
switch( p_track->fmt.i_cat )
{
case VIDEO_ES:
p_track->fmt.video.i_width = p_sample->data.p_sample_vide->i_width;
p_track->fmt.video.i_height = p_sample->data.p_sample_vide->i_height;
p_track->fmt.video.i_bits_per_pixel =
p_sample->data.p_sample_vide->i_depth;
/* fall on display size */
if( p_track->fmt.video.i_width <= 0 )
p_track->fmt.video.i_width = p_track->i_width;
if( p_track->fmt.video.i_height <= 0 )
p_track->fmt.video.i_height = p_track->i_height;
/* Find out apect ratio from display size */
if( p_track->i_width > 0 && p_track->i_height > 0 &&
/* Work-around buggy muxed files */
p_sample->data.p_sample_vide->i_width != p_track->i_width )
{
p_track->fmt.video.i_sar_num = p_track->i_width * p_track->fmt.video.i_height;
p_track->fmt.video.i_sar_den = p_track->i_height * p_track->fmt.video.i_width;
}
if( p_pasp && p_pasp->data.p_pasp->i_horizontal_spacing > 0 &&
p_pasp->data.p_pasp->i_vertical_spacing > 0 )
{
p_track->fmt.video.i_sar_num = p_pasp->data.p_pasp->i_horizontal_spacing;
p_track->fmt.video.i_sar_den = p_pasp->data.p_pasp->i_vertical_spacing;
}
/* Support for cropping (eg. in H263 files) */
p_track->fmt.video.i_visible_width = p_track->fmt.video.i_width;
p_track->fmt.video.i_visible_height = p_track->fmt.video.i_height;
/* Frame rate */
TrackGetESSampleRate( &p_track->fmt.video.i_frame_rate,
&p_track->fmt.video.i_frame_rate_base,
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;
break;
case AUDIO_ES:
p_track->fmt.audio.i_channels =
p_sample->data.p_sample_soun->i_channelcount;
p_track->fmt.audio.i_rate =
p_sample->data.p_sample_soun->i_sampleratehi;
p_track->fmt.i_bitrate = p_sample->data.p_sample_soun->i_channelcount *
p_sample->data.p_sample_soun->i_sampleratehi *
p_sample->data.p_sample_soun->i_samplesize;
p_track->fmt.audio.i_bitspersample =
p_sample->data.p_sample_soun->i_samplesize;
if( p_track->i_sample_size != 0 && if( p_track->i_sample_size != 0 &&
p_sample->data.p_sample_soun->i_qt_version == 1 && p_sample->data.p_sample_soun->i_sample_per_packet <= 0 ) p_sample->data.p_sample_soun->i_qt_version == 1 &&
p_sample->data.p_sample_soun->i_sample_per_packet <= 0 )
{ {
msg_Err( p_demux, "Invalid sample per packet value for qt_version 1" ); msg_Err( p_demux, "Invalid sample per packet value for qt_version 1" );
return VLC_EGENERIC; return VLC_EGENERIC;
......
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