Commit 52707967 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Replace block_New() with block_Alloc()

parent 0fc6e8cf
......@@ -139,8 +139,6 @@ VLC_API void block_Init( block_t *, void *, size_t );
VLC_API block_t *block_Alloc( size_t ) VLC_USED VLC_MALLOC;
VLC_API block_t *block_Realloc( block_t *, ssize_t i_pre, size_t i_body ) VLC_USED;
#define block_New( dummy, size ) block_Alloc(size)
VLC_USED
static inline block_t *block_Duplicate( block_t *p_block )
{
......
......@@ -209,7 +209,7 @@ static inline void filter_DeleteSubpicture( filter_t *p_filter, subpicture_t *p_
p_filter->pf_sub_buffer_del( p_filter, p_subpicture );
}
#define filter_NewAudioBuffer block_New
#define filter_NewAudioBuffer(f,s) ((f), block_Alloc(s))
/**
* This function gives all input attachments at once.
......
......@@ -409,7 +409,7 @@ static int Demux( demux_t *p_demux )
/* XXX
* we ensure that the TS packet start at the begining of the buffer,
* it ensure proper TS parsing */
block_t *p_block = block_New( p_demux, i_packets * BD_TS_PACKET_SIZE + BD_TS_PACKET_HEADER );
block_t *p_block = block_Alloc( i_packets * BD_TS_PACKET_SIZE + BD_TS_PACKET_HEADER );
if( !p_block )
return -1;
......
......@@ -1213,7 +1213,7 @@ static int blurayDemux(demux_t *p_demux)
{
demux_sys_t *p_sys = p_demux->p_sys;
block_t *p_block = block_New(p_demux, NB_TS_PACKETS * (int64_t)BD_TS_PACKET_SIZE);
block_t *p_block = block_Alloc(NB_TS_PACKETS * (int64_t)BD_TS_PACKET_SIZE);
if (!p_block) {
return -1;
}
......
......@@ -262,7 +262,7 @@ static block_t *Block( access_t *p_access )
if( !p_sys->b_header )
{
/* Return only the header */
p_block = block_New( p_access, sizeof( WAVEHEADER ) );
p_block = block_Alloc( sizeof( WAVEHEADER ) );
memcpy( p_block->p_buffer, &p_sys->waveheader, sizeof(WAVEHEADER) );
p_sys->b_header = true;
return p_block;
......@@ -279,7 +279,7 @@ static block_t *Block( access_t *p_access )
i_blocks = p_sys->i_last_sector - p_sys->i_sector;
/* Do the actual reading */
if( !( p_block = block_New( p_access, i_blocks * CDDA_DATA_SIZE ) ) )
if( !( p_block = block_Alloc( i_blocks * CDDA_DATA_SIZE ) ) )
{
msg_Err( p_access, "cannot get a new block of size: %i",
i_blocks * CDDA_DATA_SIZE );
......
......@@ -443,8 +443,7 @@ static block_t *GrabVideo( demux_t *p_demux )
return NULL;
}
p_block = block_New( p_demux, p_sys->frame->size[0] *
p_sys->frame->size[1] * 2 );
p_block = block_Alloc( p_sys->frame->size[0] * p_sys->frame->size[1] * 2 );
if( !p_block )
{
msg_Err( p_demux, "Can not get block" );
......
......@@ -254,7 +254,7 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
const int stride = videoFrame->GetRowBytes();
int bpp = sys->tenbits ? 4 : 2;
block_t *video_frame = block_New(demux_, width * height * bpp);
block_t *video_frame = block_Alloc(width * height * bpp);
if (!video_frame)
return S_OK;
......@@ -399,7 +399,7 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
if (audioFrame) {
const int bytes = audioFrame->GetSampleFrameCount() * sizeof(int16_t) * sys->channels;
block_t *audio_frame = block_New(demux_, bytes);
block_t *audio_frame = block_Alloc(bytes);
if (!audio_frame)
return S_OK;
......
......@@ -1817,7 +1817,7 @@ static block_t *ReadCompressed( access_t *p_access )
uint8_t *p_data;
int i_data_size = sample.p_sample->GetActualDataLength();
if( !i_data_size || !(p_block = block_New( p_access, i_data_size )) )
if( !i_data_size || !(p_block = block_Alloc( i_data_size )) )
{
sample.p_sample->Release();
continue;
......@@ -1912,7 +1912,7 @@ static int Demux( demux_t *p_demux )
i_stream, i_data_size, i_pts );
#endif
p_block = block_New( p_demux, i_data_size );
p_block = block_Alloc( i_data_size );
memcpy( p_block->p_buffer, p_data, i_data_size );
p_block->i_pts = p_block->i_dts = i_pts;
sample.p_sample->Release();
......
......@@ -2822,7 +2822,7 @@ STDMETHODIMP BDAGraph::SampleCB( double /*date*/, IMediaSample *p_sample )
if( i_sample_size > 0 && p_sample_data )
{
block_t *p_block = block_New( p_access, i_sample_size );
block_t *p_block = block_Alloc( i_sample_size );
if( p_block )
{
......
......@@ -402,7 +402,7 @@ Raw1394Handler(raw1394handle_t handle, unsigned char *data,
block_ChainAppend( &p_sys->p_frame, p_sys->p_ev->p_frame );
}
/* reset list */
p_sys->p_ev->p_frame = block_New( p_access, 144000 );
p_sys->p_ev->p_frame = block_Alloc( 144000 );
p_sys->p_ev->pp_last = &p_sys->p_frame;
vlc_mutex_unlock( &p_sys->lock );
}
......
......@@ -338,7 +338,7 @@ static block_t *BlockScan( access_t *p_access )
if ( ufds[0].revents )
{
const int i_read_once = 1;
block_t *p_block = block_New( p_access, i_read_once * TS_PACKET_SIZE );
block_t *p_block = block_Alloc( i_read_once * TS_PACKET_SIZE );
if( ( i_ret = read( p_sys->i_handle, p_block->p_buffer,
i_read_once * TS_PACKET_SIZE ) ) <= 0 )
......
......@@ -1162,7 +1162,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
}
/* Create a block */
block_t *p_pkt = block_New( p_demux, i_size );
block_t *p_pkt = block_Alloc( i_size );
memcpy( p_pkt->p_buffer, p, i_size);
/* Parse it and send it */
......
......@@ -565,7 +565,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
}
/* Create a block */
block_t *p_pkt = block_New( p_demux, i_size );
block_t *p_pkt = block_Alloc( i_size );
memcpy( p_pkt->p_buffer, p, i_size);
/* Parse it and send it */
......
......@@ -259,7 +259,7 @@ static block_t *BlockRead(access_t *p_access)
return NULL;
/* Read data */
p_block = block_New(p_access, MTU);
p_block = block_Alloc(MTU);
len = net_Read(p_access, p_sys->eyetvSock, NULL,
p_block->p_buffer, MTU, false);
......
......@@ -384,7 +384,7 @@ static block_t *Block(access_t *access)
block_t *block = NULL;
if (buffer_size > 0) {
block = block_New(access, buffer_size);
block = block_Alloc(buffer_size);
if (block)
memcpy(block->p_buffer, buffer, buffer_size);
}
......@@ -584,7 +584,7 @@ static int Demux(demux_t *demux)
dts = pts;
if (buffer_size > 0) {
block_t *block = block_New(demux, buffer_size);
block_t *block = block_Alloc(buffer_size);
if (block) {
block->i_dts = dts >= 0 ? (1 + dts) : VLC_TS_INVALID;
block->i_pts = pts >= 0 ? (1 + pts) : VLC_TS_INVALID;
......
......@@ -463,7 +463,7 @@ static block_t *GrabJack( demux_t *p_demux )
}
else
{
p_block = block_New( p_demux, i_read );
p_block = block_Alloc( i_read );
}
if( !p_block )
{
......
......@@ -539,7 +539,7 @@ static int InitAudio( demux_t *p_demux )
static int HandleVideo( demux_t *p_demux, const uint8_t *p_buffer )
{
demux_sys_t *p_sys = p_demux->p_sys;
block_t *p_current_picture = block_New( p_demux, p_sys->i_vblock_size );
block_t *p_current_picture = block_Alloc( p_sys->i_vblock_size );
if( unlikely( !p_current_picture ) )
return VLC_ENOMEM;
uint8_t *p_y = p_current_picture->p_buffer;
......@@ -609,7 +609,7 @@ static int HandleAudio( demux_t *p_demux, const uint8_t *p_buffer )
hdsdi_audio_t *p_audio = &p_sys->p_audios[i];
if ( p_audio->i_channel != -1 && p_audio->p_es != NULL )
{
block_t *p_block = block_New( p_demux, p_sys->i_ablock_size );
block_t *p_block = block_Alloc( p_sys->i_ablock_size );
if( unlikely( !p_block ) )
return VLC_ENOMEM;
SparseCopy( (int16_t *)p_block->p_buffer, (const int16_t *)p_buffer,
......
......@@ -410,7 +410,7 @@ static int NewFrame( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
p_sys->p_current_picture = block_New( p_demux, p_sys->i_block_size );
p_sys->p_current_picture = block_Alloc( p_sys->i_block_size );
if( unlikely( !p_sys->p_current_picture ) )
return VLC_ENOMEM;
p_sys->p_y = p_sys->p_current_picture->p_buffer;
......@@ -801,8 +801,7 @@ static int DecodeTelx( demux_t *p_demux )
int i_nb_slices_rounded = 3 + (i_nb_slices / 4) * 4;
int i;
uint8_t *p;
block_t *p_block = block_New( p_demux,
1 + i_nb_slices_rounded * 46 );
block_t *p_block = block_Alloc( 1 + i_nb_slices_rounded * 46 );
if( unlikely( !p_block ) )
return VLC_ENOMEM;
p_block->p_buffer[0] = 0x10; /* FIXME ? data_identifier */
......@@ -939,7 +938,7 @@ static int DecodeAudio( demux_t *p_demux, sdi_audio_t *p_audio )
return VLC_EGENERIC;
}
p_block = block_New( p_demux, p_audio->i_nb_samples * sizeof(int16_t) * 2 );
p_block = block_Alloc( p_audio->i_nb_samples * sizeof(int16_t) * 2 );
if( unlikely( !p_block ) )
return VLC_ENOMEM;
p_block->i_dts = p_block->i_pts = p_sys->i_next_date
......
......@@ -345,7 +345,7 @@ static block_t *Block( access_t *p_access )
const size_t i_offset = p_access->info.i_pos - p_sys->i_start;
const size_t i_copy = p_sys->i_header - i_offset;
block_t *p_block = block_New( p_access, i_copy );
block_t *p_block = block_Alloc( i_copy );
if( !p_block )
return NULL;
......@@ -364,7 +364,7 @@ static block_t *Block( access_t *p_access )
if( __MAX( p_sys->i_packet_used, p_sys->i_packet_length ) < i_packet_min )
i_padding = i_packet_min - __MAX( p_sys->i_packet_used, p_sys->i_packet_length );
block_t *p_block = block_New( p_access, i_copy + i_padding );
block_t *p_block = block_Alloc( i_copy + i_padding );
if( !p_block )
return NULL;
......
......@@ -412,7 +412,7 @@ static block_t *Block( access_t *p_access )
{
const size_t i_copy = p_sys->i_header - p_access->info.i_pos;
block_t *p_block = block_New( p_access, i_copy );
block_t *p_block = block_Alloc( i_copy );
if( !p_block )
return NULL;
......@@ -430,7 +430,7 @@ static block_t *Block( access_t *p_access )
if( __MAX( p_sys->i_media, p_sys->i_media_used ) < p_sys->i_packet_length )
i_padding = p_sys->i_packet_length - __MAX( p_sys->i_media, p_sys->i_media_used );
block_t *p_block = block_New( p_access, i_copy + i_padding );
block_t *p_block = block_Alloc( i_copy + i_padding );
if( !p_block )
return NULL;
......
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