[dvblast-devel] [PATCH] modified: dvb.c modified: dvblast.c modified: dvblast.h Added Multi PLP DVB-T2 support

koshkoshka andreykosh000 at mail.ru
Tue Jan 5 12:45:48 CET 2016


---
 dvb.c     | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 dvblast.c | 11 ++++++++---
 dvblast.h |  1 +
 3 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/dvb.c b/dvb.c
index d1c8409..b7925b4 100644
--- a/dvb.c
+++ b/dvb.c
@@ -940,6 +940,27 @@ static struct dtv_property dvbt_cmdargs[] = {
     { .cmd = DTV_HIERARCHY,       .u.data = HIERARCHY_AUTO },
     { .cmd = DTV_TUNE },
 };
+
+static struct dtv_property dvbt2_cmdargs[] = {
+    { .cmd = DTV_DELIVERY_SYSTEM, .u.data = SYS_DVBT2 },
+    { .cmd = DTV_FREQUENCY,       .u.data = 0 },
+    { .cmd = DTV_MODULATION,      .u.data = QAM_AUTO },
+    { .cmd = DTV_INVERSION,       .u.data = INVERSION_AUTO },
+    { .cmd = DTV_BANDWIDTH_HZ,    .u.data = 8000000 },
+    { .cmd = DTV_CODE_RATE_HP,    .u.data = FEC_AUTO },
+    { .cmd = DTV_CODE_RATE_LP,    .u.data = FEC_AUTO },
+    { .cmd = DTV_GUARD_INTERVAL,  .u.data = GUARD_INTERVAL_AUTO },
+    { .cmd = DTV_TRANSMISSION_MODE,.u.data = TRANSMISSION_MODE_AUTO },
+    { .cmd = DTV_HIERARCHY,       .u.data = HIERARCHY_AUTO },
+    { .cmd = DTV_STREAM_ID,      .u.data = 0 },
+    { .cmd = DTV_TUNE },
+};
+
+static struct dtv_properties dvbt2_cmdseq = {
+    .num = sizeof(dvbt2_cmdargs)/sizeof(struct dtv_property),
+    .props = dvbt2_cmdargs
+};
+
 static struct dtv_properties dvbt_cmdseq = {
     .num = sizeof(dvbt_cmdargs)/sizeof(struct dtv_property),
     .props = dvbt_cmdargs
@@ -972,6 +993,7 @@ static struct dtv_properties atsc_cmdseq = {
 #define ROLLOFF 8
 #define MIS 9
 #define HIERARCHY 9
+#define PLP_ID 10
 
 struct dtv_property pclear[] = {
     { .cmd = DTV_CLEAR },
@@ -1001,6 +1023,8 @@ FrontendGuessSystem( fe_delivery_system_t *p_systems, int i_systems )
             return SYS_DVBC_ANNEX_B;
         if ( !strcasecmp( psz_delsys, "DVBT" ) )
             return SYS_DVBT;
+				if ( !strcasecmp( psz_delsys, "DVBT2" ) )
+           return SYS_DVBT2;
         if ( !strcasecmp( psz_delsys, "ATSC" ) )
             return SYS_ATSC;
         msg_Err( NULL, "unknown delivery system %s", psz_delsys );
@@ -1036,6 +1060,10 @@ FrontendGuessSystem( fe_delivery_system_t *p_systems, int i_systems )
                 if ( i_frequency > 50000000 )
                     return SYS_DVBT;
                 break;
+						 case SYS_DVBT2:
+               if ( i_frequency > 50000000 && (dvb_plp_id) )
+                  return SYS_DVBT2;
+               break;
             default:
                 break;
         }
@@ -1151,7 +1179,27 @@ static void FrontendSet( bool b_init )
                  psz_modulation == NULL ? "qam_auto" : psz_modulation,
                  i_guard, i_transmission );
         break;
+		case SYS_DVBT2:
+        p = &dvbt2_cmdseq;
+       p->props[DELSYS].u.data = system;
+        p->props[FREQUENCY].u.data = i_frequency;
+        p->props[INVERSION].u.data = GetInversion();
+        if ( psz_modulation != NULL )
+            p->props[MODULATION].u.data = GetModulation();
+        p->props[BANDWIDTH].u.data = i_bandwidth * 1000000;
+        p->props[FEC_INNER].u.data = GetFECInner(info.caps);
+        p->props[FEC_LP].u.data = GetFECLP(info.caps);
+        p->props[GUARD].u.data = GetGuard();
+        p->props[TRANSMISSION].u.data = GetTransmission();
+        p->props[HIERARCHY].u.data = GetHierarchy();
+        p->props[PLP_ID].u.data = dvb_plp_id;
 
+        msg_Dbg( NULL, "tuning DVB-T2 frontend to f=%d bandwidth=%d inversion=%d fec_hp=%d fec_lp=%d hierarchy=%d modulation=%s guard=%d transmission=%d PLP_ID=%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, p->props[PLP_ID].u.data );
+        break;
 #if DVBAPI_VERSION >= 505
     case SYS_DVBC_ANNEX_A:
 #else
diff --git a/dvblast.c b/dvblast.c
index ca58ce3..3ab5615 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -67,6 +67,7 @@ int i_fenum = 0;
 int i_canum = 0;
 char *psz_delsys = NULL;
 int i_frequency = 0;
+int dvb_plp_id = 0;
 int i_inversion = -1;
 int i_srate = 27500000;
 int i_fec = 999;
@@ -598,7 +599,7 @@ void usage()
         "[-u] [-w] [-U] [-L <latency>] [-E <retention>] [-d <dest IP>[<:port>][/<opts>]*] [-3] "
         "[-z] [-C [-e] [-M <network name>] [-N <network ID>]] [-T] [-j <system charset>] "
         "[-W] [-Y] [-l] [-g <logger ident>] [-Z <mrtg file>] [-V] [-h] [-B <provider_name>] "
-        "[-1 <mis_id>] [-2 <size>] [-5 <DVBS|DVBS2|DVBC_ANNEX_A|DVBT|ATSC>] -y <ca_dev_number> "
+        "[-1 <mis_id>] [-2 <size>] [-5 <DVBS|DVBS2|DVBC_ANNEX_A|DVBT|DVBT2|ATSC>] -y <ca_dev_number> "
         "[-J <DVB charset>] [-Q <quit timeout>] [-0 pid_mapping] [-x <text|xml>]"
         "[-6 <print period>] [-7 <ES timeout>]" );
 
@@ -615,6 +616,7 @@ void usage()
     msg_Raw( NULL, "  -5 --delsys           delivery system" );
     msg_Raw( NULL, "    DVBS|DVBS2|DVBC_ANNEX_A|DVBT|ATSC (default guessed)");
     msg_Raw( NULL, "  -f --frequency        frontend frequency" );
+		msg_Raw( NULL, "  -9 --dvb-plp-id <number> Switch PLP of the DVB-T2 transmission (for Russia special)" );
     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, "  -I --inversion        Inversion (-1 auto, 0 off, 1 on)" );
@@ -713,6 +715,7 @@ int main( int i_argc, char **pp_argv )
         { "adapter",         required_argument, NULL, 'a' },
         { "frontend-number", required_argument, NULL, 'n' },
         { "delsys",          required_argument, NULL, '5' },
+				{ "dvb-plp-id",      required_argument, NULL, '9' },
         { "frequency",       required_argument, NULL, 'f' },
         { "fec-inner",       required_argument, NULL, 'F' },
         { "rolloff",         required_argument, NULL, 'R' },
@@ -767,7 +770,7 @@ int main( int i_argc, char **pp_argv )
         { 0, 0, 0, 0 }
     };
 
-    while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:5:f:F:R:s:S:k:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:3D:A:lg:zCWYeM:N:j:J:B:x:Q:6:7:hVZ:y:0:1:2:", long_options, NULL)) != -1 )
+    while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:5:f:F:R:s:S:k:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:3D:A:lg:zCWYeM:N:j:J:B:x:Q:6:7:hVZ:y:0:1:2:9:", long_options, NULL)) != -1 )
     {
         switch ( c )
         {
@@ -840,7 +843,9 @@ int main( int i_argc, char **pp_argv )
         case '5':
             psz_delsys = optarg;
             break;
-
+				case '9':
+           dvb_plp_id = strtol( optarg, NULL, 0 );
+           break;
         case 'f':
             if (optarg && optarg[0] != '-')
                 i_frequency = strtol( optarg, NULL, 0 );
diff --git a/dvblast.h b/dvblast.h
index e1bf219..f274eb3 100644
--- a/dvblast.h
+++ b/dvblast.h
@@ -238,6 +238,7 @@ extern int b_budget_mode;
 extern int b_any_type;
 extern int b_select_pmts;
 extern int b_random_tsid;
+extern int dvb_plp_id;
 extern bool b_enable_emm;
 extern bool b_enable_ecm;
 extern mtime_t i_wallclock;
-- 
1.9.1



More information about the dvblast-devel mailing list