summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-03-23 07:43:31 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-03-23 07:43:31 +0000
commitf6329a75d8199779357f92959f216f2ab4ddcb8e (patch)
treead00c35edeaedc565c4c93244620bf316ed2235f /libmpdemux
parent882fe89f99c50ad111318cd8b430e303e537a462 (diff)
downloadmpv-f6329a75d8199779357f92959f216f2ab4ddcb8e.tar.bz2
mpv-f6329a75d8199779357f92959f216f2ab4ddcb8e.tar.xz
consider parse random_access_point from the adaption_field to determine if the payload is an access point (for SL)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14993 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_ts.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c
index b82439ac7d..a2612efb7b 100644
--- a/libmpdemux/demux_ts.c
+++ b/libmpdemux/demux_ts.c
@@ -1047,7 +1047,7 @@ static int mp4_parse_sl_packet(pmt_t *pmt, uint8_t *buf, uint16_t packet_len, in
if(sl->random_accesspoint)
rap_flag = getbits(buf, n++, 1);
- if((rap_flag || sl->random_accesspoint_only) || (!sl->random_accesspoint && !sl->random_accesspoint_only))
+ if(rap_flag || sl->random_accesspoint_only)
pes_es->is_synced = 1;
n += sl->au_seqnum_len;
@@ -2364,7 +2364,7 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet,
demux_packet_t **dp = NULL;
int *dp_offset = 0, *buffer_size = 0;
int32_t progid, pid_type, bad, ts_error;
- int junk = 0;
+ int junk = 0, rap_flag = 0;
pmt_t *pmt;
@@ -2374,6 +2374,7 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet,
ds = (demux_stream_t*) NULL;
dp = (demux_packet_t **) NULL;
dp_offset = buffer_size = NULL;
+ rap_flag = 0;
junk = priv->ts.packet_size - TS_PACKET_SIZE;
buf_size = priv->ts.packet_size - junk;
@@ -2430,33 +2431,29 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet,
bad = ts_error; // || (! cc_ok);
- if(! bad)
+ afc = (packet[3] >> 4) & 3;
+ if(afc > 1)
+ {
+ int c;
+ c = stream_read_char(stream);
+ buf_size--;
+ rap_flag = stream_read_char(stream) & 0x40;
+ buf_size--;
+
+ c = min(c-1, buf_size);
+ stream_skip(stream, c);
+ buf_size -= c;
+ if(buf_size == 0)
+ continue;
+ }
+
+ if(! (afc % 2)) //no payload in this TS packet
{
- // skip adaptation field, but only if cc_ok is not corrupt,
- //otherwise we may throw away good data
- afc = (packet[3] >> 4) & 3;
- if(! (afc % 2)) //no payload in this TS packet
- {
- stream_skip(stream, buf_size-1+junk);
- continue;
- }
-
- if(afc == 3)
- {
- int c;
- c = stream_read_char(stream);
- buf_size--;
-
- c = min(c, buf_size);
- stream_skip(stream, c);
- buf_size -= c;
- if(buf_size == 0)
- continue;
-
- afc = c + 1;
- }
+ stream_skip(stream, buf_size-1+junk);
+ continue;
}
- else
+
+ if(bad)
{
// logically this packet should be dropped, but if I do it
// certain streams play corrupted. Maybe the decoders know
@@ -2652,7 +2649,7 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet,
len = pes_parse2(p, buf_size, es, pid_type, pmt, pid);
es->pid = tss->pid;
- tss->is_synced = es->is_synced;
+ tss->is_synced = es->is_synced | rap_flag;
if(es->type==SL_PES_STREAM && !tss->is_synced)
{