Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
3bd2238f
Commit
3bd2238f
authored
Nov 26, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use (s)size_t in block_t.
/!\ This breaks the plugin ABI on LP64 platforms
parent
642f48df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
28 deletions
+24
-28
include/vlc_block.h
include/vlc_block.h
+16
-20
src/misc/block.c
src/misc/block.c
+8
-8
No files found.
include/vlc_block.h
View file @
3bd2238f
...
@@ -92,7 +92,7 @@ struct block_t
...
@@ -92,7 +92,7 @@ struct block_t
int
i_samples
;
/* Used for audio */
int
i_samples
;
/* Used for audio */
int
i_rate
;
int
i_rate
;
int
i_buffer
;
size_t
i_buffer
;
uint8_t
*
p_buffer
;
uint8_t
*
p_buffer
;
/* This way the block_Release can be overloaded
/* This way the block_Release can be overloaded
...
@@ -127,8 +127,8 @@ struct block_t
...
@@ -127,8 +127,8 @@ struct block_t
* - block_Duplicate : create a copy of a block.
* - block_Duplicate : create a copy of a block.
****************************************************************************/
****************************************************************************/
#define block_New( a, b ) __block_New( VLC_OBJECT(a), b )
#define block_New( a, b ) __block_New( VLC_OBJECT(a), b )
VLC_EXPORT
(
block_t
*
,
__block_New
,
(
vlc_object_t
*
,
in
t
)
);
VLC_EXPORT
(
block_t
*
,
__block_New
,
(
vlc_object_t
*
,
size_
t
)
);
VLC_EXPORT
(
block_t
*
,
block_Realloc
,
(
block_t
*
,
int
i_pre
,
in
t
i_body
)
);
VLC_EXPORT
(
block_t
*
,
block_Realloc
,
(
block_t
*
,
ssize_t
i_pre
,
size_
t
i_body
)
);
static
inline
block_t
*
block_Duplicate
(
block_t
*
p_block
)
static
inline
block_t
*
block_Duplicate
(
block_t
*
p_block
)
{
{
...
@@ -197,32 +197,28 @@ static inline void block_ChainRelease( block_t *p_block )
...
@@ -197,32 +197,28 @@ static inline void block_ChainRelease( block_t *p_block )
p_block
=
p_next
;
p_block
=
p_next
;
}
}
}
}
static
int
block_ChainExtract
(
block_t
*
p_list
,
void
*
p_data
,
int
i_max
)
static
size_t
block_ChainExtract
(
block_t
*
p_list
,
void
*
p_data
,
size_t
i_max
)
{
{
block_t
*
b
;
size_t
i_total
=
0
;
int
i_total
=
0
;
uint8_t
*
p
=
(
uint8_t
*
)
p_data
;
uint8_t
*
p
=
(
uint8_t
*
)
p_data
;
for
(
b
=
p_list
;
b
!=
NULL
;
b
=
b
->
p_next
)
while
(
p_list
&&
i_max
)
{
{
int
i_copy
=
__MIN
(
i_max
,
b
->
i_buffer
);
size_t
i_copy
=
__MIN
(
i_max
,
p_list
->
i_buffer
);
if
(
i_copy
>
0
)
memcpy
(
p
,
p_list
->
p_buffer
,
i_copy
);
{
i_max
-=
i_copy
;
memcpy
(
p
,
b
->
p_buffer
,
i_copy
);
i_total
+=
i_copy
;
i_max
-=
i_copy
;
p
+=
i_copy
;
i_total
+=
i_copy
;
p
+=
i_copy
;
p_list
=
p_list
->
p_next
;
if
(
i_max
==
0
)
return
i_total
;
}
}
}
return
i_total
;
return
i_total
;
}
}
static
inline
block_t
*
block_ChainGather
(
block_t
*
p_list
)
static
inline
block_t
*
block_ChainGather
(
block_t
*
p_list
)
{
{
int
i_total
=
0
;
size_t
i_total
=
0
;
mtime_t
i_length
=
0
;
mtime_t
i_length
=
0
;
block_t
*
b
,
*
g
;
block_t
*
b
,
*
g
;
...
@@ -270,7 +266,7 @@ static inline block_t *block_ChainGather( block_t *p_list )
...
@@ -270,7 +266,7 @@ static inline block_t *block_ChainGather( block_t *p_list )
VLC_EXPORT
(
block_fifo_t
*
,
__block_FifoNew
,
(
vlc_object_t
*
)
);
VLC_EXPORT
(
block_fifo_t
*
,
__block_FifoNew
,
(
vlc_object_t
*
)
);
VLC_EXPORT
(
void
,
block_FifoRelease
,
(
block_fifo_t
*
)
);
VLC_EXPORT
(
void
,
block_FifoRelease
,
(
block_fifo_t
*
)
);
VLC_EXPORT
(
void
,
block_FifoEmpty
,
(
block_fifo_t
*
)
);
VLC_EXPORT
(
void
,
block_FifoEmpty
,
(
block_fifo_t
*
)
);
VLC_EXPORT
(
int
,
block_FifoPut
,
(
block_fifo_t
*
,
block_t
*
)
);
VLC_EXPORT
(
size_t
,
block_FifoPut
,
(
block_fifo_t
*
,
block_t
*
)
);
VLC_EXPORT
(
void
,
block_FifoWake
,
(
block_fifo_t
*
)
);
VLC_EXPORT
(
void
,
block_FifoWake
,
(
block_fifo_t
*
)
);
VLC_EXPORT
(
block_t
*
,
block_FifoGet
,
(
block_fifo_t
*
)
);
VLC_EXPORT
(
block_t
*
,
block_FifoGet
,
(
block_fifo_t
*
)
);
VLC_EXPORT
(
block_t
*
,
block_FifoShow
,
(
block_fifo_t
*
)
);
VLC_EXPORT
(
block_t
*
,
block_FifoShow
,
(
block_fifo_t
*
)
);
...
...
src/misc/block.c
View file @
3bd2238f
...
@@ -34,13 +34,13 @@
...
@@ -34,13 +34,13 @@
struct
block_sys_t
struct
block_sys_t
{
{
uint8_t
*
p_allocated_buffer
;
uint8_t
*
p_allocated_buffer
;
int
i_allocated_buffer
;
size_t
i_allocated_buffer
;
};
};
#define BLOCK_PADDING_SIZE 32
#define BLOCK_PADDING_SIZE 32
static
void
BlockRelease
(
block_t
*
);
static
void
BlockRelease
(
block_t
*
);
block_t
*
__block_New
(
vlc_object_t
*
p_obj
,
in
t
i_size
)
block_t
*
__block_New
(
vlc_object_t
*
p_obj
,
size_
t
i_size
)
{
{
/* We do only one malloc
/* We do only one malloc
* TODO bench if doing 2 malloc but keeping a pool of buffer is better
* TODO bench if doing 2 malloc but keeping a pool of buffer is better
...
@@ -48,7 +48,7 @@ block_t *__block_New( vlc_object_t *p_obj, int i_size )
...
@@ -48,7 +48,7 @@ block_t *__block_New( vlc_object_t *p_obj, int i_size )
* 2 * BLOCK_PADDING_SIZE -> pre + post padding
* 2 * BLOCK_PADDING_SIZE -> pre + post padding
*/
*/
block_sys_t
*
p_sys
;
block_sys_t
*
p_sys
;
const
in
t
i_alloc
=
i_size
+
2
*
BLOCK_PADDING_SIZE
+
16
;
const
size_
t
i_alloc
=
i_size
+
2
*
BLOCK_PADDING_SIZE
+
16
;
block_t
*
p_block
=
block_t
*
p_block
=
malloc
(
sizeof
(
block_t
)
+
sizeof
(
block_sys_t
)
+
i_alloc
);
malloc
(
sizeof
(
block_t
)
+
sizeof
(
block_sys_t
)
+
i_alloc
);
...
@@ -82,9 +82,9 @@ block_t *__block_New( vlc_object_t *p_obj, int i_size )
...
@@ -82,9 +82,9 @@ block_t *__block_New( vlc_object_t *p_obj, int i_size )
return
p_block
;
return
p_block
;
}
}
block_t
*
block_Realloc
(
block_t
*
p_block
,
int
i_prebody
,
in
t
i_body
)
block_t
*
block_Realloc
(
block_t
*
p_block
,
ssize_t
i_prebody
,
size_
t
i_body
)
{
{
in
t
i_buffer_size
;
ssize_
t
i_buffer_size
;
if
(
p_block
->
pf_release
!=
BlockRelease
)
if
(
p_block
->
pf_release
!=
BlockRelease
)
{
{
...
@@ -100,7 +100,7 @@ block_t *block_Realloc( block_t *p_block, int i_prebody, int i_body )
...
@@ -100,7 +100,7 @@ block_t *block_Realloc( block_t *p_block, int i_prebody, int i_body )
i_buffer_size
=
i_prebody
+
i_body
;
i_buffer_size
=
i_prebody
+
i_body
;
if
(
i_b
ody
<
0
||
i_b
uffer_size
<=
0
)
if
(
i_buffer_size
<=
0
)
{
{
block_Release
(
p_block
);
block_Release
(
p_block
);
return
NULL
;
return
NULL
;
...
@@ -211,9 +211,9 @@ void block_FifoEmpty( block_fifo_t *p_fifo )
...
@@ -211,9 +211,9 @@ void block_FifoEmpty( block_fifo_t *p_fifo )
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
}
}
in
t
block_FifoPut
(
block_fifo_t
*
p_fifo
,
block_t
*
p_block
)
size_
t
block_FifoPut
(
block_fifo_t
*
p_fifo
,
block_t
*
p_block
)
{
{
in
t
i_size
=
0
;
size_
t
i_size
=
0
;
vlc_mutex_lock
(
&
p_fifo
->
lock
);
vlc_mutex_lock
(
&
p_fifo
->
lock
);
do
do
...
...
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