free( p_buff ); \
if( i_read < 0 ) \
{ \
- msg_Warn( p_stream->p_input, "Not enough data" ); \
+ msg_Warn( p_stream->s, "Not enough data" ); \
} \
return( i_code )
static MP4_Box_t *MP4_ReadBox( MP4_Stream_t *p_stream, MP4_Box_t *p_father );
/*****************************************************************************
- * Some basic functions to manipulate MP4_Stream_t, an abstraction o p_input
+ * Some basic functions to manipulate MP4_Stream_t, an abstraction of stream_t
* in the way that you can read from a memory buffer or from an input
*
*****************************************************************************/
* MP4_InputStream create an stram with an input
*
****************************************************************************/
-MP4_Stream_t *MP4_InputStream( input_thread_t *p_input )
+MP4_Stream_t *MP4_InputStream( stream_t *s )
{
MP4_Stream_t *p_stream;
return( NULL );
}
p_stream->b_memory = 0;
- p_stream->p_input = p_input;
+ p_stream->s = s;
p_stream->i_start = 0;
p_stream->i_stop = 0;
p_stream->p_buffer = NULL;
* it uses p_buffer XXX you have to unallocate it yourself !
*
****************************************************************************/
-MP4_Stream_t *MP4_MemoryStream( input_thread_t *p_input,
+MP4_Stream_t *MP4_MemoryStream( stream_t *s,
int i_size, uint8_t *p_buffer )
{
MP4_Stream_t *p_stream;
return( NULL );
}
p_stream->b_memory = 1;
- p_stream->p_input = p_input;
+ p_stream->s = s;
p_stream->i_start = 0;
p_stream->i_stop = i_size;
if( !p_buffer )
}
else
{
- return( stream_Read( p_stream->p_input->s, p_buff, i_size ) < i_size ? VLC_EGENERIC : VLC_SUCCESS);
+ return( stream_Read( p_stream->s, p_buff, i_size ) < i_size ? VLC_EGENERIC : VLC_SUCCESS);
}
}
else
{
- if( p_stream->p_input->stream.p_selected_area->i_size > 0 )
+ if( stream_Size( p_stream->s ) > 0 )
{
- int64_t i_max =
- p_stream->p_input->stream.p_selected_area->i_size - stream_Tell( p_stream->p_input->s );
+ int64_t i_max = stream_Size( p_stream->s ) - stream_Tell( p_stream->s );
if( i_size > i_max )
{
i_size = i_max;
}
}
- return( stream_Peek( p_stream->p_input->s, pp_peek, i_size ) );
+ return( stream_Peek( p_stream->s, pp_peek, i_size ) );
}
}
}
else
{
- return( stream_Tell( p_stream->p_input->s ) );
+ return( stream_Tell( p_stream->s ) );
}
}
}
else
{
- return( stream_Seek( p_stream->p_input->s, (int64_t)i_pos ) );
+ return( stream_Seek( p_stream->s, (int64_t)i_pos ) );
}
}
#ifdef MP4_VERBOSE
if( p_box->i_size )
{
- msg_Dbg( p_stream->p_input, "found Box: %4.4s size "I64Fd,
+ msg_Dbg( p_stream->s, "found Box: %4.4s size "I64Fd,
(char*)&p_box->i_type,
p_box->i_size );
}
if( i_fcc == FOURCC_cmov || i_fcc == FOURCC_mvhd )
{
- msg_Warn( p_stream->p_input, "detected moov hidden in a free box ..." );
+ msg_Warn( p_stream->s, "detected moov hidden in a free box ..." );
p_box->i_type = FOURCC_foov;
return MP4_ReadBoxContainer( p_stream, p_box );
}
/* Nothing to do */
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "skip box: \"%4.4s\"",
+ msg_Dbg( p_stream->s, "skip box: \"%4.4s\"",
(char*)&p_box->i_type );
#endif
return( 1 );
{
s_duration[0] = 0;
}
- msg_Dbg( p_stream->p_input, "read box: \"mvhd\" creation %s modification %s time scale %d duration %s rate %f volume %f next track id %d",
+ msg_Dbg( p_stream->s, "read box: \"mvhd\" creation %s modification %s time scale %d duration %s rate %f volume %f next track id %d",
s_creation_time,
s_modification_time,
(uint32_t)p_box->data.p_mvhd->i_timescale,
MP4_ConvertDate2Str( s_modification_time, p_box->data.p_mvhd->i_modification_time );
MP4_ConvertDate2Str( s_duration, p_box->data.p_mvhd->i_duration );
- msg_Dbg( p_stream->p_input, "read box: \"tkhd\" creation %s modification %s duration %s track ID %d layer %d volume %f width %f height %f",
+ msg_Dbg( p_stream->s, "read box: \"tkhd\" creation %s modification %s duration %s track ID %d layer %d volume %f width %f height %f",
s_creation_time,
s_modification_time,
s_duration,
MP4_ConvertDate2Str( s_creation_time, p_box->data.p_mdhd->i_creation_time );
MP4_ConvertDate2Str( s_modification_time, p_box->data.p_mdhd->i_modification_time );
MP4_ConvertDate2Str( s_duration, p_box->data.p_mdhd->i_duration );
- msg_Dbg( p_stream->p_input, "read box: \"mdhd\" creation %s modification %s time scale %d duration %s language %c%c%c",
+ msg_Dbg( p_stream->s, "read box: \"mdhd\" creation %s modification %s time scale %d duration %s language %c%c%c",
s_creation_time,
s_modification_time,
(uint32_t)p_box->data.p_mdhd->i_timescale,
memcpy( p_box->data.p_hdlr->psz_name, p_peek, i_read );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"hdlr\" hanler type %4.4s name %s",
+ msg_Dbg( p_stream->s, "read box: \"hdlr\" hanler type %4.4s name %s",
(char*)&p_box->data.p_hdlr->i_handler_type,
p_box->data.p_hdlr->psz_name );
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"vmhd\" graphics-mode %d opcolor (%d, %d, %d)",
+ msg_Dbg( p_stream->s, "read box: \"vmhd\" graphics-mode %d opcolor (%d, %d, %d)",
p_box->data.p_vmhd->i_graphics_mode,
p_box->data.p_vmhd->i_opcolor[0],
p_box->data.p_vmhd->i_opcolor[1],
MP4_GET2BYTES( p_box->data.p_smhd->i_reserved );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"smhd\" balance %f",
+ msg_Dbg( p_stream->s, "read box: \"smhd\" balance %f",
(float)p_box->data.p_smhd->i_balance / 256 );
#endif
MP4_READBOX_EXIT( 1 );
MP4_GET4BYTES( p_box->data.p_hmhd->i_reserved );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"hmhd\" maxPDU-size %d avgPDU-size %d max-bitrate %d avg-bitrate %d",
+ msg_Dbg( p_stream->s, "read box: \"hmhd\" maxPDU-size %d avgPDU-size %d max-bitrate %d avg-bitrate %d",
p_box->data.p_hmhd->i_max_PDU_size,
p_box->data.p_hmhd->i_avg_PDU_size,
p_box->data.p_hmhd->i_max_bitrate,
MP4_GETSTRINGZ( p_box->data.p_url->psz_location );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"url\" url: %s",
+ msg_Dbg( p_stream->s, "read box: \"url\" url: %s",
p_box->data.p_url->psz_location );
#endif
MP4_GETSTRINGZ( p_box->data.p_urn->psz_location );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"urn\" name %s location %s",
+ msg_Dbg( p_stream->s, "read box: \"urn\" name %s location %s",
p_box->data.p_urn->psz_name,
p_box->data.p_urn->psz_location );
#endif
MP4_ReadBoxContainerRaw( p_stream, p_box );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"dref\" entry-count %d",
+ msg_Dbg( p_stream->s, "read box: \"dref\" entry-count %d",
p_box->data.p_dref->i_entry_count );
#endif
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"stts\" entry-count %d",
+ msg_Dbg( p_stream->s, "read box: \"stts\" entry-count %d",
p_box->data.p_stts->i_entry_count );
#endif
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"ctts\" entry-count %d",
+ msg_Dbg( p_stream->s, "read box: \"ctts\" entry-count %d",
p_box->data.p_ctts->i_entry_count );
#endif
i_len = MP4_ReadLengthDescriptor( &p_peek, &i_read );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "found esds MPEG4ESDescr (%dBytes)",
+ msg_Dbg( p_stream->s, "found esds MPEG4ESDescr (%dBytes)",
i_len );
#endif
i_len = MP4_ReadLengthDescriptor( &p_peek, &i_read );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "found esds MP4DecConfigDescr (%dBytes)",
+ msg_Dbg( p_stream->s, "found esds MP4DecConfigDescr (%dBytes)",
i_len );
#endif
i_len = MP4_ReadLengthDescriptor( &p_peek, &i_read );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "found esds MP4DecSpecificDescr (%dBytes)",
+ msg_Dbg( p_stream->s, "found esds MP4DecSpecificDescr (%dBytes)",
i_len );
#endif
FREE( p_box->data.p_esds->es_descriptor.p_decConfigDescr );
}
+static int MP4_ReadBox_avcC( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+{
+ MP4_Box_data_avcC_t *p_avcC;
+ int i;
+
+ MP4_READBOX_ENTER( MP4_Box_data_avcC_t );
+ p_avcC = p_box->data.p_avcC;
+
+ p_avcC->i_avcC = i_read;
+ p_avcC->p_avcC = malloc( p_avcC->i_avcC );
+ memcpy( p_avcC->p_avcC, p_peek, i_read );
+
+ MP4_GET1BYTE( p_avcC->i_version );
+ MP4_GET1BYTE( p_avcC->i_profile );
+ MP4_GET1BYTE( p_avcC->i_profile_compatibility );
+ MP4_GET1BYTE( p_avcC->i_level );
+ MP4_GET1BYTE( p_avcC->i_reserved1 );
+ p_avcC->i_length_size = (p_avcC->i_reserved1&0x03) + 1;
+ p_avcC->i_reserved1 >>= 2;
+
+ MP4_GET1BYTE( p_avcC->i_reserved2 );
+ p_avcC->i_sps = p_avcC->i_reserved2&0x1f;
+ p_avcC->i_reserved2 >>= 5;
+
+ if( p_avcC->i_sps > 0 )
+ {
+ p_avcC->i_sps_length = malloc( p_avcC->i_sps * sizeof( uint16_t ) );
+ p_avcC->sps = malloc( p_avcC->i_sps * sizeof( uint8_t* ) );
+
+ for( i = 0; i < p_avcC->i_sps; i++ )
+ {
+ MP4_GET2BYTES( p_avcC->i_sps_length[i] );
+ p_avcC->sps[i] = malloc( p_avcC->i_sps_length[i] );
+ memcpy( p_avcC->sps[i], p_peek, p_avcC->i_sps_length[i] );
+
+ p_peek += p_avcC->i_sps_length[i];
+ i_read -= p_avcC->i_sps_length[i];
+ }
+ }
+
+ MP4_GET1BYTE( p_avcC->i_pps );
+ if( p_avcC->i_pps > 0 )
+ {
+ p_avcC->i_pps_length = malloc( p_avcC->i_pps * sizeof( uint16_t ) );
+ p_avcC->pps = malloc( p_avcC->i_pps * sizeof( uint8_t* ) );
+
+ for( i = 0; i < p_avcC->i_pps; i++ )
+ {
+ MP4_GET2BYTES( p_avcC->i_pps_length[i] );
+ p_avcC->pps[i] = malloc( p_avcC->i_pps_length[i] );
+ memcpy( p_avcC->pps[i], p_peek, p_avcC->i_pps_length[i] );
+
+ p_peek += p_avcC->i_pps_length[i];
+ i_read -= p_avcC->i_pps_length[i];
+ }
+ }
+#ifdef MP4_VERBOSE
+ msg_Dbg( p_stream->s,
+ "read box: \"avcC\" version=%d profile=0x%x level=0x%x lengh size=%d sps=%d pps=%d",
+ p_avcC->i_version, p_avcC->i_profile, p_avcC->i_level,
+ p_avcC->i_length_size,
+ p_avcC->i_sps, p_avcC->i_pps );
+ for( i = 0; i < p_avcC->i_sps; i++ )
+ {
+ msg_Dbg( p_stream->s, " - sps[%d] length=%d",
+ i, p_avcC->i_sps_length[i] );
+ }
+ for( i = 0; i < p_avcC->i_pps; i++ )
+ {
+ msg_Dbg( p_stream->s, " - pps[%d] length=%d",
+ i, p_avcC->i_pps_length[i] );
+ }
+
+#endif
+ MP4_READBOX_EXIT( 1 );
+}
+
+static void MP4_FreeBox_avcC( MP4_Box_t *p_box )
+{
+ MP4_Box_data_avcC_t *p_avcC = p_box->data.p_avcC;
+ int i;
+
+ for( i = 0; i < p_avcC->i_sps; i++ )
+ {
+ FREE( p_avcC->sps[i] );
+ }
+ for( i = 0; i < p_avcC->i_pps; i++ )
+ {
+ FREE( p_avcC->pps[i] );
+ }
+ if( p_avcC->i_sps > 0 ) FREE( p_avcC->sps );
+ if( p_avcC->i_pps > 0 ) FREE( p_avcC->pps );
+}
+
static int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
unsigned int i;
MP4_READBOX_ENTER( MP4_Box_data_sample_soun_t );
+ p_box->data.p_sample_soun->p_qt_description = NULL;
/* Sanity check needed because the "wave" box does also contain an
* "mp4a" box that we don't understand. */
/*
* XXX hack -> produce a copy of the nearly complete chunk
*/
- p_box->data.p_sample_soun->i_qt_description = i_read;
- p_box->data.p_sample_soun->p_qt_description = malloc( i_read );
- memcpy( p_box->data.p_sample_soun->p_qt_description, p_peek, i_read );
+ if( i_read > 0 )
+ {
+ p_box->data.p_sample_soun->i_qt_description = i_read;
+ p_box->data.p_sample_soun->p_qt_description = malloc( i_read );
+ memcpy( p_box->data.p_sample_soun->p_qt_description, p_peek, i_read );
+ }
+ else
+ {
+ p_box->data.p_sample_soun->i_qt_description = 0;
+ p_box->data.p_sample_soun->p_qt_description = NULL;
+ }
MP4_GET2BYTES( p_box->data.p_sample_soun->i_qt_version );
MP4_GET2BYTES( p_box->data.p_sample_soun->i_qt_revision_level );
MP4_GET4BYTES( p_box->data.p_sample_soun->i_bytes_per_sample );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input,
- "read box: \"soun\" qt3+ sample/packet=%d bytes/packet=%d bytes/frame=%d bytes/sample=%d",
- p_box->data.p_sample_soun->i_sample_per_packet, p_box->data.p_sample_soun->i_bytes_per_packet,
- p_box->data.p_sample_soun->i_bytes_per_frame, p_box->data.p_sample_soun->i_bytes_per_sample );
+ msg_Dbg( p_stream->s,
+ "read box: \"soun\" qt3+ sample/packet=%d bytes/packet=%d "
+ "bytes/frame=%d bytes/sample=%d",
+ p_box->data.p_sample_soun->i_sample_per_packet,
+ p_box->data.p_sample_soun->i_bytes_per_packet,
+ p_box->data.p_sample_soun->i_bytes_per_frame,
+ p_box->data.p_sample_soun->i_bytes_per_sample );
#endif
- MP4_SeekStream( p_stream, p_box->i_pos + MP4_BOX_HEADERSIZE( p_box ) + 44 );
+ MP4_SeekStream( p_stream, p_box->i_pos +
+ MP4_BOX_HEADERSIZE( p_box ) + 44 );
}
else
{
p_box->data.p_sample_soun->i_bytes_per_frame = 0;
p_box->data.p_sample_soun->i_bytes_per_sample = 0;
- msg_Dbg( p_stream->p_input, "read box: \"soun\" mp4 or qt1/2 (rest="I64Fd")", i_read );
- MP4_SeekStream( p_stream, p_box->i_pos + MP4_BOX_HEADERSIZE( p_box ) + 28 );
+ msg_Dbg( p_stream->s, "read box: \"soun\" mp4 or qt1/2 (rest="I64Fd")",
+ i_read );
+ MP4_SeekStream( p_stream, p_box->i_pos +
+ MP4_BOX_HEADERSIZE( p_box ) + 28 );
}
if( p_box->i_type == FOURCC_drms )
{
p_box->data.p_sample_soun->p_drms =
- drms_alloc( p_stream->p_input->p_vlc->psz_homedir );
+ drms_alloc( p_stream->s->p_vlc->psz_homedir );
if( p_box->data.p_sample_soun->p_drms == NULL )
{
- msg_Err( p_stream->p_input, "drms_alloc() failed" );
+ msg_Err( p_stream->s, "drms_alloc() failed" );
}
}
MP4_ReadBoxContainerRaw( p_stream, p_box ); /* esds */
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"soun\" in stsd channel %d sample size %d sampl rate %f",
- p_box->data.p_sample_soun->i_channelcount,
- p_box->data.p_sample_soun->i_samplesize,
- (float)p_box->data.p_sample_soun->i_sampleratehi +
- (float)p_box->data.p_sample_soun->i_sampleratelo / 65536 );
+ msg_Dbg( p_stream->s, "read box: \"soun\" in stsd channel %d "
+ "sample size %d sampl rate %f",
+ p_box->data.p_sample_soun->i_channelcount,
+ p_box->data.p_sample_soun->i_samplesize,
+ (float)p_box->data.p_sample_soun->i_sampleratehi +
+ (float)p_box->data.p_sample_soun->i_sampleratelo / 65536 );
#endif
MP4_READBOX_EXIT( 1 );
static void MP4_FreeBox_sample_soun( MP4_Box_t *p_box )
{
+ FREE( p_box->data.p_sample_soun->p_qt_description );
+
if( p_box->i_type == FOURCC_drms )
{
if( p_box->data.p_sample_soun->p_drms )
p_box->data.p_sample_vide->i_qt_image_description = i_read;
p_box->data.p_sample_vide->p_qt_image_description = malloc( i_read );
memcpy( p_box->data.p_sample_vide->p_qt_image_description,
- p_peek,
- i_read );
+ p_peek, i_read );
}
else
{
MP4_ReadBoxContainerRaw( p_stream, p_box );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"vide\" in stsd %dx%d depth %d",
+ msg_Dbg( p_stream->s, "read box: \"vide\" in stsd %dx%d depth %d",
p_box->data.p_sample_vide->i_width,
p_box->data.p_sample_vide->i_height,
p_box->data.p_sample_vide->i_depth );
}
+static void MP4_FreeBox_sample_vide( MP4_Box_t *p_box )
+{
+ FREE( p_box->data.p_sample_vide->p_qt_image_description );
+}
+
+
+static int MP4_ReadBox_sample_text( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+{
+ unsigned int i;
+
+ MP4_READBOX_ENTER( MP4_Box_data_sample_text_t );
+
+ for( i = 0; i < 6 ; i++ )
+ {
+ MP4_GET1BYTE( p_box->data.p_sample_text->i_reserved1[i] );
+ }
+ MP4_GET2BYTES( p_box->data.p_sample_text->i_data_reference_index );
+
+ MP4_GET4BYTES( p_box->data.p_sample_text->i_display_flags );
+ MP4_GET4BYTES( p_box->data.p_sample_text->i_justification );
+
+ MP4_GET2BYTES( p_box->data.p_sample_text->i_background_color[0] );
+ MP4_GET2BYTES( p_box->data.p_sample_text->i_background_color[1] );
+ MP4_GET2BYTES( p_box->data.p_sample_text->i_background_color[2] );
+
+ MP4_GET8BYTES( p_box->data.p_sample_text->i_text_box );
+ MP4_GET8BYTES( p_box->data.p_sample_text->i_reserved2 );
+
+ MP4_GET2BYTES( p_box->data.p_sample_text->i_font_number );
+ MP4_GET2BYTES( p_box->data.p_sample_text->i_font_face );
+
+ MP4_GET2BYTES( p_box->data.p_sample_text->i_reserved3 );
+
+ MP4_GET2BYTES( p_box->data.p_sample_text->i_foreground_color[0] );
+ MP4_GET2BYTES( p_box->data.p_sample_text->i_foreground_color[1] );
+ MP4_GET2BYTES( p_box->data.p_sample_text->i_foreground_color[2] );
+
+ MP4_GET1BYTE( i );
+ p_box->data.p_sample_text->psz_text_name = malloc( i + 1 );
+ memcpy( p_box->data.p_sample_text->psz_text_name, p_peek, i );
+ p_box->data.p_sample_text->psz_text_name[i] = '\0';
+
+#ifdef MP4_VERBOSE
+ msg_Dbg( p_stream->s, "read box: \"text\" in stsd text name=%s",
+ p_box->data.p_sample_text->psz_text_name );
+#endif
+ MP4_READBOX_EXIT( 1 );
+}
+
+#if 0
+/* We can't easily call it, and anyway ~ 20 bytes lost isn't a real problem */
+static void MP4_FreeBox_sample_text( MP4_Box_t *p_box )
+{
+ FREE( p_box->data.p_sample_text->psz_text_name );
+}
+#endif
+
+
static int MP4_ReadBox_stsd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_ReadBoxContainerRaw( p_stream, p_box );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"stsd\" entry-count %d",
+ msg_Dbg( p_stream->s, "read box: \"stsd\" entry-count %d",
p_box->data.p_stsd->i_entry_count );
#endif
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"stsz\" sample-size %d sample-count %d",
+ msg_Dbg( p_stream->s, "read box: \"stsz\" sample-size %d sample-count %d",
p_box->data.p_stsz->i_sample_size,
p_box->data.p_stsz->i_sample_count );
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"stsc\" entry-count %d",
+ msg_Dbg( p_stream->s, "read box: \"stsc\" entry-count %d",
p_box->data.p_stsc->i_entry_count );
#endif
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"co64\" entry-count %d",
+ msg_Dbg( p_stream->s, "read box: \"co64\" entry-count %d",
p_box->data.p_co64->i_entry_count );
#endif
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"stss\" entry-count %d",
+ msg_Dbg( p_stream->s, "read box: \"stss\" entry-count %d",
p_box->data.p_stss->i_entry_count );
#endif
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"stsh\" entry-count %d",
+ msg_Dbg( p_stream->s, "read box: \"stsh\" entry-count %d",
p_box->data.p_stsh->i_entry_count );
#endif
MP4_READBOX_EXIT( 1 );
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"stdp\" entry-count "I64Fd,
+ msg_Dbg( p_stream->s, "read box: \"stdp\" entry-count "I64Fd,
i_read / 2 );
#endif
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"stdp\" entry-count "I64Fd,
+ msg_Dbg( p_stream->s, "read box: \"stdp\" entry-count "I64Fd,
i_read / 2 );
#endif
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"elst\" entry-count "I64Fd,
+ msg_Dbg( p_stream->s, "read box: \"elst\" entry-count "I64Fd,
i_read / 2 );
#endif
MP4_GETSTRINGZ( p_box->data.p_cprt->psz_notice );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"cprt\" language %c%c%c notice %s",
+ msg_Dbg( p_stream->s, "read box: \"cprt\" language %c%c%c notice %s",
p_box->data.p_cprt->i_language[0],
p_box->data.p_cprt->i_language[1],
p_box->data.p_cprt->i_language[2],
MP4_GETFOURCC( p_box->data.p_dcom->i_algorithm );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input,
+ msg_Dbg( p_stream->s,
"read box: \"dcom\" compression algorithm : %4.4s",
(char*)&p_box->data.p_dcom->i_algorithm );
#endif
if( !( p_box->data.p_cmvd->p_data = malloc( i_read ) ) )
{
- msg_Dbg( p_stream->p_input, "read box: \"cmvd\" not enough memory to load data" );
+ msg_Dbg( p_stream->s, "read box: \"cmvd\" not enough memory to load data" );
return( 1 );
}
p_box->data.p_cmvd->b_compressed = 1;
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input, "read box: \"cmvd\" compressed data size %d",
+ msg_Dbg( p_stream->s, "read box: \"cmvd\" compressed data size %d",
p_box->data.p_cmvd->i_compressed_size );
#endif
if( !( p_box->data.p_cmov = malloc( sizeof( MP4_Box_data_cmov_t ) ) ) )
{
- msg_Err( p_stream->p_input, "out of memory" );
+ msg_Err( p_stream->s, "out of memory" );
return( 0 );
}
memset( p_box->data.p_cmov, 0, sizeof( MP4_Box_data_cmov_t ) );
if( !p_box->p_father ||
( p_box->p_father->i_type != FOURCC_moov && p_box->p_father->i_type != FOURCC_foov) )
{
- msg_Warn( p_stream->p_input, "Read box: \"cmov\" box alone" );
+ msg_Warn( p_stream->s, "Read box: \"cmov\" box alone" );
return( 1 );
}
( p_cmvd = MP4_BoxGet( p_box, "cmvd" ) ) == NULL ||
p_cmvd->data.p_cmvd->p_data == NULL )
{
- msg_Warn( p_stream->p_input, "read box: \"cmov\" incomplete" );
+ msg_Warn( p_stream->s, "read box: \"cmov\" incomplete" );
return( 1 );
}
if( p_dcom->data.p_dcom->i_algorithm != FOURCC_zlib )
{
- msg_Dbg( p_stream->p_input, "read box: \"cmov\" compression algorithm : %4.4s not supported",
+ msg_Dbg( p_stream->s, "read box: \"cmov\" compression algorithm : %4.4s not supported",
(char*)&p_dcom->data.p_dcom->i_algorithm );
return( 1 );
}
#ifndef HAVE_ZLIB_H
- msg_Dbg( p_stream->p_input,
+ msg_Dbg( p_stream->s,
"read box: \"cmov\" zlib unsupported" );
return( 1 );
#else
/* allocate a new buffer */
if( !( p_data = malloc( p_cmvd->data.p_cmvd->i_uncompressed_size ) ) )
{
- msg_Err( p_stream->p_input,
+ msg_Err( p_stream->s,
"read box: \"cmov\" not enough memory to uncompress data" );
return( 1 );
}
/* init zlib */
if( ( i_result = inflateInit( &z_data ) ) != Z_OK )
{
- msg_Err( p_stream->p_input,
+ msg_Err( p_stream->s,
"read box: \"cmov\" error while uncompressing data" );
free( p_data );
return( 1 );
i_result = inflate( &z_data, Z_NO_FLUSH );
if( ( i_result != Z_OK )&&( i_result != Z_STREAM_END ) )
{
- msg_Err( p_stream->p_input,
+ msg_Err( p_stream->s,
"read box: \"cmov\" error while uncompressing data" );
free( p_data );
return( 1 );
if( p_cmvd->data.p_cmvd->i_uncompressed_size != z_data.total_out )
{
- msg_Warn( p_stream->p_input,
+ msg_Warn( p_stream->s,
"read box: \"cmov\" uncompressing data size mismatch" );
}
p_cmvd->data.p_cmvd->i_uncompressed_size = z_data.total_out;
i_result = inflateEnd( &z_data );
if( i_result != Z_OK )
{
- msg_Warn( p_stream->p_input,
+ msg_Warn( p_stream->s,
"read box: \"cmov\" error while uncompressing data (ignored)" );
}
p_cmvd->data.p_cmvd->p_data = p_data;
p_cmvd->data.p_cmvd->b_compressed = 0;
- msg_Dbg( p_stream->p_input,
+ msg_Dbg( p_stream->s,
"read box: \"cmov\" box succesfully uncompressed" );
/* now create a memory stream */
- p_stream_memory = MP4_MemoryStream( p_stream->p_input,
+ p_stream_memory = MP4_MemoryStream( p_stream->s,
p_cmvd->data.p_cmvd->i_uncompressed_size,
p_cmvd->data.p_cmvd->p_data );
free( p_stream_memory );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input,
+ msg_Dbg( p_stream->s,
"read box: \"cmov\" compressed movie header completed" );
#endif
return( p_box->data.p_cmov->p_moov ? 1 : 0 );
}
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input,
+ msg_Dbg( p_stream->s,
"read box: \"rdrf\" type:%4.4s ref %s",
(char*)&p_box->data.p_rdrf->i_ref_type,
p_box->data.p_rdrf->psz_ref );
MP4_GET4BYTES( p_box->data.p_rmdr->i_rate );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input,
+ msg_Dbg( p_stream->s,
"read box: \"rmdr\" rate:%d",
p_box->data.p_rmdr->i_rate );
#endif
MP4_GET4BYTES( p_box->data.p_rmqu->i_quality );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input,
+ msg_Dbg( p_stream->s,
"read box: \"rmqu\" quality:%d",
p_box->data.p_rmqu->i_quality );
#endif
MP4_GET2BYTES( p_box->data.p_rmvc->i_checkType );
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input,
+ msg_Dbg( p_stream->s,
"read box: \"rmvc\" gestaltType:%4.4s val1:0x%x val2:0x%x checkType:0x%x",
(char*)&p_box->data.p_rmvc->i_gestaltType,
p_box->data.p_rmvc->i_val1,p_box->data.p_rmvc->i_val2,
if( drms_init( p_drms_box->data.p_sample_soun->p_drms,
p_box->i_type, p_peek, i_read ) )
{
- msg_Err( p_stream->p_input, "drms_init( %4.4s ) failed",
+ msg_Err( p_stream->s, "drms_init( %4.4s ) failed",
(char *)&p_box->i_type );
drms_free( p_drms_box->data.p_sample_soun->p_drms );
p_box->data.p_0xa9xxx->psz_text[i_length] = '\0';
#ifdef MP4_VERBOSE
- msg_Dbg( p_stream->p_input,
+ msg_Dbg( p_stream->s,
"read box: \"%4.4s\" text=`%s'",
(char*)&p_box->i_type,
p_box->data.p_0xa9xxx->psz_text );
FREE( p_box->data.p_0xa9xxx->psz_text );
}
+/* For generic */
+static int MP4_ReadBox_default( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
+{
+ if( !p_box->p_father )
+ {
+ goto unknown;
+ }
+ if( p_box->p_father->i_type == FOURCC_stsd )
+ {
+ MP4_Box_t *p_mdia = MP4_BoxGet( p_box, "../../../.." );
+ MP4_Box_t *p_hdlr;
+
+ if( p_mdia == NULL || p_mdia->i_type != FOURCC_mdia ||
+ (p_hdlr = MP4_BoxGet( p_mdia, "hdlr" )) == NULL )
+ {
+ goto unknown;
+ }
+ switch( p_hdlr->data.p_hdlr->i_handler_type )
+ {
+ case FOURCC_soun:
+ return MP4_ReadBox_sample_soun( p_stream, p_box );
+ case FOURCC_vide:
+ return MP4_ReadBox_sample_vide( p_stream, p_box );
+ case FOURCC_text:
+ return MP4_ReadBox_sample_text( p_stream, p_box );
+ default:
+ msg_Warn( p_stream->s,
+ "unknown handler type in stsd (uncompletetly loaded)" );
+ return 1;
+ }
+ }
+
+unknown:
+ msg_Warn( p_stream->s,
+ "unknown box type %4.4s (uncompletetly loaded)",
+ (char*)&p_box->i_type );
+
+ return 1;
+}
+
/**** ------------------------------------------------------------------- ****/
/**** "Higher level" Functions ****/
/**** ------------------------------------------------------------------- ****/
{ FOURCC_esds, MP4_ReadBox_esds, MP4_FreeBox_esds },
{ FOURCC_dcom, MP4_ReadBox_dcom, MP4_FreeBox_Common },
{ FOURCC_cmvd, MP4_ReadBox_cmvd, MP4_FreeBox_cmvd },
+ { FOURCC_avcC, MP4_ReadBox_avcC, MP4_FreeBox_avcC },
/* Nothing to do with this box */
{ FOURCC_mdat, MP4_ReadBoxSkip, MP4_FreeBox_Common },
{ FOURCC_wide, MP4_ReadBoxSkip, MP4_FreeBox_Common },
/* for codecs */
- { FOURCC_soun, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_ms02, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_ms11, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_ms55, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC__mp3, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_mp4a, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_twos, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_sowt, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_QDMC, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_QDM2, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_ima4, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_IMA4, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_dvi, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_alaw, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_ulaw, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_raw, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_MAC3, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_MAC6, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_Qclp, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_samr, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
- { FOURCC_OggS, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
-
- { FOURCC_vide, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_mp4v, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_SVQ1, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_SVQ3, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_ZyGo, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_DIVX, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_h263, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_s263, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_cvid, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_3IV1, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_3iv1, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_3IV2, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_3iv2, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_3IVD, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_3ivd, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_3VID, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_3vid, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_mjpa, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_mjpb, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_mjqt, NULL, NULL }, /* found in mjpa/b */
- { FOURCC_mjht, NULL, NULL },
- { FOURCC_dvc, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_dvp, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_VP31, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_vp31, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
- { FOURCC_h264, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
-
- { FOURCC_jpeg, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
-
- { FOURCC_mp4s, NULL, MP4_FreeBox_Common },
+ { FOURCC_soun, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_ms02, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_ms11, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_ms55, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC__mp3, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_mp4a, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_twos, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_sowt, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_QDMC, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_QDM2, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_ima4, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_IMA4, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_dvi, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_alaw, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_ulaw, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_raw, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_MAC3, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_MAC6, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_Qclp, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_samr, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+ { FOURCC_OggS, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
+
+ { FOURCC_vide, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_mp4v, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_SVQ1, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_SVQ3, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_ZyGo, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_DIVX, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_XVID, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_h263, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_s263, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_cvid, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_3IV1, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_3iv1, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_3IV2, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_3iv2, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_3IVD, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_3ivd, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_3VID, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_3vid, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_mjpa, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_mjpb, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+
+ { FOURCC_mjqt, MP4_ReadBox_default, NULL }, /* found in mjpa/b */
+ { FOURCC_mjht, MP4_ReadBox_default, NULL },
+
+ { FOURCC_dvc, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_dvp, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_VP31, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_vp31, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_h264, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+
+ { FOURCC_jpeg, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+ { FOURCC_avc1, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
+
+ { FOURCC_mp4s, MP4_ReadBox_default, MP4_FreeBox_Common },
/* XXX there is 2 box where we could find this entry stbl and tref*/
- { FOURCC_hint, NULL, MP4_FreeBox_Common },
+ { FOURCC_hint, MP4_ReadBox_default, MP4_FreeBox_Common },
/* found in tref box */
- { FOURCC_dpnd, NULL, NULL },
- { FOURCC_ipir, NULL, NULL },
- { FOURCC_mpod, NULL, NULL },
+ { FOURCC_dpnd, MP4_ReadBox_default, NULL },
+ { FOURCC_ipir, MP4_ReadBox_default, NULL },
+ { FOURCC_mpod, MP4_ReadBox_default, NULL },
/* found in hnti */
- { FOURCC_rtp, NULL, NULL },
+ { FOURCC_rtp, MP4_ReadBox_default, NULL },
/* found in rmra */
{ FOURCC_rdrf, MP4_ReadBox_rdrf, MP4_FreeBox_rdrf },
{ FOURCC_0xa9cmt,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9req,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9day,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
+ { FOURCC_0xa9des,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9fmt,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9prd,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9prf,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9src,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
/* Last entry */
- { 0, NULL, NULL }
+ { 0, MP4_ReadBox_default, NULL }
};
if( !MP4_ReadBoxCommon( p_stream, p_box ) )
{
- msg_Warn( p_stream->p_input, "cannot read one box" );
+ msg_Warn( p_stream->s, "cannot read one box" );
free( p_box );
return NULL;
}
if( !p_box->i_size )
{
- msg_Dbg( p_stream->p_input, "found an empty box (null size)" );
+ msg_Dbg( p_stream->s, "found an empty box (null size)" );
free( p_box );
return NULL;
}
break;
}
}
- if( MP4_Box_Function[i_index].MP4_ReadBox_function == NULL )
- {
- msg_Warn( p_stream->p_input,
- "unknown box type %4.4s (uncompletetly loaded)",
- (char*)&p_box->i_type );
- }
- else if( !(MP4_Box_Function[i_index].MP4_ReadBox_function)( p_stream, p_box ) )
+
+ if( !(MP4_Box_Function[i_index].MP4_ReadBox_function)( p_stream, p_box ) )
{
free( p_box );
return NULL;
* MP4_FreeBox : free memory after read with MP4_ReadBox and all
* the children
*****************************************************************************/
-void MP4_BoxFree( input_thread_t *p_input, MP4_Box_t *p_box )
+void MP4_BoxFree( stream_t *s, MP4_Box_t *p_box )
{
unsigned int i_index;
MP4_Box_t *p_child;
MP4_Box_t *p_next;
p_next = p_child->p_next;
- MP4_BoxFree( p_input, p_child );
+ MP4_BoxFree( s, p_child );
p_child = p_next;
}
if( MP4_Box_Function[i_index].MP4_FreeBox_function == NULL )
{
/* Should not happen */
- msg_Warn( p_input,
+ msg_Warn( s,
"cannot free box %4.4s, type unknown",
(char*)&p_box->i_type );
}
* The first box is a virtual box "root" and is the father for all first
* level boxes for the file, a sort of virtual contener
*****************************************************************************/
-MP4_Box_t *MP4_BoxGetRoot( input_thread_t *p_input )
+MP4_Box_t *MP4_BoxGetRoot( stream_t *s )
{
MP4_Box_t *p_root;
MP4_Stream_t *p_stream;
p_root->i_pos = 0;
p_root->i_type = VLC_FOURCC( 'r', 'o', 'o', 't' );
p_root->i_shortsize = 1;
- p_root->i_size = p_input->stream.p_selected_area->i_size;
+ p_root->i_size = stream_Size( s );
CreateUUID( &p_root->i_uuid, p_root->i_type );
p_root->data.p_data = NULL;
p_root->p_last = NULL;
p_root->p_next = NULL;
- p_stream = MP4_InputStream( p_input );
+ p_stream = MP4_InputStream( s );
i_result = MP4_ReadBoxContainerRaw( p_stream, p_root );
}
-static void __MP4_BoxDumpStructure( input_thread_t *p_input,
+static void __MP4_BoxDumpStructure( stream_t *s,
MP4_Box_t *p_box, unsigned int i_level )
{
MP4_Box_t *p_child;
if( !i_level )
{
- msg_Dbg( p_input, "dumping root Box \"%4.4s\"",
+ msg_Dbg( s, "dumping root Box \"%4.4s\"",
(char*)&p_box->i_type );
}
else
(char*)&p_box->i_type,
(uint32_t)p_box->i_size );
- msg_Dbg( p_input, "%s", str );
+ msg_Dbg( s, "%s", str );
}
p_child = p_box->p_first;
while( p_child )
{
- __MP4_BoxDumpStructure( p_input, p_child, i_level + 1 );
+ __MP4_BoxDumpStructure( s, p_child, i_level + 1 );
p_child = p_child->p_next;
}
}
-void MP4_BoxDumpStructure( input_thread_t *p_input, MP4_Box_t *p_box )
+void MP4_BoxDumpStructure( stream_t *s, MP4_Box_t *p_box )
{
- __MP4_BoxDumpStructure( p_input, p_box, 0 );
+ __MP4_BoxDumpStructure( s, p_box, 0 );
}
}
return( i_count );
}
-