[Redbutton-devel] SF.net SVN: redbutton: [162] redbutton-browser/trunk/mpegts.c
Brought to you by:
skilvington
|
From: <ski...@us...> - 2006-12-18 16:23:16
|
Revision: 162
http://svn.sourceforge.net/redbutton/?rev=162&view=rev
Author: skilvington
Date: 2006-12-18 08:23:09 -0800 (Mon, 18 Dec 2006)
Log Message:
-----------
how we would do CC checking
Modified Paths:
--------------
redbutton-browser/trunk/mpegts.c
Modified: redbutton-browser/trunk/mpegts.c
===================================================================
--- redbutton-browser/trunk/mpegts.c 2006-12-18 16:09:23 UTC (rev 161)
+++ redbutton-browser/trunk/mpegts.c 2006-12-18 16:23:09 UTC (rev 162)
@@ -50,6 +50,7 @@
int stop_parse; /* stop parsing loop */
PESContext *pids[NB_PID_MAX]; /* PIDs we are demuxing */
int is_start; /* is the current packet the first of a frame */
+ int last_cc; /* last Continuity Check value we saw (<0 => none seen yet) */
};
/* TS stream handling */
@@ -104,6 +105,9 @@
ctx->is_start = 0;
+ /* last continuity check value (-1 => CC always passes) */
+ ctx->last_cc = -1;
+
return ctx;
}
@@ -266,6 +270,7 @@
handle_packet(MpegTSContext *ctx, const uint8_t *packet)
{
PESContext *pes;
+ int cc, cc_ok;
int pid, afc;
const uint8_t *p, *p_end;
@@ -276,11 +281,14 @@
ctx->is_start = packet[1] & 0x40;
+ /* continuity check */
+ cc = (packet[3] & 0xf);
+ cc_ok = (ctx->last_cc < 0) || (((ctx->last_cc + 1) & 0x0f) == cc);
+ ctx->last_cc = cc;
#if 0
- /* continuity check (currently not used) */
- cc = (packet[3] & 0xf);
- cc_ok = (tss->last_cc < 0) || ((((tss->last_cc + 1) & 0x0f) == cc));
- tss->last_cc = cc;
+ /* skip until we find the next start packet */
+ if(!cc_ok && !ctx->is_start)
+ pes->state = MPEGTS_SKIP;
#endif
/* skip adaptation field */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|