X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fmux%2Fmp4.c;h=a258adf4cd3bd326968e05ad3972a3c80f3966b4;hb=6ee1e193fd896ab9a4729fde14f009d9ce629815;hp=b693f14c1172785a444d349f40f1252edc37a2c6;hpb=06e1acc1af78481104d7f281a6466d2b239fa4a1;p=vlc diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c index b693f14c11..a258adf4cd 100644 --- a/modules/mux/mp4.c +++ b/modules/mux/mp4.c @@ -25,8 +25,6 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include -#include #include #include @@ -152,15 +150,15 @@ static void bo_add_16be ( bo_t *, uint16_t ); static void bo_add_24be ( bo_t *, uint32_t ); static void bo_add_32be ( bo_t *, uint32_t ); static void bo_add_64be ( bo_t *, uint64_t ); -static void bo_add_fourcc(bo_t *, char * ); +static void bo_add_fourcc(bo_t *, const char * ); static void bo_add_bo ( bo_t *, bo_t * ); static void bo_add_mem ( bo_t *, int , uint8_t * ); static void bo_add_descr( bo_t *, uint8_t , uint32_t ); static void bo_fix_32be ( bo_t *, int , uint32_t ); -static bo_t *box_new ( char *fcc ); -static bo_t *box_full_new( char *fcc, uint8_t v, uint32_t f ); +static bo_t *box_new ( const char *fcc ); +static bo_t *box_full_new( const char *fcc, uint8_t v, uint32_t f ); static void box_fix ( bo_t *box ); static void box_free ( bo_t *box ); static void box_gather ( bo_t *box, bo_t *box2 ); @@ -699,7 +697,7 @@ static block_t *ConvertAVC1( sout_mux_t *p_mux, mp4_stream_t *tk, block_t *p_blo last[2] = ( i_size >> 8 )&0xff; last[3] = ( i_size )&0xff; - /* Skip blocks with SPS/PPS */ + /* Skip blocks with SPS/PPS */ if( (last[4]&0x1f) == 7 || (last[4]&0x1f) == 8 ) { ; // FIXME Find a way to skip dat without frelling everything @@ -909,7 +907,7 @@ static bo_t *GetAvcCTag( mp4_stream_t *p_stream ) uint8_t *p_buffer = p_stream->fmt.p_extra; int i_buffer = p_stream->fmt.i_extra; - while( i_buffer > 4 && + while( i_buffer > 4 && p_buffer[0] == 0 && p_buffer[1] == 0 && p_buffer[2] == 0 && p_buffer[3] == 1 ) { @@ -917,18 +915,18 @@ static bo_t *GetAvcCTag( mp4_stream_t *p_stream ) int i_offset = 1; int i_size = 0; int i_startcode = 0; - + //msg_Dbg( p_stream, "we found a startcode for NAL with TYPE:%d", i_nal_type ); - + for( i_offset = 1; i_offset+3 < i_buffer ; i_offset++) { - if( p_buffer[i_offset] == 0 && p_buffer[i_offset+1] == 0 && + if( p_buffer[i_offset] == 0 && p_buffer[i_offset+1] == 0 && p_buffer[i_offset+2] == 0 && p_buffer[i_offset+3] == 1 ) { /* we found another startcode */ i_startcode = i_offset; break; - } + } } i_size = i_startcode ? i_startcode : i_buffer; if( i_nal_type == 7 ) @@ -945,7 +943,7 @@ static bo_t *GetAvcCTag( mp4_stream_t *p_stream ) p_buffer += i_size; } } - + /* FIXME use better value */ avcC = box_new( "avcC" ); bo_add_8( avcC, 1 ); /* configuration version */ @@ -1053,24 +1051,24 @@ static bo_t *GetUdtaTag( sout_mux_t *p_mux ) { #define ADD_META_BOX( type, box_string ) { \ bo_t *box = NULL; \ - if( p_meta->psz_##type ) box = box_new( "\251" box_string ); \ + if( vlc_meta_Get( p_meta, vlc_meta_##type ) ) box = box_new( "\251" box_string ); \ if( box ) \ { \ - bo_add_16be( box, strlen( p_meta->psz_##type ) ); \ + bo_add_16be( box, strlen( vlc_meta_Get( p_meta, vlc_meta_##type ) )); \ bo_add_16be( box, 0 ); \ - bo_add_mem( box, strlen( p_meta->psz_##type ), \ - (uint8_t*)(p_meta->psz_##type ) ); \ + bo_add_mem( box, strlen( vlc_meta_Get( p_meta, vlc_meta_##type ) ), \ + (uint8_t*)(vlc_meta_Get( p_meta, vlc_meta_##type ) ) ); \ box_fix( box ); \ box_gather( udta, box ); \ } } - ADD_META_BOX( title, "nam" ); - ADD_META_BOX( artist, "ART" ); - ADD_META_BOX( genre, "gen" ); - ADD_META_BOX( copyright, "cpy" ); - ADD_META_BOX( description, "des" ); - ADD_META_BOX( date, "day" ); - ADD_META_BOX( url, "url" ); + ADD_META_BOX( Title, "nam" ); + ADD_META_BOX( Artist, "ART" ); + ADD_META_BOX( Genre, "gen" ); + ADD_META_BOX( Copyright, "cpy" ); + ADD_META_BOX( Description, "des" ); + ADD_META_BOX( Date, "day" ); + ADD_META_BOX( URL, "url" ); #undef ADD_META_BOX } @@ -1528,7 +1526,7 @@ static bo_t *GetStblBox( sout_mux_t *p_mux, mp4_stream_t *p_stream ) return stbl; } -static int64_t get_timestamp(); +static int64_t get_timestamp(void); static uint32_t mvhd_matrix[9] = { 0x10000, 0, 0, 0, 0x10000, 0, 0, 0, 0x40000000 }; @@ -2003,7 +2001,7 @@ static void bo_add_64be( bo_t *p_bo, uint64_t i ) bo_add_32be( p_bo, i &0xffffffff ); } -static void bo_add_fourcc( bo_t *p_bo, char *fcc ) +static void bo_add_fourcc( bo_t *p_bo, const char *fcc ) { bo_add_8( p_bo, fcc[0] ); bo_add_8( p_bo, fcc[1] ); @@ -2029,9 +2027,9 @@ static void bo_add_descr( bo_t *p_bo, uint8_t tag, uint32_t i_size ) i_length = i_size; vals[3] = (unsigned char)(i_length & 0x7f); i_length >>= 7; - vals[2] = (unsigned char)((i_length & 0x7f) | 0x80); + vals[2] = (unsigned char)((i_length & 0x7f) | 0x80); i_length >>= 7; - vals[1] = (unsigned char)((i_length & 0x7f) | 0x80); + vals[1] = (unsigned char)((i_length & 0x7f) | 0x80); i_length >>= 7; vals[0] = (unsigned char)((i_length & 0x7f) | 0x80); @@ -2071,7 +2069,7 @@ static void bo_add_bo( bo_t *p_bo, bo_t *p_bo2 ) } } -static bo_t * box_new( char *fcc ) +static bo_t * box_new( const char *fcc ) { bo_t *box; @@ -2086,7 +2084,7 @@ static bo_t * box_new( char *fcc ) return box; } -static bo_t * box_full_new( char *fcc, uint8_t v, uint32_t f ) +static bo_t * box_full_new( const char *fcc, uint8_t v, uint32_t f ) { bo_t *box; @@ -2152,7 +2150,7 @@ static void box_send( sout_mux_t *p_mux, bo_t *box ) sout_AccessOutWrite( p_mux->p_access, p_buf ); } -static int64_t get_timestamp() +static int64_t get_timestamp(void) { int64_t i_timestamp = 0;