/** list of PMTs in the last PAT seen */
MpegTSService **services;
- /** filter for the PAT */
- MpegTSFilter *pat_filter;
- /** filter for the PMT for the MPEG program number specified by req_sid */
- MpegTSFilter *pmt_filter;
/** MPEG program number of stream we want to decode */
int req_sid;
tss->end_of_section_reached = 1;
if (!tss->check_crc ||
av_crc(av_crc04C11DB7, -1, tss->section_buf, tss->section_h_size) == 0)
- tss->section_cb(tss->opaque, tss->section_buf, tss->section_h_size);
+ tss->section_cb(tss1, tss->section_buf, tss->section_h_size);
}
}
return service;
}
-static void pmt_cb(void *opaque, const uint8_t *section, int section_len)
+static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
{
- MpegTSContext *ts = opaque;
+ MpegTSContext *ts = filter->u.section_filter.opaque;
SectionHeader h1, *h = &h1;
PESContext *pes;
AVStream *st;
}
/* all parameters are there */
ts->stop_parse=1;
- mpegts_close_filter(ts, ts->pmt_filter);
- ts->pmt_filter = NULL;
+ mpegts_close_filter(ts, filter);
}
-static void pat_cb(void *opaque, const uint8_t *section, int section_len)
+static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
{
- MpegTSContext *ts = opaque;
+ MpegTSContext *ts = filter->u.section_filter.opaque;
SectionHeader h1, *h = &h1;
const uint8_t *p, *p_end;
int sid, pmt_pid;
/* NIT info */
} else {
if (ts->req_sid == sid) {
- ts->pmt_filter = mpegts_open_section_filter(ts, pmt_pid,
+ mpegts_open_section_filter(ts, pmt_pid,
pmt_cb, ts, 1);
goto found;
}
ts->stop_parse=1;
found:
- mpegts_close_filter(ts, ts->pat_filter);
- ts->pat_filter = NULL;
+ mpegts_close_filter(ts, filter);
}
/* add all services found in the PAT */
-static void pat_scan_cb(void *opaque, const uint8_t *section, int section_len)
+static void pat_scan_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
{
- MpegTSContext *ts = opaque;
+ MpegTSContext *ts = filter->u.section_filter.opaque;
SectionHeader h1, *h = &h1;
const uint8_t *p, *p_end;
int sid, pmt_pid;
ts->stop_parse = 1;
/* remove filter */
- mpegts_close_filter(ts, ts->pat_filter);
- ts->pat_filter = NULL;
+ mpegts_close_filter(ts, filter);
}
static void mpegts_set_service(MpegTSContext *ts, int sid)
{
ts->req_sid = sid;
- ts->pat_filter = mpegts_open_section_filter(ts, PAT_PID,
+ mpegts_open_section_filter(ts, PAT_PID,
pat_cb, ts, 1);
}
-static void sdt_cb(void *opaque, const uint8_t *section, int section_len)
+static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
{
- MpegTSContext *ts = opaque;
+ MpegTSContext *ts = filter->u.section_filter.opaque;
SectionHeader h1, *h = &h1;
const uint8_t *p, *p_end, *desc_list_end, *desc_end;
int onid, val, sid, desc_list_len, desc_tag, desc_len, service_type;
than nothing !) */
static void mpegts_scan_pat(MpegTSContext *ts)
{
- ts->pat_filter = mpegts_open_section_filter(ts, PAT_PID,
+ mpegts_open_section_filter(ts, PAT_PID,
pat_scan_cb, ts, 1);
}
}
/* return non zero if a packet could be constructed */
-static void mpegts_push_data(void *opaque,
+static void mpegts_push_data(MpegTSFilter *filter,
const uint8_t *buf, int buf_size, int is_start)
{
- PESContext *pes = opaque;
+ PESContext *pes = filter->u.pes_filter.opaque;
MpegTSContext *ts = pes->ts;
const uint8_t *p;
int len, code;
}
}
} else {
- tss->u.pes_filter.pes_cb(tss->u.pes_filter.opaque,
+ tss->u.pes_filter.pes_cb(tss,
p, p_end - p, is_start);
}
}