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
2d79bfcb
Commit
2d79bfcb
authored
Dec 29, 2001
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hidden gory buffer management details in a private section of data_packet_t.
parent
9ecb59ab
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
198 additions
and
133 deletions
+198
-133
include/input_ext-dec.h
include/input_ext-dec.h
+21
-17
include/input_ext-plugins.h
include/input_ext-plugins.h
+162
-101
plugins/dvd/input_dvd.c
plugins/dvd/input_dvd.c
+3
-3
plugins/dvdread/input_dvdread.c
plugins/dvdread/input_dvdread.c
+3
-3
plugins/mpeg_system/input_es.c
plugins/mpeg_system/input_es.c
+2
-2
plugins/mpeg_system/input_ps.c
plugins/mpeg_system/input_ps.c
+3
-3
plugins/mpeg_system/input_ts.c
plugins/mpeg_system/input_ts.c
+2
-2
plugins/vcd/input_vcd.c
plugins/vcd/input_vcd.c
+2
-2
No files found.
include/input_ext-dec.h
View file @
2d79bfcb
...
...
@@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_ext-dec.h,v 1.4
7 2001/12/27 03:47:08
massiot Exp $
* $Id: input_ext-dec.h,v 1.4
8 2001/12/29 03:07:51
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
...
...
@@ -40,21 +40,25 @@
*****************************************************************************
* Describe a data packet.
*****************************************************************************/
#define DATA_PACKET \
/* start of the PS or TS packet */
\
byte_t * p_demux_start; \
/* start of the PES payload in this packet */
\
byte_t * p_payload_start; \
byte_t * p_payload_end;
/* guess ? :-) */
\
/* is the packet messed up ? */
\
boolean_t b_discard_payload;
typedef
struct
data_packet_s
{
/* Decoders information */
byte_t
*
p_demux_start
;
/* start of the PS or TS packet */
byte_t
*
p_payload_start
;
/* start of the PES payload in this packet */
byte_t
*
p_payload_end
;
/* guess ? :-) */
boolean_t
b_discard_payload
;
/* is the packet messed up ? */
/* Used to chain the TS packets that carry data for a same PES or PSI */
/* Used to chain the packets that carry data for a same PES or PSI */
struct
data_packet_s
*
p_next
;
/* Buffer manager information */
byte_t
*
p_buffer
;
/* raw data packet */
unsigned
int
i_size
;
/* buffer size */
DATA_PACKET
/* Please note that at least one buffer allocator (in particular, the
* Next Generation Buffer Allocator) extends this structure with
* private data after DATA_PACKET. */
}
data_packet_t
;
/*****************************************************************************
...
...
@@ -65,6 +69,9 @@ typedef struct data_packet_s
*****************************************************************************/
typedef
struct
pes_packet_s
{
/* Chained list to the next PES packet (depending on the context) */
struct
pes_packet_s
*
p_next
;
/* PES properties */
boolean_t
b_data_alignment
;
/* used to find the beginning of
* a video or audio unit */
...
...
@@ -76,18 +83,15 @@ typedef struct pes_packet_s
int
i_rate
;
/* current pace of reading
* (see stream_control.h) */
int
i_pes_size
;
/* size of the current PES packet */
unsigned
int
i_pes_size
;
/* size of the current PES packet */
/* Chained list to packets */
data_packet_t
*
p_first
;
/* The first packet contained by this
* PES (used by decoders). */
data_packet_t
*
p_last
;
/* The last packet contained by this
PES (used by the buffer allocator) */
int
i_nb_data
;
/* Number of data packets in the chained
unsigned
int
i_nb_data
;
/* Number of data packets in the chained
list */
/* Chained list used by the input buffers manager */
struct
pes_packet_s
*
p_next
;
}
pes_packet_t
;
/*****************************************************************************
...
...
include/input_ext-plugins.h
View file @
2d79bfcb
...
...
@@ -3,7 +3,7 @@
* but exported to plug-ins
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_ext-plugins.h,v 1.1
3 2001/12/27 03:47:08
massiot Exp $
* $Id: input_ext-plugins.h,v 1.1
4 2001/12/29 03:07:51
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -149,7 +149,7 @@ static __inline__ void input_NullPacket( input_thread_t * p_input,
#define BUFFERS_UNIQUE_SIZE 1
/* Only with NB_LIFO == 1 */
/*****************************************************************************
* input_buffers_t: defines a LIFO per data type to keep
*
_
input_buffers_t: defines a LIFO per data type to keep
*****************************************************************************/
#define PACKETS_LIFO( TYPE, NAME ) \
struct \
...
...
@@ -167,31 +167,56 @@ struct \
} NAME;
#define DECLARE_BUFFERS_EMBEDDED( FLAGS, NB_LIFO ) \
typedef struct
input_buffers_s
\
typedef struct
_input_buffers_s
\
{ \
vlc_mutex_t lock; \
PACKETS_LIFO( pes_packet_t, pes ) \
BUFFERS_LIFO(
data_packet_t, data[NB_LIFO] )
\
BUFFERS_LIFO(
_data_packet_t, data[NB_LIFO] )
\
size_t i_allocated; \
} input_buffers_t;
}
_
input_buffers_t;
#define DECLARE_BUFFERS_SHARED( FLAGS, NB_LIFO ) \
typedef struct
input_buffers_s
\
typedef struct
_input_buffers_s
\
{ \
vlc_mutex_t lock; \
PACKETS_LIFO( pes_packet_t, pes ) \
PACKETS_LIFO(
data_packet_t, data )
\
PACKETS_LIFO(
_data_packet_t, data )
\
BUFFERS_LIFO( _data_buffer_t, buffers[NB_LIFO] ) \
size_t i_allocated; \
} input_buffers_t;
}
_
input_buffers_t;
/* Data buffer, used in case the buffer can be shared between several data
* packets */
typedef
struct
_data_buffer_s
{
struct
_data_buffer_s
*
p_next
;
/* number of data packets this buffer is referenced from - when it falls
* down to 0, the buffer is freed */
int
i_refcount
;
struct
/* for compatibility with _data_packet_t */
{
/* size of the current buffer (starting right thereafter) */
unsigned
int
i_size
;
struct
_data_buffer_s
*
p_next
;
}
_private
;
}
_data_buffer_t
;
/* We overload the data_packet_t type to add private members */
typedef
struct
_data_packet_s
{
struct
_data_packet_s
*
p_next
;
DATA_PACKET
union
{
struct
_data_buffer_s
*
p_buffer
;
/* in case of shared buffers */
/* size of the embedded buffer (starting right thereafter) */
unsigned
int
i_size
;
}
_private
;
}
_data_packet_t
;
/*****************************************************************************
* input_BuffersInit: initialize the cache structures, return a pointer to it
...
...
@@ -199,14 +224,14 @@ typedef struct _data_buffer_s
#define DECLARE_BUFFERS_INIT( FLAGS, NB_LIFO ) \
static void * input_BuffersInit( void ) \
{ \
input_buffers_t * p_buffers = malloc( sizeof( input_buffers_t ) );
\
_input_buffers_t * p_buffers = malloc( sizeof( _input_buffers_t ) );
\
\
if( p_buffers == NULL ) \
{ \
return( NULL ); \
} \
\
memset( p_buffers, 0, sizeof(
input_buffers_t ) );
\
memset( p_buffers, 0, sizeof(
_input_buffers_t ) );
\
vlc_mutex_init( &p_buffers->lock ); \
\
return (void *)p_buffers; \
...
...
@@ -246,7 +271,7 @@ static void * input_BuffersInit( void ) \
while( p_buf != NULL ) \
{ \
p_next = p_buf->p_next; \
p_buffers->i_allocated -= p_buf->
i_size;
\
p_buffers->i_allocated -= p_buf->
_private.i_size;
\
free( p_buf ); \
p_buf = p_next; \
}
...
...
@@ -262,16 +287,16 @@ static void * input_BuffersInit( void ) \
#define BUFFERS_END_LOOP( FLAGS, NB_LIFO ) \
for( i = 0; i < NB_LIFO; i++ ) \
{ \
data_packet_t * p_next;
\
data_packet_t * p_buf = p_buffers->data[i].p_stack;
\
_data_packet_t * p_next;
\
_data_packet_t * p_buf = p_buffers->data[i].p_stack;
\
BUFFERS_END_BUFFERS_LOOP; \
} \
#define BUFFERS_END_LOOP_SHARED( FLAGS, NB_LIFO ) \
{ \
/* Free data packets */
\
data_packet_t * p_next;
\
data_packet_t * p_packet = p_buffers->data.p_stack;
\
_data_packet_t * p_next;
\
_data_packet_t * p_packet = p_buffers->data.p_stack;
\
BUFFERS_END_PACKETS_LOOP; \
} \
\
...
...
@@ -285,7 +310,7 @@ static void * input_BuffersInit( void ) \
#define BUFFERS_END( FLAGS, NB_LIFO, STAT_LOOP, LOOP ) \
static void input_BuffersEnd( void * _p_buffers ) \
{ \
input_buffers_t * p_buffers = (
input_buffers_t *)_p_buffers; \
_input_buffers_t * p_buffers = (_
input_buffers_t *)_p_buffers; \
\
if( _p_buffers != NULL ) \
{ \
...
...
@@ -330,11 +355,11 @@ static void input_BuffersEnd( void * _p_buffers ) \
* input_NewPacket: return a pointer to a data packet of the appropriate size
*****************************************************************************/
#define BUFFERS_NEWPACKET_EXTRA_DECLARATION( FLAGS, NB_LIFO ) \
data_packet_t ** pp_data = &p_buf;
_
data_packet_t ** pp_data = &p_buf;
#define BUFFERS_NEWPACKET_EXTRA_DECLARATION_SHARED( FLAGS, NB_LIFO ) \
data_packet_t * p_data;
\
data_packet_t ** pp_data = &p_data;
_data_packet_t * p_data;
\
_
data_packet_t ** pp_data = &p_data;
#define BUFFERS_NEWPACKET_EXTRA( FLAGS, NB_LIFO )
...
...
@@ -348,7 +373,7 @@ static void input_BuffersEnd( void * _p_buffers ) \
} \
else \
{ \
p_data = malloc( sizeof(
data_packet_t ) );
\
p_data = malloc( sizeof(
_data_packet_t ) );
\
if( p_data == NULL ) \
{ \
intf_ErrMsg( "Out of memory" ); \
...
...
@@ -364,21 +389,26 @@ static void input_BuffersEnd( void * _p_buffers ) \
* this. */
\
p_data->p_next = NULL; \
p_data->b_discard_payload = 0; \
return
p_data;
\
return
( (data_packet_t *)p_data );
\
}
#define BUFFERS_NEWPACKET_END( FLAGS, NB_LIFO )
#define BUFFERS_NEWPACKET_END( FLAGS, NB_LIFO, TYPE ) \
(*pp_data)->p_demux_start = (byte_t *)*pp_data + sizeof( TYPE );
#define BUFFERS_NEWPACKET_END_SHARED( FLAGS, NB_LIFO ) \
#define BUFFERS_NEWPACKET_END_SHARED( FLAGS, NB_LIFO, TYPE ) \
(*pp_data)->_private.p_buffer = p_buf; \
(*pp_data)->p_demux_start = (byte_t *)(*pp_data)->_private.p_buffer \
+ sizeof( TYPE ); \
/* Initialize refcount */
\
p_buf->i_refcount = 1;
#define BUFFERS_NEWPACKET( FLAGS, NB_LIFO, TYPE, NAME, EXTRA_DECLARATION, \
EXTRA, END ) \
/* This one doesn't take p_buffers->lock. */
\
static __inline__ data_packet_t * _input_NewPacket( void * _p_buffers, \
size_t i_size ) \
{ \
input_buffers_t * p_buffers = (input_buffers_t *)_p_buffers;
\
_input_buffers_t * p_buffers = (_input_buffers_t *)_p_buffers;
\
int i_select; \
TYPE * p_buf; \
EXTRA_DECLARATION( FLAGS, NB_LIFO ); \
...
...
@@ -411,16 +441,17 @@ static __inline__ data_packet_t * _input_NewPacket( void * _p_buffers, \
\
/* Reallocate the packet if it is too small or too large */
\
if( !(FLAGS & BUFFERS_UNIQUE_SIZE) && \
(p_buf->i_size < i_size || p_buf->i_size > 3 * i_size) ) \
(p_buf->_private.i_size < i_size \
|| p_buf->_private.i_size > 3 * i_size) ) \
{ \
p_buffers->i_allocated -= p_buf->
i_size;
\
p_buffers->i_allocated -= p_buf->
_private.i_size;
\
p_buf = realloc( p_buf, sizeof( TYPE ) + i_size ); \
if( p_buf == NULL ) \
{ \
intf_ErrMsg( "Out of memory" ); \
return NULL; \
} \
p_buf->
i_size = i_size;
\
p_buf->
_private.i_size = i_size;
\
p_buffers->i_allocated += i_size; \
} \
} \
...
...
@@ -433,26 +464,23 @@ static __inline__ data_packet_t * _input_NewPacket( void * _p_buffers, \
intf_ErrMsg( "Out of memory" ); \
return NULL; \
} \
p_buf->
i_size = i_size;
\
p_buf->
_private.i_size = i_size;
\
p_buffers->i_allocated += i_size; \
} \
\
/* Initialize data */
\
END( FLAGS, NB_LIFO, TYPE ); \
(*pp_data)->p_next = NULL; \
(*pp_data)->b_discard_payload = 0; \
(*pp_data)->p_buffer = (byte_t *)p_buf; \
(*pp_data)->p_demux_start = (*pp_data)->p_buffer + sizeof( TYPE ); \
(*pp_data)->p_payload_start = (*pp_data)->p_demux_start; \
(*pp_data)->p_payload_end = (*pp_data)->p_payload_start + i_size; \
\
END( FLAGS, NB_LIFO ); \
\
return( *pp_data ); \
return( (data_packet_t *)*pp_data ); \
} \
\
static data_packet_t * input_NewPacket( void * _p_buffers, size_t i_size ) \
{ \
input_buffers_t * p_buffers = (input_buffers_t *)_p_buffers;
\
_input_buffers_t * p_buffers = (_input_buffers_t *)_p_buffers;
\
data_packet_t * p_data; \
\
/* Safety check */
\
...
...
@@ -469,7 +497,7 @@ static data_packet_t * input_NewPacket( void * _p_buffers, size_t i_size ) \
}
#define DECLARE_BUFFERS_NEWPACKET( FLAGS, NB_LIFO ) \
BUFFERS_NEWPACKET( FLAGS, NB_LIFO,
data_packet_t, data,
\
BUFFERS_NEWPACKET( FLAGS, NB_LIFO,
_data_packet_t, data,
\
BUFFERS_NEWPACKET_EXTRA_DECLARATION, BUFFERS_NEWPACKET_EXTRA, \
BUFFERS_NEWPACKET_END )
...
...
@@ -482,10 +510,10 @@ static data_packet_t * input_NewPacket( void * _p_buffers, size_t i_size ) \
* input_DeletePacket: put a packet back into the cache
*****************************************************************************/
#define BUFFERS_DELETEPACKET_EXTRA( FLAGS, NB_LIFO, DATA_CACHE_SIZE ) \
data_packet_t * p_buf = p_data;
_
data_packet_t * p_buf = p_data;
#define BUFFERS_DELETEPACKET_EXTRA_SHARED( FLAGS, NB_LIFO, DATA_CACHE_SIZE )\
_data_buffer_t * p_buf = (_data_buffer_t *)p_data->
p_buffer;
\
_data_buffer_t * p_buf = (_data_buffer_t *)p_data->
_private.p_buffer;
\
\
/* Get rid of the data packet */
\
if( p_buffers->data.i_depth < DATA_CACHE_SIZE ) \
...
...
@@ -507,23 +535,43 @@ static data_packet_t * input_NewPacket( void * _p_buffers, size_t i_size ) \
return; \
}
#define BUFFERS_DELETEPACKETSTACK_EXTRA( FLAGS, NB_LIFO, DATA_CACHE_SIZE ) \
_input_buffers_t * p_buffers = (_input_buffers_t *)_p_buffers; \
_data_packet_t * p_first = (_data_packet_t *)_p_first; \
_data_packet_t ** pp_last = (_data_packet_t **)_pp_last; \
\
/* Small hopeless optimization */
\
if( (FLAGS & BUFFERS_UNIQUE_SIZE) \
&& p_buffers->data[0].i_depth < DATA_CACHE_SIZE ) \
{ \
p_buffers->data[0].i_depth += i_nb; \
*pp_last = p_buffers->data[0].p_stack; \
p_buffers->data[0].p_stack = p_first; \
} \
else
/* No semicolon after this or you will die */
#define BUFFERS_DELETEPACKETSTACK_EXTRA_SHARED( FLAGS, NB_LIFO, \
DATA_CACHE_SIZE )
#define BUFFERS_DELETEPACKET( FLAGS, NB_LIFO, DATA_CACHE_SIZE, TYPE, \
NAME, EXTRA ) \
NAME, EXTRA, EXTRA_STACK ) \
/* This one doesn't take p_buffers->lock. */
\
static __inline__ void _input_DeletePacket( void * _p_buffers, \
data_packet_t *
p_data )
\
data_packet_t *
_p_data )
\
{ \
input_buffers_t * p_buffers = (input_buffers_t *)_p_buffers; \
_input_buffers_t * p_buffers = (_input_buffers_t *)_p_buffers; \
_data_packet_t * p_data = (_data_packet_t *)_p_data; \
int i_select; \
\
while( p_data != NULL ) \
{ \
data_packet_t * p_next = p_data->p_next;
\
_data_packet_t * p_next = p_data->p_next;
\
\
EXTRA( FLAGS, NB_LIFO, DATA_CACHE_SIZE ); \
\
for( i_select = 0; i_select < NB_LIFO - 1; i_select++ ) \
{ \
if( p_buf->
i_size <=
\
if( p_buf->
_private.i_size <=
\
(2 * p_buffers->NAME[i_select].i_average_size \
+ p_buffers->NAME[i_select + 1].i_average_size) / 3 ) \
{ \
...
...
@@ -541,7 +589,8 @@ static __inline__ void _input_DeletePacket( void * _p_buffers, \
if( !(FLAGS & BUFFERS_UNIQUE_SIZE) ) \
{ \
/* Update Bresenham mean (very approximative) */
\
p_buffers->NAME[i_select].i_average_size = ( p_buf->i_size \
p_buffers->NAME[i_select].i_average_size = \
( p_buf->_private.i_size \
+ p_buffers->NAME[i_select].i_average_size \
* (INPUT_BRESENHAM_NB - 1) ) \
/ INPUT_BRESENHAM_NB; \
...
...
@@ -549,7 +598,7 @@ static __inline__ void _input_DeletePacket( void * _p_buffers, \
} \
else \
{ \
p_buffers->i_allocated -= p_buf->
i_size;
\
p_buffers->i_allocated -= p_buf->
_private.i_size;
\
free( p_buf ); \
} \
\
...
...
@@ -559,21 +608,57 @@ static __inline__ void _input_DeletePacket( void * _p_buffers, \
\
static void input_DeletePacket( void * _p_buffers, data_packet_t * p_data ) \
{ \
input_buffers_t * p_buffers = (input_buffers_t *)_p_buffers;
\
_input_buffers_t * p_buffers = (_input_buffers_t *)_p_buffers;
\
\
vlc_mutex_lock( &p_buffers->lock ); \
_input_DeletePacket( _p_buffers, p_data ); \
vlc_mutex_unlock( &p_buffers->lock ); \
} \
\
/* Delete a chained list of i_nb data packets. -- needed by DeletePES */
\
static __inline__ void _input_DeletePacketStack( void * _p_buffers, \
data_packet_t * _p_first, \
data_packet_t ** _pp_last, \
unsigned int i_nb ) \
{ \
/* Do not add code before, EXTRA_STACK makes its own declarations. */
\
EXTRA_STACK( FLAGS, NB_LIFO, DATA_CACHE_SIZE ) \
/* No semicolon - PLEASE */
\
{ \
_input_DeletePacket( _p_buffers, _p_first ); \
} \
}
#define DECLARE_BUFFERS_DELETEPACKET( FLAGS, NB_LIFO, DATA_CACHE_SIZE ) \
BUFFERS_DELETEPACKET( FLAGS, NB_LIFO, DATA_CACHE_SIZE, data_packet_t, \
data, BUFFERS_DELETEPACKET_EXTRA )
BUFFERS_DELETEPACKET( FLAGS, NB_LIFO, DATA_CACHE_SIZE, _data_packet_t, \
data, BUFFERS_DELETEPACKET_EXTRA, \
BUFFERS_DELETEPACKETSTACK_EXTRA )
#define DECLARE_BUFFERS_DELETEPACKET_SHARED( FLAGS, NB_LIFO, \
DATA_CACHE_SIZE ) \
BUFFERS_DELETEPACKET( FLAGS, NB_LIFO, DATA_CACHE_SIZE, _data_buffer_t, \
buffers, BUFFERS_DELETEPACKET_EXTRA_SHARED )
buffers, BUFFERS_DELETEPACKET_EXTRA_SHARED, \
BUFFERS_DELETEPACKETSTACK_EXTRA_SHARED )
/*****************************************************************************
* input_DeletePacketStack: optimize deleting of a stack of packets when
* knowing much information
*****************************************************************************/
/* AFAIK, this isn't used by anyone - it is here for completion.
* _input_DeletePacketStack is declared in DeletePacket because it is needed
* by DeletePES. */
#define DECLARE_BUFFERS_DELETEPACKETSTACK( FLAGS, NB_LIFO ) \
static void input_DeletePacketStack( void * _p_buffers, \
data_packet_t * p_first, \
data_packet_t ** pp_last, \
unsigned int i_nb ) \
{ \
_input_buffers_t * p_buffers = (_input_buffers_t *)_p_buffers; \
\
vlc_mutex_lock( &p_buffers->lock ); \
_input_DeletePacketStack( _p_buffers, p_first, pp_last, i_nb ); \
vlc_mutex_unlock( &p_buffers->lock ); \
}
/*****************************************************************************
* input_NewPES: return a pointer to a new PES packet
...
...
@@ -581,7 +666,7 @@ static void input_DeletePacket( void * _p_buffers, data_packet_t * p_data ) \
#define DECLARE_BUFFERS_NEWPES( FLAGS, NB_LIFO ) \
static pes_packet_t * input_NewPES( void * _p_buffers ) \
{ \
input_buffers_t * p_buffers = (input_buffers_t *)_p_buffers;
\
_input_buffers_t * p_buffers = (_input_buffers_t *)_p_buffers;
\
pes_packet_t * p_pes; \
\
vlc_mutex_lock( &p_buffers->lock ); \
...
...
@@ -619,24 +704,10 @@ static pes_packet_t * input_NewPES( void * _p_buffers ) \
/*****************************************************************************
* input_DeletePES: put a pes and all data packets back into the cache
*****************************************************************************/
#define BUFFERS_DELETEPES_EXTRA( FLAGS, NB_LIFO, DATA_CACHE_SIZE ) \
/* Small hopeless optimization */
\
if( (FLAGS & BUFFERS_UNIQUE_SIZE) \
&& p_buffers->data[0].i_depth < DATA_CACHE_SIZE ) \
{ \
p_buffers->data[0].i_depth += p_pes->i_nb_data; \
p_pes->p_last->p_next = p_buffers->data[0].p_stack; \
p_buffers->data[0].p_stack = p_pes->p_first; \
} \
else
/* No semicolon after this or you will die */
#define BUFFERS_DELETEPES_EXTRA_SHARED( FLAGS, NB_LIFO, DATA_CACHE_SIZE )
#define BUFFERS_DELETEPES( FLAGS, NB_LIFO, DATA_CACHE_SIZE, PES_CACHE_SIZE, \
EXTRA ) \
#define DECLARE_BUFFERS_DELETEPES( FLAGS, NB_LIFO, PES_CACHE_SIZE ) \
static void input_DeletePES( void * _p_buffers, pes_packet_t * p_pes ) \
{ \
input_buffers_t * p_buffers = (
input_buffers_t *)_p_buffers; \
_input_buffers_t * p_buffers = (_
input_buffers_t *)_p_buffers; \
\
vlc_mutex_lock( &p_buffers->lock ); \
\
...
...
@@ -644,10 +715,12 @@ static void input_DeletePES( void * _p_buffers, pes_packet_t * p_pes ) \
{ \
pes_packet_t * p_next = p_pes->p_next; \
\
/* Delete all data packets
- no semicolon, PLEASE */
\
EXTRA( FLAGS, NB_LIFO, DATA_CACHE_SIZE )
\
/* Delete all data packets
*/
\
if( p_pes->p_first != NULL )
\
{ \
_input_DeletePacket( _p_buffers, p_pes->p_first ); \
_input_DeletePacketStack( _p_buffers, p_pes->p_first, \
&p_pes->p_last->p_next, \
p_pes->i_nb_data ); \
} \
\
if( p_buffers->pes.i_depth < PES_CACHE_SIZE ) \
...
...
@@ -668,24 +741,14 @@ static void input_DeletePES( void * _p_buffers, pes_packet_t * p_pes ) \
vlc_mutex_unlock( &p_buffers->lock ); \
}
#define DECLARE_BUFFERS_DELETEPES( FLAGS, NB_LIFO, DATA_CACHE_SIZE, \
PES_CACHE_SIZE ) \
BUFFERS_DELETEPES( FLAGS, NB_LIFO, DATA_CACHE_SIZE, PES_CACHE_SIZE, \
BUFFERS_DELETEPES_EXTRA )
#define DECLARE_BUFFERS_DELETEPES_SHARED( FLAGS, NB_LIFO, DATA_CACHE_SIZE, \
PES_CACHE_SIZE ) \
BUFFERS_DELETEPES( FLAGS, NB_LIFO, DATA_CACHE_SIZE, PES_CACHE_SIZE, \
BUFFERS_DELETEPES_EXTRA_SHARED )
/*****************************************************************************
* input_BuffersToIO: return an
io
vector (only with BUFFERS_UNIQUE_SIZE)
* input_BuffersToIO: return an
IO
vector (only with BUFFERS_UNIQUE_SIZE)
*****************************************************************************/
#define DECLARE_BUFFERS_TOIO( FLAGS, BUFFER_SIZE ) \
static data_packet_t * input_BuffersToIO( void * _p_buffers, \
struct iovec * p_iovec, int i_nb )
\
struct iovec * p_iovec, int i_nb )
\
{ \
input_buffers_t * p_buffers = (input_buffers_t *)_p_buffers;
\
_input_buffers_t * p_buffers = (_input_buffers_t *)_p_buffers;
\
data_packet_t * p_data = NULL; \
int i; \
\
...
...
@@ -697,12 +760,7 @@ static data_packet_t * input_BuffersToIO( void * _p_buffers, \
BUFFER_SIZE
/* UNIQUE_SIZE */
); \
if( p_next == NULL ) \
{ \
while( p_data != NULL ) \
{ \
p_next = p_data->p_next; \
_input_DeletePacket( _p_buffers, p_data ); \
p_data = p_next; \
} \
return( NULL ); \
} \
\
...
...
@@ -722,29 +780,32 @@ static data_packet_t * input_BuffersToIO( void * _p_buffers, \
*****************************************************************************/
#define DECLARE_BUFFERS_SHAREBUFFER( FLAGS ) \
static data_packet_t * input_ShareBuffer( void * _p_buffers, \
data_packet_t *
p_shared_data ) \
data_packet_t * _
p_shared_data ) \
{ \
input_buffers_t * p_buffers = (input_buffers_t *)_p_buffers; \
data_packet_t * p_data; \
_data_buffer_t * p_buf = (_data_buffer_t *)p_shared_data->p_buffer; \
_input_buffers_t * p_buffers = (_input_buffers_t *)_p_buffers; \
_data_packet_t * p_shared_data = (_data_packet_t *)_p_shared_data; \
_data_packet_t * p_data; \
_data_buffer_t * p_buf = p_shared_data->_private.p_buffer; \
\
vlc_mutex_lock( &p_buffers->lock ); \
\
/* Get new data_packet_t */
\
p_data = _input_NewPacket( _p_buffers, 0 ); \
/* Get new data_packet_t, without a buffer through a special backdoor \
* in _input_NewPacket. */
\
p_data = (_data_packet_t *)_input_NewPacket( _p_buffers, 0 ); \
\
/* Finish initialization of p_data */
\
p_data->
p_buffer = p_shared_data->p_buffer;
\
p_data->
_private.p_buffer = p_shared_data->_private.p_buffer;
\
p_data->p_demux_start = p_data->p_payload_start \
= p_shared_data->p_buffer + sizeof( _data_buffer_t ); \
p_data->p_payload_end = p_shared_data->p_buffer + p_buf->i_size; \
= (byte_t *)p_shared_data->_private.p_buffer \
+ sizeof( _data_buffer_t ); \
p_data->p_payload_end = p_data->p_demux_start + p_buf->_private.i_size; \
\
/* Update refcount */
\
p_buf->i_refcount++; \
\
vlc_mutex_unlock( &p_buffers->lock ); \
\
return(
p_data );
\
return(
(data_packet_t *)p_data );
\
}
...
...
plugins/dvd/input_dvd.c
View file @
2d79bfcb
...
...
@@ -9,7 +9,7 @@
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.11
2 2001/12/29 00:39:49
massiot Exp $
* $Id: input_dvd.c,v 1.11
3 2001/12/29 03:07:51
massiot Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
...
...
@@ -123,9 +123,9 @@ DECLARE_BUFFERS_SHARED( FLAGS, NB_LIFO );
DECLARE_BUFFERS_INIT
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_END_SHARED
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_NEWPACKET_SHARED
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPACKET_SHARED
(
FLAGS
,
NB_LIFO
,
1
5
0
);
DECLARE_BUFFERS_DELETEPACKET_SHARED
(
FLAGS
,
NB_LIFO
,
1
00
0
);
DECLARE_BUFFERS_NEWPES
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPES
_SHARED
(
FLAGS
,
NB_LIFO
,
150
,
15
0
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
100
0
);
DECLARE_BUFFERS_TOIO
(
FLAGS
,
DVD_LB_SIZE
);
DECLARE_BUFFERS_SHAREBUFFER
(
FLAGS
);
...
...
plugins/dvdread/input_dvdread.c
View file @
2d79bfcb
...
...
@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_dvdread.c,v 1.
7 2001/12/29 00:39:49
massiot Exp $
* $Id: input_dvdread.c,v 1.
8 2001/12/29 03:07:51
massiot Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
...
...
@@ -114,9 +114,9 @@ DECLARE_BUFFERS_SHARED( FLAGS, NB_LIFO );
DECLARE_BUFFERS_INIT
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_END_SHARED
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_NEWPACKET_SHARED
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPACKET_SHARED
(
FLAGS
,
NB_LIFO
,
1
5
0
);
DECLARE_BUFFERS_DELETEPACKET_SHARED
(
FLAGS
,
NB_LIFO
,
1
00
0
);
DECLARE_BUFFERS_NEWPES
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPES
_SHARED
(
FLAGS
,
NB_LIFO
,
150
,
15
0
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
100
0
);
DECLARE_BUFFERS_TOIO
(
FLAGS
,
DVD_LB_SIZE
);
DECLARE_BUFFERS_SHAREBUFFER
(
FLAGS
);
...
...
plugins/mpeg_system/input_es.c
View file @
2d79bfcb
...
...
@@ -2,7 +2,7 @@
* input_es.c: Elementary Stream demux and packet management
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_es.c,v 1.
8 2001/12/27 03:47:08
massiot Exp $
* $Id: input_es.c,v 1.
9 2001/12/29 03:07:51
massiot Exp $
*
* Author: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -98,7 +98,7 @@ DECLARE_BUFFERS_END( FLAGS, NB_LIFO );
DECLARE_BUFFERS_NEWPACKET
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPACKET
(
FLAGS
,
NB_LIFO
,
150
);
DECLARE_BUFFERS_NEWPES
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
150
,
150
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
150
);
DECLARE_BUFFERS_TOIO
(
FLAGS
,
ES_PACKET_SIZE
);
/*****************************************************************************
...
...
plugins/mpeg_system/input_ps.c
View file @
2d79bfcb
...
...
@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_ps.c,v 1.
8 2001/12/27 03:47:09
massiot Exp $
* $Id: input_ps.c,v 1.
9 2001/12/29 03:07:51
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
...
...
@@ -100,9 +100,9 @@ DECLARE_BUFFERS_EMBEDDED( FLAGS, NB_LIFO );
DECLARE_BUFFERS_INIT
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_END
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_NEWPACKET
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPACKET
(
FLAGS
,
NB_LIFO
,
15
0
);
DECLARE_BUFFERS_DELETEPACKET
(
FLAGS
,
NB_LIFO
,
30
0
);
DECLARE_BUFFERS_NEWPES
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
150
,
15
0
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
30
0
);
/*****************************************************************************
...
...
plugins/mpeg_system/input_ts.c
View file @
2d79bfcb
...
...
@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_ts.c,v 1.
7 2001/12/27 03:47:09
massiot Exp $
* $Id: input_ts.c,v 1.
8 2001/12/29 03:07:51
massiot Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
...
...
@@ -101,7 +101,7 @@ DECLARE_BUFFERS_END( FLAGS, NB_LIFO );
DECLARE_BUFFERS_NEWPACKET
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPACKET
(
FLAGS
,
NB_LIFO
,
1000
);
DECLARE_BUFFERS_NEWPES
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
1
000
,
1
50
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
150
);
DECLARE_BUFFERS_TOIO
(
FLAGS
,
TS_PACKET_SIZE
);
/*****************************************************************************
...
...
plugins/vcd/input_vcd.c
View file @
2d79bfcb
...
...
@@ -102,9 +102,9 @@ DECLARE_BUFFERS_EMBEDDED( FLAGS, NB_LIFO );
DECLARE_BUFFERS_INIT
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_END
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_NEWPACKET
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPACKET
(
FLAGS
,
NB_LIFO
,
1
5
0
);
DECLARE_BUFFERS_DELETEPACKET
(
FLAGS
,
NB_LIFO
,
1
00
0
);
DECLARE_BUFFERS_NEWPES
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
1
50
,
15
0
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
1
00
0
);
/*****************************************************************************
...
...
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