vlc | branch: master | Francois Cartegnie <fcvlc...@free.fr> | Mon Nov 10 12:02:14 2014 +0100| [5107980ba879299a5490c640b0c7f90b38f0d506] | committer: Francois Cartegnie
stream_filter: smooth: fix endianness creating smoo box > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5107980ba879299a5490c640b0c7f90b38f0d506 --- modules/stream_filter/smooth/downloader.c | 51 +++++++++++++++-------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/modules/stream_filter/smooth/downloader.c b/modules/stream_filter/smooth/downloader.c index 8c83133..8400fc1 100644 --- a/modules/stream_filter/smooth/downloader.c +++ b/modules/stream_filter/smooth/downloader.c @@ -344,57 +344,58 @@ static int build_smoo_box( stream_t *s, chunk_t *p_chunk ) p_chunk->size = i_size; uint8_t *smoo_box = p_chunk->data; - smoo_box[2] = (i_size & 0xff00)>>8; - smoo_box[3] = i_size & 0xff; + SetWBE( &smoo_box[2], i_size ); smoo_box[4] = 'u'; smoo_box[5] = 'u'; smoo_box[6] = 'i'; smoo_box[7] = 'd'; + uint32_t *smoo_box32 = (uint32_t *)smoo_box; /* UUID is e1da72ba-24d7-43c3-a6a5-1b5759a1a92c */ - ((uint32_t *)smoo_box)[2] = bswap32( 0xe1da72ba ); - ((uint32_t *)smoo_box)[3] = bswap32( 0x24d743c3 ); - ((uint32_t *)smoo_box)[4] = bswap32( 0xa6a51b57 ); - ((uint32_t *)smoo_box)[5] = bswap32( 0x59a1a92c ); + SetDWBE( &smoo_box32[2], 0xe1da72ba ); + SetDWBE( &smoo_box32[3], 0x24d743c3 ); + SetDWBE( &smoo_box32[4], 0xa6a51b57 ); + SetDWBE( &smoo_box32[5], 0x59a1a92c ); int i = 0; FOREACH_ARRAY( sms_stream_t *sms, p_sys->sms_selected ); uint8_t *stra_box = smoo_box + i++ * STRA_SIZE; + uint16_t *stra_box16 = (uint16_t *)stra_box; + uint32_t *stra_box32 = (uint32_t *)stra_box; + uint64_t *stra_box64 = (uint64_t *)stra_box; - stra_box[26] = (STRA_SIZE & 0xff00)>>8; - stra_box[27] = STRA_SIZE & 0xff; + SetWBE( &stra_box[26], STRA_SIZE ); stra_box[28] = 'u'; stra_box[29] = 'u'; stra_box[30] = 'i'; stra_box[31] = 'd'; /* UUID is b03ef770-33bd-4bac-96c7-bf25f97e2447 */ - ((uint32_t *)stra_box)[8] = bswap32( 0xb03ef770 ); - ((uint32_t *)stra_box)[9] = bswap32( 0x33bd4bac ); - ((uint32_t *)stra_box)[10] = bswap32( 0x96c7bf25 ); - ((uint32_t *)stra_box)[11] = bswap32( 0xf97e2447 ); + SetDWBE( &stra_box32[8], 0xb03ef770 ); + SetDWBE( &stra_box32[9], 0x33bd4bac ); + SetDWBE( &stra_box32[10], 0x96c7bf25 ); + SetDWBE( &stra_box32[11], 0xf97e2447 ); stra_box[48] = sms->type; stra_box[49] = 0; /* reserved */ - stra_box[50] = (sms->id & 0xff00)>>8; - stra_box[51] = sms->id & 0xff; + SetWBE( &stra_box[50], sms->id ); - ((uint32_t *)stra_box)[13] = bswap32( sms->timescale ); - ((uint64_t *)stra_box)[7] = bswap64( p_sys->vod_duration ); + SetDWBE( &stra_box32[13], sms->timescale ); + SetQWBE( &stra_box64[7], p_sys->vod_duration ); const quality_level_t *qlvl = sms->current_qlvl; if ( qlvl ) { FourCC = qlvl->FourCC ? qlvl->FourCC : sms->default_FourCC; - ((uint32_t *)stra_box)[16] = bswap32( FourCC ); - ((uint32_t *)stra_box)[17] = bswap32( qlvl->Bitrate ); - ((uint32_t *)stra_box)[18] = bswap32( qlvl->MaxWidth ); - ((uint32_t *)stra_box)[19] = bswap32( qlvl->MaxHeight ); - ((uint32_t *)stra_box)[20] = bswap32( qlvl->SamplingRate ); - ((uint32_t *)stra_box)[21] = bswap32( qlvl->Channels ); - ((uint32_t *)stra_box)[22] = bswap32( qlvl->BitsPerSample ); - ((uint32_t *)stra_box)[23] = bswap32( qlvl->AudioTag ); - ((uint16_t *)stra_box)[48] = bswap16( qlvl->nBlockAlign ); + SetDWBE( &stra_box32[16], FourCC ); + SetDWBE( &stra_box32[17], qlvl->Bitrate ); + SetDWBE( &stra_box32[18], qlvl->MaxWidth ); + SetDWBE( &stra_box32[19], qlvl->MaxHeight ); + SetDWBE( &stra_box32[20], qlvl->SamplingRate ); + SetDWBE( &stra_box32[21], qlvl->Channels ); + SetDWBE( &stra_box32[22], qlvl->BitsPerSample ); + SetDWBE( &stra_box32[23], qlvl->AudioTag ); + SetWBE( &stra_box16[48], qlvl->nBlockAlign ); if( !qlvl->CodecPrivateData ) continue; _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits