mirror of
https://github.com/DigitalDevices/dddvb.git
synced 2023-10-10 13:37:43 +02:00
fix tscheck and add option to not open dvr demux
This commit is contained in:
parent
bb5e9e7f39
commit
982dc4d366
58
lib/ddzap.c
58
lib/ddzap.c
@ -27,33 +27,28 @@ void proc_ts(int i, uint8_t *buf)
|
|||||||
uint16_t pid=0x1fff&((buf[1]<<8)|buf[2]);
|
uint16_t pid=0x1fff&((buf[1]<<8)|buf[2]);
|
||||||
uint8_t ccin = buf[3] & 0x1F;
|
uint8_t ccin = buf[3] & 0x1F;
|
||||||
|
|
||||||
if( buf[0] == 0x47 && (buf[1] & 0x80) == 0)
|
if (buf[0] == 0x47 && (buf[1] & 0x80) == 0) {
|
||||||
{
|
if( pid != 8191 ) {
|
||||||
if( pid != 8191 )
|
if (ccin & 0x10) {
|
||||||
{
|
if ( cc[pid]) {
|
||||||
if( ccin != 0 )
|
// TODO: 1 repetition allowed
|
||||||
{
|
if( ( ccin & 0x10 ) != 0 && (((cc[pid] + 1) & 0x0F) != (ccin & 0x0F)) )
|
||||||
if( cc[pid] != 0 )
|
cc_errors += 1;
|
||||||
{
|
}
|
||||||
// TODO: 1 repetition allowed
|
cc[pid] = ccin;
|
||||||
if( ( ccin & 0x10 ) != 0 && (((cc[pid] + 1) & 0x0F) != (ccin & 0x0F)) )
|
}
|
||||||
cc_errors += 1;
|
payload_packets += 1;
|
||||||
}
|
}
|
||||||
cc[pid] = ccin;
|
} else
|
||||||
}
|
packet_errors += 1;
|
||||||
payload_packets += 1;
|
|
||||||
}
|
if( (packets & 0x3FFF ) == 0)
|
||||||
}
|
{
|
||||||
else
|
printf("%s Packets: %12u non null %12u, errors: %12u, CC errors: %12u%s", line_start, packets, payload_packets, packet_errors, cc_errors, line_end);
|
||||||
packet_errors += 1;
|
fflush(stdout);
|
||||||
|
}
|
||||||
if( (packets & 0x3FFF ) == 0)
|
|
||||||
{
|
packets += 1;
|
||||||
printf("%s Packets: %12u non null %12u, errors: %12u, CC errors: %12u%s", line_start, packets, payload_packets, packet_errors, cc_errors, line_end);
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
packets += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TSBUFSIZE (100*188)
|
#define TSBUFSIZE (100*188)
|
||||||
@ -108,6 +103,7 @@ int main(int argc, char **argv)
|
|||||||
uint32_t id = DDDVB_UNDEF, ssi = DDDVB_UNDEF, num = DDDVB_UNDEF, source = 0;
|
uint32_t id = DDDVB_UNDEF, ssi = DDDVB_UNDEF, num = DDDVB_UNDEF, source = 0;
|
||||||
uint32_t mtype= DDDVB_UNDEF;
|
uint32_t mtype= DDDVB_UNDEF;
|
||||||
uint32_t verbosity = 0;
|
uint32_t verbosity = 0;
|
||||||
|
uint32_t get_ts = 1;
|
||||||
enum fe_code_rate fec = FEC_AUTO;
|
enum fe_code_rate fec = FEC_AUTO;
|
||||||
enum fe_delivery_system delsys = ~0;
|
enum fe_delivery_system delsys = ~0;
|
||||||
char *config = "config/";
|
char *config = "config/";
|
||||||
@ -137,11 +133,12 @@ int main(int argc, char **argv)
|
|||||||
{"open_dvr", no_argument, 0, 'o'},
|
{"open_dvr", no_argument, 0, 'o'},
|
||||||
{"tscheck", no_argument, 0, 't'},
|
{"tscheck", no_argument, 0, 't'},
|
||||||
{"tscheck_l", required_argument, 0, 'a'},
|
{"tscheck_l", required_argument, 0, 'a'},
|
||||||
|
{"nodvr", no_argument , 0, 'q'},
|
||||||
{"help", no_argument , 0, 'h'},
|
{"help", no_argument , 0, 'h'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
c = getopt_long(argc, argv,
|
c = getopt_long(argc, argv,
|
||||||
"c:i:f:s:d:p:hg:r:n:b:l:v:m:ota:",
|
"c:i:f:s:d:p:hg:r:n:b:l:v:m:ota:q",
|
||||||
long_options, &option_index);
|
long_options, &option_index);
|
||||||
if (c==-1)
|
if (c==-1)
|
||||||
break;
|
break;
|
||||||
@ -245,6 +242,9 @@ int main(int argc, char **argv)
|
|||||||
if (!strcmp(optarg, "v") || !strcmp(optarg, "V"))
|
if (!strcmp(optarg, "v") || !strcmp(optarg, "V"))
|
||||||
pol = 0;
|
pol = 0;
|
||||||
break;
|
break;
|
||||||
|
case 'q':
|
||||||
|
get_ts = 0;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
fprintf(fout,"ddzap [-d delivery_system] [-p polarity] [-c config_dir] [-f frequency(Hz)]\n"
|
fprintf(fout,"ddzap [-d delivery_system] [-p polarity] [-c config_dir] [-f frequency(Hz)]\n"
|
||||||
" [-b bandwidth(Hz)] [-s symbol_rate(Hz)]\n"
|
" [-b bandwidth(Hz)] [-s symbol_rate(Hz)]\n"
|
||||||
@ -283,6 +283,7 @@ int main(int argc, char **argv)
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
fprintf(fout,"dvbnum = %u\n", dd->dvbfe_num);
|
fprintf(fout,"dvbnum = %u\n", dd->dvbfe_num);
|
||||||
|
dddvb_get_ts(dd, get_ts);
|
||||||
|
|
||||||
if (num != DDDVB_UNDEF)
|
if (num != DDDVB_UNDEF)
|
||||||
fe = dddvb_fe_alloc_num(dd, delsys, num);
|
fe = dddvb_fe_alloc_num(dd, delsys, num);
|
||||||
@ -303,6 +304,7 @@ int main(int argc, char **argv)
|
|||||||
dddvb_set_id(&p, id);
|
dddvb_set_id(&p, id);
|
||||||
dddvb_set_ssi(&p, ssi);
|
dddvb_set_ssi(&p, ssi);
|
||||||
dddvb_dvb_tune(fe, &p);
|
dddvb_dvb_tune(fe, &p);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
uint8_t ts[188];
|
uint8_t ts[188];
|
||||||
|
@ -89,6 +89,7 @@ LIBDDDVB_EXPORTED struct dddvb *dddvb_init(char *config, uint32_t flags)
|
|||||||
|
|
||||||
dddvb_dvb_init(dd);
|
dddvb_dvb_init(dd);
|
||||||
global_dd = dd;
|
global_dd = dd;
|
||||||
|
dd->get_ts = 1;
|
||||||
fail:
|
fail:
|
||||||
pthread_mutex_unlock(&dddvb_mutex);
|
pthread_mutex_unlock(&dddvb_mutex);
|
||||||
return dd;
|
return dd;
|
||||||
|
@ -150,6 +150,9 @@ struct dddvb {
|
|||||||
|
|
||||||
struct dddvb_fe dvbfe[DDDVB_MAX_DVB_FE];
|
struct dddvb_fe dvbfe[DDDVB_MAX_DVB_FE];
|
||||||
struct dddvb_ca dvbca[DDDVB_MAX_DVB_CA];
|
struct dddvb_ca dvbca[DDDVB_MAX_DVB_CA];
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int get_ts:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
int dddvb_dvb_init(struct dddvb *dd);
|
int dddvb_dvb_init(struct dddvb *dd);
|
||||||
|
@ -531,7 +531,7 @@ static int tune(struct dddvb_fe *fe)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int open_dmx(struct dddvb_fe *fe)
|
int open_dmx(struct dddvb_fe *fe)
|
||||||
{
|
{
|
||||||
char fname[80];
|
char fname[80];
|
||||||
struct dmx_pes_filter_params pesFilterParams;
|
struct dmx_pes_filter_params pesFilterParams;
|
||||||
@ -623,10 +623,9 @@ void dddvb_fe_handle(struct dddvb_fe *fe)
|
|||||||
uint32_t newtune, count = 0, max, nolock = 0;
|
uint32_t newtune, count = 0, max, nolock = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
printf("fe_handle\n");
|
|
||||||
|
|
||||||
open_dmx(fe);
|
if (fe->dd->get_ts)
|
||||||
printf("fe_handle 2\n");
|
open_dmx(fe);
|
||||||
while (fe->state == 1) {
|
while (fe->state == 1) {
|
||||||
pthread_mutex_lock(&fe->mutex);
|
pthread_mutex_lock(&fe->mutex);
|
||||||
newtune = fe->n_tune;
|
newtune = fe->n_tune;
|
||||||
|
@ -64,6 +64,9 @@ LIBDDDVB_EXPORTED int dddvb_ca_write(struct dddvb *dd, uint32_t nr, uint8_t *buf
|
|||||||
LIBDDDVB_EXPORTED int dddvb_ca_read(struct dddvb *dd, uint32_t nr, uint8_t *buf, uint32_t len);
|
LIBDDDVB_EXPORTED int dddvb_ca_read(struct dddvb *dd, uint32_t nr, uint8_t *buf, uint32_t len);
|
||||||
LIBDDDVB_EXPORTED int dddvb_ca_set_pmts(struct dddvb *dd, uint32_t nr, uint8_t **pmts);
|
LIBDDDVB_EXPORTED int dddvb_ca_set_pmts(struct dddvb *dd, uint32_t nr, uint8_t **pmts);
|
||||||
|
|
||||||
|
static inline void dddvb_get_ts(struct dddvb *dd, uint32_t val) {
|
||||||
|
dd->get_ts = val;
|
||||||
|
};
|
||||||
|
|
||||||
static inline void dddvb_set_frequency(struct dddvb_params *p, uint32_t freq) {
|
static inline void dddvb_set_frequency(struct dddvb_params *p, uint32_t freq) {
|
||||||
p->param[PARAM_FREQ] = freq;
|
p->param[PARAM_FREQ] = freq;
|
||||||
|
Loading…
Reference in New Issue
Block a user