Commit 0986ff4a authored by Frédéric Yhuel's avatar Frédéric Yhuel Committed by Jean-Baptiste Kempf

Smooth Streaming: don't use block_t

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 70459ae3
...@@ -78,7 +78,7 @@ static unsigned set_track_id( chunk_t *chunk, const unsigned tid ) ...@@ -78,7 +78,7 @@ static unsigned set_track_id( chunk_t *chunk, const unsigned tid )
uint32_t size, type; uint32_t size, type;
if( !chunk->data ) if( !chunk->data )
return 0; return 0;
uint8_t *slice = chunk->data->p_buffer; uint8_t *slice = chunk->data;
if( !slice ) if( !slice )
return 0; return 0;
...@@ -121,7 +121,7 @@ static int sms_Download( stream_t *s, chunk_t *chunk, char *url ) ...@@ -121,7 +121,7 @@ static int sms_Download( stream_t *s, chunk_t *chunk, char *url )
chunk->offset = p_sys->download.next_chunk_offset; chunk->offset = p_sys->download.next_chunk_offset;
p_sys->download.next_chunk_offset += chunk->size; p_sys->download.next_chunk_offset += chunk->size;
chunk->data = block_Alloc( size ); chunk->data = malloc( size );
if( chunk->data == NULL ) if( chunk->data == NULL )
{ {
...@@ -129,12 +129,12 @@ static int sms_Download( stream_t *s, chunk_t *chunk, char *url ) ...@@ -129,12 +129,12 @@ static int sms_Download( stream_t *s, chunk_t *chunk, char *url )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
int read = stream_Read( p_ts, chunk->data->p_buffer, size ); int read = stream_Read( p_ts, chunk->data, size );
if( read < size ) if( read < size )
{ {
msg_Warn( s, "sms_Download: I requested %"PRIi64" bytes, "\ msg_Warn( s, "sms_Download: I requested %"PRIi64" bytes, "\
"but I got only %i", size, read ); "but I got only %i", size, read );
chunk->data = block_Realloc( chunk->data, 0, read ); chunk->data = realloc( chunk->data, read );
} }
stream_Delete( p_ts ); stream_Delete( p_ts );
...@@ -190,7 +190,7 @@ static int get_new_chunks( stream_t *s, chunk_t *ck ) ...@@ -190,7 +190,7 @@ static int get_new_chunks( stream_t *s, chunk_t *ck )
{ {
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
uint8_t *slice = ck->data->p_buffer; uint8_t *slice = ck->data;
if( !slice ) if( !slice )
return VLC_EGENERIC; return VLC_EGENERIC;
uint8_t version, fragment_count; uint8_t version, fragment_count;
...@@ -359,11 +359,11 @@ static chunk_t *build_init_chunk( stream_t *s ) ...@@ -359,11 +359,11 @@ static chunk_t *build_init_chunk( stream_t *s )
goto build_init_chunk_error; goto build_init_chunk_error;
ret->size = SMOO_SIZE; ret->size = SMOO_SIZE;
ret->data = block_Alloc( SMOO_SIZE ); ret->data = malloc( SMOO_SIZE );
if( !ret->data ) if( !ret->data )
goto build_init_chunk_error; goto build_init_chunk_error;
int res = build_smoo_box( s, ret->data->p_buffer ); int res = build_smoo_box( s, ret->data );
if( res != VLC_SUCCESS ) if( res != VLC_SUCCESS )
goto build_init_chunk_error; goto build_init_chunk_error;
...@@ -639,8 +639,7 @@ void* sms_Thread( void *p_this ) ...@@ -639,8 +639,7 @@ void* sms_Thread( void *p_this )
ck->read_pos = 0; ck->read_pos = 0;
if( ck->data == NULL ) if( ck->data == NULL )
continue; continue;
block_Release( ck->data ); FREENULL( ck->data );
ck->data = NULL;
} }
vlc_array_destroy( p_sys->download.chunks ); vlc_array_destroy( p_sys->download.chunks );
......
...@@ -570,8 +570,8 @@ static int sms_Read( stream_t *s, uint8_t *p_read, int i_read ) ...@@ -570,8 +570,8 @@ static int sms_Read( stream_t *s, uint8_t *p_read, int i_read )
} }
if( !p_sys->b_cache || p_sys->b_live ) if( !p_sys->b_cache || p_sys->b_live )
{ {
block_Release( chunk->data ); FREENULL( chunk->data );
chunk->data = NULL; chunk->read_pos = 0;
} }
chunk->read_pos = 0; chunk->read_pos = 0;
...@@ -589,14 +589,14 @@ static int sms_Read( stream_t *s, uint8_t *p_read, int i_read ) ...@@ -589,14 +589,14 @@ static int sms_Read( stream_t *s, uint8_t *p_read, int i_read )
verb, chunk->sequence, i_read, chunk->type ); verb, chunk->sequence, i_read, chunk->type );
/* check integrity */ /* check integrity */
uint32_t type; uint32_t type;
uint8_t *slice = chunk->data->p_buffer; uint8_t *slice = chunk->data;
SMS_GET4BYTES( type ); SMS_GET4BYTES( type );
SMS_GETFOURCC( type ); SMS_GETFOURCC( type );
assert( type == ATOM_moof || type == ATOM_uuid ); assert( type == ATOM_moof || type == ATOM_uuid );
} }
int len = -1; int len = -1;
uint8_t *src = chunk->data->p_buffer + chunk->read_pos; uint8_t *src = chunk->data + chunk->read_pos;
if( i_read <= chunk->size - chunk->read_pos ) if( i_read <= chunk->size - chunk->read_pos )
len = i_read; len = i_read;
else else
...@@ -655,7 +655,7 @@ static int Peek( stream_t *s, const uint8_t **pp_peek, unsigned i_peek ) ...@@ -655,7 +655,7 @@ static int Peek( stream_t *s, const uint8_t **pp_peek, unsigned i_peek )
msg_Err( s, "could not peek %u bytes, only %i!", i_peek, bytes ); msg_Err( s, "could not peek %u bytes, only %i!", i_peek, bytes );
} }
msg_Dbg( s, "peeking at chunk %u!", chunk->sequence ); msg_Dbg( s, "peeking at chunk %u!", chunk->sequence );
*pp_peek = chunk->data->p_buffer + chunk->read_pos; *pp_peek = chunk->data + chunk->read_pos;
return bytes; return bytes;
} }
......
...@@ -49,7 +49,7 @@ typedef struct chunk_s ...@@ -49,7 +49,7 @@ typedef struct chunk_s
int read_pos; /* position in the chunk */ int read_pos; /* position in the chunk */
int type; /* video, audio, or subtitles */ int type; /* video, audio, or subtitles */
block_t *data; uint8_t *data;
} chunk_t; } chunk_t;
typedef struct quality_level_s typedef struct quality_level_s
......
...@@ -98,9 +98,8 @@ chunk_t *chunk_New( sms_stream_t* sms, uint64_t duration,\ ...@@ -98,9 +98,8 @@ chunk_t *chunk_New( sms_stream_t* sms, uint64_t duration,\
void chunk_Free( chunk_t *chunk ) void chunk_Free( chunk_t *chunk )
{ {
if( chunk->data ) if( chunk->data )
block_Release( chunk->data ); FREENULL( chunk->data );
free( chunk ); FREENULL( chunk );
chunk = NULL;
} }
sms_stream_t * sms_New( void ) sms_stream_t * sms_New( void )
......
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