]> git.sesse.net Git - vlc/commitdiff
* Audio is verified to work, it was a problem with the test setup and not with the...
authorJean-Paul Saman <jpsaman@videolan.org>
Tue, 12 Aug 2003 12:43:47 +0000 (12:43 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Tue, 12 Aug 2003 12:43:47 +0000 (12:43 +0000)
* Added code to support LNB_LOF1, LNB_LOF2, LNB_SLOF commandline options.
* Cleanup of code.

modules/access/dvb/access.c
modules/access/dvb/dvb.c
modules/access/dvb/dvb.h
modules/access/dvb/qpsk.c

index 7d5009068d4d5383ad12ec415f42d2831e6e160c..8a1e3ab70949651404791471903b072896d5cd18 100644 (file)
@@ -82,9 +82,9 @@ int E_(Open) ( vlc_object_t *p_this )
     unsigned int        u_device = 0;
     unsigned int        u_freq = 0;
     unsigned int        u_srate = 0;
-    int                 i_lnb_lof1;
-    int                 i_lnb_lof2;
-    int                 i_lnb_slof;
+    unsigned int        u_lnb_lof1;
+    unsigned int        u_lnb_lof2;
+    unsigned int        u_lnb_slof;
     int                 i_bandwidth = 0;
     int                 i_modulation = 0;
     int                 i_guard = 0;
@@ -143,8 +143,8 @@ int E_(Open) ( vlc_object_t *p_this )
         else if (strncmp( p_input->psz_access, "terrestrial",11) ==0)
             frontend_info.type = FE_OFDM;
 
-        frontend_info.frequency_max = 12999;
-        frontend_info.frequency_min = 10000;
+        frontend_info.frequency_max = 12999 * 1000;
+        frontend_info.frequency_min = 9750 * 1000;
         frontend_info.symbol_rate_max = 30000;
         frontend_info.symbol_rate_min = 1000;
     }
@@ -173,6 +173,7 @@ int E_(Open) ( vlc_object_t *p_this )
     }
 
     /* Validating input values */
+    u_freq *= 1000;
     if ( ((u_freq) > frontend_info.frequency_max) ||
          ((u_freq) < frontend_info.frequency_min) )
     {
@@ -223,16 +224,16 @@ int E_(Open) ( vlc_object_t *p_this )
 
     /* Get antenna configuration options */
     b_diseqc = config_GetInt( p_input, "diseqc" );
-    i_lnb_lof1 = config_GetInt( p_input, "lnb-lof1" );
-    i_lnb_lof2 = config_GetInt( p_input, "lnb-lof2" );
-    i_lnb_slof = config_GetInt( p_input, "lnb-slof" );
+    u_lnb_lof1 = config_GetInt( p_input, "lnb-lof1" ) * 1000;
+    u_lnb_lof2 = config_GetInt( p_input, "lnb-lof2" ) * 1000;
+    u_lnb_slof = config_GetInt( p_input, "lnb-slof" ) * 1000;
 
     /* Setting frontend parameters for tuning the hardware */      
     switch( frontend_info.type )
     {
         /* DVB-S: satellite and budget cards (nova) */
         case FE_QPSK:
-            fep.frequency = u_freq * 1000;
+            fep.frequency = u_freq;
             fep.inversion = dvb_DecodeInversion(p_input, (int) b_polarisation);
             fep.u.qpsk.symbol_rate = u_srate * 1000;
             fep.u.qpsk.fec_inner = dvb_DecodeFEC(p_input, i_fec); 
@@ -243,7 +244,7 @@ int E_(Open) ( vlc_object_t *p_this )
         case FE_QAM:
             i_modulation  = config_GetInt(p_input, "modulation");
 
-            fep.frequency = u_freq * 1000;
+            fep.frequency = u_freq;
             fep.inversion = dvb_DecodeInversion(p_input, (int) b_polarisation);
             fep.u.qam.symbol_rate = u_srate * 1000;
             fep.u.qam.fec_inner = dvb_DecodeFEC(p_input, i_fec); 
@@ -261,7 +262,7 @@ int E_(Open) ( vlc_object_t *p_this )
             i_guard = config_GetInt(p_input, "guard");
             i_hierarchy = config_GetInt(p_input, "hierarchy");
             
-            fep.frequency = u_freq * 1000;
+            fep.frequency = u_freq;
             fep.inversion = dvb_DecodeInversion(p_input, (int) b_polarisation);
             fep.u.ofdm.bandwidth = dvb_DecodeBandwidth(p_input, i_bandwidth);
             fep.u.ofdm.code_rate_HP = dvb_DecodeFEC(p_input, i_code_rate_HP); 
@@ -311,7 +312,9 @@ int E_(Open) ( vlc_object_t *p_this )
     }
 
     /* Initialize the Satellite Card */
-    switch (ioctl_SetFrontend (p_input, fep, b_polarisation, u_adapter, u_device ))
+    switch (ioctl_SetFrontend (p_input, fep, b_polarisation,
+                               u_lnb_lof1, u_lnb_lof2, u_lnb_slof,
+                               u_adapter, u_device ))
     {
         case -2:
             msg_Err( p_input, "frontend returned an unexpected event" );
index 0f48eab3062bff4ad68f980a329154aae23c24b9..ceb71132bc0a9e0dd10ac3d7e3052d1258299a1b 100644 (file)
@@ -81,86 +81,6 @@ struct diseqc_cmd_t switch_cmds[] =
 
 static int ioctl_CheckFrontend(input_thread_t * p_input, int front);
 
-/*****************************************************************************
- * ioctl_FrontendControl : commands the SEC device
- *****************************************************************************/
-int ioctl_FrontendControl(input_thread_t * p_input, int freq, int pol, int lnb_slof,
-                          int diseqc, unsigned int u_adapter, unsigned int u_device)
-{
-    struct dvb_diseqc_master_cmd  cmd;
-    fe_sec_tone_mode_t tone;
-    fe_sec_voltage_t voltage;
-    int frontend;
-    char front[] = FRONTEND;
-    int i_len;
-
-    i_len = sizeof(FRONTEND);
-    if (snprintf(front, sizeof(FRONTEND), FRONTEND, u_adapter, u_device) >= i_len)
-    {
-        msg_Err(p_input, "snprintf() truncated string for FRONTEND" );
-        front[sizeof(FRONTEND)] = '\0';
-    }
-
-    msg_Dbg(p_input, "Opening frontend %s",front);       
-    if((frontend = open(front,O_RDWR)) < 0)
-    {
-#   ifdef HAVE_ERRNO_H
-        msg_Err(p_input, "ioctl_FrontEndControl: Opening frontend failed (%s)",strerror(errno));
-#   else
-        msg_Err(p_input, "ioctl_FrontEndControl: Opening frontend failed");
-#   endif
-        return -1;
-    }
-
-    /* Set the frequency of the transponder, taking into account the
-       local frequencies of the LNB */
-    tone = (freq<lnb_slof) ? SEC_TONE_OFF : SEC_TONE_ON;
-
-    /* Set the polarisation of the transponder by setting the correct
-       voltage on the universal LNB */
-    voltage = (pol) ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13;
-    
-    /* In case we have a DiSEqC, set it to the correct address */
-    cmd.msg[0] = 0x0;  /* framing */
-    cmd.msg[1] = 0x10; /* address */
-    cmd.msg[2] = 0x38; /* command */
-    /* command parameters start at index 3 */
-    cmd.msg[3] = 0xF0 | ((diseqc * 4) & 0x0F);   
-    cmd.msg_len = 4;
-
-    /* Reset everything before sending. */
-#ifdef HAVE_ERRNO_H 
-#   define CHECK_IOCTL(X) if(X<0) \
-    { \
-        msg_Err( p_input, "InfoFrontend: ioctl failed (%s)", strerror(errno)); \
-        close(frontend); \
-        return -1; \
-    }
-#else
-#   define CHECK_IOCTL(X) if(X<0) \
-    { \
-        msg_Err( p_input, "InfoFrontend: ioctl failed"); \
-        close(frontend); \
-        return -1; \
-    }
-#endif
-
-    CHECK_IOCTL(ioctl(frontend, FE_SET_TONE, SEC_TONE_OFF));   
-    CHECK_IOCTL(ioctl(frontend, FE_SET_VOLTAGE, voltage));
-    msleep(15);
-    
-    /* Send the data to the SEC device to prepare the LNB for tuning  */
-    CHECK_IOCTL(ioctl(frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd));
-    msleep(15);
-    CHECK_IOCTL(ioctl(frontend, FE_DISEQC_SEND_BURST, &cmd));
-    msleep(15);
-    CHECK_IOCTL(ioctl(frontend, FE_SET_TONE, tone));
-#undef CHECK_IOCTL
-
-    close(frontend);
-    return 0;
-}
-
 /*****************************************************************************
  * ioctl_InfoFrontend : return information about given frontend
  *****************************************************************************/
@@ -367,15 +287,12 @@ int ioctl_SetupSwitch (input_thread_t *p_input, int frontend_fd, int switch_pos,
     return ret;
 }
 
-#define SWITCHFREQ 11700000
-#define LOF_HI     10600000
-#define LOF_LO      9750000
-
 /*****************************************************************************
  * ioctl_SetFrontend : controls the FE device
  *****************************************************************************/
-int ioctl_SetFrontend (input_thread_t * p_input, struct dvb_frontend_parameters fep,
-                       int b_polarisation, unsigned int u_adapter, unsigned int u_device  )
+int ioctl_SetFrontend (input_thread_t * p_input, struct dvb_frontend_parameters fep, int b_polarisation, 
+                       unsigned int u_lnb_lof1, unsigned int u_lnb_lof2, unsigned int u_lnb_slof,
+                       unsigned int u_adapter, unsigned int u_device  )
 {
     int front;
     int ret;
@@ -392,7 +309,7 @@ int ioctl_SetFrontend (input_thread_t * p_input, struct dvb_frontend_parameters
     }
     
     /* Open the frontend device */
-         msg_Dbg(p_input, "Opening frontend %s", frontend);
+    msg_Dbg(p_input, "Opening frontend %s", frontend);
     if((front = open(frontend,O_RDWR)) < 0)
     {
 #   ifdef HAVE_ERRNO_H
@@ -405,7 +322,8 @@ int ioctl_SetFrontend (input_thread_t * p_input, struct dvb_frontend_parameters
     
     /* Set the frequency of the transponder, taking into account the
        local frequencies of the LNB */
-    hiband = (fep.frequency >= SWITCHFREQ);
+    hiband = (fep.frequency >= u_lnb_slof);
+
     if ((ret=ioctl_SetupSwitch (p_input, front, 0, b_polarisation, hiband))<0)
     {
         msg_Err(p_input, "ioctl_SetupSwitch failed (%d)", ret);
@@ -413,9 +331,9 @@ int ioctl_SetFrontend (input_thread_t * p_input, struct dvb_frontend_parameters
     }
 
     if (hiband)
-        fep.frequency -= LOF_HI;
+        fep.frequency -= u_lnb_lof2;
     else
-        fep.frequency -= LOF_LO;
+        fep.frequency -= u_lnb_lof2;
 
     /* Now send it all to the frontend device */
     if ((ret=ioctl(front, FE_SET_FRONTEND, &fep)) < 0)
index 87b08a0c42fef76d8a1634dfd157894bc256b433..8ba18ab23c679badec9038de307bfc95ed4c70b2 100644 (file)
@@ -33,8 +33,9 @@
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
-int ioctl_FrontendControl(input_thread_t *p_input, int freq, int pol, int lnb_slof, int diseqc, unsigned int u_adapter, unsigned int u_device );
-int ioctl_SetFrontend (input_thread_t * p_input, struct dvb_frontend_parameters fep, int b_polarisation, unsigned int u_adapter, unsigned int u_device );
+int ioctl_SetFrontend (input_thread_t * p_input, struct dvb_frontend_parameters fep, int b_polarisation,
+                       unsigned int u_lnb_lof1, unsigned int u_lnb_lof2, unsigned int u_lnb_slof,
+                       unsigned int u_adapter, unsigned int u_device );
 int ioctl_SetDMXFilter(input_thread_t * p_input, int i_pid, int *pi_fd, int i_type, unsigned int u_adapter, unsigned int u_device );
 int ioctl_UnsetDMXFilter(input_thread_t * p_input, int );
 int ioctl_InfoFrontend(input_thread_t * p_input, struct dvb_frontend_info *info, unsigned int u_adapter, unsigned int u_device );
index 882007e71b7fcb96f5b5795d2bbc8bf0d3350b73..cccbf07415c8130d6b24b9baa4fe9ebaea39e61f 100644 (file)
@@ -99,30 +99,27 @@ void E_(Close)   ( vlc_object_t * );
 
 vlc_module_begin();
     add_category_hint( N_("Input"), NULL, VLC_FALSE );
-                         add_integer( "adapter", 1, NULL, ADAPTER_TEXT, ADAPTER_LONGTEXT, VLC_FALSE );
-                               add_integer( "device", 0, NULL, DEVICE_TEXT, DEVICE_LONGTEXT, VLC_FALSE );
+        add_integer( "adapter", 1, NULL, ADAPTER_TEXT, ADAPTER_LONGTEXT, VLC_FALSE );
+        add_integer( "device", 0, NULL, DEVICE_TEXT, DEVICE_LONGTEXT, VLC_FALSE );
         add_integer( "frequency", 11954, NULL, FREQ_TEXT, FREQ_LONGTEXT, VLC_FALSE );
         add_integer( "polarization", 0, NULL, POL_TEXT, POL_LONGTEXT, VLC_FALSE );
         add_integer( "fec", 3, NULL, FEC_TEXT, FEC_LONGTEXT, VLC_FALSE );
         add_integer( "symbol-rate", 27500, NULL, SRATE_TEXT, SRATE_LONGTEXT, VLC_FALSE );
         add_bool( "diseqc", 0, NULL, DISEQC_TEXT, DISEQC_LONGTEXT, VLC_FALSE );
-        add_integer( "lnb-lof1", 10000, NULL,
-                     LNB_LOF1_TEXT, LNB_LOF1_LONGTEXT, VLC_FALSE );
-        add_integer( "lnb-lof2", 10000, NULL,
-                     LNB_LOF2_TEXT, LNB_LOF2_LONGTEXT, VLC_FALSE );
-        add_integer( "lnb-slof", 11700, NULL,
-                     LNB_SLOF_TEXT, LNB_SLOF_LONGTEXT, VLC_FALSE );
-                         add_bool( "probe", 0, NULL, PROBE_TEXT, PROBE_LONGTEXT, VLC_FALSE );
-             add_integer( "code-rate-hp", 9, NULL, CODE_RATE_HP_TEXT, CODE_RATE_HP_LONGTEXT, VLC_FALSE );
-             add_integer( "code-rate-lp", 9, NULL, CODE_RATE_LP_TEXT, CODE_RATE_LP_LONGTEXT, VLC_FALSE );
-                         add_integer( "bandwidth", 0, NULL, BANDWIDTH_TEXT, BANDWIDTH_LONGTEXT, VLC_FALSE );
-                         add_integer( "modulation", 0, NULL, MODULATION_TEXT, MODULATION_LONGTEXT, VLC_FALSE );
-                         add_integer( "quard", 0, NULL, GUARD_TEXT, GUARD_LONGTEXT, VLC_TRUE );
-                         add_integer( "transmission", 0, NULL, TRANSMISSION_TEXT, TRANSMISSION_LONGTEXT, VLC_TRUE );
-                         add_integer( "hierarchy", 0, NULL, HIERARCHY_TEXT, HIERARCHY_LONGTEXT, VLC_TRUE );
+        add_integer( "lnb-lof1",  9750, NULL, LNB_LOF1_TEXT, LNB_LOF1_LONGTEXT, VLC_FALSE );
+        add_integer( "lnb-lof2", 10600, NULL, LNB_LOF2_TEXT, LNB_LOF2_LONGTEXT, VLC_FALSE );
+        add_integer( "lnb-slof", 11700, NULL, LNB_SLOF_TEXT, LNB_SLOF_LONGTEXT, VLC_FALSE );
+        add_bool( "probe", 0, NULL, PROBE_TEXT, PROBE_LONGTEXT, VLC_FALSE );
+        add_integer( "code-rate-hp", 9, NULL, CODE_RATE_HP_TEXT, CODE_RATE_HP_LONGTEXT, VLC_FALSE );
+        add_integer( "code-rate-lp", 9, NULL, CODE_RATE_LP_TEXT, CODE_RATE_LP_LONGTEXT, VLC_FALSE );
+        add_integer( "bandwidth", 0, NULL, BANDWIDTH_TEXT, BANDWIDTH_LONGTEXT, VLC_FALSE );
+        add_integer( "modulation", 0, NULL, MODULATION_TEXT, MODULATION_LONGTEXT, VLC_FALSE );
+        add_integer( "quard", 0, NULL, GUARD_TEXT, GUARD_LONGTEXT, VLC_TRUE );
+        add_integer( "transmission", 0, NULL, TRANSMISSION_TEXT, TRANSMISSION_LONGTEXT, VLC_TRUE );
+        add_integer( "hierarchy", 0, NULL, HIERARCHY_TEXT, HIERARCHY_LONGTEXT, VLC_TRUE );
     set_description( _("DVB input module with v4l2 support") );
     set_capability( "access", 0 );
-               add_shortcut( "qpsk" );
+    add_shortcut( "qpsk" );
     add_shortcut( "cable" );
     add_shortcut( "terrestrial" );
     add_shortcut( "dvb" );