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 )
uint32_t size, type;
if( !chunk->data )
return 0;
uint8_t *slice = chunk->data->p_buffer;
uint8_t *slice = chunk->data;
if( !slice )
return 0;
......@@ -121,7 +121,7 @@ static int sms_Download( stream_t *s, chunk_t *chunk, char *url )
chunk->offset = p_sys->download.next_chunk_offset;
p_sys->download.next_chunk_offset += chunk->size;
chunk->data = block_Alloc( size );
chunk->data = malloc( size );
if( chunk->data == NULL )
{
......@@ -129,12 +129,12 @@ static int sms_Download( stream_t *s, chunk_t *chunk, char *url )
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 )
{
msg_Warn( s, "sms_Download: I requested %"PRIi64" bytes, "\
"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 );
......@@ -190,7 +190,7 @@ static int get_new_chunks( stream_t *s, chunk_t *ck )
{
stream_sys_t *p_sys = s->p_sys;
uint8_t *slice = ck->data->p_buffer;
uint8_t *slice = ck->data;
if( !slice )
return VLC_EGENERIC;
uint8_t version, fragment_count;
......@@ -359,11 +359,11 @@ static chunk_t *build_init_chunk( stream_t *s )
goto build_init_chunk_error;
ret->size = SMOO_SIZE;
ret->data = block_Alloc( SMOO_SIZE );
ret->data = malloc( SMOO_SIZE );
if( !ret->data )
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 )
goto build_init_chunk_error;
......@@ -639,8 +639,7 @@ void* sms_Thread( void *p_this )
ck->read_pos = 0;
if( ck->data == NULL )
continue;
block_Release( ck->data );
ck->data = NULL;
FREENULL( ck->data );
}
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 )
}
if( !p_sys->b_cache || p_sys->b_live )
{
block_Release( chunk->data );
chunk->data = NULL;
FREENULL( chunk->data );
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 )
verb, chunk->sequence, i_read, chunk->type );
/* check integrity */
uint32_t type;
uint8_t *slice = chunk->data->p_buffer;
uint8_t *slice = chunk->data;
SMS_GET4BYTES( type );
SMS_GETFOURCC( type );
assert( type == ATOM_moof || type == ATOM_uuid );
}
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 )
len = i_read;
else
......@@ -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_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;
}
......
......@@ -49,7 +49,7 @@ typedef struct chunk_s
int read_pos; /* position in the chunk */
int type; /* video, audio, or subtitles */
block_t *data;
uint8_t *data;
} chunk_t;
typedef struct quality_level_s
......
......@@ -98,9 +98,8 @@ chunk_t *chunk_New( sms_stream_t* sms, uint64_t duration,\
void chunk_Free( chunk_t *chunk )
{
if( chunk->data )
block_Release( chunk->data );
free( chunk );
chunk = NULL;
FREENULL( chunk->data );
FREENULL( chunk );
}
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