Commit 230ed0ad authored by Christophe Massiot's avatar Christophe Massiot

* dvblast.c, dvb.c: Add options for many tuning parameters such as pilot,...

* dvblast.c, dvb.c: Add options for many tuning parameters such as pilot, fec_lp, hierarchy, transmission, guard interval, etc. * dvb.c: Add a warning when compiling for old linux-dvb without S2API.
parent 75da755c
...@@ -11,8 +11,7 @@ Changes between 1.2 and 2.0: ...@@ -11,8 +11,7 @@ Changes between 1.2 and 2.0:
* Add a configurable MTU * Add a configurable MTU
* Add support for NIT in DVB compliance mode * Add support for NIT in DVB compliance mode
* Syslog support with -l option * Syslog support with -l option
* Override FEC Inner with -F option * Override tuning parameters with new options
* Override Rolloff with -R option
Changes between 1.1 and 1.2: Changes between 1.1 and 1.2:
---------------------------- ----------------------------
......
...@@ -520,8 +520,51 @@ static int FrontendDoDiseqc(void) ...@@ -520,8 +520,51 @@ static int FrontendDoDiseqc(void)
#if DVB_API_VERSION >= 5 #if DVB_API_VERSION >= 5
/***************************************************************************** /*****************************************************************************
* GetModulation : helper functions for S2API * Helper functions for S2API
*****************************************************************************/ *****************************************************************************/
static fe_spectral_inversion_t GetInversion(void)
{
switch ( i_inversion )
{
case 0: return INVERSION_OFF;
case 1: return INVERSION_ON;
default:
msg_Warn( NULL, "invalid inversion %d", i_inversion );
case -1: return INVERSION_AUTO;
}
}
static fe_code_rate_t GetFEC(fe_caps_t fe_caps, int i_fec_value)
{
#define GET_FEC_INNER(fec, val) \
if ( (fe_caps & FE_CAN_##fec) && (i_fec_value == val) ) \
return fec;
GET_FEC_INNER(FEC_AUTO, 999);
GET_FEC_INNER(FEC_AUTO, -1);
if (i_fec_value == 0)
return FEC_NONE;
GET_FEC_INNER(FEC_1_2, 12);
GET_FEC_INNER(FEC_2_3, 23);
GET_FEC_INNER(FEC_3_4, 34);
if (i_fec_value == 35)
return FEC_3_5;
GET_FEC_INNER(FEC_4_5, 45);
GET_FEC_INNER(FEC_5_6, 56);
GET_FEC_INNER(FEC_6_7, 67);
GET_FEC_INNER(FEC_7_8, 78);
GET_FEC_INNER(FEC_8_9, 89);
if (i_fec_value == 910)
return FEC_9_10;
#undef GET_FEC_INNER
msg_Warn(NULL, "invalid FEC %d", i_fec_value );
return FEC_AUTO;
}
#define GetFECInner(caps) GetFEC(caps, i_fec)
#define GetFECLP(caps) GetFEC(caps, i_fec_lp)
static fe_modulation_t GetModulation(void) static fe_modulation_t GetModulation(void)
{ {
#define GET_MODULATION( mod ) \ #define GET_MODULATION( mod ) \
...@@ -547,45 +590,75 @@ static fe_modulation_t GetModulation(void) ...@@ -547,45 +590,75 @@ static fe_modulation_t GetModulation(void)
exit(1); exit(1);
} }
static fe_code_rate_t GetFECInner(fe_caps_t fe_caps) static fe_pilot_t GetPilot(void)
{ {
#define GET_FEC_INNER(fec,val) \ switch ( i_pilot )
if ( (fe_caps & FE_CAN_##fec) && (i_fec == val) ) \ {
return fec; case 0: return PILOT_OFF;
case 1: return PILOT_ON;
GET_FEC_INNER(FEC_AUTO,999); default:
if (i_fec == 0) msg_Warn( NULL, "invalid pilot %d", i_pilot );
return FEC_NONE; case -1: return PILOT_AUTO;
GET_FEC_INNER(FEC_1_2, 12); }
GET_FEC_INNER(FEC_2_3, 23);
GET_FEC_INNER(FEC_3_4, 34);
if (i_fec == 35)
return FEC_3_5;
GET_FEC_INNER(FEC_4_5, 45);
GET_FEC_INNER(FEC_5_6, 56);
GET_FEC_INNER(FEC_6_7, 67);
GET_FEC_INNER(FEC_7_8, 78);
GET_FEC_INNER(FEC_8_9, 89);
if (i_fec == 910)
return FEC_9_10;
#undef GET_FEC_INNER
msg_Err( NULL, "invalid fec-inner %d", i_fec );
exit(1);
} }
static fe_rolloff_t GetRollOff(int rolloff) static fe_rolloff_t GetRollOff(void)
{ {
switch( rolloff ) switch ( i_rolloff )
{ {
case -1:
case 0: return ROLLOFF_AUTO; case 0: return ROLLOFF_AUTO;
case 20: return ROLLOFF_20; case 20: return ROLLOFF_20;
case 25: return ROLLOFF_25; case 25: return ROLLOFF_25;
default: default:
msg_Warn( NULL, "invalid rolloff %d", i_rolloff );
case 35: return ROLLOFF_35; case 35: return ROLLOFF_35;
} }
} }
static fe_guard_interval_t GetGuard(void)
{
switch ( i_guard )
{
case 32: return GUARD_INTERVAL_1_32;
case 16: return GUARD_INTERVAL_1_16;
case 8: return GUARD_INTERVAL_1_8;
case 4: return GUARD_INTERVAL_1_4;
default:
msg_Warn( NULL, "invalid guard interval %d", i_guard );
case -1:
case 0: return GUARD_INTERVAL_AUTO;
}
}
static fe_transmit_mode_t GetTransmission(void)
{
switch ( i_transmission )
{
case 2: return TRANSMISSION_MODE_2K;
case 8: return TRANSMISSION_MODE_8K;
case 4: return TRANSMISSION_MODE_4K;
default:
msg_Warn( NULL, "invalid tranmission mode %d", i_transmission );
case -1:
case 0: return TRANSMISSION_MODE_AUTO;
}
}
static fe_hierarchy_t GetHierarchy(void)
{
switch ( i_hierarchy )
{
case 0: return HIERARCHY_NONE;
case 1: return HIERARCHY_1;
case 2: return HIERARCHY_2;
case 4: return HIERARCHY_4;
default:
msg_Warn( NULL, "invalid intramission mode %d", i_transmission );
case -1: return HIERARCHY_AUTO;
}
}
/***************************************************************************** /*****************************************************************************
* FrontendInfo : Print frontend info * FrontendInfo : Print frontend info
*****************************************************************************/ *****************************************************************************/
...@@ -721,7 +794,12 @@ static struct dtv_properties dvbt_cmdseq = { ...@@ -721,7 +794,12 @@ static struct dtv_properties dvbt_cmdseq = {
#define SYMBOL_RATE 3 #define SYMBOL_RATE 3
#define BANDWIDTH 3 #define BANDWIDTH 3
#define FEC_INNER 4 #define FEC_INNER 4
#define FEC_LP 5
#define GUARD 6
#define PILOT 6
#define TRANSMISSION 7
#define ROLLOFF 7 #define ROLLOFF 7
#define HIERARCHY 8
struct dtv_property pclear[] = { struct dtv_property pclear[] = {
{ .cmd = DTV_CLEAR }, { .cmd = DTV_CLEAR },
...@@ -758,24 +836,33 @@ static void FrontendSet( bool b_init ) ...@@ -758,24 +836,33 @@ static void FrontendSet( bool b_init )
case FE_OFDM: case FE_OFDM:
p = &dvbt_cmdseq; p = &dvbt_cmdseq;
p->props[FREQUENCY].u.data = i_frequency; p->props[FREQUENCY].u.data = i_frequency;
p->props[INVERSION].u.data = GetInversion();
if ( psz_modulation != NULL ) if ( psz_modulation != NULL )
p->props[MODULATION].u.data = GetModulation(); p->props[MODULATION].u.data = GetModulation();
p->props[BANDWIDTH].u.data = i_bandwidth * 1000000; p->props[BANDWIDTH].u.data = i_bandwidth * 1000000;
p->props[FEC_INNER].u.data = GetFECInner(info.caps);
msg_Dbg( NULL, "tuning OFDM frontend to f=%d bandwidth=%d modulation=%s", p->props[FEC_LP].u.data = GetFECLP(info.caps);
i_frequency, i_bandwidth, p->props[GUARD].u.data = GetGuard();
psz_modulation == NULL ? "qam_auto" : psz_modulation ); p->props[TRANSMISSION].u.data = GetTransmission();
p->props[HIERARCHY].u.data = GetHierarchy();
msg_Dbg( NULL, "tuning OFDM frontend to f=%d bandwidth=%d inversion=%d fec_hp=%d fec_lp=%d hierarchy=%d modulation=%s guard=%d transmission=%d",
i_frequency, i_bandwidth, i_inversion, i_fec, i_fec_lp,
i_hierarchy,
psz_modulation == NULL ? "qam_auto" : psz_modulation,
i_guard, i_transmission );
break; break;
case FE_QAM: case FE_QAM:
p = &dvbc_cmdseq; p = &dvbc_cmdseq;
p->props[FREQUENCY].u.data = i_frequency; p->props[FREQUENCY].u.data = i_frequency;
p->props[INVERSION].u.data = GetInversion();
if ( psz_modulation != NULL ) if ( psz_modulation != NULL )
p->props[MODULATION].u.data = GetModulation(); p->props[MODULATION].u.data = GetModulation();
p->props[SYMBOL_RATE].u.data = i_srate; p->props[SYMBOL_RATE].u.data = i_srate;
msg_Dbg( NULL, "tuning QAM frontend to f=%d srate=%d modulation=%s", msg_Dbg( NULL, "tuning QAM frontend to f=%d srate=%d inversion=%d modulation=%s",
i_frequency, i_srate, i_frequency, i_srate, i_inversion,
psz_modulation == NULL ? "qam_auto" : psz_modulation ); psz_modulation == NULL ? "qam_auto" : psz_modulation );
break; break;
...@@ -784,18 +871,20 @@ static void FrontendSet( bool b_init ) ...@@ -784,18 +871,20 @@ static void FrontendSet( bool b_init )
{ {
p = &dvbs2_cmdseq; p = &dvbs2_cmdseq;
p->props[MODULATION].u.data = GetModulation(); p->props[MODULATION].u.data = GetModulation();
p->props[ROLLOFF].u.data = GetRollOff(i_rolloff); p->props[PILOT].u.data = GetPilot();
p->props[ROLLOFF].u.data = GetRollOff();
} }
else else
p = &dvbs_cmdseq; p = &dvbs_cmdseq;
p->props[INVERSION].u.data = GetInversion();
p->props[SYMBOL_RATE].u.data = i_srate; p->props[SYMBOL_RATE].u.data = i_srate;
p->props[FEC_INNER].u.data = GetFECInner(info.caps); p->props[FEC_INNER].u.data = GetFECInner(info.caps);
p->props[FREQUENCY].u.data = FrontendDoDiseqc(); p->props[FREQUENCY].u.data = FrontendDoDiseqc();
msg_Dbg( NULL, "tuning QPSK frontend to f=%d srate=%d fec=%d rolloff=%d modulation=%s", msg_Dbg( NULL, "tuning QPSK frontend to f=%d srate=%d inversion=%d fec=%d rolloff=%d modulation=%s pilot=%d",
i_frequency, i_srate, i_fec, i_rolloff, i_frequency, i_srate, i_inversion, i_fec, i_rolloff,
psz_modulation == NULL ? "legacy" : psz_modulation ); psz_modulation == NULL ? "legacy" : psz_modulation, i_pilot );
break; break;
default: default:
...@@ -825,6 +914,9 @@ static void FrontendSet( bool b_init ) ...@@ -825,6 +914,9 @@ static void FrontendSet( bool b_init )
#else /* !S2API */ #else /* !S2API */
#warn "You are trying to compile DVBlast with an outdated linux-dvb interface."
#warn "DVBlast will be very limited and some options will have no effect."
static void FrontendSet( bool b_init ) static void FrontendSet( bool b_init )
{ {
struct dvb_frontend_info info; struct dvb_frontend_info info;
......
...@@ -60,6 +60,7 @@ static int i_priority = -1; ...@@ -60,6 +60,7 @@ static int i_priority = -1;
int i_adapter = 0; int i_adapter = 0;
int i_fenum = 0; int i_fenum = 0;
int i_frequency = 0; int i_frequency = 0;
int i_inversion = -1;
int i_srate = 27500000; int i_srate = 27500000;
int i_fec = 999; int i_fec = 999;
int i_rolloff = 35; int i_rolloff = 35;
...@@ -68,6 +69,11 @@ int i_voltage = 13; ...@@ -68,6 +69,11 @@ int i_voltage = 13;
int b_tone = 0; int b_tone = 0;
int i_bandwidth = 8; int i_bandwidth = 8;
char *psz_modulation = NULL; char *psz_modulation = NULL;
int i_pilot = -1;
int i_fec_lp = 999;
int i_guard = -1;
int i_transmission = -1;
int i_hierarchy = -1;
int b_budget_mode = 0; int b_budget_mode = 0;
int b_random_tsid = 0; int b_random_tsid = 0;
uint16_t i_network_id = 0xffff; uint16_t i_network_id = 0xffff;
...@@ -373,7 +379,7 @@ static void DisplayVersion() ...@@ -373,7 +379,7 @@ static void DisplayVersion()
*****************************************************************************/ *****************************************************************************/
void usage() void usage()
{ {
msg_Raw( NULL, "Usage: dvblast [-q] [-c <config file>] [-r <remote socket>] [-t <ttl>] [-o <SSRC IP>] [-i <RT priority>] [-a <adapter>] [-n <frontend number>] [-S <diseqc>] [-f <frequency>|-D [<src host>[:<src port>]@]<src mcast>[:<port>][/<opts>]*|-A <ASI adapter>] [-F <fec inner>] [-R <rolloff>] [-s <symbol rate>] [-v <0|13|18>] [-p] [-b <bandwidth>] [-m <modulation] [-u] [-U] [-L <latency>] [-E <retention>] [-d <dest IP>[<:port>][/<opts>]*] [-C [-e] [-M <network name] [-N <network ID>]] [-T] [-j <system charset>] [-J <DVB charset>]" ); msg_Raw( NULL, "Usage: dvblast [-q] [-c <config file>] [-r <remote socket>] [-t <ttl>] [-o <SSRC IP>] [-i <RT priority>] [-a <adapter>] [-n <frontend number>] [-S <diseqc>] [-f <frequency>|-D [<src host>[:<src port>]@]<src mcast>[:<port>][/<opts>]*|-A <ASI adapter>] [-s <symbol rate>] [-v <0|13|18>] [-p] [-b <bandwidth>] [-I <inversion>] [-F <fec inner>] [-m <modulation] [-R <rolloff>] [-P <pilot>] [-K <fec lp>] [-G <guard interval>] [-H <hierarchy>] [X <transmission>] [-u] [-U] [-L <latency>] [-E <retention>] [-d <dest IP>[<:port>][/<opts>]*] [-C [-e] [-M <network name] [-N <network ID>]] [-T] [-j <system charset>] [-J <DVB charset>]" );
msg_Raw( NULL, "Input:" ); msg_Raw( NULL, "Input:" );
msg_Raw( NULL, " -a --adapter <adapter>" ); msg_Raw( NULL, " -a --adapter <adapter>" );
...@@ -383,15 +389,22 @@ void usage() ...@@ -383,15 +389,22 @@ void usage()
msg_Raw( NULL, " -f --frequency frontend frequency" ); msg_Raw( NULL, " -f --frequency frontend frequency" );
msg_Raw( NULL, " -F --fec-inner Forward Error Correction (FEC Inner)"); msg_Raw( NULL, " -F --fec-inner Forward Error Correction (FEC Inner)");
msg_Raw( NULL, " DVB-S2 0|12|23|34|35|56|78|89|910|999 (default auto: 999)"); msg_Raw( NULL, " DVB-S2 0|12|23|34|35|56|78|89|910|999 (default auto: 999)");
msg_Raw( NULL, " -I --inversion Inversion (-1 auto, 0 off, 1 on)" );
msg_Raw( NULL, " -m --modulation Modulation type" ); msg_Raw( NULL, " -m --modulation Modulation type" );
msg_Raw( NULL, " DVB-C qpsk|qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)" ); msg_Raw( NULL, " DVB-C qpsk|qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)" );
msg_Raw( NULL, " DVB-T qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)" ); msg_Raw( NULL, " DVB-T qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)" );
msg_Raw( NULL, " DVB-S2 qpsk|psk_8 (default legacy DVB-S)" ); msg_Raw( NULL, " DVB-S2 qpsk|psk_8 (default legacy DVB-S)" );
msg_Raw( NULL, " -n --frontend-number <frontend number>" ); msg_Raw( NULL, " -n --frontend-number <frontend number>" );
msg_Raw( NULL, " -p --force-pulse force 22kHz pulses for high-band selection (DVB-S)" ); msg_Raw( NULL, " -p --force-pulse force 22kHz pulses for high-band selection (DVB-S)" );
msg_Raw( NULL, " -P --pilot DVB-S2 Pilot (-1 auto, 0 off, 1 on)" );
msg_Raw( NULL, " -R --rolloff DVB-S2 Rolloff value" ); msg_Raw( NULL, " -R --rolloff DVB-S2 Rolloff value" );
msg_Raw( NULL, " DVB-S2 35=0.35|25=0.25|20=0.20|0=AUTO (default: 35)" ); msg_Raw( NULL, " DVB-S2 35=0.35|25=0.25|20=0.20|0=AUTO (default: 35)" );
msg_Raw( NULL, " -s --symbole-rate" ); msg_Raw( NULL, " -K --fec-lp DVB-T low priority FEC (default auto)" );
msg_Raw( NULL, " -G --guard DVB-T guard interval" );
msg_Raw( NULL, " DVB-T 32 (1/32)|16 (1/16)|8 (1/8)|4 (1/4)|-1 (auto, default)" );
msg_Raw( NULL, " -H --hierarchy DVB-T hierarchy (0, 1, 2, 4 or -1 auto, default)" );
msg_Raw( NULL, " -X --transmission DVB-T transmission (2, 4, 8 or -1 auto, default)" );
msg_Raw( NULL, " -s --symbol-rate" );
msg_Raw( NULL, " -S --diseqc satellite number for diseqc (0: no diseqc, 1-4, A or B)" ); msg_Raw( NULL, " -S --diseqc satellite number for diseqc (0: no diseqc, 1-4, A or B)" );
msg_Raw( NULL, " -u --budget-mode turn on budget mode (no hardware PID filtering)" ); msg_Raw( NULL, " -u --budget-mode turn on budget mode (no hardware PID filtering)" );
msg_Raw( NULL, " -v --voltage voltage to apply to the LNB (QPSK)" ); msg_Raw( NULL, " -v --voltage voltage to apply to the LNB (QPSK)" );
...@@ -457,7 +470,13 @@ int main( int i_argc, char **pp_argv ) ...@@ -457,7 +470,13 @@ int main( int i_argc, char **pp_argv )
{ "voltage", required_argument, NULL, 'v' }, { "voltage", required_argument, NULL, 'v' },
{ "force-pulse", no_argument, NULL, 'p' }, { "force-pulse", no_argument, NULL, 'p' },
{ "bandwidth", required_argument, NULL, 'b' }, { "bandwidth", required_argument, NULL, 'b' },
{ "inversion", required_argument, NULL, 'I' },
{ "modulation", required_argument, NULL, 'm' }, { "modulation", required_argument, NULL, 'm' },
{ "pilot", required_argument, NULL, 'P' },
{ "fec-lp", required_argument, NULL, 'K' },
{ "guard", required_argument, NULL, 'G' },
{ "hierarchy", required_argument, NULL, 'H' },
{ "transmission", required_argument, NULL, 'X' },
{ "budget-mode", no_argument, NULL, 'u' }, { "budget-mode", no_argument, NULL, 'u' },
{ "udp", no_argument, NULL, 'U' }, { "udp", no_argument, NULL, 'U' },
{ "unique-ts-id", no_argument, NULL, 'T' }, { "unique-ts-id", no_argument, NULL, 'T' },
...@@ -478,7 +497,7 @@ int main( int i_argc, char **pp_argv ) ...@@ -478,7 +497,7 @@ int main( int i_argc, char **pp_argv )
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:f:F:R:s:S:v:pb:m:uUTL:E:d:D:A:lCeM:N:j:J:hV", long_options, NULL)) != -1 ) while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:f:F:R:s:S:v:pb:I:m:P:K:G:H:X:uUTL:E:d:D:A:lCeM:N:j:J:hV", long_options, NULL)) != -1 )
{ {
switch ( c ) switch ( c )
{ {
...@@ -581,10 +600,34 @@ int main( int i_argc, char **pp_argv ) ...@@ -581,10 +600,34 @@ int main( int i_argc, char **pp_argv )
i_bandwidth = strtol( optarg, NULL, 0 ); i_bandwidth = strtol( optarg, NULL, 0 );
break; break;
case 'I':
i_inversion = strtol( optarg, NULL, 0 );
break;
case 'm': case 'm':
psz_modulation = optarg; psz_modulation = optarg;
break; break;
case 'P':
i_pilot = strtol( optarg, NULL, 0 );
break;
case 'K':
i_fec_lp = strtol( optarg, NULL, 0 );
break;
case 'G':
i_guard = strtol( optarg, NULL, 0 );
break;
case 'X':
i_transmission = strtol( optarg, NULL, 0 );
break;
case 'H':
i_hierarchy = strtol( optarg, NULL, 0 );
break;
case 'u': case 'u':
b_budget_mode = 1; b_budget_mode = 1;
break; break;
......
...@@ -141,7 +141,13 @@ extern int i_rolloff; ...@@ -141,7 +141,13 @@ extern int i_rolloff;
extern int i_voltage; extern int i_voltage;
extern int b_tone; extern int b_tone;
extern int i_bandwidth; extern int i_bandwidth;
extern int i_inversion;
extern char *psz_modulation; extern char *psz_modulation;
extern int i_pilot;
extern int i_fec_lp;
extern int i_guard;
extern int i_transmission;
extern int i_hierarchy;
extern int b_budget_mode; extern int b_budget_mode;
extern int b_random_tsid; extern int b_random_tsid;
extern uint16_t i_network_id; extern uint16_t i_network_id;
......
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