[vlc-commits] demux: mp4: remove useless avcC unfolding
Francois Cartegnie
git at videolan.org
Thu Jul 19 13:52:21 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jul 19 13:29:10 2018 +0200| [aad1456de47d06f6fb781f6a1b805adee1dcba90] | committer: Francois Cartegnie
demux: mp4: remove useless avcC unfolding
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aad1456de47d06f6fb781f6a1b805adee1dcba90
---
modules/demux/mp4/libmp4.c | 94 +---------------------------------------------
modules/demux/mp4/libmp4.h | 15 +-------
2 files changed, 3 insertions(+), 106 deletions(-)
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 301a33ddbf..621cd07b8a 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -1823,30 +1823,12 @@ static int MP4_ReadBox_esds( stream_t *p_stream, MP4_Box_t *p_box )
static void MP4_FreeBox_avcC( MP4_Box_t *p_box )
{
MP4_Box_data_avcC_t *p_avcC = p_box->data.p_avcC;
-
free( p_avcC->p_avcC );
-
- if( p_avcC->sps )
- {
- for( int i = 0; i < p_avcC->i_sps; i++ )
- free( p_avcC->sps[i] );
- free( p_avcC->sps );
- }
- free( p_avcC->i_sps_length );
-
- if( p_avcC->pps )
- {
- for( int i = 0; i < p_avcC->i_pps; i++ )
- free( p_avcC->pps[i] );
- free( p_avcC->pps );
- }
- free( p_avcC->i_pps_length );
}
static int MP4_ReadBox_avcC( 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, MP4_FreeBox_avcC );
p_avcC = p_box->data.p_avcC;
@@ -1863,84 +1845,12 @@ static int MP4_ReadBox_avcC( stream_t *p_stream, MP4_Box_t *p_box )
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 = calloc( p_avcC->i_sps, sizeof( uint16_t ) );
- p_avcC->sps = calloc( p_avcC->i_sps, sizeof( uint8_t* ) );
-
- if( !p_avcC->i_sps_length || !p_avcC->sps )
- goto error;
-
- for( i = 0; i < p_avcC->i_sps && i_read > 2; i++ )
- {
- MP4_GET2BYTES( p_avcC->i_sps_length[i] );
- if ( p_avcC->i_sps_length[i] > i_read )
- goto error;
- p_avcC->sps[i] = malloc( p_avcC->i_sps_length[i] );
- if( p_avcC->sps[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];
- }
- if ( i != p_avcC->i_sps )
- goto error;
- }
-
- MP4_GET1BYTE( p_avcC->i_pps );
- if( p_avcC->i_pps > 0 )
- {
- p_avcC->i_pps_length = calloc( p_avcC->i_pps, sizeof( uint16_t ) );
- p_avcC->pps = calloc( p_avcC->i_pps, sizeof( uint8_t* ) );
-
- if( !p_avcC->i_pps_length || !p_avcC->pps )
- goto error;
-
- for( i = 0; i < p_avcC->i_pps && i_read > 2; i++ )
- {
- MP4_GET2BYTES( p_avcC->i_pps_length[i] );
- if( p_avcC->i_pps_length[i] > i_read )
- goto error;
- p_avcC->pps[i] = malloc( p_avcC->i_pps_length[i] );
- if( p_avcC->pps[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];
- }
- if ( i != p_avcC->i_pps )
- goto error;
- }
#ifdef MP4_VERBOSE
msg_Dbg( p_stream,
- "read box: \"avcC\" version=%d profile=0x%x level=0x%x length 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, " - sps[%d] length=%d",
- i, p_avcC->i_sps_length[i] );
- }
- for( i = 0; i < p_avcC->i_pps; i++ )
- {
- msg_Dbg( p_stream, " - pps[%d] length=%d",
- i, p_avcC->i_pps_length[i] );
- }
-
+ "read box: \"avcC\" version=%d profile=0x%x level=0x%x",
+ p_avcC->i_version, p_avcC->i_profile, p_avcC->i_level );
#endif
MP4_READBOX_EXIT( 1 );
-
-error:
- MP4_READBOX_EXIT( 0 );
}
static void MP4_FreeBox_vpcC( MP4_Box_t *p_box )
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 3f1e45a986..c8e997dd9c 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -1269,20 +1269,7 @@ typedef struct
uint8_t i_profile_compatibility;
uint8_t i_level;
- uint8_t i_reserved1; /* 6 bits */
- uint8_t i_length_size;
-
- uint8_t i_reserved2; /* 3 bits */
- uint8_t i_sps;
- uint16_t *i_sps_length;
- uint8_t **sps;
-
- uint8_t i_pps;
- uint16_t *i_pps_length;
- uint8_t **pps;
-
- /* XXX: Hack raw avcC atom payload */
- int i_avcC;
+ size_t i_avcC;
uint8_t *p_avcC;
} MP4_Box_data_avcC_t;
More information about the vlc-commits
mailing list