summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_ts.c
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-10-28 08:54:31 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-10-28 08:54:31 +0000
commitb705af5710c05ca81a521fb990eb054318c2f945 (patch)
treed278a1c28780812e1f3da39b68960eca61399434 /libmpdemux/demux_ts.c
parentd9b8e39c751fd0b48617443ba1b12c568e5aa4dd (diff)
downloadmpv-b705af5710c05ca81a521fb990eb054318c2f945.tar.bz2
mpv-b705af5710c05ca81a521fb990eb054318c2f945.tar.xz
slight simplifications
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20478 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demux_ts.c')
-rw-r--r--libmpdemux/demux_ts.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c
index 7d4d2a3dfd..2e5e71c144 100644
--- a/libmpdemux/demux_ts.c
+++ b/libmpdemux/demux_ts.c
@@ -1282,6 +1282,7 @@ static int pes_parse2(unsigned char *buf, uint16_t packet_len, ES_stream_t *es,
es->payload_size -= header_len + 3;
+ es->is_synced = 1; //only for SL streams we have to make sure it's really true, see below
if (stream_id == 0xbd)
{
mp_msg(MSGT_DEMUX, MSGL_DBG3, "pes_parse2: audio buf = %02X %02X %02X %02X %02X %02X %02X %02X, 80: %d\n",
@@ -1388,6 +1389,7 @@ static int pes_parse2(unsigned char *buf, uint16_t packet_len, ES_stream_t *es,
{
int l;
+ es->is_synced = 0;
if(type_from_pmt != UNKNOWN) //MP4 A/V or SL
{
es->start = p;
@@ -1444,6 +1446,7 @@ static int pes_parse2(unsigned char *buf, uint16_t packet_len, ES_stream_t *es,
mp_msg(MSGT_DEMUX, MSGL_DBG2, "pes_parse2: unknown packet, id: %x\n", stream_id);
}
+ es->is_synced = 0;
return 0;
}
@@ -2619,8 +2622,10 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet,
}
+ if(is_start)
+ tss->is_synced = 1;
- if(((pid > 1) && (pid < 16)) || (pid == 8191)) //invalid pid
+ if((!is_start && !tss->is_synced) || ((pid > 1) && (pid < 16)) || (pid == 8191)) //invalid pid
{
stream_skip(stream, buf_size-1+junk);
continue;
@@ -2882,17 +2887,14 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet,
stream_skip(stream, junk);
len = pes_parse2(p, buf_size, es, pid_type, pmt, pid);
+ if(! len)
+ {
+ tss->is_synced = 0;
+ continue;
+ }
es->pid = tss->pid;
tss->is_synced |= es->is_synced || rap_flag;
- if(es->type==SL_PES_STREAM && !tss->is_synced)
- {
- if(probe)
- return 0;
- else
- continue;
- }
-
if(probe)
{
if(es->type == UNKNOWN)
@@ -2981,16 +2983,6 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet,
{
uint16_t sz;
- if((tss->type == UNKNOWN) || (tss->type==SL_PES_STREAM && !tss->is_synced))
- {
- stream_skip(stream, buf_size+junk);
- if(probe)
- return (is_video || is_audio || is_sub);
- else
- continue;
- }
-
-
es->pid = tss->pid;
es->type = tss->type;
es->subtype = tss->subtype;