/*****************************************************************************
* access.c: DVB card input v4l2 only
*****************************************************************************
- * Copyright (C) 1998-2005 the VideoLAN team
+ * Copyright (C) 1998-2010 the VideoLAN team
*
* Authors: Johan Bilien <jobi@via.ecp.fr>
* Jean-Paul Saman <jpsaman _at_ videolan _dot_ org>
* Christophe Massiot <massiot@via.ecp.fr>
* Laurent Aimar <fenrir@via.ecp.fr>
+ * David Kaplan <david@2of1.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <vlc_input.h>
#include <vlc_interface.h>
#include <vlc_dialog.h>
+#include <vlc_fs.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
-#include <fcntl.h>
#include <sys/types.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <errno.h>
#endif
#ifdef ENABLE_HTTPD
-# include "vlc_httpd.h"
+# include <vlc_httpd.h>
#endif
#include "dvb.h"
#define BUDGET_LONGTEXT N_("This allows you to stream an entire transponder with a \"budget\" card.")
/* Satellite */
+#define SATELLITE_TEXT N_("Satellite scanning config")
+#define SATELLITE_LONGTEXT N_("filename of config file in share/dvb/dvb-s")
+
#define SATNO_TEXT N_("Satellite number in the Diseqc system")
#define SATNO_LONGTEXT N_("[0=no diseqc, 1-4=satellite number].")
true )
add_integer( "dvb-frequency", 0, NULL, FREQ_TEXT, FREQ_LONGTEXT,
false )
+ change_safe()
add_integer( "dvb-inversion", 2, NULL, INVERSION_TEXT, INVERSION_LONGTEXT,
true )
- add_bool( "dvb-probe", 1, NULL, PROBE_TEXT, PROBE_LONGTEXT, true )
- add_bool( "dvb-budget-mode", 0, NULL, BUDGET_TEXT, BUDGET_LONGTEXT,
+ add_bool( "dvb-probe", true, NULL, PROBE_TEXT, PROBE_LONGTEXT, true )
+ add_bool( "dvb-budget-mode", false, NULL, BUDGET_TEXT, BUDGET_LONGTEXT,
true )
/* DVB-S (satellite) */
+ add_string( "dvb-satellite", NULL, NULL, SATELLITE_TEXT, SATELLITE_LONGTEXT,
+ true )
add_integer( "dvb-satno", 0, NULL, SATNO_TEXT, SATNO_LONGTEXT,
true )
add_integer( "dvb-voltage", 13, NULL, VOLTAGE_TEXT, VOLTAGE_LONGTEXT,
true )
- add_bool( "dvb-high-voltage", 0, NULL, HIGH_VOLTAGE_TEXT,
+ add_bool( "dvb-high-voltage", false, NULL, HIGH_VOLTAGE_TEXT,
HIGH_VOLTAGE_LONGTEXT, true )
add_integer( "dvb-tone", -1, NULL, TONE_TEXT, TONE_LONGTEXT,
true )
CODE_RATE_LP_LONGTEXT, true )
add_integer( "dvb-bandwidth", 0, NULL, BANDWIDTH_TEXT, BANDWIDTH_LONGTEXT,
true )
+ change_safe()
add_integer( "dvb-guard", 0, NULL, GUARD_TEXT, GUARD_LONGTEXT, true )
add_integer( "dvb-transmission", 0, NULL, TRANSMISSION_TEXT,
TRANSMISSION_LONGTEXT, true )
true )
add_string( "dvb-http-user", NULL, NULL, USER_TEXT, USER_LONGTEXT,
true )
- add_string( "dvb-http-password", NULL, NULL, PASSWORD_TEXT,
- PASSWORD_LONGTEXT, true )
+ add_password( "dvb-http-password", NULL, NULL, PASSWORD_TEXT,
+ PASSWORD_LONGTEXT, true )
add_string( "dvb-http-acl", NULL, NULL, ACL_TEXT, ACL_LONGTEXT,
true )
add_string( "dvb-http-intf-cert", NULL, NULL, CERT_TEXT, CERT_LONGTEXT,
#endif
set_capability( "access", 0 )
- add_shortcut( "dvb" ) /* Generic name */
-
- add_shortcut( "dvb-s" ) /* Satellite */
- add_shortcut( "qpsk" )
- add_shortcut( "satellite" )
-
- add_shortcut( "dvb-c" ) /* Cable */
- add_shortcut( "cable" )
-
- add_shortcut( "dvb-t" ) /* Terrestrial */
- add_shortcut( "terrestrial" )
-
- add_shortcut( "atsc" ) /* Atsc */
+ add_shortcut( "dvb", /* Generic name */
+ "dvb-s", "qpsk", "satellite", /* Satellite */
+ "dvb-c", "cable", /* Cable */
+ "dvb-t", "terrestrial", /* Terrestrial */
+ "atsc" ) /* Atsc */
add_shortcut( "usdigital" )
set_callbacks( Open, Close )
#define DVB_READ_ONCE_SCAN 1
#define TS_PACKET_SIZE 188
-#define DVB_SCAN_MAX_SIGNAL_TIME (300*1000)
+#define DVB_SCAN_MAX_SIGNAL_TIME (1000*1000)
#define DVB_SCAN_MAX_LOCK_TIME (5000*1000)
-#define DVB_SCAN_MAX_PROBE_TIME (30000*1000)
+#define DVB_SCAN_MAX_PROBE_TIME (45000*1000)
static void FilterUnset( access_t *, int i_max );
static void FilterUnsetPID( access_t *, int i_pid );
else
p_sys->i_read_once = DVB_READ_ONCE_START;
+ free( p_access->psz_demux );
+ p_access->psz_demux = strdup( p_sys->b_scan_mode ? "m3u8" : "ts" );
return VLC_SUCCESS;
}
scan_configuration_t cfg;
scan_session_t session;
+ /* set satellite config file path */
+ if( p_scan->parameter.type == SCAN_DVB_S )
+ p_scan->parameter.sat_info.psz_name = var_GetString( p_access, "dvb-satellite" );
+
/* */
if( scan_Next( p_scan, &cfg ) )
{
return NULL;
/* */
- msg_Dbg( p_access, "Scanning frequency %d", cfg.i_frequency );
+ if( p_scan->parameter.type == SCAN_DVB_S )
+ {
+ msg_Dbg( p_access,
+ "Scanning frequency %d, symbol rate = %d, fec = %d",
+ cfg.i_frequency,
+ cfg.i_bandwidth,
+ cfg.i_fec );
+ }
+ else
+ msg_Dbg( p_access, "Scanning frequency %d, bandwidth = %d",
+ cfg.i_frequency,
+ cfg.i_bandwidth );
+
var_SetInteger( p_access, "dvb-frequency", cfg.i_frequency );
var_SetInteger( p_access, "dvb-bandwidth", cfg.i_bandwidth );
+ if ( cfg.i_fec )
+ var_SetInteger( p_access, "dvb-fec", cfg.i_fec );
+ if ( cfg.c_polarization )
+ var_SetInteger( p_access, "dvb-voltage", cfg.c_polarization == 'H' ? 18 : 13 );
/* Setting frontend parameters for tuning the hardware */
if( FrontendSet( p_access ) < 0 )
var_Create( p_access, "dvb-budget-mode", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/* */
+ var_Create( p_access, "dvb-satellite", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-satno", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-voltage", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-high-voltage", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/* */
static int ParseMRL( access_t *p_access )
{
- char *psz_dup = strdup( p_access->psz_path );
+ char *psz_dup = strdup( p_access->psz_location );
char *psz_parser = psz_dup;
char *psz_next;
vlc_value_t val;
var_Set( p_access, "dvb-" option, val ); \
}
+#define GET_OPTION_STRING( option ) \
+ if ( !strncmp( psz_parser, option "=", strlen( option "=" ) ) ) \
+ { \
+ psz_parser += strlen( option "=" ); \
+ val.psz_string = psz_parser; \
+ char *p_save; \
+ char *tok = strtok_r(val.psz_string, ":", &p_save); \
+ val.psz_string[tok - val.psz_string - 1] = 0; \
+ var_Set( p_access, "dvb-" option, val ); \
+ psz_parser += strlen( val.psz_string ); \
+ }
+
/* Test for old syntax */
strtol( psz_parser, &psz_next, 10 );
if( psz_next != psz_parser )
{
msg_Err( p_access, "the DVB input old syntax is deprecated, use vlc "
"-p dvb to see an explanation of the new syntax" );
- dialog_FatalWait( p_access, _("Input syntax is deprecated"),
+ dialog_FatalWait( p_access, _("Input syntax is deprecated"), "%s",
_("The given syntax is deprecated. Run \"vlc -p dvb\" to see an " \
"explanation of the new syntax.") );
free( psz_dup );
else GET_OPTION_BOOL("probe")
else GET_OPTION_BOOL("budget-mode")
+ else GET_OPTION_STRING("satellite")
else GET_OPTION_INT("voltage")
else GET_OPTION_BOOL("high-voltage")
else GET_OPTION_INT("tone")
}
#undef GET_OPTION_INT
#undef GET_OPTION_BOOL
+#undef GET_OPTION_STRING
free( psz_dup );
return VLC_SUCCESS;