bouquets: scan + bat tables - fix the scan end condition for bouquets
This commit is contained in:
parent
851982fdbf
commit
f60ecec797
4 changed files with 46 additions and 22 deletions
|
@ -110,6 +110,7 @@ typedef struct mpegts_table_state
|
|||
uint64_t extraid;
|
||||
int version;
|
||||
int complete;
|
||||
int working;
|
||||
uint32_t sections[8];
|
||||
RB_ENTRY(mpegts_table_state) link;
|
||||
} mpegts_table_state_t;
|
||||
|
@ -142,15 +143,16 @@ struct mpegts_table
|
|||
*/
|
||||
int mt_flags;
|
||||
|
||||
#define MT_CRC 0x0001
|
||||
#define MT_FULL 0x0002
|
||||
#define MT_QUICKREQ 0x0004
|
||||
#define MT_RECORD 0x0008
|
||||
#define MT_SKIPSUBS 0x0010
|
||||
#define MT_SCANSUBS 0x0020
|
||||
#define MT_FAST 0x0040
|
||||
#define MT_SLOW 0x0080
|
||||
#define MT_DEFER 0x0100
|
||||
#define MT_CRC 0x0001
|
||||
#define MT_FULL 0x0002
|
||||
#define MT_QUICKREQ 0x0004
|
||||
#define MT_FASTSWITCH 0x0008
|
||||
#define MT_RECORD 0x0010
|
||||
#define MT_SKIPSUBS 0x0020
|
||||
#define MT_SCANSUBS 0x0040
|
||||
#define MT_FAST 0x0080
|
||||
#define MT_SLOW 0x0100
|
||||
#define MT_DEFER 0x0200
|
||||
|
||||
/**
|
||||
* Cycle queue
|
||||
|
@ -184,6 +186,8 @@ struct mpegts_table
|
|||
#define MT_DEFER_OPEN_PID 1
|
||||
#define MT_DEFER_CLOSE_PID 2
|
||||
|
||||
int mt_working;
|
||||
|
||||
int mt_count;
|
||||
|
||||
int mt_pid;
|
||||
|
|
|
@ -1165,8 +1165,11 @@ dvb_nit_callback
|
|||
if (r == 0) {
|
||||
if (tableid == 0x4A) {
|
||||
if ((b = mt->mt_bat) != NULL) {
|
||||
if (!b->complete)
|
||||
if (!b->complete) {
|
||||
dvb_bat_completed(b, mt->mt_name, tableid, mm->mm_tsid, nbid, mm);
|
||||
mt->mt_working -= st->working;
|
||||
st->working = 0;
|
||||
}
|
||||
if (b->complete)
|
||||
dvb_bat_destroy_lists(mt);
|
||||
}
|
||||
|
@ -1205,6 +1208,11 @@ dvb_nit_callback
|
|||
TAILQ_INIT(&bi->services);
|
||||
LIST_INSERT_HEAD(&b->bats, bi, link);
|
||||
}
|
||||
if (!st->working) {
|
||||
st->working = 1;
|
||||
mt->mt_working++;
|
||||
mt->mt_flags |= MT_FASTSWITCH;
|
||||
}
|
||||
}
|
||||
|
||||
/* Network Descriptors */
|
||||
|
@ -1639,7 +1647,11 @@ dvb_fs_sdt_callback
|
|||
if (tableid != 0xBD)
|
||||
return -1;
|
||||
r = dvb_table_begin(mt, ptr, len, tableid, nbid, 7, &st, §, &last, &ver);
|
||||
if (r == 0) bouquet_completed(bq);
|
||||
if (r == 0) {
|
||||
mt->mt_working -= st->working;
|
||||
st->working = 0;
|
||||
bouquet_completed(bq);
|
||||
}
|
||||
if (r != 1) return r;
|
||||
if (len < 5) return -1;
|
||||
ptr += 5;
|
||||
|
@ -1751,6 +1763,12 @@ dvb_fs_sdt_callback
|
|||
idnode_changed(&s->s_id);
|
||||
service_refresh_channel((service_t*)s);
|
||||
}
|
||||
|
||||
if (!st->working) {
|
||||
st->working = 1;
|
||||
mt->mt_working++;
|
||||
mt->mt_flags |= MT_FASTSWITCH;
|
||||
}
|
||||
}
|
||||
|
||||
if (bq && bq->bq_saveflag)
|
||||
|
@ -1758,7 +1776,6 @@ dvb_fs_sdt_callback
|
|||
|
||||
/* End */
|
||||
return dvb_table_end(mt, st, sect);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -866,7 +866,7 @@ mpegts_mux_scan_done ( mpegts_mux_t *mm, const char *buf, int res )
|
|||
static void
|
||||
mpegts_mux_scan_timeout ( void *aux )
|
||||
{
|
||||
int c, q;
|
||||
int c, q, w;
|
||||
char buf[256];
|
||||
mpegts_mux_t *mm = aux;
|
||||
mpegts_table_t *mt;
|
||||
|
@ -884,17 +884,19 @@ mpegts_mux_scan_timeout ( void *aux )
|
|||
again:
|
||||
pthread_mutex_lock(&mm->mm_tables_lock);
|
||||
mpegts_table_consistency_check(mm);
|
||||
c = q = 0;
|
||||
c = q = w = 0;
|
||||
LIST_FOREACH(mt, &mm->mm_tables, mt_link) {
|
||||
if (!(mt->mt_flags & MT_QUICKREQ)) continue;
|
||||
if (!(mt->mt_flags & MT_QUICKREQ) && !mt->mt_working) continue;
|
||||
if (!mt->mt_count) {
|
||||
mpegts_table_grab(mt);
|
||||
pthread_mutex_unlock(&mm->mm_tables_lock);
|
||||
mpegts_table_destroy(mt);
|
||||
mpegts_table_release(mt);
|
||||
goto again;
|
||||
} else if (!mt->mt_complete) {
|
||||
} else if (!mt->mt_complete || mt->mt_working) {
|
||||
q++;
|
||||
if (mt->mt_working)
|
||||
w++;
|
||||
} else {
|
||||
c++;
|
||||
}
|
||||
|
@ -906,10 +908,10 @@ again:
|
|||
tvhinfo("mpegts", "%s - scan no data, failed", buf);
|
||||
mpegts_mux_scan_done(mm, buf, 0);
|
||||
|
||||
/* Pending tables (another 20s - bit arbitrary) */
|
||||
/* Pending tables (another 20s or 30s - bit arbitrary) */
|
||||
} else if (q) {
|
||||
tvhinfo("mepgts", "%s - scan needs more time", buf);
|
||||
gtimer_arm(&mm->mm_scan_timeout, mpegts_mux_scan_timeout, mm, 20);
|
||||
tvhinfo("mpegts", "%s - scan needs more time", buf);
|
||||
gtimer_arm(&mm->mm_scan_timeout, mpegts_mux_scan_timeout, mm, w ? 30 : 20);
|
||||
return;
|
||||
|
||||
/* Complete */
|
||||
|
|
|
@ -52,8 +52,9 @@ mpegts_table_fastswitch ( mpegts_mux_t *mm )
|
|||
|
||||
pthread_mutex_lock(&mm->mm_tables_lock);
|
||||
LIST_FOREACH(mt, &mm->mm_tables, mt_link) {
|
||||
if (!(mt->mt_flags & MT_QUICKREQ)) continue;
|
||||
if(!mt->mt_complete) {
|
||||
if (!(mt->mt_flags & MT_QUICKREQ) && !mt->mt_working)
|
||||
continue;
|
||||
if(!mt->mt_complete || mt->mt_working) {
|
||||
pthread_mutex_unlock(&mm->mm_tables_lock);
|
||||
return;
|
||||
}
|
||||
|
@ -126,7 +127,7 @@ mpegts_table_dispatch
|
|||
if(ret >= 0)
|
||||
mt->mt_count++;
|
||||
|
||||
if(!ret && mt->mt_flags & MT_QUICKREQ)
|
||||
if(!ret && mt->mt_flags & (MT_QUICKREQ|MT_FASTSWITCH))
|
||||
mpegts_table_fastswitch(mt->mt_mux);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue