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
afc46709
Commit
afc46709
authored
Dec 27, 2001
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Changed pf_read prototype and minor changes.
parent
abde4bbf
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
194 additions
and
267 deletions
+194
-267
include/config.h.in
include/config.h.in
+0
-7
include/input_ext-dec.h
include/input_ext-dec.h
+2
-2
include/input_ext-intf.h
include/input_ext-intf.h
+3
-5
include/input_ext-plugins.h
include/input_ext-plugins.h
+12
-17
include/modules.h
include/modules.h
+2
-3
plugins/dvd/input_dvd.c
plugins/dvd/input_dvd.c
+28
-29
plugins/mpeg_system/input_es.c
plugins/mpeg_system/input_es.c
+27
-31
plugins/mpeg_system/input_es.h
plugins/mpeg_system/input_es.h
+4
-3
plugins/mpeg_system/input_ps.c
plugins/mpeg_system/input_ps.c
+36
-28
plugins/mpeg_system/input_ps.h
plugins/mpeg_system/input_ps.h
+2
-52
plugins/mpeg_system/input_ts.c
plugins/mpeg_system/input_ts.c
+41
-41
plugins/mpeg_system/input_ts.h
plugins/mpeg_system/input_ts.h
+7
-2
plugins/vcd/input_vcd.c
plugins/vcd/input_vcd.c
+8
-13
src/input/input.c
src/input/input.c
+22
-34
No files found.
include/config.h.in
View file @
afc46709
...
...
@@ -97,13 +97,6 @@
/* Environment variable containing the memcpy method */
#define MEMCPY_METHOD_VAR "vlc_memcpy"
/*
* Decoders FIFO configuration
*/
/* Size of the FIFO. FIFO_SIZE+1 must be a power of 2 */
#define FIFO_SIZE 1023
/*
* Paths
*/
...
...
include/input_ext-dec.h
View file @
afc46709
/*****************************************************************************
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999-200
0
VideoLAN
* $Id: input_ext-dec.h,v 1.4
6 2001/12/27 01:49:34
massiot Exp $
* Copyright (C) 1999-200
1
VideoLAN
* $Id: input_ext-dec.h,v 1.4
7 2001/12/27 03:47:08
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
...
...
include/input_ext-intf.h
View file @
afc46709
...
...
@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.5
3 2001/12/12 13:48:09
massiot Exp $
* $Id: input_ext-intf.h,v 1.5
4 2001/12/27 03:47:08
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -26,7 +26,6 @@
/*
* Communication input -> interface
*/
#define INPUT_MAX_PLUGINS 1
/* FIXME ! */
#define REQUESTED_MPEG 1
#define REQUESTED_AC3 2
...
...
@@ -94,6 +93,7 @@ typedef struct es_descriptor_s
#define SPU_ES 0x02
#define NAV_ES 0x03
#define UNKNOWN_ES 0xFF
/*****************************************************************************
* pgrm_descriptor_t
*****************************************************************************
...
...
@@ -262,7 +262,7 @@ typedef struct input_thread_s
/* Read & Demultiplex */
int
(
*
pf_read
)(
struct
input_thread_s
*
,
struct
data_packet_s
*
pp_packets
[]
);
struct
data_packet_s
*
*
);
void
(
*
pf_demux
)(
struct
input_thread_s
*
,
struct
data_packet_s
*
);
...
...
@@ -288,8 +288,6 @@ typedef struct input_thread_s
int
i_handle
;
/* socket or file descriptor */
FILE
*
p_stream
;
/* if applicable */
void
*
p_handle
;
/* if i_handle isn't suitable */
int
i_read_once
;
/* number of packet read by
* pf_read once */
void
*
p_method_data
;
/* data of the packet manager */
void
*
p_plugin_data
;
/* data of the plugin */
...
...
include/input_ext-plugins.h
View file @
afc46709
...
...
@@ -3,7 +3,7 @@
* but exported to plug-ins
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_ext-plugins.h,v 1.1
2 2001/12/27 01:49:34
massiot Exp $
* $Id: input_ext-plugins.h,v 1.1
3 2001/12/27 03:47:08
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -27,10 +27,6 @@
*/
/* FIXME: you've gotta move this move this, you've gotta move this move this */
#define INPUT_READ_ONCE 7
/* We live in a world dominated by Ethernet. *
* Ethernet MTU is 1500 bytes, so in a UDP *
* packet we can put : 1500/188 = 7 TS *
* packets. Have a nice day and merry Xmas. */
#define PADDING_PACKET_SIZE 188
/* Size of the NULL packet inserted in case
* of data loss (this should be < 188). */
#define PADDING_PACKET_NUMBER 10
/* Number of padding packets top insert to
...
...
@@ -185,17 +181,16 @@ typedef struct input_buffers_s \
vlc_mutex_t lock; \
PACKETS_LIFO( pes_packet_t, pes ) \
PACKETS_LIFO( data_packet_t, data ) \
BUFFERS_LIFO(
data_buffer_t, buffers[NB_LIFO] )
\
BUFFERS_LIFO(
_data_buffer_t, buffers[NB_LIFO] )
\
size_t i_allocated; \
} input_buffers_t;
typedef
struct
data_buffer_s
typedef
struct
_
data_buffer_s
{
int
i_refcount
;
unsigned
int
i_size
;
struct
data_buffer_s
*
p_next
;
byte_t
payload_start
;
}
data_buffer_t
;
struct
_data_buffer_s
*
p_next
;
}
_data_buffer_t
;
/*****************************************************************************
...
...
@@ -282,8 +277,8 @@ static void * input_BuffersInit( void ) \
\
for( i = 0; i < NB_LIFO; i++ ) \
{ \
data_buffer_t * p_next;
\
data_buffer_t * p_buf = p_buffers->buffers[i].p_stack;
\
_data_buffer_t * p_next;
\
_data_buffer_t * p_buf = p_buffers->buffers[i].p_stack;
\
BUFFERS_END_BUFFERS_LOOP; \
} \
...
...
@@ -479,7 +474,7 @@ static data_packet_t * input_NewPacket( void * _p_buffers, size_t i_size ) \
BUFFERS_NEWPACKET_END )
#define DECLARE_BUFFERS_NEWPACKET_SHARED( FLAGS, NB_LIFO ) \
BUFFERS_NEWPACKET( FLAGS, NB_LIFO,
data_buffer_t, buffers,
\
BUFFERS_NEWPACKET( FLAGS, NB_LIFO,
_data_buffer_t, buffers,
\
BUFFERS_NEWPACKET_EXTRA_DECLARATION_SHARED, \
BUFFERS_NEWPACKET_EXTRA_SHARED, BUFFERS_NEWPACKET_END_SHARED )
...
...
@@ -490,7 +485,7 @@ static data_packet_t * input_NewPacket( void * _p_buffers, size_t i_size ) \
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->p_buffer;
\
\
/* Get rid of the data packet */
\
if( p_buffers->data.i_depth < DATA_CACHE_SIZE ) \
...
...
@@ -577,7 +572,7 @@ static void input_DeletePacket( void * _p_buffers, data_packet_t * p_data ) \
#define DECLARE_BUFFERS_DELETEPACKET_SHARED( FLAGS, NB_LIFO, \
DATA_CACHE_SIZE ) \
BUFFERS_DELETEPACKET( FLAGS, NB_LIFO, DATA_CACHE_SIZE,
data_buffer_t,
\
BUFFERS_DELETEPACKET( FLAGS, NB_LIFO, DATA_CACHE_SIZE,
_data_buffer_t,
\
buffers, BUFFERS_DELETEPACKET_EXTRA_SHARED )
/*****************************************************************************
...
...
@@ -731,7 +726,7 @@ static data_packet_t * input_ShareBuffer( void * _p_buffers, \
{ \
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;
\
_data_buffer_t * p_buf = (_data_buffer_t *)p_shared_data->p_buffer;
\
\
vlc_mutex_lock( &p_buffers->lock ); \
\
...
...
@@ -741,7 +736,7 @@ static data_packet_t * input_ShareBuffer( void * _p_buffers, \
/* Finish initialization of p_data */
\
p_data->p_buffer = p_shared_data->p_buffer; \
p_data->p_demux_start = p_data->p_payload_start \
= p_shared_data->p_buffer + sizeof(
data_buffer_t );
\
= p_shared_data->p_buffer + sizeof(
_data_buffer_t );
\
p_data->p_payload_end = p_shared_data->p_buffer + p_buf->i_size; \
\
/* Update refcount */
\
...
...
include/modules.h
View file @
afc46709
...
...
@@ -2,7 +2,7 @@
* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.h,v 1.3
6 2001/12/09 17:01:35 sam
Exp $
* $Id: modules.h,v 1.3
7 2001/12/27 03:47:08 massiot
Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
...
...
@@ -125,8 +125,7 @@ typedef struct function_list_s
void
*
);
int
(
*
pf_read
)
(
struct
input_thread_s
*
,
struct
data_packet_s
*
pp_packets
[]
);
struct
data_packet_s
**
);
void
(
*
pf_demux
)(
struct
input_thread_s
*
,
struct
data_packet_s
*
);
...
...
plugins/dvd/input_dvd.c
View file @
afc46709
...
...
@@ -9,7 +9,7 @@
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.11
0 2001/12/27 01:49:34
massiot Exp $
* $Id: input_dvd.c,v 1.11
1 2001/12/27 03:47:08
massiot Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
...
...
@@ -92,7 +92,6 @@
/* how many blocks DVDRead will read in each loop */
#define DVD_BLOCK_READ_ONCE 64
#define DVD_DATA_READ_ONCE (4 * DVD_BLOCK_READ_ONCE)
/*****************************************************************************
* Local prototypes
...
...
@@ -221,11 +220,8 @@ static void DVDInit( input_thread_t * p_input )
return
;
}
/* We read DVD_BLOCK_READ_ONCE in each loop, so the input will receive
* DVD_DATA_READ_ONCE at most */
/* We read DVD_BLOCK_READ_ONCE in each loop */
p_dvd
->
i_block_once
=
DVD_BLOCK_READ_ONCE
;
/* this value mustn't be modifed */
p_input
->
i_read_once
=
DVD_DATA_READ_ONCE
;
/* Ifo allocation & initialisation */
if
(
IfoCreate
(
p_dvd
)
<
0
)
...
...
@@ -832,14 +828,14 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
/*****************************************************************************
* DVDRead: reads data packets into the netlist.
*****************************************************************************
* Returns -1 in case of error, 0 i
f everything went well, and 1 in case
of
*
EOF
.
* Returns -1 in case of error, 0 i
n case of EOF, otherwise the number
of
*
packets
.
*****************************************************************************/
static
int
DVDRead
(
input_thread_t
*
p_input
,
data_packet_t
**
pp_
packets
)
data_packet_t
**
pp_
data
)
{
thread_dvd_data_t
*
p_dvd
;
struct
iovec
p_vec
[
DVD_
DATA
_READ_ONCE
];
struct
iovec
p_vec
[
DVD_
BLOCK
_READ_ONCE
];
u8
*
pi_cur
;
int
i_block_once
;
int
i_packet_size
;
...
...
@@ -853,6 +849,8 @@ static int DVDRead( input_thread_t * p_input,
p_dvd
=
(
thread_dvd_data_t
*
)
p_input
->
p_plugin_data
;
*
pp_data
=
NULL
;
b_eoc
=
0
;
i_sector
=
p_dvd
->
i_title_start
+
p_dvd
->
i_sector
;
i_block_once
=
p_dvd
->
i_end_sector
-
p_dvd
->
i_sector
+
1
;
...
...
@@ -869,7 +867,6 @@ static int DVDRead( input_thread_t * p_input,
/* Find cell index in adress map */
if
(
DVDFindSector
(
p_dvd
)
<
0
)
{
pp_packets
[
0
]
=
NULL
;
intf_ErrMsg
(
"dvd error: can't find next cell"
);
return
1
;
}
...
...
@@ -917,8 +914,8 @@ intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_o
*/
/* Get iovecs */
p_data
=
input_BuffersToIO
(
p_input
->
p_method_data
,
p_vec
,
DVD_DATA
_READ_ONCE
);
*
pp_data
=
p_data
=
input_BuffersToIO
(
p_input
->
p_method_data
,
p_vec
,
DVD_BLOCK
_READ_ONCE
);
if
(
p_data
==
NULL
)
{
...
...
@@ -944,7 +941,7 @@ intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_o
{
pi_cur
=
(
u8
*
)
p_vec
[
i_iovec
].
iov_base
+
i_pos
;
/*
d
efault header */
/*
D
efault header */
if
(
U32_AT
(
pi_cur
)
!=
0x1BA
)
{
/* That's the case for all packets, except pack header. */
...
...
@@ -958,30 +955,32 @@ intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_o
if
(
i_pos
!=
0
)
{
pp_packets
[
i_packet
]
=
input_ShareBuffer
(
p_input
->
p_method_data
,
p_current
);
*
pp_data
=
input_ShareBuffer
(
p_input
->
p_method_data
,
p_current
);
}
else
{
pp_packets
[
i_packet
]
=
p_data
;
*
pp_data
=
p_data
;
p_data
=
p_data
->
p_next
;
}
pp_packets
[
i_packet
]
->
p_payload_start
=
pp_packets
[
i_packet
]
->
p_demux_start
=
pp_packets
[
i_packet
]
->
p_demux_start
+
i_pos
;
(
*
pp_data
)
->
p_payload_start
=
(
*
pp_data
)
->
p_demux_start
=
(
*
pp_data
)
->
p_demux_start
+
i_pos
;
pp_packets
[
i_packet
]
->
p_payload_end
=
pp_packets
[
i_packet
]
->
p_payload_start
+
i_packet_size
+
6
;
(
*
pp_data
)
->
p_payload_end
=
(
*
pp_data
)
->
p_payload_start
+
i_packet_size
+
6
;
i_packet
++
;
i_pos
+=
i_packet_size
+
6
;
pp_data
=
&
(
*
pp_data
)
->
p_next
;
}
}
pp_packets
[
i_packet
]
=
NULL
;
p_input
->
pf_delete_packet
(
p_input
->
p_method_data
,
p_data
);
if
(
i_packet
!=
0
)
{
(
*
pp_data
)
->
p_next
=
NULL
;
}
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
...
...
@@ -1002,7 +1001,7 @@ intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_o
{
/* EOF */
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
return
1
;
return
0
;
}
/* EOT */
...
...
@@ -1010,17 +1009,17 @@ intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_o
p_dvd
->
i_title
++
;
DVDSetArea
(
p_input
,
p_input
->
stream
.
pp_areas
[
p_dvd
->
i_title
]
);
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
return
0
;
return
(
i_packet
)
;
}
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
if
(
i_read_blocks
=
=
i_block_once
)
if
(
i_read_blocks
!
=
i_block_once
)
{
return
0
;
return
-
1
;
}
return
-
1
;
return
(
i_packet
)
;
}
/*****************************************************************************
...
...
plugins/mpeg_system/input_es.c
View file @
afc46709
...
...
@@ -2,7 +2,7 @@
* input_es.c: Elementary Stream demux and packet management
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_es.c,v 1.
7 2001/12/27 01:49:34
massiot Exp $
* $Id: input_es.c,v 1.
8 2001/12/27 03:47:08
massiot Exp $
*
* Author: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -74,8 +74,7 @@
* Local prototypes
*****************************************************************************/
static
int
ESProbe
(
probedata_t
*
);
static
int
ESRead
(
struct
input_thread_s
*
,
data_packet_t
*
p_packets
[
INPUT_READ_ONCE
]
);
static
int
ESRead
(
struct
input_thread_s
*
,
data_packet_t
**
);
static
void
ESInit
(
struct
input_thread_s
*
);
static
void
ESEnd
(
struct
input_thread_s
*
);
static
void
ESSeek
(
struct
input_thread_s
*
,
off_t
);
...
...
@@ -188,56 +187,53 @@ static void ESEnd( input_thread_t * p_input )
/*****************************************************************************
* ESRead: reads data packets
*****************************************************************************
* Returns -1 in case of error, 0 i
f everything went well, and 1 in case
of
*
EOF
.
* Returns -1 in case of error, 0 i
n case of EOF, otherwise the number
of
*
packets
.
*****************************************************************************/
static
int
ESRead
(
input_thread_t
*
p_input
,
data_packet_t
*
pp_packets
[
INPUT_READ_ONCE
]
)
data_packet_t
*
*
pp_data
)
{
int
i_read
,
i_loop
;
struct
iovec
p_iovec
[
INPUT
_READ_ONCE
];
int
i_read
;
struct
iovec
p_iovec
[
ES
_READ_ONCE
];
data_packet_t
*
p_data
;
/* Get iovecs */
p_data
=
input_BuffersToIO
(
p_input
->
p_method_data
,
p_iovec
,
INPUT
_READ_ONCE
);
*
pp_data
=
p_data
=
input_BuffersToIO
(
p_input
->
p_method_data
,
p_iovec
,
ES
_READ_ONCE
);
if
(
p_data
==
NULL
)
{
return
(
-
1
);
}
memset
(
pp_packets
,
0
,
INPUT_READ_ONCE
*
sizeof
(
data_packet_t
*
)
);
i_read
=
readv
(
p_input
->
i_handle
,
p_iovec
,
INPUT_READ_ONCE
);
i_read
=
readv
(
p_input
->
i_handle
,
p_iovec
,
ES_READ_ONCE
);
if
(
i_read
==
-
1
)
{
intf_ErrMsg
(
"input error: ES readv error"
);
p_input
->
pf_delete_packet
(
p_input
->
p_method_data
,
p_data
);
return
(
-
1
);
}
p_input
->
stream
.
p_selected_area
->
i_tell
+=
i_read
;
i_read
/=
ES_PACKET_SIZE
;
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
;
pp_packets
[
i_loop
]
->
p_next
=
NULL
;
}
/* Delete remaining packets */
input_DeletePacket
(
p_input
->
p_method_data
,
p_data
);
for
(
;
i_loop
<
INPUT_READ_ONCE
;
i_loop
++
)
if
(
i_read
!=
ES_READ_ONCE
)
{
pp_packets
[
i_loop
]
=
NULL
;
}
/* We got fewer packets than wanted. Give remaining packets
* back to the buffer allocator. */
int
i_loop
;
/* EOF */
if
(
i_read
==
0
&&
p_input
->
stream
.
b_seekable
)
{
return
(
1
);
for
(
i_loop
=
0
;
i_loop
+
1
<
i_read
;
i_loop
++
)
{
p_data
=
p_data
->
p_next
;
}
p_input
->
pf_delete_packet
(
p_input
->
p_method_data
,
p_data
->
p_next
);
if
(
i_read
!=
0
)
{
p_data
->
p_next
=
NULL
;
}
}
p_input
->
stream
.
p_selected_area
->
i_tell
+=
i_read
;
return
(
0
);
return
(
i_read
);
}
/*****************************************************************************
...
...
plugins/mpeg_system/input_es.h
View file @
afc46709
...
...
@@ -2,9 +2,9 @@
* input_es.h: thread structure of the ES plugin
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_es.h,v 1.
2 2001/12/12 17:41:15
massiot Exp $
* $Id: input_es.h,v 1.
3 2001/12/27 03:47:09
massiot Exp $
*
* Authors:
* Authors:
Christophe Massiot <massiot@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -22,4 +22,5 @@
*****************************************************************************/
#define ES_PACKET_SIZE 2048
#define MAX_PACKETS_IN_FIFO 14
#define ES_READ_ONCE 50
#define MAX_PACKETS_IN_FIFO 50
plugins/mpeg_system/input_ps.c
View file @
afc46709
...
...
@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_ps.c,v 1.
7 2001/12/27 01:49:34
massiot Exp $
* $Id: input_ps.c,v 1.
8 2001/12/27 03:47:09
massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
...
...
@@ -85,8 +85,7 @@ static __inline__ off_t fseeko( FILE *p_file, off_t i_offset, int i_pos )
* Local prototypes
*****************************************************************************/
static
int
PSProbe
(
probedata_t
*
);
static
int
PSRead
(
struct
input_thread_s
*
,
data_packet_t
*
p_packets
[
INPUT_READ_ONCE
]
);
static
int
PSRead
(
struct
input_thread_s
*
,
data_packet_t
**
);
static
void
PSInit
(
struct
input_thread_s
*
);
static
void
PSEnd
(
struct
input_thread_s
*
);
static
int
PSSetProgram
(
struct
input_thread_s
*
,
pgrm_descriptor_t
*
);
...
...
@@ -210,12 +209,22 @@ static void PSInit( input_thread_t * p_input )
while
(
!
p_input
->
b_die
&&
!
p_input
->
b_error
&&
!
p_demux_data
->
b_has_PSM
)
{
int
i_result
,
i
;
data_packet_t
*
pp_packets
[
INPUT_READ_ONCE
];
int
i_result
;
data_packet_t
*
p_data
;
data_packet_t
*
p_saved_data
;
i_result
=
PSRead
(
p_input
,
pp_packets
);
i_result
=
PSRead
(
p_input
,
&
p_data
);
p_saved_data
=
p_data
;
if
(
i_result
==
1
)
while
(
p_data
!=
NULL
)
{
input_ParsePS
(
p_input
,
p_data
);
p_data
=
p_data
->
p_next
;
}
p_input
->
pf_delete_packet
(
p_input
->
p_method_data
,
p_saved_data
);
if
(
i_result
==
0
)
{
/* EOF */
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
...
...
@@ -229,13 +238,6 @@ static void PSInit( input_thread_t * p_input )
break
;
}
for
(
i
=
0
;
i
<
INPUT_READ_ONCE
&&
pp_packets
[
i
]
!=
NULL
;
i
++
)
{
/* FIXME: use i_p_config_t */
input_ParsePS
(
p_input
,
pp_packets
[
i
]
);
p_input
->
pf_delete_packet
(
p_input
->
p_method_data
,
pp_packets
[
i
]
);
}
/* File too big. */
if
(
p_input
->
stream
.
p_selected_area
->
i_tell
>
INPUT_PREPARSE_LENGTH
)
...
...
@@ -361,7 +363,7 @@ static __inline__ int SafeRead( input_thread_t * p_input, byte_t * p_buffer,
{
if
(
feof
(
p_input
->
p_stream
)
)
{
return
(
1
);
return
(
0
);
}
if
(
(
i_error
=
ferror
(
p_input
->
p_stream
))
)
...
...
@@ -373,28 +375,29 @@ static __inline__ int SafeRead( input_thread_t * p_input, byte_t * p_buffer,
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
p_input
->
stream
.
p_selected_area
->
i_tell
+=
i_len
;
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
return
(
0
);
return
(
i_len
);
}
/*****************************************************************************
* PSRead: reads data packets
*****************************************************************************
* Returns -1 in case of error, 0 i
f everything went well, and 1 in case
of
*
EOF
.
* Returns -1 in case of error, 0 i
n case of EOF, otherwise the number
of
*
packets
.
*****************************************************************************/
static
int
PSRead
(
input_thread_t
*
p_input
,
data_packet_t
*
pp_packets
[
INPUT_READ_ONCE
]
)
data_packet_t
*
*
pp_data
)
{
byte_t
p_header
[
6
];
data_packet_t
*
p_data
;
size_t
i_packet_size
;
int
i_packet
,
i_error
;
memset
(
pp_packets
,
0
,
INPUT_READ_ONCE
*
sizeof
(
data_packet_t
*
)
);
for
(
i_packet
=
0
;
i_packet
<
INPUT_READ_ONCE
;
i_packet
++
)
*
pp_data
=
NULL
;
for
(
i_packet
=
0
;
i_packet
<
PS_READ_ONCE
;
i_packet
++
)
{
/* Read what we believe to be a packet header. */
if
(
(
i_error
=
SafeRead
(
p_input
,
p_header
,
4
))
)
if
(
(
i_error
=
SafeRead
(
p_input
,
p_header
,
4
))
<=
0
)
{
return
(
i_error
);
}
...
...
@@ -423,7 +426,7 @@ static int PSRead( input_thread_t * p_input,
}
else
{
return
(
1
);
return
(
0
);
}
}
/* Packet found. */
...
...
@@ -434,7 +437,7 @@ static int PSRead( input_thread_t * p_input,
if
(
U32_AT
(
p_header
)
!=
0x1B9
)
{
/* The packet is at least 6 bytes long. */
if
(
(
i_error
=
SafeRead
(
p_input
,
p_header
+
4
,
2
))
)
if
(
(
i_error
=
SafeRead
(
p_input
,
p_header
+
4
,
2
))
<=
0
)
{
return
(
i_error
);
}
...
...
@@ -486,8 +489,10 @@ static int PSRead( input_thread_t * p_input,
/* Read the remaining of the packet. */
if
(
i_packet_size
&&
(
i_error
=
SafeRead
(
p_input
,
p_data
->
p_demux_start
+
6
,
i_packet_size
))
)
SafeRead
(
p_input
,
p_data
->
p_demux_start
+
6
,
i_packet_size
))
<=
0
)
{
p_input
->
pf_delete_packet
(
p_input
->
p_method_data
,
p_data
);
return
(
i_error
);
}
...
...
@@ -499,8 +504,10 @@ static int PSRead( input_thread_t * p_input,
/* MPEG-2 stuffing bytes */
byte_t
p_garbage
[
8
];
if
(
(
i_error
=
SafeRead
(
p_input
,
p_garbage
,
p_data
->
p_demux_start
[
13
]
&
0x7
))
)
p_data
->
p_demux_start
[
13
]
&
0x7
))
<=
0
)
{
p_input
->
pf_delete_packet
(
p_input
->
p_method_data
,
p_data
);
return
(
i_error
);
}
}
...
...
@@ -513,10 +520,11 @@ static int PSRead( input_thread_t * p_input,
}
/* Give the packet to the other input stages. */
pp_packets
[
i_packet
]
=
p_data
;
*
pp_data
=
p_data
;
pp_data
=
&
p_data
->
p_next
;
}
return
(
0
);
return
(
i_packet
+
1
);
}
/*****************************************************************************
...
...
plugins/mpeg_system/input_ps.h
View file @
afc46709
...
...
@@ -2,7 +2,7 @@
* input_ps.h: thread structure of the PS plugin
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ps.h,v 1.
1 2001/12/09 17:01:36 sam
Exp $
* $Id: input_ps.h,v 1.
2 2001/12/27 03:47:09 massiot
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
...
...
@@ -22,54 +22,4 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define DATA_CACHE_SIZE 150
#define PES_CACHE_SIZE 150
#define SMALL_CACHE_SIZE 150
#define LARGE_CACHE_SIZE 150
#define MAX_SMALL_SIZE 50 // frontier between small and large packets
typedef
struct
{
data_packet_t
**
p_stack
;
long
l_index
;
}
data_packet_cache_t
;
typedef
struct
{
pes_packet_t
**
p_stack
;
long
l_index
;
}
pes_packet_cache_t
;
typedef
struct
{
byte_t
*
p_data
;
long
l_size
;
}
packet_buffer_t
;
typedef
struct
{
packet_buffer_t
*
p_stack
;
long
l_index
;
}
small_buffer_cache_t
;
typedef
struct
{
packet_buffer_t
*
p_stack
;
long
l_index
;
}
large_buffer_cache_t
;
typedef
struct
{
vlc_mutex_t
lock
;
data_packet_cache_t
data
;
pes_packet_cache_t
pes
;
small_buffer_cache_t
smallbuffer
;
large_buffer_cache_t
largebuffer
;
}
packet_cache_t
;
#define PS_READ_ONCE 50
plugins/mpeg_system/input_ts.c
View file @
afc46709
...
...
@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_ts.c,v 1.
6 2001/12/27 01:49:34
massiot Exp $
* $Id: input_ts.c,v 1.
7 2001/12/27 03:47:09
massiot Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
...
...
@@ -88,8 +88,7 @@
static
int
TSProbe
(
probedata_t
*
);
static
void
TSInit
(
struct
input_thread_s
*
);
static
void
TSEnd
(
struct
input_thread_s
*
);
static
int
TSRead
(
struct
input_thread_s
*
,
data_packet_t
*
p_packets
[
INPUT_READ_ONCE
]
);
static
int
TSRead
(
struct
input_thread_s
*
,
data_packet_t
**
);
/*****************************************************************************
* Declare a buffer manager
...
...
@@ -244,17 +243,16 @@ static void TSEnd( input_thread_t * p_input )
/*****************************************************************************
* TSRead: reads data packets
*****************************************************************************
* Returns -1 in case of error, 0 i
f everything went well, and 1 in case
of
*
EOF
.
* Returns -1 in case of error, 0 i
n case of EOF, otherwise the number
of
*
packets
.
*****************************************************************************/
static
int
TSRead
(
input_thread_t
*
p_input
,
data_packet_t
*
pp_packets
[
INPUT_READ_ONCE
]
)
data_packet_t
*
*
pp_data
)
{
thread_ts_data_t
*
p_method
;
unsigned
int
i_loop
;
int
i_read
;
int
i_read
=
0
,
i_loop
;
int
i_data
=
1
;
struct
iovec
p_iovec
[
INPUT
_READ_ONCE
];
struct
iovec
p_iovec
[
TS
_READ_ONCE
];
data_packet_t
*
p_data
;
struct
timeval
timeout
;
...
...
@@ -269,9 +267,6 @@ static int TSRead( input_thread_t * p_input,
timeout
.
tv_sec
=
0
;
timeout
.
tv_usec
=
500000
;
/* Reset pointer table */
memset
(
pp_packets
,
0
,
INPUT_READ_ONCE
*
sizeof
(
data_packet_t
*
)
);
/* Fill if some data is available */
#if defined( WIN32 )
if
(
!
p_input
->
stream
.
b_pace_control
)
...
...
@@ -290,8 +285,8 @@ static int TSRead( input_thread_t * p_input,
if
(
i_data
)
{
/* Get iovecs */
p_data
=
input_BuffersToIO
(
p_input
->
p_method_data
,
p_iovec
,
INPUT
_READ_ONCE
);
*
pp_data
=
p_data
=
input_BuffersToIO
(
p_input
->
p_method_data
,
p_iovec
,
TS
_READ_ONCE
);
if
(
p_data
==
NULL
)
{
...
...
@@ -301,15 +296,15 @@ static int TSRead( input_thread_t * p_input,
#if defined( WIN32 )
if
(
p_input
->
stream
.
b_pace_control
)
{
i_read
=
readv
(
p_input
->
i_handle
,
p_iovec
,
INPUT
_READ_ONCE
);
i_read
=
readv
(
p_input
->
i_handle
,
p_iovec
,
TS
_READ_ONCE
);
}
else
{
i_read
=
readv_network
(
p_input
->
i_handle
,
p_iovec
,
INPUT
_READ_ONCE
,
p_method
);
TS
_READ_ONCE
,
p_method
);
}
#else
i_read
=
readv
(
p_input
->
i_handle
,
p_iovec
,
INPUT
_READ_ONCE
);
i_read
=
readv
(
p_input
->
i_handle
,
p_iovec
,
TS
_READ_ONCE
);
/* Shouldn't happen, but it does - at least under Linux */
if
(
(
i_read
==
-
1
)
&&
(
(
errno
==
EAGAIN
)
||
(
errno
=
EWOULDBLOCK
)
)
)
...
...
@@ -319,41 +314,46 @@ static int TSRead( input_thread_t * p_input,
i_read
=
0
;
}
#endif
/* check correct TS header */
for
(
i_loop
=
0
;
i_loop
*
TS_PACKET_SIZE
<
i_read
;
i_loop
++
)
{
pp_packets
[
i_loop
]
=
p_data
;
p_data
=
p_data
->
p_next
;
pp_packets
[
i_loop
]
->
p_next
=
NULL
;
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_demux_start
[
0
]
);
}
/* Delete remaining packets */
input_DeletePacket
(
p_input
->
p_method_data
,
p_data
);
for
(
;
i_loop
<
INPUT_READ_ONCE
;
i_loop
++
)
{
pp_packets
[
i_loop
]
=
NULL
;
}
/* Error */
if
(
i_read
==
-
1
)
{
intf_ErrMsg
(
"input error: TS readv error"
);
p_input
->
pf_delete_packet
(
p_input
->
p_method_data
,
p_data
);
return
(
-
1
);
}
p_input
->
stream
.
p_selected_area
->
i_tell
+=
i_read
;
i_read
/=
TS_PACKET_SIZE
;
/*
EOF
*/
if
(
i_read
==
0
&&
p_input
->
stream
.
b_seekable
)
/*
Check correct TS header
*/
for
(
i_loop
=
0
;
i_loop
+
1
<
i_read
;
i_loop
++
)
{
return
(
1
);
if
(
p_data
->
p_demux_start
[
0
]
!=
0x47
)
{
intf_ErrMsg
(
"input error: bad TS packet (starts with "
"0x%.2x, should be 0x47)"
,
p_data
->
p_demux_start
[
0
]
);
}
p_data
=
p_data
->
p_next
;
}
/* Last packet */
if
(
p_data
->
p_demux_start
[
0
]
!=
0x47
)
{
intf_ErrMsg
(
"input error: bad TS packet (starts with "
"0x%.2x, should be 0x47)"
,
p_data
->
p_demux_start
[
0
]
);
}
p_input
->
stream
.
p_selected_area
->
i_tell
+=
i_read
;
if
(
i_read
!=
TS_READ_ONCE
)
{
/* Delete remaining packets */
p_input
->
pf_delete_packet
(
p_input
->
p_method_data
,
p_data
->
p_next
);
if
(
i_read
!=
0
)
{
p_data
->
p_next
=
NULL
;
}
}
}
return
0
;
return
(
i_read
)
;
}
plugins/mpeg_system/input_ts.h
View file @
afc46709
...
...
@@ -2,7 +2,7 @@
* input_ts.h: structures of the input not exported to other modules
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ts.h,v 1.
3 2001/12/12 17:41:15
massiot Exp $
* $Id: input_ts.h,v 1.
4 2001/12/27 03:47:09
massiot Exp $
*
* Authors: Henri Fallon <henri@via.ecp.fr>
* Boris Dors <babal@via.ecp.fr>
...
...
@@ -22,7 +22,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define BUFFER_SIZE (7 * TS_PACKET_SIZE)
/* UDP packets contain 1500 bytes, that is 7 TS packets */
#define TS_READ_ONCE 7
#ifdef WIN32
# define BUFFER_SIZE (7 * TS_PACKET_SIZE)
#endif
/*****************************************************************************
* thread_ts_data_t: private input data
...
...
plugins/vcd/input_vcd.c
View file @
afc46709
...
...
@@ -243,8 +243,6 @@ static void VCDInit( input_thread_t * p_input )
intf_ErrMsg
(
"vcd error: could not read TOC"
);
}
p_input
->
i_read_once
=
VCD_DATA_ONCE
;
/* Set stream and area data */
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
...
...
@@ -396,10 +394,10 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
/*****************************************************************************
* VCDRead: reads from the VCD into PES packets.
*****************************************************************************
* Returns -1 in case of error, 0 i
f everything went well, and 1 in case
of
*
EOF
.
* Returns -1 in case of error, 0 i
n case of EOF, otherwise the number
of
*
packets
.
*****************************************************************************/
static
int
VCDRead
(
input_thread_t
*
p_input
,
data_packet_t
**
pp_
packets
)
static
int
VCDRead
(
input_thread_t
*
p_input
,
data_packet_t
**
pp_
data
)
{
thread_vcd_data_t
*
p_vcd
;
data_packet_t
*
p_data
;
...
...
@@ -413,6 +411,7 @@ static int VCDRead( input_thread_t * p_input, data_packet_t ** pp_packets )
p_vcd
=
(
thread_vcd_data_t
*
)
p_input
->
p_plugin_data
;
i_packet
=
0
;
*
pp_data
=
NULL
;
while
(
i_packet
<
VCD_DATA_ONCE
&&
!
p_vcd
->
b_end_of_track
)
...
...
@@ -489,10 +488,8 @@ static int VCDRead( input_thread_t * p_input, data_packet_t ** pp_packets )
break
;
}
#ifdef DEBUG
intf_DbgMsg
(
"i_index : %d
\n
"
,
i_index
);
intf_DbgMsg
(
"i_packet_size : %d
\n
"
,
i_packet_size
);
#endif
if
(
i_index
+
i_packet_size
>
BUFFER_SIZE
)
{
...
...
@@ -525,13 +522,11 @@ static int VCDRead( input_thread_t * p_input, data_packet_t ** pp_packets )
}
/* Give the packet to the other input stages. */
pp_packets
[
i_packet
]
=
p_data
;
i_packet
++
;
*
pp_data
=
p_data
;
pp_data
=
&
p_data
->
p_next
;
}
}
pp_packets
[
i_packet
]
=
NULL
;
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
p_input
->
stream
.
p_selected_area
->
i_tell
=
...
...
@@ -553,7 +548,7 @@ static int VCDRead( input_thread_t * p_input, data_packet_t ** pp_packets )
if
(
p_vcd
->
i_track
>=
p_vcd
->
nb_tracks
-
1
)
{
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
return
1
;
return
0
;
}
intf_WarnMsg
(
4
,
"vcd info: new title"
);
...
...
@@ -569,7 +564,7 @@ static int VCDRead( input_thread_t * p_input, data_packet_t ** pp_packets )
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
return
0
;
return
(
i_packet
+
1
)
;
}
/*****************************************************************************
...
...
src/input/input.c
View file @
afc46709
...
...
@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input.c,v 1.16
5 2001/12/12 02:13:50 sam
Exp $
* $Id: input.c,v 1.16
6 2001/12/27 03:47:09 massiot
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -120,9 +120,6 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
return
(
NULL
);
}
/* Packets read once */
p_input
->
i_read_once
=
INPUT_READ_ONCE
;
/* Initialize thread properties */
p_input
->
b_die
=
0
;
p_input
->
b_error
=
0
;
...
...
@@ -229,9 +226,6 @@ void input_DestroyThread( input_thread_t *p_input, int *pi_status )
*****************************************************************************/
static
void
RunThread
(
input_thread_t
*
p_input
)
{
int
i_error
,
i
;
data_packet_t
**
pp_packets
;
if
(
InitThread
(
p_input
)
)
{
/* If we failed, wait before we are killed, and exit */
...
...
@@ -242,22 +236,16 @@ static void RunThread( input_thread_t *p_input )
return
;
}
/* initialization is complete
d
*/
/* initialization is complete */
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
p_input
->
stream
.
b_changed
=
1
;
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
pp_packets
=
(
data_packet_t
**
)
malloc
(
p_input
->
i_read_once
*
sizeof
(
data_packet_t
*
)
);
if
(
pp_packets
==
NULL
)
{
intf_ErrMsg
(
"input error: out of memory"
);
free
(
pp_packets
);
p_input
->
b_error
=
1
;
}
while
(
!
p_input
->
b_die
&&
!
p_input
->
b_error
&&
!
p_input
->
b_eof
)
{
data_packet_t
*
p_data
;
int
i_count
,
i
;
p_input
->
c_loops
++
;
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
...
...
@@ -357,33 +345,33 @@ static void RunThread( input_thread_t *p_input )
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
i_
error
=
p_input
->
pf_read
(
p_input
,
pp_packets
);
i_
count
=
p_input
->
pf_read
(
p_input
,
&
p_data
);
/* Demultiplex read packets. */
for
(
i
=
0
;
i
<
p_input
->
i_read_once
&&
pp_packets
[
i
]
!=
NULL
;
i
++
)
while
(
p_data
!=
NULL
)
{
data_packet_t
*
p_next
=
p_data
->
p_next
;
p_data
->
p_next
=
NULL
;
p_input
->
stream
.
c_packets_read
++
;
p_input
->
pf_demux
(
p_input
,
pp_packets
[
i
]
);
p_input
->
pf_demux
(
p_input
,
p_data
);
p_data
=
p_next
;
}
if
(
i_
error
)
if
(
i_
count
==
0
&&
p_input
->
stream
.
b_seekable
)
{
if
(
i_error
==
1
)
{
/* End of file - we do not set b_die because only the
* interface is allowed to do so. */
intf_WarnMsg
(
3
,
"input: EOF reached"
);
p_input
->
b_eof
=
1
;
}
else
{
p_input
->
b_error
=
1
;
}
/* End of file - we do not set b_die because only the
* interface is allowed to do so. */
intf_WarnMsg
(
3
,
"input: EOF reached"
);
p_input
->
b_eof
=
1
;
}
else
if
(
i_count
<
0
)
{
p_input
->
b_error
=
1
;
}
}
free
(
pp_packets
);
if
(
p_input
->
b_error
||
p_input
->
b_eof
)
{
ErrorThread
(
p_input
);
...
...
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