From b705af5710c05ca81a521fb990eb054318c2f945 Mon Sep 17 00:00:00 2001 From: nicodvb Date: Sat, 28 Oct 2006 08:54:31 +0000 Subject: slight simplifications git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20478 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_ts.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'libmpdemux/demux_ts.c') 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; -- cgit v1.2.3