Commit d2a2e28b authored by Clément Stenac's avatar Clément Stenac

pvr.c : Converted to access2 and added options for autobuilt panels

parent 3a4e04e7
...@@ -43,6 +43,7 @@ vlc_module_begin(); ...@@ -43,6 +43,7 @@ vlc_module_begin();
add_shortcut( "http" ); add_shortcut( "http" );
add_shortcut( "ftp" ); add_shortcut( "ftp" );
add_shortcut( "tcp" ); add_shortcut( "tcp" );
add_shortcut( "pvr" );
/* Hack */ /* Hack */
//add_shortcut( "file" ); //add_shortcut( "file" );
......
...@@ -68,19 +68,95 @@ struct ivtv_ioctl_codec { ...@@ -68,19 +68,95 @@ struct ivtv_ioctl_codec {
static int Open ( vlc_object_t * ); static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * ); static void Close ( vlc_object_t * );
static ssize_t Read ( input_thread_t *, byte_t *, size_t ); static int Read ( access_t *, uint8_t *, int );
static int Control ( access_t *, int, va_list );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
#define DEVICE_TEXT N_( "Device" )
#define DEVICE_LONGTEXT N_( "PVR video device" )
#define NORM_TEXT N_( "Norm" )
#define NORM_LONGTEXT N_( "Defines the norm of the stream (Automatic, SECAM, PAL, or NTSC)" )
static int i_norm_list[] = { V4L2_STD_UNKNOWN, V4L2_STD_SECAM, V4L2_STD_PAL,
V4L2_STD_NTSC };
static char *psz_norm_list_text[] = { N_("Automatic"), N_("SECAM"),
N_("PAL"), N_("NSTC") };
#define WIDTH_TEXT N_( "Width" )
#define WIDTH_LONGTEXT N_( "Width of the stream to capture (-1 for " \
"autodetect)" )
#define HEIGHT_TEXT N_( "Height" )
#define HEIGHT_LONGTEXT N_( "Height of the stream to capture (-1 for " \
"autodetect)" )
#define FREQUENCY_TEXT N_( "Frequency" )
#define FREQUENCY_LONGTEXT N_( "Frequency to capture (in kHz), if applicable" )
#define FRAMERATE_TEXT N_( "Framerate" )
#define FRAMERATE_LONGTEXT N_( "Framerate to capture, if applicable (-1 for " \
"auto" )
#define KEYINT_TEXT N_( "Key interval" )
#define KEYINT_LONGTEXT N_( "Interval between keyframes, in FIXME (-1 for " \
" auto" )
#define BFRAMES_TEXT N_( "B Frames" )
#define BFRAMES_LONGTEXT N_("If this option is set, B-Frames will be used." \
"Use this option to set the number of B-Frames")
#define BITRATE_TEXT N_( "Bitrate" )
#define BITRATE_LONGTEXT N_( "Bitrate to use (-1 for default)" )
#define BITRATE_PEAK_TEXT N_( "Bitrate peak" )
#define BITRATE_PEAK_LONGTEXT N_( "Peak bitrate in VBR mode" )
#define BITRATE_MODE_TEXT N_( "Bitrate mode (vbr or cbr)" )
#define BITRATE_MODE_LONGTEXT N_( "Bitrate mode to use" )
#define BITMASK_TEXT N_( "Audio bitmask" )
#define BITMASK_LONGTEXT N_("FIXME FIXME FIXME FIXME" )
#define CHAN_TEXT N_( "Channel" )
#define CHAN_LONGTEXT N_( "Channel of the card to use (Usually, 0 = tuner, " \
"1 = composite, 2 = svideo )" )
static int i_bitrates[] = { 0, 1 };
static char *psz_bitrates_list_text[] = { N_("vbr"), N_("cbr") };
vlc_module_begin(); vlc_module_begin();
set_shortname( _("PVR") ); set_shortname( _("PVR") );
set_description( _("MPEG Encoding cards input (with ivtv drivers)") ); set_description( _("MPEG Encoding cards input (with ivtv drivers)") );
set_capability( "access", 0 ); set_capability( "access2", 0 );
add_shortcut( "pvr" ); add_shortcut( "pvr" );
add_string( "pvr-device", "/dev/video0", NULL, DEVICE_TEXT,
DEVICE_LONGTEXT, VLC_FALSE );
add_integer( "pvr-norm", V4L2_STD_UNKNOWN , NULL, NORM_TEXT,
NORM_LONGTEXT, VLC_FALSE );
change_integer_list( i_norm_list, psz_norm_list_text, 0 );
add_integer( "pvr-width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, VLC_TRUE );
add_integer( "pvr-height", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT,
VLC_TRUE );
add_integer( "pvr-frequency", -1, NULL, FREQUENCY_TEXT, FREQUENCY_LONGTEXT,
VLC_FALSE );
add_integer( "pvr-framerate", -1, NULL, FRAMERATE_TEXT, FRAMERATE_LONGTEXT,
VLC_TRUE );
add_integer( "pvr-keyint", -1, NULL, KEYINT_TEXT, KEYINT_LONGTEXT,
VLC_TRUE );
add_integer( "pvr-bframes", -1, NULL, FRAMERATE_TEXT, FRAMERATE_LONGTEXT,
VLC_TRUE );
add_integer( "pvr-bitrate", -1, NULL, BITRATE_TEXT, BITRATE_LONGTEXT,
VLC_FALSE );
add_integer( "pvr-bitrate-peak", -1, NULL, BITRATE_PEAK_TEXT,
BITRATE_PEAK_LONGTEXT, VLC_TRUE );
add_integer( "pvr-bitrate-mode", -1, NULL, BITRATE_MODE_TEXT,
BITRATE_MODE_LONGTEXT, VLC_TRUE );
change_integer_list( i_bitrates, psz_bitrates_list_text, 0 );
add_integer( "pvr-audio-bitmask", -1, NULL, BITMASK_TEXT,
BITMASK_LONGTEXT, VLC_TRUE );
add_integer( "pvr-channel", -1, NULL, CHAN_TEXT,
CHAN_LONGTEXT, VLC_TRUE );
set_callbacks( Open, Close ); set_callbacks( Open, Close );
vlc_module_end(); vlc_module_end();
vlc_bool_t b_eof;
/***************************************************************************** /*****************************************************************************
* Private access data * Private access data
*****************************************************************************/ *****************************************************************************/
...@@ -88,6 +164,9 @@ struct access_sys_t ...@@ -88,6 +164,9 @@ struct access_sys_t
{ {
/* file descriptor */ /* file descriptor */
int i_fd; int i_fd;
int64_t i_tell; /** Number of read bytes */
vlc_bool_t b_eof;
/* options */ /* options */
int i_standard; int i_standard;
...@@ -95,8 +174,8 @@ struct access_sys_t ...@@ -95,8 +174,8 @@ struct access_sys_t
int i_height; int i_height;
int i_frequency; int i_frequency;
int i_framerate; int i_framerate;
int i_bframes;
int i_keyint; int i_keyint;
int i_bframes;
int i_bitrate; int i_bitrate;
int i_bitrate_peak; int i_bitrate_peak;
int i_bitrate_mode; int i_bitrate_mode;
...@@ -109,10 +188,11 @@ struct access_sys_t ...@@ -109,10 +188,11 @@ struct access_sys_t
*****************************************************************************/ *****************************************************************************/
static int Open( vlc_object_t * p_this ) static int Open( vlc_object_t * p_this )
{ {
input_thread_t * p_input = (input_thread_t*) p_this; access_t *p_access = (access_t*) p_this;
access_sys_t * p_sys; access_sys_t * p_sys;
char * psz_tofree, * psz_parser, * psz_device; char * psz_tofree, * psz_parser, * psz_device;
char psz_tmp[5];
vlc_value_t val;
struct v4l2_format vfmt; struct v4l2_format vfmt;
struct v4l2_frequency vf; struct v4l2_frequency vf;
...@@ -120,33 +200,76 @@ static int Open( vlc_object_t * p_this ) ...@@ -120,33 +200,76 @@ static int Open( vlc_object_t * p_this )
//psz_device = calloc( strlen( "/dev/videox" ) + 1, 1 ); //psz_device = calloc( strlen( "/dev/videox" ) + 1, 1 );
p_input->pf_read = Read; p_access->pf_read = Read;
p_input->stream.b_pace_control = 0; p_access->pf_block = NULL;
p_input->stream.b_seekable = 0; p_access->pf_seek = NULL;
p_input->i_pts_delay = 1000000; p_access->pf_control = Control;
/* create private access data */ /* create private access data */
p_sys = calloc( sizeof( access_sys_t ), 1 ); p_sys = calloc( sizeof( access_sys_t ), 1 );
p_input->p_access_data = p_sys; p_access->p_sys = p_sys;
/* defaults values */ /* defaults values */
var_Create( p_access, "pvr-device", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_access, "pvr-device" , &val);
psz_device = val.psz_string;
var_Create( p_access, "pvr-norm", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_access, "pvr-norm" , &val);
p_sys->i_standard = val.i_int;
var_Create( p_access, "pvr-width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_access, "pvr-width" , &val);
p_sys->i_width = val.i_int;
var_Create( p_access, "pvr-height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_access, "pvr-height" , &val);
p_sys->i_height = val.i_int;
var_Create( p_access, "pvr-frequency", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_access, "pvr-frequency" , &val);
p_sys->i_frequency = val.i_int;
var_Create( p_access, "pvr-framerate", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_access, "pvr-framerate" , &val);
p_sys->i_framerate = val.i_int;
var_Create( p_access, "pvr-keyint", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_access, "pvr-keyint" , &val);
p_sys->i_keyint = val.i_int;
psz_device = 0; var_Create( p_access, "pvr-bframes", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
p_sys->i_standard = V4L2_STD_UNKNOWN; var_Get( p_access, "pvr-bframes" , &val);
p_sys->i_width = -1; p_sys->i_bframes = val.b_bool;
p_sys->i_height = -1;
p_sys->i_frequency = -1; var_Create( p_access, "pvr-bitrate", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
p_sys->i_framerate = -1; var_Get( p_access, "pvr-bitrate" , &val);
p_sys->i_keyint = -1; p_sys->i_bitrate = val.i_int;
p_sys->i_bframes = -1;
p_sys->i_bitrate = -1; var_Create( p_access, "pvr-bitrate-peak", VLC_VAR_INTEGER |
p_sys->i_bitrate_peak = -1; VLC_VAR_DOINHERIT );
p_sys->i_bitrate_mode = -1; var_Get( p_access, "pvr-bitrate-peak" , &val);
p_sys->i_audio_bitmask = -1; p_sys->i_bitrate_peak = val.i_int;
p_sys->i_input = -1;
var_Create( p_access, "pvr-bitrate-mode", VLC_VAR_INTEGER |
VLC_VAR_DOINHERIT );
var_Get( p_access, "pvr-bitrate-mode" , &val);
p_sys->i_bitrate_mode = val.i_int;
var_Create( p_access, "pvr-audio-bitmask", VLC_VAR_INTEGER |
VLC_VAR_DOINHERIT );
var_Get( p_access, "pvr-audio-bitmask" , &val);
p_sys->i_audio_bitmask = val.i_int;
var_Create( p_access, "pvr-channel", VLC_VAR_INTEGER |
VLC_VAR_DOINHERIT );
var_Get( p_access, "pvr-channel" , &val);
p_sys->i_input = val.i_int;
p_sys->i_tell = 0;
/* parse command line options */ /* parse command line options */
psz_tofree = strdup( p_input->psz_name ); psz_tofree = strdup( p_access->psz_path );
psz_parser = psz_tofree; psz_parser = psz_tofree;
if( *psz_parser ) if( *psz_parser )
...@@ -227,6 +350,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -227,6 +350,7 @@ static int Open( vlc_object_t * p_this )
strtol( psz_parser + strlen( "bframes=" ), strtol( psz_parser + strlen( "bframes=" ),
&psz_parser, 0 ); &psz_parser, 0 );
} }
else if( !strncmp( psz_parser, "width=", else if( !strncmp( psz_parser, "width=",
strlen( "width=" ) ) ) strlen( "width=" ) ) )
{ {
...@@ -327,12 +451,12 @@ static int Open( vlc_object_t * p_this ) ...@@ -327,12 +451,12 @@ static int Open( vlc_object_t * p_this )
/* open the device */ /* open the device */
if( ( p_sys->i_fd = open( psz_device, O_RDWR ) ) < 0 ) if( ( p_sys->i_fd = open( psz_device, O_RDWR ) ) < 0 )
{ {
msg_Err( p_input, "cannot open device (%s)", strerror( errno ) ); msg_Err( p_access, "cannot open device (%s)", strerror( errno ) );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
else else
{ {
msg_Dbg( p_input, "using video device: %s",psz_device); msg_Dbg( p_access, "using video device: %s",psz_device);
} }
free( psz_device ); free( psz_device );
...@@ -342,11 +466,11 @@ static int Open( vlc_object_t * p_this ) ...@@ -342,11 +466,11 @@ static int Open( vlc_object_t * p_this )
{ {
if ( ioctl( p_sys->i_fd, VIDIOC_S_INPUT, &p_sys->i_input ) < 0 ) if ( ioctl( p_sys->i_fd, VIDIOC_S_INPUT, &p_sys->i_input ) < 0 )
{ {
msg_Warn( p_input, "VIDIOC_S_INPUT failed" ); msg_Warn( p_access, "VIDIOC_S_INPUT failed" );
} }
else else
{ {
msg_Dbg( p_input, "input set to:%d", p_sys->i_input); msg_Dbg( p_access, "input set to:%d", p_sys->i_input);
} }
} }
...@@ -355,11 +479,11 @@ static int Open( vlc_object_t * p_this ) ...@@ -355,11 +479,11 @@ static int Open( vlc_object_t * p_this )
{ {
if ( ioctl( p_sys->i_fd, VIDIOC_S_STD, &p_sys->i_standard ) < 0 ) if ( ioctl( p_sys->i_fd, VIDIOC_S_STD, &p_sys->i_standard ) < 0 )
{ {
msg_Warn( p_input, "VIDIOC_S_STD failed" ); msg_Warn( p_access, "VIDIOC_S_STD failed" );
} }
else else
{ {
msg_Dbg( p_input, "video standard set to:%x", p_sys->i_standard); msg_Dbg( p_access, "video standard set to:%x", p_sys->i_standard);
} }
} }
...@@ -368,7 +492,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -368,7 +492,7 @@ static int Open( vlc_object_t * p_this )
{ {
if ( ioctl( p_sys->i_fd, VIDIOC_G_FMT, &vfmt ) < 0 ) if ( ioctl( p_sys->i_fd, VIDIOC_G_FMT, &vfmt ) < 0 )
{ {
msg_Warn( p_input, "VIDIOC_G_FMT failed" ); msg_Warn( p_access, "VIDIOC_G_FMT failed" );
} }
else else
{ {
...@@ -384,11 +508,11 @@ static int Open( vlc_object_t * p_this ) ...@@ -384,11 +508,11 @@ static int Open( vlc_object_t * p_this )
if ( ioctl( p_sys->i_fd, VIDIOC_S_FMT, &vfmt ) < 0 ) if ( ioctl( p_sys->i_fd, VIDIOC_S_FMT, &vfmt ) < 0 )
{ {
msg_Warn( p_input, "VIDIOC_S_FMT failed" ); msg_Warn( p_access, "VIDIOC_S_FMT failed" );
} }
else else
{ {
msg_Dbg( p_input, "picture size set to:%dx%d", msg_Dbg( p_access, "picture size set to:%dx%d",
vfmt.fmt.pix.width, vfmt.fmt.pix.height ); vfmt.fmt.pix.width, vfmt.fmt.pix.height );
} }
} }
...@@ -400,7 +524,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -400,7 +524,7 @@ static int Open( vlc_object_t * p_this )
vf.tuner = 0; /* TODO: let the user choose the tuner */ vf.tuner = 0; /* TODO: let the user choose the tuner */
if ( ioctl( p_sys->i_fd, VIDIOC_G_FREQUENCY, &vf ) < 0 ) if ( ioctl( p_sys->i_fd, VIDIOC_G_FREQUENCY, &vf ) < 0 )
{ {
msg_Warn( p_input, "VIDIOC_G_FREQUENCY failed (%s)", msg_Warn( p_access, "VIDIOC_G_FREQUENCY failed (%s)",
strerror( errno ) ); strerror( errno ) );
} }
else else
...@@ -408,12 +532,12 @@ static int Open( vlc_object_t * p_this ) ...@@ -408,12 +532,12 @@ static int Open( vlc_object_t * p_this )
vf.frequency = p_sys->i_frequency * 16 / 1000; vf.frequency = p_sys->i_frequency * 16 / 1000;
if( ioctl( p_sys->i_fd, VIDIOC_S_FREQUENCY, &vf ) < 0 ) if( ioctl( p_sys->i_fd, VIDIOC_S_FREQUENCY, &vf ) < 0 )
{ {
msg_Warn( p_input, "VIDIOC_S_FREQUENCY failed (%s)", msg_Warn( p_access, "VIDIOC_S_FREQUENCY failed (%s)",
strerror( errno ) ); strerror( errno ) );
} }
else else
{ {
msg_Dbg( p_input, "Tuner frequency set to:%d", msg_Dbg( p_access, "Tuner frequency set to:%d",
p_sys->i_frequency); p_sys->i_frequency);
} }
} }
...@@ -421,16 +545,16 @@ static int Open( vlc_object_t * p_this ) ...@@ -421,16 +545,16 @@ static int Open( vlc_object_t * p_this )
/* codec parameters */ /* codec parameters */
if ( p_sys->i_framerate != -1 if ( p_sys->i_framerate != -1
|| p_sys->i_keyint != -1
|| p_sys->i_bframes != -1
|| p_sys->i_bitrate_mode != -1 || p_sys->i_bitrate_mode != -1
|| p_sys->i_bitrate_peak != -1 || p_sys->i_bitrate_peak != -1
|| p_sys->i_keyint != -1
|| p_sys->i_bframes != -1
|| p_sys->i_bitrate != -1 || p_sys->i_bitrate != -1
|| p_sys->i_audio_bitmask != -1 ) || p_sys->i_audio_bitmask != -1 )
{ {
if ( ioctl( p_sys->i_fd, IVTV_IOC_G_CODEC, &codec ) < 0 ) if ( ioctl( p_sys->i_fd, IVTV_IOC_G_CODEC, &codec ) < 0 )
{ {
msg_Warn( p_input, "IVTV_IOC_G_CODEC failed" ); msg_Warn( p_access, "IVTV_IOC_G_CODEC failed" );
} }
else else
{ {
...@@ -447,22 +571,12 @@ static int Open( vlc_object_t * p_this ) ...@@ -447,22 +571,12 @@ static int Open( vlc_object_t * p_this )
break; break;
default: default:
msg_Warn( p_input, "invalid framerate, reverting to 25" ); msg_Warn( p_access, "invalid framerate, reverting to 25" );
codec.framerate = 1; codec.framerate = 1;
break; break;
} }
} }
if ( p_sys->i_keyint != -1 )
{
codec.framespergop = p_sys->i_keyint;
}
if ( p_sys->i_bframes != -1 )
{
codec.bframes = p_sys->i_bframes;
}
if ( p_sys->i_bitrate != -1 ) if ( p_sys->i_bitrate != -1 )
{ {
codec.bitrate = p_sys->i_bitrate; codec.bitrate = p_sys->i_bitrate;
...@@ -482,14 +596,22 @@ static int Open( vlc_object_t * p_this ) ...@@ -482,14 +596,22 @@ static int Open( vlc_object_t * p_this )
{ {
codec.audio_bitmask = p_sys->i_audio_bitmask; codec.audio_bitmask = p_sys->i_audio_bitmask;
} }
if ( p_sys->i_keyint != -1 )
{
codec.framespergop = p_sys->i_keyint;
}
if ( p_sys->i_bframes != -1 )
{
codec.bframes = p_sys->i_bframes;
}
if( ioctl( p_sys->i_fd, IVTV_IOC_S_CODEC, &codec ) < 0 ) if( ioctl( p_sys->i_fd, IVTV_IOC_S_CODEC, &codec ) < 0 )
{ {
msg_Warn( p_input, "IVTV_IOC_S_CODEC failed" ); msg_Warn( p_access, "IVTV_IOC_S_CODEC failed" );
} }
else else
{ {
msg_Dbg( p_input, "Setting codec parameters to: framerate: %d, bitrate: %d/%d/%d", msg_Dbg( p_access, "Setting codec parameters to: framerate: %d, bitrate: %d/%d/%d",
codec.framerate, codec.bitrate, codec.bitrate_peak, codec.bitrate_mode ); codec.framerate, codec.bitrate, codec.bitrate_peak, codec.bitrate_mode );
} }
} }
...@@ -517,8 +639,8 @@ static int Open( vlc_object_t * p_this ) ...@@ -517,8 +639,8 @@ static int Open( vlc_object_t * p_this )
*****************************************************************************/ *****************************************************************************/
static void Close( vlc_object_t * p_this ) static void Close( vlc_object_t * p_this )
{ {
input_thread_t * p_input = (input_thread_t*) p_this; access_t *p_access = (access_t*) p_this;
access_sys_t * p_sys = p_input->p_access_data; access_sys_t * p_sys = p_access->p_sys;
close( p_sys->i_fd ); close( p_sys->i_fd );
free( p_sys ); free( p_sys );
...@@ -527,10 +649,10 @@ static void Close( vlc_object_t * p_this ) ...@@ -527,10 +649,10 @@ static void Close( vlc_object_t * p_this )
/***************************************************************************** /*****************************************************************************
* Read * Read
*****************************************************************************/ *****************************************************************************/
static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer, static int Read( access_t * p_access, uint8_t * p_buffer,
size_t i_len ) int i_len )
{ {
access_sys_t * p_sys = p_input->p_access_data; access_sys_t * p_sys = p_access->p_sys;
int i_ret; int i_ret;
...@@ -542,6 +664,9 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer, ...@@ -542,6 +664,9 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer,
timeout.tv_sec = 0; timeout.tv_sec = 0;
timeout.tv_usec = 500000; timeout.tv_usec = 500000;
if( p_sys->b_eof )
return 0;
while( !( i_ret = select( p_sys->i_fd + 1, &fds, while( !( i_ret = select( p_sys->i_fd + 1, &fds,
NULL, NULL, &timeout ) ) ) NULL, NULL, &timeout ) ) )
{ {
...@@ -550,17 +675,88 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer, ...@@ -550,17 +675,88 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer,
timeout.tv_sec = 0; timeout.tv_sec = 0;
timeout.tv_usec = 500000; timeout.tv_usec = 500000;
if( p_input->b_die || p_input->b_error ) if( p_access->b_die || p_access->b_error )
return 0; return 0;
} }
if( i_ret < 0 ) if( i_ret < 0 )
{ {
msg_Err( p_input, "select error (%s)", strerror( errno ) ); msg_Err( p_access, "select error (%s)", strerror( errno ) );
return -1; return -1;
} }
i_ret = read( p_sys->i_fd, p_buffer, i_len ); i_ret = read( p_sys->i_fd, p_buffer, i_len );
if( i_ret == 0 )
{
p_sys->b_eof = VLC_TRUE;
}
else if ( i_ret > 0 )
{
p_sys->i_tell += i_ret;
}
return i_ret; return i_ret;
} }
/*****************************************************************************
* Control
*****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args )
{
access_sys_t *p_sys = p_access->p_sys;
vlc_bool_t *pb_bool;
int *pi_int;
int64_t *pi_64;
switch( i_query )
{
/* */
case ACCESS_CAN_SEEK:
case ACCESS_CAN_FASTSEEK:
pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
*pb_bool = VLC_FALSE;
break;
case ACCESS_CAN_PAUSE:
pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
*pb_bool = VLC_FALSE;
break;
case ACCESS_CAN_CONTROL_PACE:
pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
*pb_bool = VLC_FALSE;
break;
/* */
case ACCESS_GET_MTU:
pi_int = (int*)va_arg( args, int * );
*pi_int = 0;
break;
case ACCESS_GET_SIZE:
pi_64 = (int64_t*)va_arg( args, int64_t * );
*pi_64 = 0;
break;
case ACCESS_GET_POS:
pi_64 = (int64_t*)va_arg( args, int64_t * );
*pi_64 = p_sys->i_tell;
break;
case ACCESS_GET_EOF:
pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
*pb_bool = p_sys->b_eof;
break;
case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * );
*pi_64 = 1000000;
break;
/* */
case ACCESS_SET_PAUSE_STATE:
/* Nothing to do */
break;
default:
msg_Err( p_access, "unimplemented query in control" );
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
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