]> git.sesse.net Git - vlc/blobdiff - modules/access/dtv/access.c
DTV: deal with "cable", "terrestrial" and "satellite" scheme right
[vlc] / modules / access / dtv / access.c
index 4a603bc46a78b3515eb1a1540a061398a5acddc5..c7cbf067698028a6ef8014c45181d6587ce6f253 100644 (file)
@@ -232,7 +232,8 @@ vlc_module_begin ()
     add_shortcut ("dtv", "tv", "dvb", /* "radio", "dab",*/
                   "cable", "dvb-c", "cqam", "isdb-c",
                   "satellite", "dvb-s", "dvb-s2", "isdb-s",
-                  "terrestrial", "dvb-t", "dvb-t2", "isdb-t", "atsc")
+                  "terrestrial", "dvb-t", "dvb-t2", "isdb-t", "atsc",
+                  "dvbt")
 
 #ifdef __linux__
     add_integer ("dvb-adapter", 0, ADAPTER_TEXT, ADAPTER_LONGTEXT, false)
@@ -588,25 +589,7 @@ static int Control (access_t *access, int query, va_list args)
 /** Determines which delivery system to use. */
 static const delsys_t *GuessSystem (const char *scheme, dvb_device_t *dev)
 {
-    /* NOTE: We should guess the delivery system for the "cable", "satellite"
-     * and "terrestrial" shortcuts (i.e. DVB, ISDB, ATSC...). But there is
-     * seemingly no sane way to do get the info with Linux DVB version 5.2.
-     * In particular, the frontend infos distinguish only the modulator class
-     * (QPSK, QAM, OFDM or ATSC).
-     *
-     * Furthermore, if the demodulator supports 2G, we cannot guess whether
-     * 1G or 2G is intended. For backward compatibility, 1G is assumed
-     * (this is not a limitation of Linux DVB). We will probably need something
-     * smarter when 2G (semi automatic) scanning is implemented. */
-    if (!strcasecmp (scheme, "cable"))
-        scheme = "dvb-c";
-    else
-    if (!strcasecmp (scheme, "satellite"))
-        scheme = "dvb-s";
-    else
-    if (!strcasecmp (scheme, "terrestrial"))
-        scheme = "dvb-t";
-
+    /* Specific delivery system is specified */
     if (!strcasecmp (scheme, "atsc"))
         return &atsc;
     if (!strcasecmp (scheme, "cqam"))
@@ -628,15 +611,48 @@ static const delsys_t *GuessSystem (const char *scheme, dvb_device_t *dev)
     if (!strcasecmp (scheme, "isdb-t"))
         return &isdbt;
 
+    /* If the demodulator supports 2G, we cannot guess whether
+     * 1G or 2G is intended. For backward compatibility, 1G is assumed
+     * (this is not a limitation of Linux DVB). We will probably need something
+     * smarter when 2G (semi automatic) scanning is implemented. */
     unsigned systems = dvb_enum_systems (dev);
-    if (systems & ATSC)
-        return &atsc;
+
+    /* Only wave carrier is specified */
+    if (!strcasecmp (scheme, "cable"))
+    {
+        if (systems & DVB_C)
+            return &dvbc;
+        if (systems & CQAM)
+            return &cqam;
+        if (systems & ISDB_C)
+            return &isdbc;
+    }
+    if (!strcasecmp (scheme, "satellite"))
+    {
+        if (systems & DVB_S)
+            return &dvbs;
+        if (systems & ISDB_S)
+            return &isdbs;
+    }
+    if (!strcasecmp (scheme, "terrestrial"))
+    {
+        if (systems & DVB_T)
+            return &dvbc;
+        if (systems & ATSC)
+            return &cqam;
+        if (systems & ISDB_T)
+            return &isdbt;
+    }
+
+    /* Only standards family or nothing is specified */
     if (systems & DVB_C)
         return &dvbc;
     if (systems & DVB_S)
         return &dvbc;
     if (systems & DVB_T)
         return &dvbt;
+    if (systems & ATSC)
+        return &atsc;
     return NULL;
 }