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
2b947947
Commit
2b947947
authored
Jan 15, 2004
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/demux/mpeg/ts.c: better auto-detection of MPEG-TS streams.
parent
c04771fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
22 deletions
+44
-22
modules/demux/mpeg/system.h
modules/demux/mpeg/system.h
+2
-1
modules/demux/mpeg/ts.c
modules/demux/mpeg/ts.c
+42
-21
No files found.
modules/demux/mpeg/system.h
View file @
2b947947
...
...
@@ -2,7 +2,7 @@
* system.h: MPEG demultiplexing.
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: system.h,v 1.1
3 2004/01/09 00:30:29
gbazin Exp $
* $Id: system.h,v 1.1
4 2004/01/15 22:15:40
gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -30,6 +30,7 @@
*****************************************************************************/
#define TS_PACKET_SIZE 188
/* Size of a TS packet */
#define TS_SYNC_CODE 0x47
/* First byte of a TS packet */
#define TS_SYNC_CODES_MIN 5
/* Min number of sync codes to look for */
#define PSI_SECTION_SIZE 4096
/* Maximum size of a PSI section */
#define PAT_UNINITIALIZED (1 << 6)
...
...
modules/demux/mpeg/ts.c
View file @
2b947947
...
...
@@ -2,7 +2,7 @@
* mpeg_ts.c : Transport Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000, 2001, 2003 VideoLAN
* $Id: ts.c,v 1.4
4 2004/01/09 00:30:29
gbazin Exp $
* $Id: ts.c,v 1.4
5 2004/01/15 22:15:40
gbazin Exp $
*
* Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
...
...
@@ -156,42 +156,63 @@ static int Activate( vlc_object_t * p_this )
es_ts_data_t
*
p_demux_data
;
stream_ts_data_t
*
p_stream_data
;
byte_t
*
p_peek
;
vlc_bool_t
b_force
=
VLC_FALSE
;
int
i_sync_pos
;
/* Set the demux function */
p_input
->
pf_demux
=
Demux
;
p_input
->
pf_demux_control
=
demux_vaControlDefault
;
#if 0
/* XXX Unused already done by src/input.c */
/* Initialize access plug-in structures. */
if( p_input->i_mtu == 0 )
{
/* Improve speed. */
msg_Dbg( p_input, "using default mtu (%d) with bufsize (%d)\n",
p_input->i_mtu, INPUT_DEFAULT_BUFSIZE );
p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE;
}
#endif
/* Have a peep at the show. */
if
(
input_Peek
(
p_input
,
&
p_peek
,
1
)
<
1
)
/* Have a peep at the show */
if
(
input_Peek
(
p_input
,
&
p_peek
,
TS_PACKET_SIZE
)
<
TS_PACKET_SIZE
)
{
msg_Err
(
p_input
,
"cannot peek()"
);
return
-
1
;
return
VLC_EGENERIC
;
}
if
(
*
p_peek
!=
TS_SYNC_CODE
)
if
(
*
p_input
->
psz_demux
&&
(
!
strncmp
(
p_input
->
psz_demux
,
"ts"
,
3
)
||
!
strncmp
(
p_input
->
psz_demux
,
"ts_dvbpsi"
,
10
)
)
)
b_force
=
VLC_TRUE
;
/* In a TS_PACKET_SIZE buffer we should find a sync byte */
for
(
i_sync_pos
=
0
;
i_sync_pos
<
TS_PACKET_SIZE
&&
p_peek
[
i_sync_pos
]
!=
TS_SYNC_CODE
;
i_sync_pos
++
);
if
(
i_sync_pos
>=
TS_PACKET_SIZE
)
{
if
(
*
p_input
->
psz_demux
&&
(
!
strncmp
(
p_input
->
psz_demux
,
"ts"
,
3
)
||
!
strncmp
(
p_input
->
psz_demux
,
"ts_dvbpsi"
,
10
)
)
)
if
(
b_force
)
{
/* User forced */
msg_Err
(
p_input
,
"this does not look like a TS stream, continuing"
);
msg_Err
(
p_input
,
"this does not look like a TS stream, "
"continuing anyway"
);
}
else
{
msg_Warn
(
p_input
,
"TS module discarded (no sync)"
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
/* Now that we have the first TS_SYNC_CODE, check the following
* TS_SYNC_CODEs are where they are supposed to be (one byte sync code
* is not enough to ensure the sync). */
if
(
!
b_force
)
{
if
(
input_Peek
(
p_input
,
&
p_peek
,
TS_PACKET_SIZE
*
TS_SYNC_CODES_MIN
)
<
TS_PACKET_SIZE
*
TS_SYNC_CODES_MIN
)
{
msg_Err
(
p_input
,
"cannot peek()"
);
return
VLC_EGENERIC
;
}
for
(
;
i_sync_pos
<
TS_PACKET_SIZE
*
TS_SYNC_CODES_MIN
;
i_sync_pos
+=
TS_PACKET_SIZE
)
{
if
(
p_peek
[
i_sync_pos
]
!=
TS_SYNC_CODE
)
{
msg_Warn
(
p_input
,
"TS module discarded (lost sync)"
);
return
VLC_EGENERIC
;
}
}
}
...
...
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