Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
605a3534
Commit
605a3534
authored
Dec 19, 2001
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Next Generation Buffer Manager for DVD and VCD plug-ins.
parent
ba2dbc41
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
434 additions
and
634 deletions
+434
-634
include/input_ext-dec.h
include/input_ext-dec.h
+4
-3
include/input_ext-plugins.h
include/input_ext-plugins.h
+257
-95
plugins/dvd/input_dvd.c
plugins/dvd/input_dvd.c
+56
-37
plugins/dvdread/input_dvdread.c
plugins/dvdread/input_dvdread.c
+57
-39
plugins/mpeg_system/input_es.c
plugins/mpeg_system/input_es.c
+4
-4
plugins/mpeg_system/input_ps.c
plugins/mpeg_system/input_ps.c
+7
-7
plugins/mpeg_system/input_ts.c
plugins/mpeg_system/input_ts.c
+4
-4
plugins/vcd/input_vcd.c
plugins/vcd/input_vcd.c
+27
-427
src/input/mpeg_system.c
src/input/mpeg_system.c
+18
-18
No files found.
include/input_ext-dec.h
View file @
605a3534
...
...
@@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-dec.h,v 1.4
4 2001/12/12 13:48:09
massiot Exp $
* $Id: input_ext-dec.h,v 1.4
5 2001/12/19 10:00:00
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
...
...
@@ -44,16 +44,17 @@ typedef struct data_packet_s
{
/* Nothing before this line, the code relies on that */
byte_t
*
p_buffer
;
/* raw data packet */
byte_t
*
p_buffer_end
;
long
l_size
;
/* buffer size */
/* 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 ? */
int
*
pi_refcount
;
unsigned
int
i_size
;
/* buffer size */
long
l_size
;
/* buffer size */
/* Used to chain the TS packets that carry data for a same PES or PSI */
struct
data_packet_s
*
p_next
;
...
...
include/input_ext-plugins.h
View file @
605a3534
This diff is collapsed.
Click to expand it.
plugins/dvd/input_dvd.c
View file @
605a3534
...
...
@@ -4,13 +4,12 @@
* This plugins should handle all the known specificities of the DVD format,
* especially the 2048 bytes logical block size.
* It depends on:
* -input_netlist used to read packets
* -libdvdcss for access and unscrambling
* -dvd_ifo for ifo parsing and analyse
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.10
6 2001/12/10 04:53:10 sam
Exp $
* $Id: input_dvd.c,v 1.10
7 2001/12/19 10:00:00 massiot
Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
...
...
@@ -95,9 +94,6 @@
#define DVD_BLOCK_READ_ONCE 64
#define DVD_DATA_READ_ONCE (4 * DVD_BLOCK_READ_ONCE)
/* Size of netlist */
#define DVD_NETLIST_SIZE 256
/*****************************************************************************
* Local prototypes
*****************************************************************************/
...
...
@@ -119,6 +115,21 @@ static int DVDFindCell( thread_dvd_data_t * );
static
int
DVDFindSector
(
thread_dvd_data_t
*
);
static
int
DVDChapterSelect
(
thread_dvd_data_t
*
,
int
);
/*****************************************************************************
* Declare a buffer manager
*****************************************************************************/
#define FLAGS BUFFERS_UNIQUE_SIZE
#define NB_LIFO 1
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
,
150
);
DECLARE_BUFFERS_NEWPES
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
150
);
DECLARE_BUFFERS_TOIO
(
FLAGS
,
DVD_LB_SIZE
);
DECLARE_BUFFERS_SHAREBUFFER
(
FLAGS
);
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
...
...
@@ -136,10 +147,10 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
input
.
pf_set_area
=
DVDSetArea
;
input
.
pf_set_program
=
DVDSetProgram
;
input
.
pf_demux
=
input_DemuxPS
;
input
.
pf_new_packet
=
input_Ne
tlistNe
wPacket
;
input
.
pf_new_pes
=
input_Ne
tlistNe
wPES
;
input
.
pf_delete_packet
=
input_
Netlist
DeletePacket
;
input
.
pf_delete_pes
=
input_
Netlist
DeletePES
;
input
.
pf_new_packet
=
input_NewPacket
;
input
.
pf_new_pes
=
input_NewPES
;
input
.
pf_delete_packet
=
input_DeletePacket
;
input
.
pf_delete_pes
=
input_DeletePES
;
input
.
pf_rewind
=
DVDRewind
;
input
.
pf_seek
=
DVDSeek
;
#undef input
...
...
@@ -194,7 +205,12 @@ static void DVDInit( input_thread_t * p_input )
}
p_input
->
p_plugin_data
=
(
void
*
)
p_dvd
;
p_input
->
p_method_data
=
NULL
;
if
(
(
p_input
->
p_method_data
=
input_BuffersInit
())
==
NULL
)
{
p_input
->
b_error
=
1
;
return
;
}
p_dvd
->
dvdhandle
=
(
dvdcss_handle
)
p_input
->
p_handle
;
...
...
@@ -211,11 +227,6 @@ static void DVDInit( input_thread_t * p_input )
/* this value mustn't be modifed */
p_input
->
i_read_once
=
DVD_DATA_READ_ONCE
;
/* Reading structures initialisation */
input_NetlistInit
(
p_input
,
DVD_NETLIST_SIZE
,
2
*
DVD_NETLIST_SIZE
,
DVD_NETLIST_SIZE
,
DVD_LB_SIZE
,
p_dvd
->
i_block_once
);
intf_WarnMsg
(
2
,
"dvd info: netlist initialized"
);
/* Ifo allocation & initialisation */
if
(
IfoCreate
(
p_dvd
)
<
0
)
{
...
...
@@ -385,7 +396,7 @@ static void DVDEnd( input_thread_t * p_input )
free
(
p_dvd
);
input_
NetlistEnd
(
p_input
);
input_
BuffersEnd
(
p_input
->
p_method_data
);
}
/*****************************************************************************
...
...
@@ -829,9 +840,7 @@ static int DVDRead( input_thread_t * p_input,
data_packet_t
**
pp_packets
)
{
thread_dvd_data_t
*
p_dvd
;
netlist_t
*
p_netlist
;
struct
iovec
*
p_vec
;
struct
data_packet_s
*
pp_data
[
DVD_DATA_READ_ONCE
];
struct
iovec
p_vec
[
DVD_DATA_READ_ONCE
];
u8
*
pi_cur
;
int
i_block_once
;
int
i_packet_size
;
...
...
@@ -843,9 +852,9 @@ static int DVDRead( input_thread_t * p_input,
boolean_t
b_eof
;
boolean_t
b_eot
;
boolean_t
b_eoc
;
data_packet_t
*
p_data
;
p_dvd
=
(
thread_dvd_data_t
*
)
p_input
->
p_plugin_data
;
p_netlist
=
(
netlist_t
*
)
p_input
->
p_method_data
;
b_eoc
=
0
;
i_sector
=
p_dvd
->
i_title_start
+
p_dvd
->
i_sector
;
...
...
@@ -909,23 +918,20 @@ static int DVDRead( input_thread_t * p_input,
/*
intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_once, p_dvd->i_chapter );
*/
p_netlist
->
i_read_once
=
i_block_once
;
/* Get an iovec pointer */
if
(
(
p_vec
=
input_NetlistGetiovec
(
p_netlist
)
)
==
NULL
)
/* Get iovecs */
p_data
=
input_BuffersToIO
(
p_input
->
p_method_data
,
p_vec
,
DVD_DATA_READ_ONCE
);
if
(
p_data
==
NULL
)
{
intf_ErrMsg
(
"dvd error: can't get iovec"
);
return
-
1
;
return
(
-
1
);
}
/* Reads from DVD */
i_read_blocks
=
dvdcss_readv
(
p_dvd
->
dvdhandle
,
p_vec
,
i_block_once
,
DVDCSS_READ_DECRYPT
);
/* Update netlist indexes: we don't do it in DVDGetiovec since we
* need know the real number of blocks read */
input_NetlistMviovec
(
p_netlist
,
i_read_blocks
,
pp_data
);
/* Update global position */
p_dvd
->
i_sector
+=
i_read_blocks
;
...
...
@@ -934,9 +940,10 @@ intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_o
/* Read headers to compute payload length */
for
(
i_iovec
=
0
;
i_iovec
<
i_read_blocks
;
i_iovec
++
)
{
data_packet_t
*
p_current
=
p_data
;
i_pos
=
0
;
while
(
i_pos
<
p_netlist
->
i_buffer_size
)
while
(
i_pos
<
DVD_LB_SIZE
)
{
pi_cur
=
(
u8
*
)
p_vec
[
i_iovec
].
iov_base
+
i_pos
;
...
...
@@ -945,21 +952,26 @@ intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_o
{
/* That's the case for all packets, except pack header. */
i_packet_size
=
U16_AT
(
pi_cur
+
4
);
pp_packets
[
i_packet
]
=
input_NetlistNewPtr
(
p_netlist
);
(
*
pp_data
[
i_iovec
]
->
pi_refcount
)
++
;
pp_packets
[
i_packet
]
->
pi_refcount
=
pp_data
[
i_iovec
]
->
pi_refcount
;
pp_packets
[
i_packet
]
->
p_buffer
=
pp_data
[
i_iovec
]
->
p_buffer
;
}
else
{
/* MPEG-2 Pack header. */
i_packet_size
=
8
;
pp_packets
[
i_packet
]
=
pp_data
[
i_iovec
];
}
if
(
i_pos
!=
0
)
{
pp_packets
[
i_packet
]
=
input_ShareBuffer
(
p_input
->
p_method_data
,
p_current
);
}
else
{
pp_packets
[
i_packet
]
=
p_data
;
p_data
=
p_data
->
p_next
;
}
pp_packets
[
i_packet
]
->
p_payload_start
=
pp_packets
[
i_packet
]
->
p_buffer
+
i_pos
;
pp_packets
[
i_packet
]
->
p_demux_start
=
pp_packets
[
i_packet
]
->
p_demux_start
+
i_pos
;
pp_packets
[
i_packet
]
->
p_payload_end
=
pp_packets
[
i_packet
]
->
p_payload_start
+
i_packet_size
+
6
;
...
...
@@ -971,6 +983,13 @@ intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_o
pp_packets
[
i_packet
]
=
NULL
;
while
(
p_data
!=
NULL
)
{
data_packet_t
*
p_next
=
p_data
->
p_next
;
p_input
->
pf_delete_packet
(
p_input
->
p_method_data
,
p_data
);
p_data
=
p_next
;
}
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
p_input
->
stream
.
p_selected_area
->
i_tell
=
...
...
plugins/dvdread/input_dvdread.c
View file @
605a3534
...
...
@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_dvdread.c,v 1.
3 2001/12/07 18:33:07 sam
Exp $
* $Id: input_dvdread.c,v 1.
4 2001/12/19 10:00:00 massiot
Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
...
...
@@ -87,9 +87,6 @@
#define DVD_BLOCK_READ_ONCE 64
#define DVD_DATA_READ_ONCE (4 * DVD_BLOCK_READ_ONCE)
/* Size of netlist */
#define DVD_NETLIST_SIZE 512
/*****************************************************************************
* Local prototypes
*****************************************************************************/
...
...
@@ -108,6 +105,21 @@ static int DvdReadRewind ( struct input_thread_s * );
static
void
DvdReadHandleDSI
(
thread_dvd_data_t
*
p_dvd
,
u8
*
p_data
);
static
void
DvdReadFindCell
(
thread_dvd_data_t
*
p_dvd
);
/*****************************************************************************
* Declare a buffer manager
*****************************************************************************/
#define FLAGS BUFFERS_UNIQUE_SIZE
#define NB_LIFO 1
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
,
150
);
DECLARE_BUFFERS_NEWPES
(
FLAGS
,
NB_LIFO
);
DECLARE_BUFFERS_DELETEPES
(
FLAGS
,
NB_LIFO
,
150
);
DECLARE_BUFFERS_TOIO
(
FLAGS
,
DVD_LB_SIZE
);
DECLARE_BUFFERS_SHAREBUFFER
(
FLAGS
);
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
...
...
@@ -124,10 +136,10 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
input
.
pf_read
=
DvdReadRead
;
input
.
pf_set_area
=
DvdReadSetArea
;
input
.
pf_demux
=
input_DemuxPS
;
input
.
pf_new_packet
=
input_Ne
tlistNe
wPacket
;
input
.
pf_new_pes
=
input_Ne
tlistNe
wPES
;
input
.
pf_delete_packet
=
input_
Netlist
DeletePacket
;
input
.
pf_delete_pes
=
input_
Netlist
DeletePES
;
input
.
pf_new_packet
=
input_NewPacket
;
input
.
pf_new_pes
=
input_NewPES
;
input
.
pf_delete_packet
=
input_DeletePacket
;
input
.
pf_delete_pes
=
input_DeletePES
;
input
.
pf_rewind
=
DvdReadRewind
;
input
.
pf_seek
=
DvdReadSeek
;
#undef input
...
...
@@ -188,7 +200,12 @@ static void DvdReadInit( input_thread_t * p_input )
p_dvd
->
p_vts_file
=
NULL
;
p_input
->
p_plugin_data
=
(
void
*
)
p_dvd
;
p_input
->
p_method_data
=
NULL
;
if
(
(
p_input
->
p_method_data
=
input_BuffersInit
())
==
NULL
)
{
p_input
->
b_error
=
1
;
return
;
}
/* We read DVD_BLOCK_READ_ONCE in each loop, so the input will receive
* DVD_DATA_READ_ONCE at most */
...
...
@@ -196,11 +213,6 @@ static void DvdReadInit( input_thread_t * p_input )
/* this value mustn't be modifed */
p_input
->
i_read_once
=
DVD_DATA_READ_ONCE
;
/* Reading structures initialisation */
input_NetlistInit
(
p_input
,
DVD_NETLIST_SIZE
,
2
*
DVD_NETLIST_SIZE
,
DVD_NETLIST_SIZE
,
DVD_VIDEO_LB_LEN
,
p_dvd
->
i_block_once
);
intf_WarnMsg
(
2
,
"dvdread info: netlist initialized"
);
/* Ifo allocation & initialisation */
if
(
!
(
p_dvd
->
p_vmg_file
=
ifoOpen
(
p_dvd
->
p_dvdread
,
0
)
)
)
{
...
...
@@ -349,9 +361,7 @@ static void DvdReadEnd( input_thread_t * p_input )
ifoClose
(
p_dvd
->
p_vts_file
);
ifoClose
(
p_dvd
->
p_vmg_file
);
/* Close netlist */
input_NetlistEnd
(
p_input
);
p_input
->
p_method_data
=
NULL
;
input_BuffersEnd
(
p_input
->
p_method_data
);
}
#define p_pgc p_dvd->p_cur_pgc
...
...
@@ -775,10 +785,8 @@ static int DvdReadRead( input_thread_t * p_input,
data_packet_t
**
pp_packets
)
{
thread_dvd_data_t
*
p_dvd
;
netlist_t
*
p_netlist
;
u8
p_data
[
DVD_VIDEO_LB_LEN
];
struct
iovec
*
p_vec
;
struct
data_packet_s
*
pp_data
[
DVD_DATA_READ_ONCE
];
struct
iovec
p_vec
[
DVD_DATA_READ_ONCE
];
u8
*
pi_cur
;
int
i_blocks
;
int
i_read
;
...
...
@@ -786,9 +794,9 @@ static int DvdReadRead( input_thread_t * p_input,
int
i_packet_size
;
int
i_packet
;
int
i_pos
;
data_packet_t
*
p_data
;
p_dvd
=
(
thread_dvd_data_t
*
)
p_input
->
p_plugin_data
;
p_netlist
=
(
netlist_t
*
)
p_input
->
p_method_data
;
/*
* Playback by cell in this pgc, starting at the cell for our chapter.
...
...
@@ -838,13 +846,14 @@ static int DvdReadRead( input_thread_t * p_input,
i_blocks
=
p_dvd
->
i_pack_len
>=
DVD_BLOCK_READ_ONCE
?
DVD_BLOCK_READ_ONCE
:
p_dvd
->
i_pack_len
;
p_dvd
->
i_pack_len
-=
i_blocks
;
p_netlist
->
i_read_once
=
i_blocks
;
/* Get an iovec pointer */
if
(
(
p_vec
=
input_NetlistGetiovec
(
p_netlist
)
)
==
NULL
)
/* Get iovecs */
p_data
=
input_BuffersToIO
(
p_input
->
p_method_data
,
p_vec
,
DVD_DATA_READ_ONCE
);
if
(
p_data
==
NULL
)
{
intf_ErrMsg
(
"dvdread error: can't get iovec"
);
return
-
1
;
return
(
-
1
);
}
/* Reads from DVD */
...
...
@@ -861,18 +870,15 @@ static int DvdReadRead( input_thread_t * p_input,
/*
intf_WarnMsg( 12, "dvdread i_blocks: %d len: %d current: 0x%02x", i_read, p_dvd->i_pack_len, p_dvd->i_cur_block );
*/
/* Update netlist indexes: we don't do it in DVDGetiovec since we
* need know the real number of blocks read */
input_NetlistMviovec
(
p_netlist
,
i_read
,
pp_data
);
i_packet
=
0
;
/* Read headers to compute payload length */
for
(
i_iovec
=
0
;
i_iovec
<
i_read
;
i_iovec
++
)
{
data_packet_t
*
p_current
=
p_data
;
i_pos
=
0
;
while
(
i_pos
<
p_netlist
->
i_buffer_size
)
while
(
i_pos
<
DVD_LB_SIZE
)
{
pi_cur
=
(
u8
*
)
p_vec
[
i_iovec
].
iov_base
+
i_pos
;
...
...
@@ -881,22 +887,27 @@ static int DvdReadRead( input_thread_t * p_input,
{
/* That's the case for all packets, except pack header. */
i_packet_size
=
U16_AT
(
pi_cur
+
4
);
pp_packets
[
i_packet
]
=
input_NetlistNewPtr
(
p_netlist
);
(
*
pp_data
[
i_iovec
]
->
pi_refcount
)
++
;
pp_packets
[
i_packet
]
->
pi_refcount
=
pp_data
[
i_iovec
]
->
pi_refcount
;
pp_packets
[
i_packet
]
->
p_buffer
=
pp_data
[
i_iovec
]
->
p_buffer
;
}
else
{
/* MPEG-2 Pack header. */
i_packet_size
=
8
;
pp_packets
[
i_packet
]
=
pp_data
[
i_iovec
];
}
if
(
i_pos
!=
0
)
{
pp_packets
[
i_packet
]
=
input_ShareBuffer
(
p_input
->
p_method_data
,
p_current
);
}
else
{
pp_packets
[
i_packet
]
=
p_data
;
p_data
=
p_data
->
p_next
;
}
pp_packets
[
i_packet
]
->
p_payload_start
=
pp_packets
[
i_packet
]
->
p_buffer
+
i_pos
;
pp_packets
[
i_packet
]
->
p_demux_start
=
pp_packets
[
i_packet
]
->
p_demux_start
+
i_pos
;
pp_packets
[
i_packet
]
->
p_payload_end
=
pp_packets
[
i_packet
]
->
p_payload_start
+
i_packet_size
+
6
;
...
...
@@ -911,6 +922,13 @@ static int DvdReadRead( input_thread_t * p_input,
pp_packets
[
i_packet
]
=
NULL
;
while
(
p_data
!=
NULL
)
{
data_packet_t
*
p_next
=
p_data
->
p_next
;
p_input
->
pf_delete_packet
(
p_input
->
p_method_data
,
p_data
);
p_data
=
p_next
;
}
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
p_input
->
stream
.
p_selected_area
->
i_tell
=
...
...
plugins/mpeg_system/input_es.c
View file @
605a3534
...
...
@@ -2,7 +2,7 @@
* input_es.c: Elementary Stream demux and packet management
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_es.c,v 1.
5 2001/12/13 17:58:16 jobi
Exp $
* $Id: input_es.c,v 1.
6 2001/12/19 10:00:00 massiot
Exp $
*
* Author: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -99,7 +99,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
);
/*****************************************************************************
...
...
@@ -204,7 +204,7 @@ static int ESRead( input_thread_t * p_input,
if
(
p_data
==
NULL
)
{
return
(
-
1
);
/* empty netlist */
return
(
-
1
);
}
memset
(
pp_packets
,
0
,
INPUT_READ_ONCE
*
sizeof
(
data_packet_t
*
)
);
...
...
@@ -216,7 +216,7 @@ static int ESRead( input_thread_t * p_input,
return
(
-
1
);
}
for
(
i_loop
=
0
;
i_loop
*
ES_PACKET_SIZE
<
i_read
;
i_loop
++
)
for
(
i_loop
=
0
;
i_loop
*
ES_PACKET_SIZE
<
i_read
;
i_loop
++
)
{
pp_packets
[
i_loop
]
=
p_data
;
p_data
=
p_data
->
p_next
;
...
...
plugins/mpeg_system/input_ps.c
View file @
605a3534
...
...
@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_ps.c,v 1.
5 2001/12/19 03:50:22 sam
Exp $
* $Id: input_ps.c,v 1.
6 2001/12/19 10:00:00 massiot
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
...
...
@@ -103,7 +103,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
);
/*****************************************************************************
...
...
@@ -482,11 +482,11 @@ static int PSRead( input_thread_t * p_input,
if
(
U32_AT
(
p_header
)
!=
0x1B9
)
{
/* Copy the header we already read. */
memcpy
(
p_data
->
p_
buffer
,
p_header
,
6
);
memcpy
(
p_data
->
p_
demux_start
,
p_header
,
6
);
/* Read the remaining of the packet. */
if
(
i_packet_size
&&
(
i_error
=
SafeRead
(
p_input
,
p_data
->
p_
buffer
+
6
,
i_packet_size
))
)
SafeRead
(
p_input
,
p_data
->
p_
demux_start
+
6
,
i_packet_size
))
)
{
return
(
i_error
);
}
...
...
@@ -494,12 +494,12 @@ static int PSRead( input_thread_t * p_input,
/* In MPEG-2 pack headers we still have to read stuffing bytes. */
if
(
U32_AT
(
p_header
)
==
0x1BA
)
{
if
(
i_packet_size
==
8
&&
(
p_data
->
p_
buffer
[
13
]
&
0x7
)
!=
0
)
if
(
i_packet_size
==
8
&&
(
p_data
->
p_
demux_start
[
13
]
&
0x7
)
!=
0
)
{
/* MPEG-2 stuffing bytes */
byte_t
p_garbage
[
8
];
if
(
(
i_error
=
SafeRead
(
p_input
,
p_garbage
,
p_data
->
p_
buffer
[
13
]
&
0x7
))
)
p_data
->
p_
demux_start
[
13
]
&
0x7
))
)
{
return
(
i_error
);
}
...
...
@@ -509,7 +509,7 @@ static int PSRead( input_thread_t * p_input,
else
{
/* Copy the small header. */
memcpy
(
p_data
->
p_
buffer
,
p_header
,
4
);
memcpy
(
p_data
->
p_
demux_start
,
p_header
,
4
);
}
/* Give the packet to the other input stages. */
...
...
plugins/mpeg_system/input_ts.c
View file @
605a3534
...
...
@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_ts.c,v 1.
4 2001/12/12 17:41:15
massiot Exp $
* $Id: input_ts.c,v 1.
5 2001/12/19 10:00:00
massiot Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
...
...
@@ -102,7 +102,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
);
/*****************************************************************************
...
...
@@ -326,10 +326,10 @@ static int TSRead( input_thread_t * p_input,
p_data
=
p_data
->
p_next
;
pp_packets
[
i_loop
]
->
p_next
=
NULL
;
if
(
pp_packets
[
i_loop
]
->
p_
buffer
[
0
]
!=
0x47
)
if
(
pp_packets
[
i_loop
]
->
p_
demux_start
[
0
]
!=
0x47
)
intf_ErrMsg
(
"input error: bad TS packet (starts with "
"0x%.2x, should be 0x47)"
,
pp_packets
[
i_loop
]
->
p_
buffer
[
0
]
);
pp_packets
[
i_loop
]
->
p_
demux_start
[
0
]
);
}
for
(
;
i_loop
<
INPUT_READ_ONCE
;
i_loop
++
)
{
...
...
plugins/vcd/input_vcd.c
View file @
605a3534
This diff is collapsed.
Click to expand it.
src/input/mpeg_system.c
View file @
605a3534
...
...
@@ -2,7 +2,7 @@
* mpeg_system.c: TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: mpeg_system.c,v 1.7
5 2001/12/17 16:42:27 sam
Exp $
* $Id: mpeg_system.c,v 1.7
6 2001/12/19 10:00:00 massiot
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
...
...
@@ -508,13 +508,13 @@ static u16 GetID( data_packet_t * p_data )
{
u16
i_id
;
i_id
=
p_data
->
p_
payload_start
[
3
];
/* stream_id */
i_id
=
p_data
->
p_
demux_start
[
3
];
/* stream_id */
if
(
i_id
==
0xBD
)
{
/* FIXME : this is not valid if the header is split in multiple
* packets */
/* stream_private_id */
i_id
|=
p_data
->
p_
payload_start
[
9
+
p_data
->
p_payload
_start
[
8
]
]
<<
8
;
i_id
|=
p_data
->
p_
demux_start
[
9
+
p_data
->
p_demux
_start
[
8
]
]
<<
8
;
}
return
(
i_id
);
}
...
...
@@ -533,14 +533,14 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data )
int
i
;
int
i_new_es_number
=
0
;
if
(
p_data
->
p_
payload
_start
+
10
>
p_data
->
p_payload_end
)
if
(
p_data
->
p_
demux
_start
+
10
>
p_data
->
p_payload_end
)
{
intf_ErrMsg
(
"input error: PSM too short : packet corrupt"
);
return
;
}
if
(
p_demux
->
b_has_PSM
&&
p_demux
->
i_PSM_version
==
(
p_data
->
p_
payload
_start
[
6
]
&
0x1F
)
)
&&
p_demux
->
i_PSM_version
==
(
p_data
->
p_
demux
_start
[
6
]
&
0x1F
)
)
{
/* Already got that one. */
return
;
...
...
@@ -548,12 +548,12 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data )
intf_DbgMsg
(
"input: building PSM"
);
p_demux
->
b_has_PSM
=
1
;
p_demux
->
i_PSM_version
=
p_data
->
p_
payload
_start
[
6
]
&
0x1F
;
p_demux
->
i_PSM_version
=
p_data
->
p_
demux
_start
[
6
]
&
0x1F
;
/* Go to elementary_stream_map_length, jumping over
* program_stream_info. */
p_byte
=
p_data
->
p_
payload
_start
+
10
+
U16_AT
(
&
p_data
->
p_
payload
_start
[
8
]);
p_byte
=
p_data
->
p_
demux
_start
+
10
+
U16_AT
(
&
p_data
->
p_
demux
_start
[
8
]);
if
(
p_byte
>
p_data
->
p_payload_end
)
{
intf_ErrMsg
(
"input error: PSM too short, packet corrupt"
);
...
...
@@ -658,7 +658,7 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
u32
i_code
;
es_descriptor_t
*
p_es
=
NULL
;
i_code
=
p_data
->
p_
payload
_start
[
3
];
i_code
=
p_data
->
p_
demux
_start
[
3
];
if
(
i_code
>
0xBC
)
/* ES start code */
{
...
...
@@ -697,7 +697,7 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
i_id
,
0
);
if
(
p_es
!=
NULL
)
{
p_es
->
i_stream_id
=
p_data
->
p_
payload
_start
[
3
];
p_es
->
i_stream_id
=
p_data
->
p_
demux
_start
[
3
];
/* Set stream type and auto-spawn. */
if
(
(
i_id
&
0xF0
)
==
0xE0
)
...
...
@@ -797,10 +797,10 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
boolean_t
b_trash
=
0
;
es_descriptor_t
*
p_es
=
NULL
;
i_code
=
((
u32
)
p_data
->
p_
payload
_start
[
0
]
<<
24
)
|
((
u32
)
p_data
->
p_
payload
_start
[
1
]
<<
16
)
|
((
u32
)
p_data
->
p_
payload
_start
[
2
]
<<
8
)
|
p_data
->
p_
payload
_start
[
3
];
i_code
=
((
u32
)
p_data
->
p_
demux
_start
[
0
]
<<
24
)
|
((
u32
)
p_data
->
p_
demux
_start
[
1
]
<<
16
)
|
((
u32
)
p_data
->
p_
demux
_start
[
2
]
<<
8
)
|
p_data
->
p_
demux
_start
[
3
];
if
(
i_code
<=
0x1BC
)
{
switch
(
i_code
)
...
...
@@ -811,12 +811,12 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
mtime_t
scr_time
;
u32
i_mux_rate
;
if
(
(
p_data
->
p_
payload
_start
[
4
]
&
0xC0
)
==
0x40
)
if
(
(
p_data
->
p_
demux
_start
[
4
]
&
0xC0
)
==
0x40
)
{
/* MPEG-2 */
byte_t
p_header
[
14
];
byte_t
*
p_byte
;
p_byte
=
p_data
->
p_
payload
_start
;
p_byte
=
p_data
->
p_
demux
_start
;
if
(
MoveChunk
(
p_header
,
&
p_data
,
&
p_byte
,
14
)
!=
14
)
{
...
...
@@ -848,7 +848,7 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
/* MPEG-1 SCR is like PTS. */
byte_t
p_header
[
12
];
byte_t
*
p_byte
;
p_byte
=
p_data
->
p_
payload
_start
;
p_byte
=
p_data
->
p_
demux
_start
;
if
(
MoveChunk
(
p_header
,
&
p_data
,
&
p_byte
,
12
)
!=
12
)
{
...
...
@@ -951,7 +951,7 @@ void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data )
es_ts_data_t
*
p_es_demux
=
NULL
;
pgrm_ts_data_t
*
p_pgrm_demux
=
NULL
;
#define p (p_data->p_
buffer
)
#define p (p_data->p_
demux_start
)
/* Extract flags values from TS common header. */
i_pid
=
((
p
[
1
]
&
0x1F
)
<<
8
)
|
p
[
2
];
b_unit_start
=
(
p
[
1
]
&
0x40
);
...
...
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