"Allows you to modify the default caching value for dvb streams. This " \
"value should be set in millisecond units." )
-#define PROGRAM_TEXT N_("Program to decode")
-#define PROGRAM_LONGTEXT N_("This is a workaround for a bug in the input")
-
#define ADAPTER_TEXT N_("Adapter card to tune")
#define ADAPTER_LONGTEXT N_("Adapter cards have a device file in directory named /dev/dvb/adapter[n] with n>=0.")
vlc_module_begin();
set_shortname( _("DVB") );
set_description( N_("DVB input with v4l2 support") );
+ set_category( CAT_INPUT );
+ set_subcategory( SUBCAT_INPUT_ACCESS );
add_integer( "dvb-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
CACHING_LONGTEXT, VLC_TRUE );
static block_t *Block( access_t * );
static int Control( access_t *, int, va_list );
-#define SATELLITE_READ_ONCE 3
+#define DVB_READ_ONCE 3
#define TS_PACKET_SIZE 188
static void FilterUnset( access_t *, int i_max );
FilterSet( p_access, 0x0, OTHER_TYPE );
}
+ E_(CAMOpen)( p_access );
+
return VLC_SUCCESS;
}
E_(DVRClose)( p_access );
E_(FrontendClose)( p_access );
+ E_(CAMClose)( p_access );
+
free( p_sys );
}
static block_t *Block( access_t *p_access )
{
access_sys_t *p_sys = p_access->p_sys;
- struct timeval timeout;
- fd_set fds;
- int i_ret;
block_t *p_block;
- /* Initialize file descriptor set */
- FD_ZERO( &fds );
- FD_SET( p_sys->i_handle, &fds );
-
- /* We'll wait 0.5 second if nothing happens */
- timeout.tv_sec = 0;
- timeout.tv_usec = 500000;
-
- /* Find if some data is available */
- while( (i_ret = select( p_sys->i_handle + 1, &fds, NULL, NULL, &timeout )) == 0 ||
- (i_ret < 0 && errno == EINTR) )
+ for ( ; ; )
{
+ struct timeval timeout;
+ fd_set fds;
+ int i_ret;
+
+ /* Initialize file descriptor set */
FD_ZERO( &fds );
FD_SET( p_sys->i_handle, &fds );
+
+ /* We'll wait 0.5 second if nothing happens */
timeout.tv_sec = 0;
timeout.tv_usec = 500000;
- if( p_access->b_die )
+ /* Find if some data is available */
+ i_ret = select( p_sys->i_handle + 1, &fds, NULL, NULL, &timeout );
+
+ if ( p_access->b_die )
return NULL;
- }
- if ( i_ret < 0 )
- {
- msg_Err( p_access, "select error (%s)", strerror(errno) );
- return NULL;
+ if ( i_ret < 0 && errno == EINTR )
+ continue;
+
+ if ( i_ret < 0 )
+ {
+ msg_Err( p_access, "select error (%s)", strerror(errno) );
+ return NULL;
+ }
+
+ if ( p_sys->i_ca_handle && mdate() > p_sys->i_ca_next_event )
+ {
+ E_(CAMPoll)( p_access );
+ p_sys->i_ca_next_event = mdate() + p_sys->i_ca_timeout;
+ }
+
+ if ( FD_ISSET( p_sys->i_handle, &fds ) )
+ {
+ break;
+ }
}
- p_block = block_New( p_access, SATELLITE_READ_ONCE * TS_PACKET_SIZE );
- if( ( p_block->i_buffer = read( p_sys->i_handle, p_block->p_buffer, SATELLITE_READ_ONCE * TS_PACKET_SIZE ) ) <= 0 )
+ p_block = block_New( p_access, DVB_READ_ONCE * TS_PACKET_SIZE );
+ if( ( p_block->i_buffer = read( p_sys->i_handle, p_block->p_buffer,
+ DVB_READ_ONCE * TS_PACKET_SIZE ) ) <= 0 )
{
msg_Err( p_access, "read failed (%s)", strerror(errno) );
block_Release( p_block );
/* */
case ACCESS_GET_MTU:
pi_int = (int*)va_arg( args, int * );
- *pi_int = SATELLITE_READ_ONCE * TS_PACKET_SIZE;
+ *pi_int = DVB_READ_ONCE * TS_PACKET_SIZE;
break;
case ACCESS_GET_PTS_DELAY:
return VLC_EGENERIC;
case ACCESS_SET_PRIVATE_ID_STATE:
- b_bool = (vlc_bool_t)va_arg( args, vlc_bool_t ); /* b_selected */
i_int = (int)va_arg( args, int ); /* Private data (pid for now)*/
+ b_bool = (vlc_bool_t)va_arg( args, vlc_bool_t ); /* b_selected */
if( !p_sys->b_budget_mode )
{
/* FIXME we may want to give the real type (me ?, I don't ;) */
}
break;
+ case ACCESS_SET_PRIVATE_ID_CA:
+ {
+ uint8_t **pp_capmts;
+ int i_nb_capmts;
+
+ pp_capmts = (uint8_t **)va_arg( args, uint8_t ** );
+ i_nb_capmts = (int)va_arg( args, int );
+
+ E_(CAMSet)( p_access, pp_capmts, i_nb_capmts );
+ break;
+ }
default:
- msg_Err( p_access, "unimplemented query in control" );
+ msg_Warn( p_access, "unimplemented query in control" );
return VLC_EGENERIC;
}
#define GET_OPTION_INT( option ) \
if ( !strncmp( psz_parser, option "=", strlen(option "=") ) ) \
{ \
- val.i_int = strtol( psz_parser+strlen(option "="), &psz_parser, 0 );\
- var_Set( p_access, "dvb-" option, val ); \
+ val.i_int = strtol( psz_parser + strlen(option "="), &psz_parser, \
+ 0 ); \
+ var_Set( p_access, "dvb-" option, val ); \
}
#define GET_OPTION_BOOL( option ) \
{ \
val.b_bool = strtol( psz_parser + strlen(option "="), &psz_parser, \
0 ); \
- var_Set( p_access, "dvb-" option, val ); \
+ var_Set( p_access, "dvb-" option, val ); \
}
/* Test for old syntax */
return VLC_EGENERIC;
}
- psz_parser++;
+ if ( *psz_parser )
+ psz_parser++;
}
#undef GET_OPTION_INT
#undef GET_OPTION_BOOL