Commit 596d0665 authored by Christophe Massiot's avatar Christophe Massiot

* modules/access/dvb:

  - Rewrote QPSK frontend tuning functions, after reading the doc - it
    should hopefully fix the infamous "Operation not permitted" problem.
  - Permanently monitor the frontend status, and reinit it if it crashes.
  - New --dvb-high-voltage option for very long cables.
  - Moved all EN 50 221-related code from ts.c to en50221.c. We no longer
    need the --ts-capmt-sysid option because the sysid is determined
    automatically from the CAM.
  - Also changed the way we send the CAPMTs to the CAM, hoping to fix a bug
    with Aston professional CAMs which all of sudden stop descrambling
    a program after a few days.
parent c05cbdf5
......@@ -1427,7 +1427,7 @@ then
then
AC_CHECK_HEADERS(dvbpsi/dr.h,
[ VLC_ADD_PLUGINS([mux_ts ts])
VLC_ADD_LDFLAGS([mux_ts ts],[-ldvbpsi]) ],
VLC_ADD_LDFLAGS([mux_ts ts dvb],[-ldvbpsi]) ],
[ AC_MSG_WARN([cannot find libdvbpsi headers]) ],
[#if defined( HAVE_STDINT_H )
# include <stdint.h>
......@@ -1452,8 +1452,8 @@ then
dnl Use a custom libdvbpsi
AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
VLC_ADD_BUILTINS([mux_ts ts])
VLC_ADD_CPPFLAGS([mux_ts ts],[-I${real_dvbpsi_tree}/src])
VLC_ADD_LDFLAGS([mux_ts ts],[-L${real_dvbpsi_tree}/src/.libs -ldvbpsi])
VLC_ADD_CPPFLAGS([mux_ts ts dvb],[-I${real_dvbpsi_tree}/src])
VLC_ADD_LDFLAGS([mux_ts ts dvb],[-L${real_dvbpsi_tree}/src/.libs -ldvbpsi])
else
dnl The given libdvbpsi wasn't built
AC_MSG_RESULT(no)
......@@ -1477,8 +1477,8 @@ then
CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
AC_CHECK_HEADERS([dvbpsi/dr.h],[
VLC_ADD_PLUGINS([mux_ts ts])
VLC_ADD_CPPFLAGS([mux_ts ts],[${CPPFLAGS_test}])
VLC_ADD_LDFLAGS([mux_ts ts],[${LDFLAGS_test} -ldvbpsi])
VLC_ADD_CPPFLAGS([mux_ts ts dvb],[${CPPFLAGS_test}])
VLC_ADD_LDFLAGS([mux_ts ts dvb],[${LDFLAGS_test} -ldvbpsi])
],[
if test -n "${enable_dvbpsi}"
......
......@@ -39,6 +39,23 @@
#include <errno.h>
/* Include dvbpsi headers */
#ifdef HAVE_DVBPSI_DR_H
# include <dvbpsi/dvbpsi.h>
# include <dvbpsi/descriptor.h>
# include <dvbpsi/pat.h>
# include <dvbpsi/pmt.h>
# include <dvbpsi/dr.h>
# include <dvbpsi/psi.h>
#else
# include "dvbpsi.h"
# include "descriptor.h"
# include "tables/pat.h"
# include "tables/pmt.h"
# include "descriptors/dr.h"
# include "psi.h"
#endif
#include "dvb.h"
/*****************************************************************************
......@@ -81,11 +98,15 @@ static void Close( vlc_object_t *p_this );
#define BUDGET_LONGTEXT N_("This allows you to stream an entire transponder with a budget card.")
#define SATNO_TEXT N_("Satellite number in the Diseqc system")
#define SATNO_LONGTEXT N_("[0=no diseqc, 1-4=normal diseqc, -1=A, -2=B simple diseqc]")
#define SATNO_LONGTEXT N_("[0=no diseqc, 1-4=satellite number]")
#define VOLTAGE_TEXT N_("LNB voltage")
#define VOLTAGE_LONGTEXT N_("In Volts [0, 13=vertical, 18=horizontal]")
#define HIGH_VOLTAGE_TEXT N_("High LNB voltage")
#define HIGH_VOLTAGE_LONGTEXT N_("Enable high voltage if your cables are " \
"particularly long. This is not supported by all frontends.")
#define TONE_TEXT N_("22 kHz tone")
#define TONE_LONGTEXT N_("[0=off, 1=on, -1=auto]")
......@@ -148,6 +169,8 @@ vlc_module_begin();
VLC_TRUE );
add_integer( "dvb-voltage", 13, NULL, VOLTAGE_TEXT, VOLTAGE_LONGTEXT,
VLC_TRUE );
add_bool( "dvb-high-voltage", 0, NULL, HIGH_VOLTAGE_TEXT,
HIGH_VOLTAGE_LONGTEXT, VLC_TRUE );
add_integer( "dvb-tone", -1, NULL, TONE_TEXT, TONE_LONGTEXT,
VLC_TRUE );
add_integer( "dvb-fec", 9, NULL, FEC_TEXT, FEC_LONGTEXT, VLC_TRUE );
......@@ -305,19 +328,24 @@ static block_t *Block( access_t *p_access )
for ( ; ; )
{
struct timeval timeout;
fd_set fds;
fd_set fds, fde;
int i_ret;
int i_max_handle = p_sys->i_handle;
/* Initialize file descriptor set */
/* Initialize file descriptor sets */
FD_ZERO( &fds );
FD_ZERO( &fde );
FD_SET( p_sys->i_handle, &fds );
FD_SET( p_sys->i_frontend_handle, &fde );
if ( p_sys->i_frontend_handle > i_max_handle )
i_max_handle = p_sys->i_frontend_handle;
/* We'll wait 0.5 second if nothing happens */
timeout.tv_sec = 0;
timeout.tv_usec = 500000;
/* Find if some data is available */
i_ret = select( p_sys->i_handle + 1, &fds, NULL, NULL, &timeout );
i_ret = select( i_max_handle + 1, &fds, NULL, &fde, &timeout );
if ( p_access->b_die )
return NULL;
......@@ -337,6 +365,11 @@ static block_t *Block( access_t *p_access )
p_sys->i_ca_next_event = mdate() + p_sys->i_ca_timeout;
}
if ( FD_ISSET( p_sys->i_frontend_handle, &fde ) )
{
E_(FrontendPoll)( p_access );
}
if ( FD_ISSET( p_sys->i_handle, &fds ) )
{
break;
......@@ -408,15 +441,14 @@ static int Control( access_t *p_access, int i_query, va_list args )
case ACCESS_SET_PRIVATE_ID_CA:
{
uint8_t **pp_capmts;
int i_nb_capmts;
dvbpsi_pmt_t *p_pmt;
pp_capmts = (uint8_t **)va_arg( args, uint8_t ** );
i_nb_capmts = (int)va_arg( args, int );
p_pmt = (dvbpsi_pmt_t *)va_arg( args, dvbpsi_pmt_t * );
E_(CAMSet)( p_access, pp_capmts, i_nb_capmts );
E_(CAMSet)( p_access, p_pmt );
break;
}
default:
msg_Warn( p_access, "unimplemented query in control" );
return VLC_EGENERIC;
......@@ -512,6 +544,7 @@ static void VarInit( access_t *p_access )
var_Create( p_access, "dvb-budget-mode", VLC_VAR_BOOL | 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 );
var_Create( p_access, "dvb-tone", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-fec", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-srate", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
......@@ -575,7 +608,9 @@ static int ParseMRL( access_t *p_access )
else GET_OPTION_BOOL("budget-mode")
else GET_OPTION_INT("voltage")
else GET_OPTION_BOOL("high-voltage")
else GET_OPTION_INT("tone")
else GET_OPTION_INT("satno")
else GET_OPTION_INT("fec")
else GET_OPTION_INT("srate")
......@@ -588,18 +623,6 @@ static int ParseMRL( access_t *p_access )
else GET_OPTION_INT("guard")
else GET_OPTION_INT("hierarchy")
else if( !strncmp( psz_parser, "satno=",
strlen( "satno=" ) ) )
{
psz_parser += strlen( "satno=" );
if ( *psz_parser == 'A' || *psz_parser == 'a' )
val.i_int = -1;
else if ( *psz_parser == 'B' || *psz_parser == 'b' )
val.i_int = -2;
else
val.i_int = strtol( psz_parser, &psz_parser, 0 );
var_Set( p_access, "dvb-satno", val );
}
/* Redundant with voltage but much easier to use */
else if( !strncmp( psz_parser, "polarization=",
strlen( "polarization=" ) ) )
......
......@@ -57,10 +57,11 @@ typedef struct
#define MAX_DEMUX 256
#define MAX_CI_SLOTS 16
#define MAX_SESSIONS 32
#define MAX_PROGRAMS 24
struct access_sys_t
{
int i_handle;
int i_handle, i_frontend_handle;
demux_handle_t p_demux_handles[MAX_DEMUX];
frontend_t *p_frontend;
vlc_bool_t b_budget_mode;
......@@ -71,9 +72,8 @@ struct access_sys_t
vlc_bool_t pb_active_slot[MAX_CI_SLOTS];
vlc_bool_t pb_tc_has_data[MAX_CI_SLOTS];
en50221_session_t p_sessions[MAX_SESSIONS];
mtime_t i_ca_timeout, i_ca_next_event, i_ca_next_pmt;
uint8_t **pp_capmts;
int i_nb_capmts;
mtime_t i_ca_timeout, i_ca_next_event;
dvbpsi_pmt_t *pp_selected_programs[MAX_PROGRAMS];
};
#define VIDEO0_TYPE 1
......@@ -88,6 +88,7 @@ struct access_sys_t
* Prototypes
*****************************************************************************/
int E_(FrontendOpen)( access_t * );
void E_(FrontendPoll)( access_t *p_access );
int E_(FrontendSet)( access_t * );
void E_(FrontendClose)( access_t * );
......@@ -99,10 +100,10 @@ void E_(DVRClose)( access_t * );
int E_(CAMOpen)( access_t * );
int E_(CAMPoll)( access_t * );
int E_(CAMSet)( access_t *, uint8_t **, int );
int E_(CAMSet)( access_t *, dvbpsi_pmt_t * );
void E_(CAMClose)( access_t * );
int E_(en50221_Poll)( access_t * );
int E_(en50221_SetCAPMT)( access_t *, uint8_t **, int );
int E_(en50221_SetCAPMT)( access_t *, dvbpsi_pmt_t * );
void E_(en50221_End)( access_t * );
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment