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

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;
......
......@@ -294,7 +294,7 @@ static block_t* GrabAudio( demux_t *p_demux )
block_t *p_block;
if( p_sys->p_block ) p_block = p_sys->p_block;
else p_block = block_New( p_demux, p_sys->i_max_frame_size );
else p_block = block_Alloc( p_sys->i_max_frame_size );
if( !p_block )
{
......
......@@ -417,7 +417,7 @@ static int Demux(demux_t *p_demux)
demux_sys_t *p_sys = p_demux->p_sys;
block_t *p_block;
p_block = block_New(p_demux, p_sys->width * p_sys->height * 2 /* FIXME */);
p_block = block_Alloc(p_sys->width * p_sys->height * 2 /* FIXME */);
if (!p_block) {
msg_Err(p_demux, "cannot get block");
return 0;
......
......@@ -502,7 +502,7 @@ static int Demux(demux_t *p_demux)
block_t *p_blocka;
NSAutoreleasePool *pool;
p_blocka = block_New(p_demux, p_sys->i_audio_max_buffer_size);
p_blocka = block_Alloc(p_sys->i_audio_max_buffer_size);
if(!p_blocka) {
msg_Err(p_demux, "cannot get audio block");
......
......@@ -230,7 +230,7 @@ static int Open( vlc_object_t *p_this )
goto error;
}
p_sys->p_header = block_New( p_access, 4096 );
p_sys->p_header = block_Alloc( 4096 );
p_sys->p_header->i_buffer =
rmff_dump_header( h, (char *)p_sys->p_header->p_buffer, 1024 );
rmff_free_header( h );
......@@ -283,7 +283,7 @@ static block_t *BlockRead( access_t *p_access )
i_size = real_get_rdt_chunk_header( p_access->p_sys->p_rtsp, &pheader );
if( i_size <= 0 ) return NULL;
p_block = block_New( p_access, i_size );
p_block = block_Alloc( i_size );
p_block->i_buffer = real_get_rdt_chunk( p_access->p_sys->p_rtsp, &pheader,
&p_block->p_buffer );
......
......@@ -325,7 +325,7 @@ block_t *screen_Capture( demux_t *p_demux )
i_size = p_sys->fmt.video.i_height * p_sys->fmt.video.i_width * 4;
if( !( p_block = block_New( p_demux, i_size ) ) )
if( !( p_block = block_Alloc( i_size ) ) )
{
msg_Warn( p_demux, "cannot get block" );
return NULL;
......
......@@ -277,7 +277,7 @@ static block_t* Block( access_t* p_access )
/* Allocate the buffer we need */
size_t i_len = __MIN( p_access->p_sys->i_read_size, p_access->info.i_size -
p_access->info.i_pos );
block_t* p_block = block_New( p_access, i_len );
block_t* p_block = block_Alloc( i_len );
if( !p_block )
return NULL;
......
......@@ -206,7 +206,7 @@ static block_t *BlockUDP( 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, (intptr_t)p_sys, NULL,
p_block->p_buffer, MTU, false );
if( len < 0 )
......
......@@ -351,7 +351,7 @@ static block_t *Block( access_t *p_access )
}
/* Do the actual reading */
if( i_blocks < 0 || !( p_block = block_New( p_access, i_blocks * VCD_DATA_SIZE ) ) )
if( i_blocks < 0 || !( p_block = block_Alloc( i_blocks * VCD_DATA_SIZE ) ) )
{
msg_Err( p_access, "cannot get a new block of size: %i",
i_blocks * VCD_DATA_SIZE );
......
......@@ -150,7 +150,7 @@ VCDReadBlock( access_t * p_access )
(long unsigned int) p_vcdplayer->i_lsn );
/* Allocate a block for the reading */
if( !( p_block = block_New( p_access, i_blocks * M2F2_SECTOR_SIZE ) ) )
if( !( p_block = block_Alloc( i_blocks * M2F2_SECTOR_SIZE ) ) )
{
msg_Err( p_access, "cannot get a new block of size: %i",
i_blocks * M2F2_SECTOR_SIZE );
......
......@@ -400,7 +400,7 @@ static block_t *GetSoutBuffer( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block = block_New( p_dec, p_sys->frame.i_size );
block_t *p_block = block_Alloc( p_sys->frame.i_size );
if( p_block )
{
p_block->i_pts = p_block->i_dts = date_Get( &p_sys->end_date );
......
......@@ -854,7 +854,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
const int bytesPerPixel = p_enc->fmt_out.video.i_bits_per_pixel ?
p_enc->fmt_out.video.i_bits_per_pixel / 8 : 3;
const int blocksize = __MAX( FF_MIN_BUFFER_SIZE,bytesPerPixel * p_sys->p_context->height * p_sys->p_context->width + 200 );
block_t *p_block = block_New( p_enc, blocksize );
block_t *p_block = block_Alloc( blocksize );
if( likely(p_pict) ) {
AVFrame *frame;
......@@ -1035,7 +1035,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
{
msg_Dbg(p_enc,"Flushing..");
do {
p_block = block_New( p_enc, p_sys->i_buffer_out );
p_block = block_Alloc( p_sys->i_buffer_out );
av_init_packet( &packet );
packet.data = p_block->p_buffer;
packet.size = p_block->i_buffer;
......@@ -1058,7 +1058,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
frame->pts = p_aout_buf->i_pts;
p_block = block_New( p_enc, p_sys->i_buffer_out );
p_block = block_Alloc( p_sys->i_buffer_out );
av_init_packet( &packet );
packet.data = p_block->p_buffer;
packet.size = p_block->i_buffer;
......
......@@ -855,7 +855,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
/* store dts in a queue, so that they appear in order in
* coded order */
p_block = block_New( p_enc, 1 );
p_block = block_Alloc( 1 );
if( !p_block )
return NULL;
p_block->i_dts = p_pic->date - p_sys->i_pts_offset;
......@@ -870,7 +870,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
StorePicturePTS( p_enc, p_sys->i_input_picnum, p_pic->date + p_sys->i_field_time );
p_sys->i_input_picnum++;
p_block = block_New( p_enc, 1 );
p_block = block_Alloc( 1 );
if( !p_block )
return NULL;
p_block->i_dts = p_pic->date - p_sys->i_pts_offset + p_sys->i_field_time;
......@@ -891,7 +891,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
uint32_t pic_num;
/* extract data from encoder temporary buffer. */
p_block = block_New( p_enc, p_sys->p_dirac->enc_buf.size );
p_block = block_Alloc( p_sys->p_dirac->enc_buf.size );
if( !p_block )
return NULL;
memcpy( p_block->p_buffer, p_sys->p_dirac->enc_buf.buffer,
......
......@@ -1542,7 +1542,7 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
p_enc->fmt_in.video.i_height *
p_enc->fmt_in.video.i_bits_per_pixel / 8;
p_block_in = block_New( p_enc, i_buffer );
p_block_in = block_Alloc( i_buffer );
/* Copy picture stride by stride */
p_dst = p_block_in->p_buffer;
......@@ -1566,7 +1566,7 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
else
{
block_t *p_aout_buffer = (block_t *)p_data;
p_block_in = block_New( p_enc, p_aout_buffer->i_buffer );
p_block_in = block_Alloc( p_aout_buffer->i_buffer );
memcpy( p_block_in->p_buffer, p_aout_buffer->p_buffer,
p_block_in->i_buffer );
......@@ -1609,7 +1609,7 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
block_t *p_block_out;
CMediaBuffer *p_out;
p_block_out = block_New( p_enc, p_sys->i_min_output );
p_block_out = block_Alloc( p_sys->i_min_output );
p_block_out->i_buffer = 0;
p_out = CMediaBufferCreate(p_block_out, p_sys->i_min_output, false);
memset( &db, 0, sizeof(db) );
......
......@@ -425,7 +425,7 @@ static block_t *GetSoutBuffer( decoder_t *p_dec )
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block;
p_block = block_New( p_dec, p_sys->i_frame_size );
p_block = block_Alloc( p_sys->i_frame_size );
if( p_block == NULL ) return NULL;
p_block->i_pts = p_block->i_dts = date_Get( &p_sys->end_date );
......
......@@ -1994,7 +1994,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
#ifdef DEBUG_DVBSUB
msg_Dbg( p_enc, "encoding subpicture" );
#endif
p_block = block_New( p_enc, 64000 );
p_block = block_Alloc( 64000 );
bs_init( s, p_block->p_buffer, p_block->i_buffer );
bs_write( s, 8, 0x20 ); /* Data identifier */
......@@ -2021,7 +2021,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
p_block->i_length = p_subpic->i_stop - p_subpic->i_start;
/* Send another (empty) subtitle to signal the end of display */
p_block_stop = block_New( p_enc, 64000 );
p_block_stop = block_Alloc( 64000 );
bs_init( s, p_block_stop->p_buffer, p_block_stop->i_buffer );
bs_write( s, 8, 0x20 ); /* Data identifier */
bs_write( s, 8, 0x0 ); /* Subtitle stream id */
......
......@@ -434,7 +434,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
in_buf.bufElSizes = &in_elem_size;
}
block_t *p_block;
p_block = block_New( p_enc, p_sys->i_maxoutputsize );
p_block = block_Alloc( p_sys->i_maxoutputsize );
p_block->i_buffer = p_sys->i_maxoutputsize;
out_ptr = p_block->p_buffer;
out_size = p_block->i_buffer;
......
......@@ -452,7 +452,7 @@ static void ProcessHeader( decoder_t *p_dec )
/* Decode STREAMINFO */
msg_Dbg( p_dec, "decode STREAMINFO" );
p_sys->p_block = block_New( p_dec, p_dec->fmt_in.i_extra );
p_sys->p_block = block_Alloc( p_dec->fmt_in.i_extra );
memcpy( p_sys->p_block->p_buffer, p_dec->fmt_in.p_extra,
p_dec->fmt_in.i_extra );
FLAC__stream_decoder_process_until_end_of_metadata( p_sys->p_flac );
......@@ -641,7 +641,7 @@ EncoderWriteCallback( const FLAC__StreamEncoder *encoder,
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
p_block = block_New( p_enc, bytes );
p_block = block_Alloc( bytes );
memcpy( p_block->p_buffer, buffer, bytes );
p_block->i_dts = p_block->i_pts = p_sys->i_pts;
......
......@@ -703,7 +703,7 @@ static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] )
if( p_sys->cc.i_data <= 0 )
return NULL;
p_cc = block_New( p_dec, p_sys->cc.i_data);
p_cc = block_Alloc( p_sys->cc.i_data);
if( p_cc )
{
memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
......
......@@ -542,7 +542,7 @@ static block_t *EncodeFrames( encoder_t *p_enc, block_t *p_aout_buf )
for ( int i = 0; i < i_num_frames; ++i )
{
block_t *p_block = block_New( p_enc, i_frame_size );
block_t *p_block = block_Alloc( i_frame_size );
if( !p_block )
return NULL;
......
......@@ -552,7 +552,7 @@ static block_t *GetSoutBuffer( decoder_t *p_dec )
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block;
p_block = block_New( p_dec, p_sys->i_frame_size );
p_block = block_Alloc( p_sys->i_frame_size );
if( p_block == NULL ) return NULL;
p_block->i_pts = p_block->i_dts = date_Get( &p_sys->end_date );
......
......@@ -1614,7 +1614,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
{
/* We're not in direct rendering mode.
* Get a new block and copy the content */
p_block = block_New( p_dec, p_header->nFilledLen );
p_block = block_Alloc( p_header->nFilledLen );
memcpy(p_block->p_buffer, p_header->pBuffer, p_header->nFilledLen );
}
......
......@@ -1483,7 +1483,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
/* store dts in a queue, so that they appear in order in
* coded order */
p_block = block_New( p_enc, 1 );
p_block = block_Alloc( 1 );
if( !p_block )
return NULL;
p_block->i_dts = p_pic->date - p_sys->i_pts_offset;
......@@ -1497,7 +1497,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
StorePicturePTS( p_enc, p_sys->i_input_picnum, p_pic->date + p_sys->i_field_time );
p_sys->i_input_picnum++;
p_block = block_New( p_enc, 1 );
p_block = block_Alloc( 1 );
if( !p_block )
return NULL;
p_block->i_dts = p_pic->date - p_sys->i_pts_offset + p_sys->i_field_time;
......@@ -1527,7 +1527,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
uint32_t u_pic_num;
int i_presentation_frame;
p_enc_buf = schro_encoder_pull( p_sys->p_schro, &i_presentation_frame );
p_block = block_New( p_enc, p_enc_buf->length );
p_block = block_Alloc( p_enc_buf->length );
if( !p_block )
return NULL;
......
......@@ -148,7 +148,7 @@ static block_t *GetPCM( encoder_t *p_enc, block_t *p_block )
while( p_sys->i_buffer + p_block->i_buffer >= pcm_chunk_size )
{
unsigned int i_buffer = 0;
p_pcm_block = block_New( p_enc, pcm_chunk_size );
p_pcm_block = block_Alloc( pcm_chunk_size );
if( !p_pcm_block )
break;
......@@ -224,7 +224,7 @@ static block_t *EncodeFrame( encoder_t *p_enc, block_t *p_block )
encode_frame( (char*)p_pcm_block->p_buffer, chunk );
block_Release( p_pcm_block );
block_t *p_mp3_block = block_New( p_enc, chunk->enc_size );
block_t *p_mp3_block = block_Alloc( chunk->enc_size );
if( !p_mp3_block )
break;
......
......@@ -508,7 +508,7 @@ static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
(8 - (i_bits_in_speex_frame % 8)) )
/ 8;
p_new_block = block_New( p_dec, i_bytes_in_speex_frame );
p_new_block = block_Alloc( i_bytes_in_speex_frame );
memset( p_new_block->p_buffer, 0xff, i_bytes_in_speex_frame );
/*
......@@ -1053,7 +1053,7 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
MAX_FRAME_BYTES );
speex_bits_reset( &p_sys->bits );
p_block = block_New( p_enc, i_out );
p_block = block_Alloc( i_out );
memcpy( p_block->p_buffer, p_sys->p_buffer_out, i_out );
p_block->i_length = (mtime_t)1000000 *
......
......@@ -514,7 +514,7 @@ static int ParseImageAttachments( decoder_t *p_dec )
{
block_t *p_block;
p_block = block_New( p_image->p_parent, p_attach->i_data );
p_block = block_Alloc( p_attach->i_data );
if( p_block != NULL )
{
......
......@@ -98,7 +98,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
/* This should already be UTF-8 encoded, so not much effort... */
len = strlen( p_region->psz_text );
p_block = block_New( p_enc, len );
p_block = block_Alloc( len );
memcpy( p_block->p_buffer, p_region->psz_text, len );
p_block->i_pts = p_block->i_dts = p_spu->i_start;
......
......@@ -850,7 +850,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
th_encode_packetout( p_sys->tcx, 0, &oggpacket );
/* Ogg packet to block */
p_block = block_New( p_enc, oggpacket.bytes );
p_block = block_Alloc( oggpacket.bytes );
memcpy( p_block->p_buffer, oggpacket.packet, oggpacket.bytes );
p_block->i_dts = p_block->i_pts = p_pict->date;
......
......@@ -286,7 +286,7 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
p_sys->p_buffer, MPEG_FRAME_SIZE,
p_sys->p_out_buffer, MAX_CODED_FRAME_SIZE );
p_sys->i_nb_samples = 0;
p_block = block_New( p_enc, i_used );
p_block = block_Alloc( i_used );
memcpy( p_block->p_buffer, p_sys->p_out_buffer, i_used );
p_block->i_length = (mtime_t)1000000 *
(mtime_t)MPEG_FRAME_SIZE / (mtime_t)p_enc->fmt_out.audio.i_rate;
......
......@@ -880,7 +880,7 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
while( vorbis_bitrate_flushpacket( &p_sys->vd, &oggpacket ) )
{
int i_block_size;
p_block = block_New( p_enc, oggpacket.bytes );
p_block = block_Alloc( oggpacket.bytes );
memcpy( p_block->p_buffer, oggpacket.packet, oggpacket.bytes );
i_block_size = vorbis_packet_blocksize( &p_sys->vi, &oggpacket );
......
......@@ -1475,7 +1475,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
for( i = 0; i < i_nal; i++ )
i_out += nal[i].i_payload;
p_block = block_New( p_enc, i_out + p_sys->i_sei_size );
p_block = block_Alloc( i_out + p_sys->i_sei_size );
if( !p_block ) return NULL;