[dvblast-devel] [PATCH RFC] Add support for DVB-T/S2 and ISDB multistream.

Georgi Chorbadzhiyski gf at unixsol.org
Fri Oct 19 08:31:05 CEST 2012


Generic multistream support was added in Linux 3.6 in commit 287cefd096b.

http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=287cefd096b

The way it is added it is backwards compatible with older kernels.

This patch implements mis support in DVBlast. Unfortunately I don't
have mis compatible hardware and a way to test it, so I'm posting
this patch as call for testing.

If your frontend reports FE_CAN_MULTISTREAM (you have to use Linux 3.6
and higher) it'll be invaluable to test if multistream support is
working.
---
 NEWS         |  1 +
 config.h     |  6 ++++++
 dvb.c        | 11 +++++++----
 dvblast.c    | 11 +++++++++--
 dvblast.h    |  1 +
 dvblastctl.c |  3 +--
 6 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index 32b06a5..5390e3d 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Changes between 2.2 and 2.3:
   * Fixed ECM pid selection.
   * Added CA device addressing.
   * Added support for remapping ES pids to fixed values.
+  * Added support for multistream that appeared in Linux 3.6
 
 Changes between 2.1 and 2.2:
 ----------------------------
diff --git a/config.h b/config.h
index 8a009af..e09c09c 100644
--- a/config.h
+++ b/config.h
@@ -25,9 +25,15 @@
 #define _DVBLAST_CONFIG_H_
 
 #if defined(__linux__)
+#define DVBAPI_VERSION ((DVB_API_VERSION)*100+(DVB_API_VERSION_MINOR))
 #define HAVE_DVB_SUPPORT
 #define HAVE_ASI_SUPPORT
 #define HAVE_CLOCK_NANOSLEEP
+#define HAVE_DVB_MULTISTREAM
+#if DVBAPI_VERSION < 508
+  #define DTV_STREAM_ID        42
+  #define FE_CAN_MULTISTREAM   0x4000000
+#endif
 #endif
 
 #define HAVE_ICONV
diff --git a/dvb.c b/dvb.c
index 9991cf9..12ab2dd 100644
--- a/dvb.c
+++ b/dvb.c
@@ -578,8 +578,6 @@ static int FrontendDoDiseqc(void)
     return bis_frequency;
 }
 
-#define DVBAPI_VERSION ((DVB_API_VERSION)*100+(DVB_API_VERSION_MINOR))
-
 #if DVB_API_VERSION >= 5
 
 /*****************************************************************************
@@ -782,6 +780,7 @@ static void FrontendInfo( struct dvb_frontend_info info )
 #if DVBAPI_VERSION >= 501
     FRONTEND_INFO( info.caps, FE_CAN_2G_MODULATION, "2G_MODULATION" )
 #endif
+    FRONTEND_INFO( info.caps, FE_CAN_MULTISTREAM, "MULTISTREAM" )
     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" )
@@ -815,6 +814,7 @@ static struct dtv_property dvbs2_cmdargs[] = {
     { .cmd = DTV_DELIVERY_SYSTEM, .u.data = SYS_DVBS2 },
     { .cmd = DTV_PILOT,           .u.data = PILOT_AUTO },
     { .cmd = DTV_ROLLOFF,         .u.data = ROLLOFF_AUTO },
+    { .cmd = DTV_STREAM_ID,       .u.data = 0 },
     { .cmd = DTV_TUNE },
 };
 static struct dtv_properties dvbs2_cmdseq = {
@@ -876,6 +876,7 @@ static struct dtv_properties atsc_cmdseq = {
 #define PILOT 6
 #define TRANSMISSION 7
 #define ROLLOFF 7
+#define MIS 8
 #define HIERARCHY 8
 
 struct dtv_property pclear[] = {
@@ -950,6 +951,7 @@ static void FrontendSet( bool b_init )
             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;
         }
         else
             p = &dvbs_cmdseq;
@@ -959,9 +961,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 QPSK frontend to f=%d srate=%d inversion=%d fec=%d rolloff=%d modulation=%s pilot=%d",
+        msg_Dbg( NULL, "tuning QPSK frontend to f=%d srate=%d inversion=%d fec=%d rolloff=%d modulation=%s pilot=%d mis=%d",
                  i_frequency, i_srate, i_inversion, i_fec, i_rolloff,
-                 psz_modulation == NULL ? "legacy" : psz_modulation, i_pilot );
+                 psz_modulation == NULL ? "legacy" : psz_modulation, i_pilot,
+                 i_mis );
         break;
 
     case FE_ATSC:
diff --git a/dvblast.c b/dvblast.c
index 2da2d38..fc56a0d 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -74,6 +74,7 @@ int b_tone = 0;
 int i_bandwidth = 8;
 char *psz_modulation = NULL;
 int i_pilot = -1;
+int i_mis = 0;
 int i_fec_lp = 999;
 int i_guard = -1;
 int i_transmission = -1;
@@ -483,6 +484,7 @@ void usage()
     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, "    DVB-S2 35=0.35|25=0.25|20=0.20|0=AUTO (default: 35)" );
+    msg_Raw( NULL, "  -1 --multistream-id   Set stream ID (0-255, default: 0)" );
     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)" );
@@ -552,7 +554,7 @@ int main( int i_argc, char **pp_argv )
         usage();
 
     /*
-     * The only short options left are: 123456789
+     * The only short options left are: 23456789
      * Use them wisely.
      */
     static const struct option long_options[] =
@@ -576,6 +578,7 @@ int main( int i_argc, char **pp_argv )
         { "inversion",       required_argument, NULL, 'I' },
         { "modulation",      required_argument, NULL, 'm' },
         { "pilot",           required_argument, NULL, 'P' },
+        { "mutistream-id",   required_argument, NULL, '1' },
         { "fec-lp",          required_argument, NULL, 'K' },
         { "guard",           required_argument, NULL, 'G' },
         { "hierarchy",       required_argument, NULL, 'H' },
@@ -613,7 +616,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:f:F:R:s:S:k:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:D:A:lg:zCWYeM:N:j:J:B:x:Q:hVZ:y:0:", 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:k:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:D:A:lg:zCWYeM:N:j:J:B:x:Q:hVZ:y:0:1:", long_options, NULL)) != -1 )
     {
         switch ( c )
         {
@@ -737,6 +740,10 @@ int main( int i_argc, char **pp_argv )
             i_pilot = strtol( optarg, NULL, 0 );
             break;
 
+        case '1':
+            i_mis = strtol( optarg, NULL, 0 );
+            break;
+
         case 'K':
             i_fec_lp = strtol( optarg, NULL, 0 );
             break;
diff --git a/dvblast.h b/dvblast.h
index f3b4cde..7a1ddd5 100644
--- a/dvblast.h
+++ b/dvblast.h
@@ -165,6 +165,7 @@ extern int i_bandwidth;
 extern int i_inversion;
 extern char *psz_modulation;
 extern int i_pilot;
+extern int i_mis;
 extern int i_fec_lp;
 extern int i_guard;
 extern int i_transmission;
diff --git a/dvblastctl.c b/dvblastctl.c
index 1cb3cc2..0ffb1b9 100644
--- a/dvblastctl.c
+++ b/dvblastctl.c
@@ -626,8 +626,6 @@ int main( int i_argc, char **ppsz_argv )
         PRINT_CAPS( CAN_HIERARCHY_AUTO );
         PRINT_CAPS( CAN_MUTE_TS );
 
-#define DVBAPI_VERSION ((DVB_API_VERSION)*100+(DVB_API_VERSION_MINOR))
-
 #if DVBAPI_VERSION >= 301
         PRINT_CAPS( CAN_8VSB );
         PRINT_CAPS( CAN_16VSB );
@@ -640,6 +638,7 @@ int main( int i_argc, char **ppsz_argv )
 #if DVBAPI_VERSION >= 501
         PRINT_CAPS( CAN_2G_MODULATION );
 #endif
+        PRINT_CAPS( CAN_MULTISTREAM );
 #undef PRINT_CAPS
 
         if ( i_print_type == PRINT_TEXT )
-- 
1.7.12.1



More information about the dvblast-devel mailing list