Commit 77f1c3bd authored by Sebastian Ramacher's avatar Sebastian Ramacher

New upstream version 3.3

parent 3d516d94
Changes between 3.2 and -next
-----------------------------
* Add support for getting EIT present/following for chosen service in dvblastctl
* Add support for getting EIT schedule for chosen service in dvblastctl
* Switch default string charset to UTF-8//IGNORE
* Add --system-charset/-j option to dvblastctl
* Add --timeout/-t option to dvblastctl and set default to 15 seconds
* Add --lnb-type universal|old-sky option to dvblast
* Add support for multistream-id calculation using --multistream-id-pls-mode,
--multistream-id-pls-code and --multistream-id-is-id options
* Add --passthrough (to stdout) option
Changes between 3.1 and 3.2:
----------------------------
* Fix HEVC support
* Fix memory leak on loading the configuration
* Also remap ONID in EIT
* Fix segmentation fault when using output charset different from native
* Use default charset ISO 6937 for ASCII strings
* Add /charset= output option
* Fix EIT schedule signaling in SDT
Changes between 3.0 and 3.1:
----------------------------
* Print source address in UDP input
......
......@@ -40,9 +40,11 @@ for instance for DVB-S :
dvblast -f 11570000 -s 27500000 -v 18
This tunes to frequency 11570 MHz, symbol rate 27500, horizontal (-v 18). For
DVB-S2, you must indicate a modulation with -m qpsk or -m psk_8. For DVB-T,
a bandwidth (usually -b 8 for 8 MHz multiplexes).
This tunes to frequency 11570 MHz, symbol rate 27500, horizontal (-v 18).
For DVB-S2 you must indicate a modulation with -m qpsk|psk_8|apsk_16|apsk_32.
For DVB-T you must indicate a bandwidth, usually -b 8 for 8 MHz multiplexes.
Please note that frequencies are in kHz for DVB-S/S2/C, but Hz for DVB-T.
Symbol rates are in symbols/s, and bandwidths in MHz. If you have several
......
......@@ -224,6 +224,8 @@ static void comm_Read(struct ev_loop *loop, struct ev_io *w, int revents)
break;
}
case CMD_GET_EIT_PF:
case CMD_GET_EIT_SCHEDULE:
case CMD_GET_PMT:
{
if ( i_size < COMM_HEADER_SIZE + 2 )
......@@ -233,11 +235,19 @@ static void comm_Read(struct ev_loop *loop, struct ev_io *w, int revents)
}
uint16_t i_sid = (uint16_t)((p_input[0] << 8) | p_input[1]);
p_packed_section = demux_get_packed_PMT(i_sid, &i_packed_section_size);
if ( i_command == CMD_GET_EIT_PF ) {
i_answer = RET_EIT_PF;
p_packed_section = demux_get_packed_EIT_pf( i_sid, &i_packed_section_size );
} else if ( i_command == CMD_GET_EIT_SCHEDULE ) {
i_answer = RET_EIT_SCHEDULE;
p_packed_section = demux_get_packed_EIT_schedule( i_sid, &i_packed_section_size );
} else {
i_answer = RET_PMT;
p_packed_section = demux_get_packed_PMT(i_sid, &i_packed_section_size);
}
if ( p_packed_section && i_packed_section_size )
{
i_answer = RET_PMT;
i_answer_size = i_packed_section_size;
memcpy( p_answer + COMM_HEADER_SIZE, p_packed_section, i_packed_section_size );
free( p_packed_section );
......
......@@ -23,7 +23,7 @@
#include <bitstream/mpeg/psi.h>
#define COMM_HEADER_SIZE 8
#define COMM_BUFFER_SIZE (COMM_HEADER_SIZE + ((PSI_PRIVATE_MAX_SIZE + PSI_HEADER_SIZE) * (PSI_TABLE_MAX_SECTIONS / 2)))
#define COMM_BUFFER_SIZE (COMM_HEADER_SIZE + ((PSI_PRIVATE_MAX_SIZE + PSI_HEADER_SIZE) * PSI_TABLE_MAX_SECTIONS))
#define COMM_HEADER_MAGIC 0x49
#define COMM_MAX_MSG_CHUNK 4096
......@@ -47,6 +47,8 @@ typedef enum {
CMD_GET_PID = 16, /* arg: pid (uint16_t) */
CMD_MMI_SEND_TEXT = 17, /* arg: slot, en50221_mmi_object_t */
CMD_MMI_SEND_CHOICE = 18, /* arg: slot, en50221_mmi_object_t */
CMD_GET_EIT_PF = 19, /* arg: service_id (uint16_t) */
CMD_GET_EIT_SCHEDULE = 20, /* arg: service_id (uint16_t) */
} ctl_cmd_t;
typedef enum {
......@@ -65,6 +67,8 @@ typedef enum {
RET_PMT = 12,
RET_PIDS = 13,
RET_PID = 14,
RET_EIT_PF = 15,
RET_EIT_SCHEDULE = 16,
RET_HUH = 255,
} ctl_cmd_answer_t;
......
This diff is collapsed.
......@@ -52,6 +52,7 @@
#if DVBAPI_VERSION < 508
#define DTV_STREAM_ID 42
#define FE_CAN_MULTISTREAM 0x4000000
#define FE_CAN_TURBO_FEC 0x8000000
#endif
#define MAX_DELIVERY_SYSTEMS 20
......@@ -470,44 +471,69 @@ static int FrontendDoDiseqc(void)
fe_tone = b_tone ? SEC_TONE_ON : SEC_TONE_OFF;
/* Automatic mode. */
if ( i_frequency >= 950000 && i_frequency <= 2150000 )
if ( strcmp( psz_lnb_type, "universal" ) == 0 )
{
msg_Dbg( NULL, "frequency %d is in IF-band", i_frequency );
bis_frequency = i_frequency;
}
else if ( i_frequency >= 2500000 && i_frequency <= 2700000 )
{
msg_Dbg( NULL, "frequency %d is in S-band", i_frequency );
bis_frequency = 3650000 - i_frequency;
}
else if ( i_frequency >= 3400000 && i_frequency <= 4200000 )
{
msg_Dbg( NULL, "frequency %d is in C-band (lower)", i_frequency );
bis_frequency = 5150000 - i_frequency;
}
else if ( i_frequency >= 4500000 && i_frequency <= 4800000 )
{
msg_Dbg( NULL, "frequency %d is in C-band (higher)", i_frequency );
bis_frequency = 5950000 - i_frequency;
}
else if ( i_frequency >= 10700000 && i_frequency < 11700000 )
{
msg_Dbg( NULL, "frequency %d is in Ku-band (lower)",
i_frequency );
bis_frequency = i_frequency - 9750000;
/* Automatic mode. */
if ( i_frequency >= 950000 && i_frequency <= 2150000 )
{
msg_Dbg( NULL, "frequency %d is in IF-band", i_frequency );
bis_frequency = i_frequency;
}
else if ( i_frequency >= 2500000 && i_frequency <= 2700000 )
{
msg_Dbg( NULL, "frequency %d is in S-band", i_frequency );
bis_frequency = 3650000 - i_frequency;
}
else if ( i_frequency >= 3400000 && i_frequency <= 4200000 )
{
msg_Dbg( NULL, "frequency %d is in C-band (lower)", i_frequency );
bis_frequency = 5150000 - i_frequency;
}
else if ( i_frequency >= 4500000 && i_frequency <= 4800000 )
{
msg_Dbg( NULL, "frequency %d is in C-band (higher)", i_frequency );
bis_frequency = 5950000 - i_frequency;
}
else if ( i_frequency >= 10700000 && i_frequency < 11700000 )
{
msg_Dbg( NULL, "frequency %d is in Ku-band (lower)",
i_frequency );
bis_frequency = i_frequency - 9750000;
}
else if ( i_frequency >= 11700000 && i_frequency <= 13250000 )
{
msg_Dbg( NULL, "frequency %d is in Ku-band (higher)",
i_frequency );
bis_frequency = i_frequency - 10600000;
fe_tone = SEC_TONE_ON;
}
else
{
msg_Err( NULL, "frequency %d is out of any known band",
i_frequency );
exit(1);
}
}
else if ( i_frequency >= 11700000 && i_frequency <= 13250000 )
else if ( strcmp( psz_lnb_type, "old-sky" ) == 0 )
{
msg_Dbg( NULL, "frequency %d is in Ku-band (higher)",
i_frequency );
bis_frequency = i_frequency - 10600000;
fe_tone = SEC_TONE_ON;
if ( i_frequency >= 11700000 && i_frequency <= 13250000 )
{
msg_Dbg( NULL, "frequency %d is in Ku-band (higher)",
i_frequency );
bis_frequency = i_frequency - 11300000;
fe_tone = SEC_TONE_ON;
}
else
{
msg_Err( NULL, "frequency %d is out of any known band",
i_frequency );
exit(1);
}
}
else
{
msg_Err( NULL, "frequency %d is out of any known band",
i_frequency );
msg_Err( NULL, "lnb-type '%s' is not known. Valid type: universal old-sky",
psz_lnb_type );
exit(1);
}
......@@ -608,8 +634,8 @@ static int FrontendDoDiseqc(void)
msleep(100000); /* ... */
msg_Dbg( NULL, "configuring LNB to v=%d p=%d satnum=%x uncommitted=%x",
i_voltage, b_tone, i_satnum, i_uncommitted );
msg_Dbg( NULL, "configuring LNB to v=%d p=%d satnum=%x uncommitted=%x lnb-type=%s bis_frequency=%d",
i_voltage, b_tone, i_satnum, i_uncommitted, psz_lnb_type, bis_frequency );
return bis_frequency;
}
......@@ -809,6 +835,7 @@ static void FrontendInfo( struct dvb_frontend_info *info, uint32_t version,
FRONTEND_INFO( info->caps, FE_CAN_2G_MODULATION, "2G_MODULATION" )
#endif
FRONTEND_INFO( info->caps, FE_CAN_MULTISTREAM, "MULTISTREAM" )
FRONTEND_INFO( info->caps, FE_CAN_TURBO_FEC, "TURBO_FEC" )
FRONTEND_INFO( info->caps, FE_NEEDS_BENDING, "NEEDS_BENDING" )
FRONTEND_INFO( info->caps, FE_CAN_RECOVER, "FE_CAN_RECOVER" )
FRONTEND_INFO( info->caps, FE_CAN_MUTE_TS, "FE_CAN_MUTE_TS" )
......@@ -891,6 +918,12 @@ static struct dtv_properties dvbs_cmdseq = {
.props = dvbs_cmdargs
};
#define IDX_DVBS2_PILOT 6
#define IDX_DVBS2_ROLLOFF 7
#define IDX_DVBS2_STREAM_ID 8
/* Commands 0..5 are the same as dvbs_cmdargs */
/* Commands 6..8 are special for DVB-S2 */
static struct dtv_property dvbs2_cmdargs[] = {
{ .cmd = DTV_DELIVERY_SYSTEM, .u.data = SYS_DVBS2 },
{ .cmd = DTV_FREQUENCY, .u.data = 0 },
......@@ -898,9 +931,9 @@ static struct dtv_property dvbs2_cmdargs[] = {
{ .cmd = DTV_INVERSION, .u.data = INVERSION_AUTO },
{ .cmd = DTV_SYMBOL_RATE, .u.data = 27500000 },
{ .cmd = DTV_INNER_FEC, .u.data = FEC_AUTO },
{ .cmd = DTV_PILOT, .u.data = PILOT_AUTO },
{ .cmd = DTV_ROLLOFF, .u.data = ROLLOFF_AUTO },
{ .cmd = DTV_STREAM_ID, .u.data = 0 },
{ .cmd = DTV_PILOT, .u.data = PILOT_AUTO }, /* idx: 6 */
{ .cmd = DTV_ROLLOFF, .u.data = ROLLOFF_AUTO }, /* idx: 7 */
{ .cmd = DTV_STREAM_ID, .u.data = 0 }, /* idx: 8 */
{ .cmd = DTV_TUNE },
};
static struct dtv_properties dvbs2_cmdseq = {
......@@ -1011,10 +1044,8 @@ static struct dtv_properties isdbt_cmdseq = {
#define FEC_INNER 5
#define FEC_LP 6
#define GUARD 7
#define PILOT 7
#define TRANSMISSION 8
#define ROLLOFF 8
#define MIS 9
#define HIERARCHY 9
#define PLP_ID 10
......@@ -1276,9 +1307,9 @@ static void FrontendSet( bool b_init )
{
p = &dvbs2_cmdseq;
p->props[MODULATION].u.data = GetModulation();
p->props[PILOT].u.data = GetPilot();
p->props[ROLLOFF].u.data = GetRollOff();
p->props[MIS].u.data = i_mis;
p->props[IDX_DVBS2_PILOT].u.data = GetPilot();
p->props[IDX_DVBS2_ROLLOFF].u.data = GetRollOff();
p->props[IDX_DVBS2_STREAM_ID].u.data = i_mis;
}
else
p = &dvbs_cmdseq;
......@@ -1288,10 +1319,10 @@ static void FrontendSet( bool b_init )
p->props[FEC_INNER].u.data = GetFECInner(info.caps);
p->props[FREQUENCY].u.data = FrontendDoDiseqc();
msg_Dbg( NULL, "tuning DVB-S frontend to f=%d srate=%d inversion=%d fec=%d rolloff=%d modulation=%s pilot=%d mis=%d",
msg_Dbg( NULL, "tuning DVB-S frontend to f=%d srate=%d inversion=%d fec=%d rolloff=%d modulation=%s pilot=%d mis=%d /pls-mode: %s (%d) pls-code: %d is-id: %d /",
i_frequency, i_srate, i_inversion, i_fec, i_rolloff,
psz_modulation == NULL ? "legacy" : psz_modulation, i_pilot,
i_mis );
i_mis, psz_mis_pls_mode, i_mis_pls_mode, i_mis_pls_code, i_mis_is_id );
break;
case SYS_ATSC:
......
......@@ -73,6 +73,9 @@ Frontend frequency. If '\-' is specified instead of a numeric value,
the frontend will be not be tuned by dvblast and you should use external
tuning tool (szap) to tune it.
.TP
\fB\-8\fR, \fB\-\-lnb\-type\fR universal\|old\-sky
Choose LNB type. Default: 'universal' - Universal LNB ("Astra" LNB)
.TP
\fB\-F\fR, \fB\-\-fec\-inner\fR <FEC>
Forward Error Correction used by satellite (FEC Inner)
.br
......@@ -107,11 +110,23 @@ Port number for uncommitted DiSEqC switch (0: no uncommitted DiSEqC swtich, 1\-1
\fB\-K\fR, \fB\-\-fec-lp\fR
DVB-T low priority FEC (default auto)
.TP
\fB\-1\fR, \fB\-\-delsys\fR <delivery_system>
\fB\-5\fR, \fB\-\-delsys\fR <delivery_system>
Select delivery system. Possible values: DVBS|DVBS2|DVBC_ANNEX_A|DVBT|ATSC (default guessed)
.TP
\fB\-5\fR, \fB\-\-multistream\-id\fR <stream_id>
Set stream ID for multistream capable transponders. Value: 0-255 (default: 0)
\fB\-1\fR, \fB\-\-multistream\-id\fR <stream_id>
Set stream ID for multistream capable transponders. Value: 0-2147483648 (default: 0)
.TP
\fB\-\-multistream\-id\-pls\-mode\fR <ROOT|GOLD|COMBO>
Set PLS mode used in multistream-id calculation. Possible values are: ROOT GOLD and COMBO (default: ROOT).
If this option is set multistream-id option is overwritten.
.TP
\fB\-\-multistream\-id\-pls\-code\fR <0-262143>
Set PLS code used in multistream-id calculation. Possible values are in range 0..262143 (default: 0).
If this option is set multistream-id option is overwritten.
.TP
\fB\-\-multistream\-id\-is\-id\fR <0-255>
Set IS id used in multistream-id calculation. Possible values are in range 0..255 (default: 0).
If this option is set multistream-id option is overwritten.
.TP
\fB\-l\fR, \fB\-\-logger\fR
Send messages to syslog instead of stderr
......@@ -129,7 +144,7 @@ DVB-C qpsk|qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)
.br
DVB-T qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)
.br
DVB-S2 qpsk|psk_8 (default legacy DVB-S)
DVB-S2 qpsk|psk_8|apsk_16|apsk_32 (default legacy DVB-S)
.TP
\fB\-M\fR, \fB\-\-network-name\fR <name>
DVB network name to declare in the NIT
......
This diff is collapsed.
......@@ -23,6 +23,7 @@
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h> /* u_int16_t */
#include <netinet/udp.h>
#include <netinet/in.h>
#include <netinet/ip.h>
......@@ -220,6 +221,7 @@ extern int i_canum;
extern char *psz_delsys;
extern int i_dvr_buffer_size;
extern int i_frequency;
extern char *psz_lnb_type;
extern int i_srate;
extern int i_satnum;
extern int i_uncommitted;
......@@ -231,7 +233,15 @@ extern int i_bandwidth;
extern int i_inversion;
extern char *psz_modulation;
extern int i_pilot;
extern int i_mis;
/* Multistream settings */
extern int i_mis; /* Calculated from the three settings bellow, if they are set */
extern char *psz_mis_pls_mode; /* ROOT, GOLD, COMBO */
extern int i_mis_pls_mode; /* ROOT - 0, GOLD - 1, COMBO - 2 */
extern int i_mis_pls_code; /* 0 .. 262143 */
extern int i_mis_is_id; /* 0 .. 255 */
#define calc_multistream_id( pls_mode, pls_code, is_id ) ( pls_mode << 26 | pls_code << 8 | is_id )
extern int i_fec_lp;
extern int i_guard;
extern int i_transmission;
......@@ -341,6 +351,8 @@ uint8_t *demux_get_current_packed_CAT( unsigned int *pi_pack_size );
uint8_t *demux_get_current_packed_NIT( unsigned int *pi_pack_size );
uint8_t *demux_get_current_packed_SDT( unsigned int *pi_pack_size );
uint8_t *demux_get_packed_PMT( uint16_t service_id, unsigned int *pi_pack_size );
uint8_t *demux_get_packed_EIT_pf( uint16_t service_id, unsigned int *pi_pack_size );
uint8_t *demux_get_packed_EIT_schedule( uint16_t service_id, unsigned int *pi_pack_size );
void demux_get_PID_info( uint16_t i_pid, uint8_t *p_data );
void demux_get_PIDS_info( uint8_t *p_data );
......
......@@ -51,6 +51,7 @@
int i_verbose = 3;
int i_syslog = 0;
unsigned int i_timeout_seconds = 15;
print_type_t i_print_type = PRINT_TEXT;
mtime_t now;
......@@ -116,7 +117,7 @@ static char *iconv_append_null(const char *p_string, size_t i_length)
return psz_string;
}
const char *psz_native_charset = "UTF-8";
const char *psz_native_charset = "UTF-8//IGNORE";
char *psi_iconv(void *_unused, const char *psz_encoding,
char *p_string, size_t i_length)
......@@ -210,6 +211,114 @@ void print_pids( uint8_t *p_data )
print_pids_footer();
}
void print_eit_events(uint8_t *p_eit, f_print pf_print, void *print_opaque, f_iconv pf_iconv, void *iconv_opaque, print_type_t i_print_type)
{
uint8_t *p_event;
uint8_t j = 0;
while ((p_event = eit_get_event(p_eit, j)) != NULL) {
j++;
char start_str[24], duration_str[10];
int duration, hour, min, sec;
time_t start_ts;
start_ts = dvb_time_format_UTC(eitn_get_start_time(p_event), NULL, start_str);
dvb_time_decode_bcd(eitn_get_duration_bcd(p_event), &duration, &hour, &min, &sec);
sprintf(duration_str, "%02d:%02d:%02d", hour, min, sec);
switch (i_print_type) {
case PRINT_XML:
pf_print(print_opaque, "<EVENT id=\"%u\" start_time=\"%ld\" start_time_dec=\"%s\""
" duration=\"%u\" duration_dec=\"%s\""
" running=\"%d\" free_CA=\"%d\">",
eitn_get_event_id(p_event),
start_ts, start_str,
duration, duration_str,
eitn_get_running(p_event),
eitn_get_ca(p_event)
);
break;
default:
pf_print(print_opaque, " * EVENT id=%u start_time=%ld start_time_dec=\"%s\" duration=%u duration_dec=%s running=%d free_CA=%d",
eitn_get_event_id(p_event),
start_ts, start_str,
duration, duration_str,
eitn_get_running(p_event),
eitn_get_ca(p_event)
);
}
descs_print(eitn_get_descs(p_event), pf_print, print_opaque,
pf_iconv, iconv_opaque, i_print_type);
switch (i_print_type) {
case PRINT_XML:
pf_print(print_opaque, "</EVENT>");
break;
default:
break;
}
}
}
void print_eit(uint8_t *p_eit, unsigned int i_eit_size, f_print pf_print, void *print_opaque, f_iconv pf_iconv, void *iconv_opaque, print_type_t i_print_type)
{
uint8_t *p_eit_end = p_eit + i_eit_size;
uint8_t i_tid = psi_get_tableid(p_eit);
const char *psz_tid = "unknown";
if (i_tid == EIT_TABLE_ID_PF_ACTUAL)
psz_tid = "actual_pf";
else if (i_tid == EIT_TABLE_ID_PF_OTHER)
psz_tid = "other_pf";
else if (i_tid >= EIT_TABLE_ID_SCHED_ACTUAL_FIRST && i_tid <= EIT_TABLE_ID_SCHED_ACTUAL_LAST)
psz_tid = "actual_schedule";
else if (i_tid >= EIT_TABLE_ID_SCHED_OTHER_FIRST && i_tid <= EIT_TABLE_ID_SCHED_OTHER_LAST)
psz_tid = "other_schedule";
switch (i_print_type) {
case PRINT_XML:
pf_print(print_opaque,
"<EIT tableid=\"0x%02x\" type=\"%s\" service_id=\"%u\""
" version=\"%u\""
" current_next=\"%u\""
" tsid=\"%u\" onid=\"%u\">",
i_tid, psz_tid,
eit_get_sid(p_eit),
psi_get_version(p_eit),
!psi_get_current(p_eit) ? 0 : 1,
eit_get_tsid(p_eit),
eit_get_onid(p_eit)
);
break;
default:
pf_print(print_opaque,
"new EIT tableid=0x%02x type=%s service_id=%u version=%u%s"
" tsid=%u"
" onid=%u",
i_tid, psz_tid,
eit_get_sid(p_eit),
psi_get_version(p_eit),
!psi_get_current(p_eit) ? " (next)" : "",
eit_get_tsid(p_eit),
eit_get_onid(p_eit)
);
}
while (p_eit < p_eit_end) {
print_eit_events(p_eit, pf_print, print_opaque, pf_iconv, iconv_opaque, i_print_type);
p_eit += psi_get_length( p_eit ) + PSI_HEADER_SIZE;
}
switch (i_print_type) {
case PRINT_XML:
pf_print(print_opaque, "</EIT>");
break;
default:
pf_print(print_opaque, "end EIT");
}
}
struct dvblastctl_option {
char * opt;
int nparams;
......@@ -235,6 +344,8 @@ static const struct dvblastctl_option options[] =
{ "get_cat", 0, CMD_GET_CAT },
{ "get_nit", 0, CMD_GET_NIT },
{ "get_sdt", 0, CMD_GET_SDT },
{ "get_eit_pf", 1, CMD_GET_EIT_PF }, /* arg: service_id (uint16_t) */
{ "get_eit_schedule", 1, CMD_GET_EIT_SCHEDULE }, /* arg: service_id (uint16_t) */
{ "get_pmt", 1, CMD_GET_PMT }, /* arg: service_id (uint16_t) */
{ "get_pids", 0, CMD_GET_PIDS },
{ "get_pid", 1, CMD_GET_PID }, /* arg: pid (uint16_t) */
......@@ -248,6 +359,8 @@ void usage()
printf("Usage: dvblastctl -r <remote socket> [-x <text|xml>] [cmd]\n");
printf("Options:\n");
printf(" -r --remote-socket <name> Set socket name to <name>.\n" );
printf(" -t --timeout <seconds> Set socket read/write timeout in seconds (default 15).\n" );
printf(" -j --system-charset <name> Character set used for output (default UTF-8//IGNORE)\n" );
printf(" -x --print <text|xml> Choose output format for info commands.\n" );
printf("Control commands:\n");
printf(" reload Reload configuration.\n");
......@@ -269,6 +382,8 @@ void usage()
printf(" get_cat Return last CAT table.\n");
printf(" get_nit Return last NIT table.\n");
printf(" get_sdt Return last SDT table.\n");
printf(" get_eit_pf <service_id> Return last EIT present/following data.\n");
printf(" get_eit_schedule <service_id> Return last EIT schedule data.\n");
printf(" get_pmt <service_id> Return last PMT table.\n");
printf(" get_pids Return info about all pids.\n");
printf(" get_pid <pid> Return info for chosen pid only.\n");
......@@ -296,12 +411,14 @@ int main( int i_argc, char **ppsz_argv )
static const struct option long_options[] =
{
{"remote-socket", required_argument, NULL, 'r'},
{"timeout", required_argument, NULL, 't'},
{"system-charset", required_argument, NULL, 'j'},
{"print", required_argument, NULL, 'x'},
{"help", no_argument, NULL, 'h'},
{0, 0, 0, 0}
};
if ( (c = getopt_long(i_argc, ppsz_argv, "r:x:h", long_options, NULL)) == -1 )
if ( (c = getopt_long(i_argc, ppsz_argv, "r:t:x:j:h", long_options, NULL)) == -1 )
break;
switch ( c )
......@@ -310,6 +427,14 @@ int main( int i_argc, char **ppsz_argv )
psz_srv_socket = optarg;
break;
case 't':
i_timeout_seconds = (unsigned int)strtoul(optarg, NULL, 10);
break;
case 'j':
psz_native_charset = optarg;
break;
case 'x':
if ( !strcmp(optarg, "text") )
i_print_type = PRINT_TEXT;
......@@ -417,6 +542,8 @@ int main( int i_argc, char **ppsz_argv )
case CMD_GET_PIDS:
/* These commands need no special handling because they have no parameters */
break;
case CMD_GET_EIT_PF:
case CMD_GET_EIT_SCHEDULE:
case CMD_GET_PMT:
{
uint16_t i_sid = atoi(p_arg1);
......@@ -486,6 +613,18 @@ int main( int i_argc, char **ppsz_argv )
return_error( "Unhandled option (%d)", opt.cmd );
}
if ( i_timeout_seconds > 0 ) {
struct timeval tv_timeout = {
.tv_sec = i_timeout_seconds,
.tv_usec = 0,
};
if ( setsockopt( i_fd, SOL_SOCKET, SO_SNDTIMEO, &tv_timeout, sizeof( tv_timeout ) ) != 0 )
return_error( "Cannot set SO_SNDTIMEO (%s)", strerror(errno) );
if ( setsockopt( i_fd, SOL_SOCKET, SO_RCVTIMEO, &tv_timeout, sizeof( tv_timeout ) ) != 0 )
return_error( "Cannot set SO_RCVTIMEO (%s)", strerror(errno) );
}
/* Send command and receive answer */
if ( sendto( i_fd, p_buffer, i_size, 0, (struct sockaddr *)&sun_server,
SUN_LEN(&sun_server) ) < 0 )
......@@ -567,6 +706,15 @@ int main( int i_argc, char **ppsz_argv )
break;
}
case RET_EIT_PF:
case RET_EIT_SCHEDULE:
{
uint8_t *p_eit_data = p_buffer + COMM_HEADER_SIZE;
unsigned int i_eit_data_size = i_received - COMM_HEADER_SIZE;
print_eit( p_eit_data, i_eit_data_size, psi_print, NULL, psi_iconv, NULL, i_print_type );
break;
}
case RET_PMT:
{
pmt_print( p_data, psi_print, NULL, psi_iconv, NULL, i_print_type );
......@@ -689,6 +837,7 @@ int main( int i_argc, char **ppsz_argv )
PRINT_CAPS( CAN_2G_MODULATION );
#endif
#if DVBAPI_VERSION >= 508
PRINT_CAPS( CAN_TURBO_FEC );
PRINT_CAPS( CAN_MULTISTREAM );
#endif
#undef PRINT_CAPS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment