Merge pull request #95 from adamsutton/e183645081af85ae3a85c9cc43088d7a22b2b901
Expose/Extend DVB tables API
This commit is contained in:
commit
bc2053271c
2 changed files with 59 additions and 52 deletions
|
@ -209,6 +209,46 @@ typedef struct th_dvb_adapter {
|
||||||
|
|
||||||
} th_dvb_adapter_t;
|
} th_dvb_adapter_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DVB table
|
||||||
|
*/
|
||||||
|
typedef struct th_dvb_table {
|
||||||
|
/**
|
||||||
|
* Flags, must never be changed after creation.
|
||||||
|
* We inspect it without holding global_lock
|
||||||
|
*/
|
||||||
|
int tdt_flags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cycle queue
|
||||||
|
* Tables that did not get a fd or filter in hardware will end up here
|
||||||
|
* waiting for any other table to be received so it can reuse that fd.
|
||||||
|
* Only linked if fd == -1
|
||||||
|
*/
|
||||||
|
TAILQ_ENTRY(th_dvb_table) tdt_pending_link;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File descriptor for filter
|
||||||
|
*/
|
||||||
|
int tdt_fd;
|
||||||
|
|
||||||
|
LIST_ENTRY(th_dvb_table) tdt_link;
|
||||||
|
|
||||||
|
char *tdt_name;
|
||||||
|
|
||||||
|
void *tdt_opaque;
|
||||||
|
int (*tdt_callback)(th_dvb_mux_instance_t *tdmi, uint8_t *buf, int len,
|
||||||
|
uint8_t tableid, void *opaque);
|
||||||
|
|
||||||
|
|
||||||
|
int tdt_count;
|
||||||
|
int tdt_pid;
|
||||||
|
|
||||||
|
struct dmx_sct_filter_params *tdt_fparams;
|
||||||
|
|
||||||
|
int tdt_id;
|
||||||
|
|
||||||
|
} th_dvb_table_t;
|
||||||
|
|
||||||
|
|
||||||
extern struct th_dvb_adapter_queue dvb_adapters;
|
extern struct th_dvb_adapter_queue dvb_adapters;
|
||||||
|
@ -335,6 +375,17 @@ void dvb_table_add_default(th_dvb_mux_instance_t *tdmi);
|
||||||
|
|
||||||
void dvb_table_flush_all(th_dvb_mux_instance_t *tdmi);
|
void dvb_table_flush_all(th_dvb_mux_instance_t *tdmi);
|
||||||
|
|
||||||
|
struct dmx_sct_filter_params *dvb_fparams_alloc(void);
|
||||||
|
void
|
||||||
|
tdt_add(th_dvb_mux_instance_t *tdmi, struct dmx_sct_filter_params *fparams,
|
||||||
|
int (*callback)(th_dvb_mux_instance_t *tdmi, uint8_t *buf, int len,
|
||||||
|
uint8_t tableid, void *opaque), void *opaque,
|
||||||
|
const char *name, int flags, int pid, th_dvb_table_t *tdt);
|
||||||
|
|
||||||
|
#define TDT_CRC 0x1
|
||||||
|
#define TDT_QUICKREQ 0x2
|
||||||
|
#define TDT_CA 0x4
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Satellite configuration
|
* Satellite configuration
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -42,68 +42,19 @@
|
||||||
#include "notify.h"
|
#include "notify.h"
|
||||||
#include "cwc.h"
|
#include "cwc.h"
|
||||||
|
|
||||||
#define TDT_CRC 0x1
|
|
||||||
#define TDT_QUICKREQ 0x2
|
|
||||||
#define TDT_CA 0x4
|
|
||||||
|
|
||||||
static void dvb_table_add_pmt(th_dvb_mux_instance_t *tdmi, int pmt_pid);
|
static void dvb_table_add_pmt(th_dvb_mux_instance_t *tdmi, int pmt_pid);
|
||||||
|
|
||||||
static int tdt_id_tally;
|
static int tdt_id_tally;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
typedef struct th_dvb_table {
|
|
||||||
/**
|
|
||||||
* Flags, must never be changed after creation.
|
|
||||||
* We inspect it without holding global_lock
|
|
||||||
*/
|
|
||||||
int tdt_flags;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cycle queue
|
|
||||||
* Tables that did not get a fd or filter in hardware will end up here
|
|
||||||
* waiting for any other table to be received so it can reuse that fd.
|
|
||||||
* Only linked if fd == -1
|
|
||||||
*/
|
|
||||||
TAILQ_ENTRY(th_dvb_table) tdt_pending_link;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* File descriptor for filter
|
|
||||||
*/
|
|
||||||
int tdt_fd;
|
|
||||||
|
|
||||||
LIST_ENTRY(th_dvb_table) tdt_link;
|
|
||||||
|
|
||||||
char *tdt_name;
|
|
||||||
|
|
||||||
void *tdt_opaque;
|
|
||||||
int (*tdt_callback)(th_dvb_mux_instance_t *tdmi, uint8_t *buf, int len,
|
|
||||||
uint8_t tableid, void *opaque);
|
|
||||||
|
|
||||||
|
|
||||||
int tdt_count;
|
|
||||||
int tdt_pid;
|
|
||||||
|
|
||||||
struct dmx_sct_filter_params *tdt_fparams;
|
|
||||||
|
|
||||||
int tdt_id;
|
|
||||||
|
|
||||||
} th_dvb_table_t;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper for preparing a section filter parameter struct
|
* Helper for preparing a section filter parameter struct
|
||||||
*/
|
*/
|
||||||
static struct dmx_sct_filter_params *
|
struct dmx_sct_filter_params *
|
||||||
dvb_fparams_alloc(void)
|
dvb_fparams_alloc(void)
|
||||||
{
|
{
|
||||||
return calloc(1, sizeof(struct dmx_sct_filter_params));
|
return calloc(1, sizeof(struct dmx_sct_filter_params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -323,7 +274,7 @@ dvb_tdt_destroy(th_dvb_adapter_t *tda, th_dvb_mux_instance_t *tdmi,
|
||||||
/**
|
/**
|
||||||
* Add a new DVB table
|
* Add a new DVB table
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
tdt_add(th_dvb_mux_instance_t *tdmi, struct dmx_sct_filter_params *fparams,
|
tdt_add(th_dvb_mux_instance_t *tdmi, struct dmx_sct_filter_params *fparams,
|
||||||
int (*callback)(th_dvb_mux_instance_t *tdmi, uint8_t *buf, int len,
|
int (*callback)(th_dvb_mux_instance_t *tdmi, uint8_t *buf, int len,
|
||||||
uint8_t tableid, void *opaque), void *opaque,
|
uint8_t tableid, void *opaque), void *opaque,
|
||||||
|
@ -331,8 +282,13 @@ tdt_add(th_dvb_mux_instance_t *tdmi, struct dmx_sct_filter_params *fparams,
|
||||||
{
|
{
|
||||||
th_dvb_table_t *t;
|
th_dvb_table_t *t;
|
||||||
|
|
||||||
|
// Allow multiple entries per PID, but only one per callback/opaque instance
|
||||||
|
// TODO: this could mean reading the same data multiple times, and not
|
||||||
|
// sure how well this will work! I know Andreas has some thoughts on
|
||||||
|
// this
|
||||||
LIST_FOREACH(t, &tdmi->tdmi_tables, tdt_link) {
|
LIST_FOREACH(t, &tdmi->tdmi_tables, tdt_link) {
|
||||||
if(pid == t->tdt_pid) {
|
if(pid == t->tdt_pid &&
|
||||||
|
tdt->tdt_callback == callback && tdt->tdt_opaque == opaque) {
|
||||||
free(tdt);
|
free(tdt);
|
||||||
free(fparams);
|
free(fparams);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue