set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_DEMUX )
set_description( N_("MP4 stream demuxer") )
+ set_shortname( N_("MP4") )
set_capability( "demux", 242 )
set_callbacks( Open, Close )
vlc_module_end ()
uint32_t i_sample_count; /* how many samples in this chunk */
uint32_t i_sample_first; /* index of the first sample in this chunk */
- /* now provide way to calculate pts, dts, and offset without to
- much memory and with fast acces */
+ /* now provide way to calculate pts, dts, and offset without too
+ much memory and with fast access */
/* with this we can calculate dts/pts without waste memory */
uint64_t i_first_dts;
free( psz_path );
}
msg_Dbg( p_demux, "adding ref = `%s'", psz_ref );
- input_item_t *p_input = input_item_NewExt( p_demux, psz_ref
- , NULL, 0, NULL, 0, -1 );
+ input_item_t *p_input = input_item_New( p_demux, psz_ref, NULL );
input_item_CopyOptions( p_current, p_input );
input_item_AddSubItem( p_current, p_input );
vlc_gc_decref( p_input );
}
}
/*****************************************************************************
- * Seek: Got to i_date
+ * Seek: Go to i_date
******************************************************************************/
static int Seek( demux_t *p_demux, mtime_t i_date )
{
break;
case FOURCC_0xa9trk: /* Track */
- SET( vlc_meta_SetTracknum );
+ SET( vlc_meta_SetTrackNum );
break;
case FOURCC_0xa9cmt: /* Commment */
}
}
+ /* */
+ 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_aspect =
+ VOUT_ASPECT_FACTOR * p_track->i_width / p_track->i_height;
+
+ /* 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 */
+ p_track->fmt.video.i_frame_rate = p_track->i_timescale;
+ p_track->fmt.video.i_frame_rate_base = 1;
+
+ if( p_track->fmt.video.i_frame_rate &&
+ (p_box = MP4_BoxGet( p_track->p_stbl, "stts" )) &&
+ p_box->data.p_stts->i_entry_count >= 1 )
+ {
+ p_track->fmt.video.i_frame_rate_base =
+ p_box->data.p_stts->i_sample_delta[0];
+ }
+
+ 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 &&
+ 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" );
+ return VLC_EGENERIC;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+
/* It's a little ugly but .. there are special cases */
switch( p_sample->i_type )
{
p_soun->i_qt_version = 0;
break;
}
+ case( VLC_FOURCC( 'a', 'c', '-', '3' ) ):
+ {
+ MP4_Box_t *p_dac3_box = MP4_BoxGet( p_sample, "dac3", 0 );
+
+ p_track->fmt.i_codec = VLC_FOURCC( 'a', '5', '2', ' ' );
+ if( p_dac3_box )
+ {
+ static const int pi_bitrate[] = {
+ 32, 40, 48, 56,
+ 64, 80, 96, 112,
+ 128, 160, 192, 224,
+ 256, 320, 384, 448,
+ 512, 576, 640,
+ };
+ MP4_Box_data_dac3_t *p_dac3 = p_dac3_box->data.p_dac3;
+ p_track->fmt.audio.i_channels = 0;
+ p_track->fmt.i_bitrate = 0;
+ if( p_dac3->i_bitrate_code < sizeof(pi_bitrate)/sizeof(*pi_bitrate) )
+ p_track->fmt.i_bitrate = pi_bitrate[p_dac3->i_bitrate_code] * 1000;
+ p_track->fmt.audio.i_bitspersample = 0;
+ }
+ break;
+ }
+ case( VLC_FOURCC( 'e', 'c', '-', '3' ) ):
+ {
+ p_track->fmt.i_codec = VLC_FOURCC( 'e', 'a', 'c', '3' );
+ break;
+ }
case( VLC_FOURCC( 'r', 'a', 'w', ' ' ) ):
case( VLC_FOURCC( 'N', 'O', 'N', 'E' ) ):
#undef p_decconfig
- /* some last initialisation */
- 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_aspect =
- VOUT_ASPECT_FACTOR * p_track->i_width / p_track->i_height;
-
- /* 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 */
- p_track->fmt.video.i_frame_rate = p_track->i_timescale;
- p_track->fmt.video.i_frame_rate_base = 1;
-
- if( p_track->fmt.video.i_frame_rate &&
- (p_box = MP4_BoxGet( p_track->p_stbl, "stts" )) &&
- p_box->data.p_stts->i_entry_count >= 1 )
- {
- p_track->fmt.video.i_frame_rate_base =
- p_box->data.p_stts->i_sample_delta[0];
- }
-
- 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 &&
- 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" );
- return VLC_EGENERIC;
- }
- break;
-
- default:
- break;
- }
-
if( pp_es )
*pp_es = es_out_Add( p_demux->out, &p_track->fmt );