Commit 344f8406 authored by yhuelf's avatar yhuelf Committed by Jean-Baptiste Kempf
Browse files

Smooth Streaming: read PacketSize attribute in manifest



PacketSize == nBlockAlign attribute of WaveFormatEx structure.

We also remove the AvgBytesPerSec attribute of the quality_level_t
structure, since it is equal to the Bitrate attribute (divided per 8).

This fixes streams done by Expression Encoder 4
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3a4021cf
...@@ -514,9 +514,7 @@ static int MP4_ReadBox_stra( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -514,9 +514,7 @@ static int MP4_ReadBox_stra( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_stra->SamplingRate ); MP4_GET4BYTES( p_stra->SamplingRate );
MP4_GET4BYTES( p_stra->Channels ); MP4_GET4BYTES( p_stra->Channels );
MP4_GET4BYTES( p_stra->BitsPerSample ); MP4_GET4BYTES( p_stra->BitsPerSample );
MP4_GET4BYTES( p_stra->PacketSize );
MP4_GET4BYTES( p_stra->AudioTag ); MP4_GET4BYTES( p_stra->AudioTag );
MP4_GET4BYTES( p_stra->AvgBytesPerSec );
MP4_GET2BYTES( p_stra->nBlockAlign ); MP4_GET2BYTES( p_stra->nBlockAlign );
MP4_GET1BYTE( i_reserved ); MP4_GET1BYTE( i_reserved );
......
...@@ -1140,10 +1140,8 @@ typedef struct ...@@ -1140,10 +1140,8 @@ typedef struct
uint32_t MaxWidth; uint32_t MaxWidth;
uint32_t MaxHeight; uint32_t MaxHeight;
uint32_t SamplingRate; uint32_t SamplingRate;
uint32_t AvgBytesPerSec;
uint32_t Channels; uint32_t Channels;
uint32_t BitsPerSample; uint32_t BitsPerSample;
uint32_t PacketSize;
uint32_t AudioTag; uint32_t AudioTag;
uint16_t nBlockAlign; uint16_t nBlockAlign;
uint8_t cpd_len; uint8_t cpd_len;
......
...@@ -3207,7 +3207,7 @@ static int MP4_frg_TrackCreate( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_ ...@@ -3207,7 +3207,7 @@ static int MP4_frg_TrackCreate( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_
fmt->audio.i_bitspersample = p_data->BitsPerSample; fmt->audio.i_bitspersample = p_data->BitsPerSample;
fmt->audio.i_blockalign = p_data->nBlockAlign; fmt->audio.i_blockalign = p_data->nBlockAlign;
fmt->i_bitrate = p_data->AvgBytesPerSec * 8; fmt->i_bitrate = p_data->Bitrate;
ret = MP4_SetCodecExtraData( fmt, p_data ); ret = MP4_SetCodecExtraData( fmt, p_data );
if( ret != VLC_SUCCESS ) if( ret != VLC_SUCCESS )
......
...@@ -277,8 +277,8 @@ static int get_new_chunks( stream_t *s, chunk_t *ck ) ...@@ -277,8 +277,8 @@ static int get_new_chunks( stream_t *s, chunk_t *ck )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
#define STRA_SIZE 342 #define STRA_SIZE 334
#define SMOO_SIZE (STRA_SIZE * 3 + 24) /* 1050 */ #define SMOO_SIZE (STRA_SIZE * 3 + 24) /* 1026 */
/* SmooBox is a very simple MP4 box, used only to pass information /* SmooBox is a very simple MP4 box, used only to pass information
* to the demux layer. As this box is not aimed to travel accross networks, * to the demux layer. As this box is not aimed to travel accross networks,
...@@ -356,16 +356,14 @@ static int build_smoo_box( stream_t *s, uint8_t *smoo_box ) ...@@ -356,16 +356,14 @@ static int build_smoo_box( stream_t *s, uint8_t *smoo_box )
((uint32_t *)stra_box)[20] = bswap32( qlvl->SamplingRate ); ((uint32_t *)stra_box)[20] = bswap32( qlvl->SamplingRate );
((uint32_t *)stra_box)[21] = bswap32( qlvl->Channels ); ((uint32_t *)stra_box)[21] = bswap32( qlvl->Channels );
((uint32_t *)stra_box)[22] = bswap32( qlvl->BitsPerSample ); ((uint32_t *)stra_box)[22] = bswap32( qlvl->BitsPerSample );
((uint32_t *)stra_box)[23] = bswap32( qlvl->PacketSize ); ((uint32_t *)stra_box)[23] = bswap32( qlvl->AudioTag );
((uint32_t *)stra_box)[24] = bswap32( qlvl->AudioTag ); ((uint16_t *)stra_box)[48] = bswap16( qlvl->nBlockAlign );
((uint32_t *)stra_box)[25] = bswap32( qlvl->AvgBytesPerSec );
((uint16_t *)stra_box)[52] = bswap16( qlvl->nBlockAlign );
stra_box[106] = stra_box[107] = stra_box[108] = 0; /* reserved */ stra_box[98] = stra_box[99] = stra_box[100] = 0; /* reserved */
assert( strlen( qlvl->CodecPrivateData ) < 512 ); assert( strlen( qlvl->CodecPrivateData ) < 512 );
stra_box[109] = strlen( qlvl->CodecPrivateData ) / 2; stra_box[101] = strlen( qlvl->CodecPrivateData ) / 2;
uint8_t *binary_cpd = decode_string_hex_to_binary( qlvl->CodecPrivateData ); uint8_t *binary_cpd = decode_string_hex_to_binary( qlvl->CodecPrivateData );
memcpy( stra_box + 110, binary_cpd, stra_box[109] ); memcpy( stra_box + 102, binary_cpd, stra_box[101] );
free( binary_cpd ); free( binary_cpd );
} }
......
...@@ -247,6 +247,8 @@ static int parse_Manifest( stream_t *s ) ...@@ -247,6 +247,8 @@ static int parse_Manifest( stream_t *s )
ql->Index = strtol( value, NULL, 10 ); ql->Index = strtol( value, NULL, 10 );
if( !strcmp( name, "Bitrate" ) ) if( !strcmp( name, "Bitrate" ) )
ql->Bitrate = strtoull( value, NULL, 10 ); ql->Bitrate = strtoull( value, NULL, 10 );
if( !strcmp( name, "PacketSize" ) )
ql->nBlockAlign = strtoull( value, NULL, 10 );
if( !strcmp( name, "FourCC" ) ) if( !strcmp( name, "FourCC" ) )
ql->FourCC = VLC_FOURCC( value[0], value[1], ql->FourCC = VLC_FOURCC( value[0], value[1],
value[2], value[3] ); value[2], value[3] );
...@@ -263,7 +265,6 @@ static int parse_Manifest( stream_t *s ) ...@@ -263,7 +265,6 @@ static int parse_Manifest( stream_t *s )
ql->Channels = ((uint16_t *)WaveFormatEx)[1]; ql->Channels = ((uint16_t *)WaveFormatEx)[1];
ql->SamplingRate = ((uint32_t *)WaveFormatEx)[1]; ql->SamplingRate = ((uint32_t *)WaveFormatEx)[1];
ql->AvgBytesPerSec = ((uint32_t *)WaveFormatEx)[2];
ql->nBlockAlign = ((uint16_t *)WaveFormatEx)[6]; ql->nBlockAlign = ((uint16_t *)WaveFormatEx)[6];
ql->BitsPerSample = ((uint16_t *)WaveFormatEx)[7]; ql->BitsPerSample = ((uint16_t *)WaveFormatEx)[7];
free( WaveFormatEx ); free( WaveFormatEx );
......
...@@ -60,10 +60,8 @@ typedef struct quality_level_s ...@@ -60,10 +60,8 @@ typedef struct quality_level_s
unsigned MaxWidth; unsigned MaxWidth;
unsigned MaxHeight; unsigned MaxHeight;
unsigned SamplingRate; unsigned SamplingRate;
unsigned AvgBytesPerSec;
unsigned Channels; unsigned Channels;
unsigned BitsPerSample; unsigned BitsPerSample;
unsigned PacketSize;
unsigned AudioTag; unsigned AudioTag;
unsigned nBlockAlign; unsigned nBlockAlign;
unsigned id; unsigned id;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment