~ubuntu-branches/ubuntu/lucid/linux-rt/lucid

« back to all changes in this revision

Viewing changes to drivers/media/dvb/dvb-core/dvb_demux.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-08-05 23:00:52 UTC
  • Revision ID: james.westby@ubuntu.com-20090805230052-7xedvqcyk9dnnxb2
Tags: 2.6.31-1.1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
*/
39
39
// #define DVB_DEMUX_SECTION_LOSS_LOG
40
40
 
 
41
static int dvb_demux_tscheck;
 
42
module_param(dvb_demux_tscheck, int, 0644);
 
43
MODULE_PARM_DESC(dvb_demux_tscheck,
 
44
                "enable transport stream continuity and TEI check");
 
45
 
 
46
#define dprintk_tscheck(x...) do {                              \
 
47
                if (dvb_demux_tscheck && printk_ratelimit())    \
 
48
                        printk(x);                              \
 
49
        } while (0)
 
50
 
41
51
/******************************************************************************
42
52
 * static inlined helper functions
43
53
 ******************************************************************************/
376
386
        u16 pid = ts_pid(buf);
377
387
        int dvr_done = 0;
378
388
 
 
389
        if (dvb_demux_tscheck) {
 
390
                if (!demux->cnt_storage)
 
391
                        demux->cnt_storage = vmalloc(MAX_PID + 1);
 
392
 
 
393
                if (!demux->cnt_storage) {
 
394
                        printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n");
 
395
                        dvb_demux_tscheck = 0;
 
396
                        goto no_dvb_demux_tscheck;
 
397
                }
 
398
 
 
399
                /* check pkt counter */
 
400
                if (pid < MAX_PID) {
 
401
                        if (buf[1] & 0x80)
 
402
                                dprintk_tscheck("TEI detected. "
 
403
                                                "PID=0x%x data1=0x%x\n",
 
404
                                                pid, buf[1]);
 
405
 
 
406
                        if ((buf[3] & 0xf) != demux->cnt_storage[pid])
 
407
                                dprintk_tscheck("TS packet counter mismatch. "
 
408
                                                "PID=0x%x expected 0x%x "
 
409
                                                "got 0x%x\n",
 
410
                                                pid, demux->cnt_storage[pid],
 
411
                                                buf[3] & 0xf);
 
412
 
 
413
                        demux->cnt_storage[pid] = ((buf[3] & 0xf) + 1)&0xf;
 
414
                };
 
415
                /* end check */
 
416
        };
 
417
no_dvb_demux_tscheck:
 
418
 
379
419
        list_for_each_entry(feed, &demux->feed_list, list_head) {
380
420
                if ((feed->pid != pid) && (feed->pid != 0x2000))
381
421
                        continue;
1160
1200
        int i;
1161
1201
        struct dmx_demux *dmx = &dvbdemux->dmx;
1162
1202
 
 
1203
        dvbdemux->cnt_storage = NULL;
1163
1204
        dvbdemux->users = 0;
1164
1205
        dvbdemux->filter = vmalloc(dvbdemux->filternum * sizeof(struct dvb_demux_filter));
1165
1206
 
1226
1267
 
1227
1268
void dvb_dmx_release(struct dvb_demux *dvbdemux)
1228
1269
{
 
1270
        vfree(dvbdemux->cnt_storage);
1229
1271
        vfree(dvbdemux->filter);
1230
1272
        vfree(dvbdemux->feed);
1231
1273
}