* Assemble SI section
*/
void mpegts_psi_section_reassemble
- ( mpegts_psi_table_t *mt, const uint8_t *tsb, int crc,
+ ( mpegts_psi_table_t *mt, const char *logpref, const uint8_t *tsb, int crc,
mpegts_psi_section_callback_t cb, void *opaque );
/* PSI table parser helpers */
void dvb_table_parse_done ( mpegts_psi_table_t *mt);
void dvb_table_parse
- (mpegts_psi_table_t *mt, const uint8_t *tsb, int len,
- int crc, int full, mpegts_psi_parse_callback_t cb);
+ (mpegts_psi_table_t *mt, const char *logprefix,
+ const uint8_t *tsb, int len, int crc, int full,
+ mpegts_psi_parse_callback_t cb);
int dvb_table_append_crc32(uint8_t *dst, int off, int maxlen);
*/
static int
mpegts_psi_section_reassemble0
- ( mpegts_psi_table_t *mt, const uint8_t *data,
+ ( mpegts_psi_table_t *mt, const char *logpref,
+ const uint8_t *data,
int len, int start, int crc,
mpegts_psi_section_callback_t cb, void *opaque)
{
}
if(crc && tvh_crc32(p, tsize, 0xffffffff)) {
- if (tvhlog_limit(&mt->mt_err_log, 10))
- tvhwarn(mt->mt_name, "invalid checksum (len %i, errors %zi)",
- tsize, mt->mt_err_log.count);
+ if (tvhlog_limit(&mt->mt_err_log, 10)) {
+ tvhwarn(mt->mt_name, "%s: invalid checksum (len %i, errors %zi)",
+ logpref, tsize, mt->mt_err_log.count);
+ }
return -1;
}
*/
void
mpegts_psi_section_reassemble
- (mpegts_psi_table_t *mt, const uint8_t *tsb, int crc,
+ (mpegts_psi_table_t *mt, const char *logprefix,
+ const uint8_t *tsb, int crc,
mpegts_psi_section_callback_t cb, void *opaque)
{
int pusi = tsb[1] & 0x40;
if (cc & 0x10) {
if (mt->mt_sect.ps_cc != -1 && mt->mt_sect.ps_cc != (cc & 0x0f)) {
uint16_t pid = ((tsb[1] & 0x1f) << 8) | tsb[2];
- tvhdebug(mt->mt_name, "PID %04X CC error %d != %d", pid, cc & 0x0f, mt->mt_sect.ps_cc);
+ tvhdebug(mt->mt_name, "%s: PID %04X CC error %d != %d",
+ logprefix, pid, cc & 0x0f, mt->mt_sect.ps_cc);
mt->mt_sect.ps_lock = 0;
}
mt->mt_sect.ps_cc = (cc + 1) & 0x0f;
mt->mt_sect.ps_lock = 0;
return;
}
- mpegts_psi_section_reassemble0(mt, tsb + off, len, 0, crc, cb, opaque);
+ mpegts_psi_section_reassemble0(mt, logprefix, tsb + off, len, 0, crc, cb, opaque);
off += len;
}
}
while(off < 188) {
- r = mpegts_psi_section_reassemble0(mt, tsb + off, 188 - off, pusi, crc,
+ r = mpegts_psi_section_reassemble0(mt, logprefix, tsb + off, 188 - off, pusi, crc,
cb, opaque);
if(r < 0) {
mt->mt_sect.ps_lock = 0;
}
void dvb_table_parse
- (mpegts_psi_table_t *mt, const uint8_t *tsb, int len,
- int crc, int full, mpegts_psi_parse_callback_t cb)
+ (mpegts_psi_table_t *mt, const char *logprefix,
+ const uint8_t *tsb, int len,
+ int crc, int full, mpegts_psi_parse_callback_t cb)
{
const uint8_t *end;
struct psi_parse parse;
parse.full = full ? 3 : 0;
for (end = tsb + len; tsb < end; tsb += 188)
- mpegts_psi_section_reassemble(mt, tsb, crc,
+ mpegts_psi_section_reassemble(mt, logprefix, tsb, crc,
dvb_table_parse_cb, &parse);
}
}
static void
-mpegts_input_table_dispatch ( mpegts_mux_t *mm, const uint8_t *tsb, int tsb_len )
+mpegts_input_table_dispatch
+ ( mpegts_mux_t *mm, const char *logprefix, const uint8_t *tsb, int tsb_len )
{
int i, len = 0, c = 0;
const uint8_t *tsb2, *tsb2_end;
mt = vec[i];
if (!mt->mt_destroyed && mt->mt_pid == pid)
for (tsb2 = tsb, tsb2_end = tsb + tsb_len; tsb2 < tsb2_end; tsb2 += 188)
- mpegts_psi_section_reassemble((mpegts_psi_table_t *)mt, tsb2,
- mt->mt_flags & MT_CRC,
+ mpegts_psi_section_reassemble((mpegts_psi_table_t *)mt, logprefix,
+ tsb2, mt->mt_flags & MT_CRC,
mpegts_table_dispatch, mt);
mpegts_table_release(mt);
}
#if ENABLE_TSDEBUG
off_t tsdebug_pos;
#endif
+ char muxname[256];
if (mm == NULL || (mmi = mm->mm_active) == NULL)
return 0;
+ mpegts_mux_nice_name(mm, muxname, sizeof(muxname));
+
assert(mm == mmi->mmi_mux);
#if ENABLE_TSDEBUG
tsb2 < tsb2_end; tsb2 += 188) {
cc = tsb2[3] & 0x0f;
if (cc2 != 0xff && cc2 != cc) {
- tvhtrace("mpegts", "pid %04X cc err %2d != %2d", pid, cc, cc2);
+ tvhtrace("mpegts", "%s: pid %04X cc err %2d != %2d", muxname, pid, cc, cc2);
++mmi->tii_stats.cc;
}
cc2 = (cc + 1) & 0xF;
if (type & (MPS_TABLE | MPS_FTABLE)) {
if (!(tsb[1] & 0x80)) {
if (type & MPS_FTABLE)
- mpegts_input_table_dispatch(mm, tsb, llen);
+ mpegts_input_table_dispatch(mm, muxname, tsb, llen);
if (type & MPS_TABLE) {
mpegts_table_feed_t *mtf = malloc(sizeof(mpegts_table_feed_t)+llen);
mtf->mtf_len = llen;
{
mpegts_table_feed_t *mtf;
mpegts_input_t *mi = aux;
+ mpegts_mux_t *mm = NULL;
+ char muxname[256];
pthread_mutex_lock(&mi->mi_output_lock);
while (mi->mi_running) {
/* Process */
pthread_mutex_lock(&global_lock);
- if (mtf->mtf_mux && mtf->mtf_mux->mm_active)
- mpegts_input_table_dispatch(mtf->mtf_mux, mtf->mtf_tsb, mtf->mtf_len);
+ if (mm != mtf->mtf_mux) {
+ mm = mtf->mtf_mux;
+ if (mm)
+ mpegts_mux_nice_name(mm, muxname, sizeof(muxname));
+ }
+ if (mm && mm->mm_active)
+ mpegts_input_table_dispatch(mm, muxname, mtf->mtf_tsb, mtf->mtf_len);
pthread_mutex_unlock(&global_lock);
/* Cleanup */
/* PAT */
if (pid == DVB_PAT_PID) {
- dvb_table_parse(&pm->pm_pat, tsb, l, 1, 0, pass_muxer_pat_cb);
+ dvb_table_parse(&pm->pm_pat, "-", tsb, l, 1, 0, pass_muxer_pat_cb);
/* SDT */
} else if (pid == DVB_SDT_PID) {
- dvb_table_parse(&pm->pm_sdt, tsb, l, 1, 0, pass_muxer_sdt_cb);
+ dvb_table_parse(&pm->pm_sdt, "-", tsb, l, 1, 0, pass_muxer_sdt_cb);
/* EIT */
} else if (pid == DVB_EIT_PID) {
- dvb_table_parse(&pm->pm_eit, tsb, l, 1, 0, pass_muxer_eit_cb);
+ dvb_table_parse(&pm->pm_eit, "-", tsb, l, 1, 0, pass_muxer_eit_cb);
/* PMT */
} else {