Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
52707967
Commit
52707967
authored
Dec 13, 2012
by
Rémi Denis-Courmont
Browse files
Replace block_New() with block_Alloc()
parent
0fc6e8cf
Changes
92
Hide whitespace changes
Inline
Side-by-side
include/vlc_block.h
View file @
52707967
...
...
@@ -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
)
{
...
...
include/vlc_filter.h
View file @
52707967
...
...
@@ -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.
...
...
modules/access/bd/bd.c
View file @
52707967
...
...
@@ -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
;
...
...
modules/access/bluray.c
View file @
52707967
...
...
@@ -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
;
}
...
...
modules/access/cdda.c
View file @
52707967
...
...
@@ -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
);
...
...
modules/access/dc1394.c
View file @
52707967
...
...
@@ -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"
);
...
...
modules/access/decklink.cpp
View file @
52707967
...
...
@@ -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
;
...
...
modules/access/dshow/dshow.cpp
View file @
52707967
...
...
@@ -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
();
...
...
modules/access/dtv/bdagraph.cpp
View file @
52707967
...
...
@@ -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
)
{
...
...
modules/access/dv.c
View file @
52707967
...
...
@@ -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
);
}
...
...
modules/access/dvb/access.c
View file @
52707967
...
...
@@ -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
)
...
...
modules/access/dvdnav.c
View file @
52707967
...
...
@@ -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 */
...
...
modules/access/dvdread.c
View file @
52707967
...
...
@@ -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 */
...
...
modules/access/eyetv.m
View file @
52707967
...
...
@@ -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
);
...
...
modules/access/imem.c
View file @
52707967
...
...
@@ -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
;
...
...
modules/access/jack.c
View file @
52707967
...
...
@@ -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
)
{
...
...
modules/access/linsys/linsys_hdsdi.c
View file @
52707967
...
...
@@ -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
,
...
...
modules/access/linsys/linsys_sdi.c
View file @
52707967
...
...
@@ -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
...
...
modules/access/mms/mmsh.c
View file @
52707967
...
...
@@ -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
;
...
...
modules/access/mms/mmstu.c
View file @
52707967
...
...
@@ -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
;
...
...
Prev
1
2
3
4
5
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment