Commit c279528f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

V4L2: remove unused parameters

parent 11d44bdd
...@@ -417,8 +417,8 @@ static int OpenVideoDev( vlc_object_t *, demux_sys_t *, bool ); ...@@ -417,8 +417,8 @@ static int OpenVideoDev( vlc_object_t *, demux_sys_t *, bool );
static bool ProbeVideoDev( vlc_object_t *, demux_sys_t *, static bool ProbeVideoDev( vlc_object_t *, demux_sys_t *,
const char *psz_device ); const char *psz_device );
static int ControlList( vlc_object_t *, demux_sys_t *, int , bool, bool ); static int ControlList( vlc_object_t *, int , bool, bool );
static int Control( vlc_object_t *, demux_sys_t *, int i_fd, static int Control( vlc_object_t *, int i_fd,
const char *psz_name, int i_cid, int i_value ); const char *psz_name, int i_cid, int i_value );
static int DemuxControlCallback( vlc_object_t *p_this, const char *psz_var, static int DemuxControlCallback( vlc_object_t *p_this, const char *psz_var,
...@@ -1583,15 +1583,10 @@ static bool IsPixelFormatSupported( demux_t *p_demux, unsigned int i_pixelformat ...@@ -1583,15 +1583,10 @@ static bool IsPixelFormatSupported( demux_t *p_demux, unsigned int i_pixelformat
return false; return false;
} }
static float GetMaxFrameRate( demux_t *p_demux, int i_fd, static float GetMaxFrameRate( int i_fd, uint32_t i_pixel_format,
uint32_t i_pixel_format,
uint32_t i_width, uint32_t i_height ) uint32_t i_width, uint32_t i_height )
{ {
(void)p_demux;
#ifdef VIDIOC_ENUM_FRAMEINTERVALS #ifdef VIDIOC_ENUM_FRAMEINTERVALS
#ifdef HAVE_LIBV4L2
demux_sys_t *p_sys = p_demux->p_sys;
#endif
/* This is new in Linux 2.6.19 */ /* This is new in Linux 2.6.19 */
struct v4l2_frmivalenum frmival; struct v4l2_frmivalenum frmival;
memset( &frmival, 0, sizeof(frmival) ); memset( &frmival, 0, sizeof(frmival) );
...@@ -1632,9 +1627,6 @@ static float GetAbsoluteMaxFrameRate( demux_t *p_demux, int i_fd, ...@@ -1632,9 +1627,6 @@ static float GetAbsoluteMaxFrameRate( demux_t *p_demux, int i_fd,
{ {
float f_fps_max = -1.; float f_fps_max = -1.;
#ifdef VIDIOC_ENUM_FRAMESIZES #ifdef VIDIOC_ENUM_FRAMESIZES
#ifdef HAVE_LIBV4L2
demux_sys_t *p_sys = p_demux->p_sys;
#endif
/* This is new in Linux 2.6.19 */ /* This is new in Linux 2.6.19 */
struct v4l2_frmsizeenum frmsize; struct v4l2_frmsizeenum frmsize;
memset( &frmsize, 0, sizeof(frmsize) ); memset( &frmsize, 0, sizeof(frmsize) );
...@@ -1647,8 +1639,7 @@ static float GetAbsoluteMaxFrameRate( demux_t *p_demux, int i_fd, ...@@ -1647,8 +1639,7 @@ static float GetAbsoluteMaxFrameRate( demux_t *p_demux, int i_fd,
do do
{ {
frmsize.index++; frmsize.index++;
float f_fps = GetMaxFrameRate( p_demux, i_fd, float f_fps = GetMaxFrameRate( i_fd, i_pixel_format,
i_pixel_format,
frmsize.discrete.width, frmsize.discrete.width,
frmsize.discrete.height ); frmsize.discrete.height );
if( f_fps > f_fps_max ) f_fps_max = f_fps; if( f_fps > f_fps_max ) f_fps_max = f_fps;
...@@ -1665,8 +1656,7 @@ static float GetAbsoluteMaxFrameRate( demux_t *p_demux, int i_fd, ...@@ -1665,8 +1656,7 @@ static float GetAbsoluteMaxFrameRate( demux_t *p_demux, int i_fd,
i_width += frmsize.stepwise.step_width, i_width += frmsize.stepwise.step_width,
i_height += frmsize.stepwise.step_height ) i_height += frmsize.stepwise.step_height )
{ {
float f_fps = GetMaxFrameRate( p_demux, i_fd, float f_fps = GetMaxFrameRate( i_fd, i_pixel_format,
i_pixel_format,
i_width, i_height ); i_width, i_height );
if( f_fps > f_fps_max ) f_fps_max = f_fps; if( f_fps > f_fps_max ) f_fps_max = f_fps;
} }
...@@ -1675,8 +1665,7 @@ static float GetAbsoluteMaxFrameRate( demux_t *p_demux, int i_fd, ...@@ -1675,8 +1665,7 @@ static float GetAbsoluteMaxFrameRate( demux_t *p_demux, int i_fd,
case V4L2_FRMSIZE_TYPE_CONTINUOUS: case V4L2_FRMSIZE_TYPE_CONTINUOUS:
/* FIXME */ /* FIXME */
msg_Err( p_demux, "GetAbsoluteMaxFrameRate implementation for V4L2_FRMSIZE_TYPE_CONTINUOUS isn't correct" ); msg_Err( p_demux, "GetAbsoluteMaxFrameRate implementation for V4L2_FRMSIZE_TYPE_CONTINUOUS isn't correct" );
f_fps_max = GetMaxFrameRate( p_demux, i_fd, f_fps_max = GetMaxFrameRate( i_fd, i_pixel_format,
i_pixel_format,
frmsize.stepwise.max_width, frmsize.stepwise.max_width,
frmsize.stepwise.max_height ); frmsize.stepwise.max_height );
break; break;
...@@ -1693,9 +1682,6 @@ static void GetMaxDimensions( demux_t *p_demux, int i_fd, ...@@ -1693,9 +1682,6 @@ static void GetMaxDimensions( demux_t *p_demux, int i_fd,
*pi_width = 0; *pi_width = 0;
*pi_height = 0; *pi_height = 0;
#ifdef VIDIOC_ENUM_FRAMESIZES #ifdef VIDIOC_ENUM_FRAMESIZES
#ifdef HAVE_LIBV4L2
demux_sys_t *p_sys = p_demux->p_sys;
#endif
/* This is new in Linux 2.6.19 */ /* This is new in Linux 2.6.19 */
struct v4l2_frmsizeenum frmsize; struct v4l2_frmsizeenum frmsize;
memset( &frmsize, 0, sizeof(frmsize) ); memset( &frmsize, 0, sizeof(frmsize) );
...@@ -1708,8 +1694,7 @@ static void GetMaxDimensions( demux_t *p_demux, int i_fd, ...@@ -1708,8 +1694,7 @@ static void GetMaxDimensions( demux_t *p_demux, int i_fd,
do do
{ {
frmsize.index++; frmsize.index++;
float f_fps = GetMaxFrameRate( p_demux, i_fd, float f_fps = GetMaxFrameRate( i_fd, i_pixel_format,
i_pixel_format,
frmsize.discrete.width, frmsize.discrete.width,
frmsize.discrete.height ); frmsize.discrete.height );
if( f_fps >= f_fps_min && if( f_fps >= f_fps_min &&
...@@ -1731,8 +1716,7 @@ static void GetMaxDimensions( demux_t *p_demux, int i_fd, ...@@ -1731,8 +1716,7 @@ static void GetMaxDimensions( demux_t *p_demux, int i_fd,
i_width += frmsize.stepwise.step_width, i_width += frmsize.stepwise.step_width,
i_height += frmsize.stepwise.step_height ) i_height += frmsize.stepwise.step_height )
{ {
float f_fps = GetMaxFrameRate( p_demux, i_fd, float f_fps = GetMaxFrameRate( i_fd, i_pixel_format,
i_pixel_format,
i_width, i_height ); i_width, i_height );
if( f_fps >= f_fps_min && i_width > *pi_width ) if( f_fps >= f_fps_min && i_width > *pi_width )
{ {
...@@ -1745,8 +1729,7 @@ static void GetMaxDimensions( demux_t *p_demux, int i_fd, ...@@ -1745,8 +1729,7 @@ static void GetMaxDimensions( demux_t *p_demux, int i_fd,
case V4L2_FRMSIZE_TYPE_CONTINUOUS: case V4L2_FRMSIZE_TYPE_CONTINUOUS:
/* FIXME */ /* FIXME */
msg_Err( p_demux, "GetMaxDimension implementation for V4L2_FRMSIZE_TYPE_CONTINUOUS isn't correct" ); msg_Err( p_demux, "GetMaxDimension implementation for V4L2_FRMSIZE_TYPE_CONTINUOUS isn't correct" );
float f_fps = GetMaxFrameRate( p_demux, i_fd, float f_fps = GetMaxFrameRate( i_fd, i_pixel_format,
i_pixel_format,
frmsize.stepwise.max_width, frmsize.stepwise.max_width,
frmsize.stepwise.max_height ); frmsize.stepwise.max_height );
if( f_fps >= f_fps_min && if( f_fps >= f_fps_min &&
...@@ -1895,8 +1878,8 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux ) ...@@ -1895,8 +1878,8 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux )
/* TODO: Move the resolution stuff up here */ /* TODO: Move the resolution stuff up here */
/* if MPEG encoder card, no need to do anything else after this */ /* if MPEG encoder card, no need to do anything else after this */
ControlList( p_obj, p_sys, i_fd, ControlList( p_obj, i_fd, var_GetBool( p_obj, "v4l2-controls-reset" ),
var_GetBool( p_obj, "v4l2-controls-reset" ), b_demux ); b_demux );
SetAvailControlsByString( p_obj, p_sys, i_fd ); SetAvailControlsByString( p_obj, p_sys, i_fd );
/* Verify device support for the various IO methods */ /* Verify device support for the various IO methods */
...@@ -2700,7 +2683,7 @@ static void name2var( unsigned char *name ) ...@@ -2700,7 +2683,7 @@ static void name2var( unsigned char *name )
* Print a user-class v4l2 control's details, create the relevant variable, * Print a user-class v4l2 control's details, create the relevant variable,
* change the value if needed. * change the value if needed.
*****************************************************************************/ *****************************************************************************/
static void ControlListPrint( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd, static void ControlListPrint( vlc_object_t *p_obj, int i_fd,
struct v4l2_queryctrl queryctrl, struct v4l2_queryctrl queryctrl,
bool b_reset, bool b_demux ) bool b_reset, bool b_demux )
{ {
...@@ -2819,14 +2802,13 @@ static void ControlListPrint( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd, ...@@ -2819,14 +2802,13 @@ static void ControlListPrint( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd,
if( b_reset && queryctrl.default_value != control.value ) if( b_reset && queryctrl.default_value != control.value )
{ {
msg_Dbg( p_obj, " reset value to default" ); msg_Dbg( p_obj, " reset value to default" );
Control( p_obj, p_sys, i_fd, psz_name, Control( p_obj, i_fd, psz_name,
queryctrl.id, queryctrl.default_value ); queryctrl.id, queryctrl.default_value );
} }
} }
else else
{ {
Control( p_obj, p_sys, i_fd, psz_name, Control( p_obj, i_fd, psz_name, queryctrl.id, i_val );
queryctrl.id, i_val );
} }
} }
break; break;
...@@ -2874,8 +2856,8 @@ static void ControlListPrint( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd, ...@@ -2874,8 +2856,8 @@ static void ControlListPrint( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd,
* List all user-class v4l2 controls, set them to the user specified * List all user-class v4l2 controls, set them to the user specified
* value and create the relevant variables to enable runtime changes * value and create the relevant variables to enable runtime changes
*****************************************************************************/ *****************************************************************************/
static int ControlList( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd, static int ControlList( vlc_object_t *p_obj, int i_fd, bool b_reset,
bool b_reset, bool b_demux ) bool b_demux )
{ {
struct v4l2_queryctrl queryctrl; struct v4l2_queryctrl queryctrl;
int i_cid; int i_cid;
...@@ -2936,7 +2918,7 @@ static int ControlList( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd, ...@@ -2936,7 +2918,7 @@ static int ControlList( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd,
queryctrl.name, queryctrl.id ); queryctrl.name, queryctrl.id );
break; break;
} }
ControlListPrint( p_obj, p_sys, i_fd, queryctrl, b_reset, b_demux ); ControlListPrint( p_obj, i_fd, queryctrl, b_reset, b_demux );
queryctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL; queryctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
} }
} }
...@@ -2956,8 +2938,7 @@ static int ControlList( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd, ...@@ -2956,8 +2938,7 @@ static int ControlList( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd,
continue; continue;
msg_Dbg( p_obj, "Available control: %s (%x)", msg_Dbg( p_obj, "Available control: %s (%x)",
queryctrl.name, queryctrl.id ); queryctrl.name, queryctrl.id );
ControlListPrint( p_obj, p_sys, i_fd, queryctrl, ControlListPrint( p_obj, i_fd, queryctrl, b_reset, b_demux );
b_reset, b_demux );
} }
} }
...@@ -2973,8 +2954,7 @@ static int ControlList( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd, ...@@ -2973,8 +2954,7 @@ static int ControlList( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd,
continue; continue;
msg_Dbg( p_obj, "Available private control: %s (%x)", msg_Dbg( p_obj, "Available private control: %s (%x)",
queryctrl.name, queryctrl.id ); queryctrl.name, queryctrl.id );
ControlListPrint( p_obj, p_sys, i_fd, queryctrl, ControlListPrint( p_obj, i_fd, queryctrl, b_reset, b_demux );
b_reset, b_demux );
} }
else else
break; break;
...@@ -3042,7 +3022,7 @@ static void SetAvailControlsByString( vlc_object_t *p_obj, demux_sys_t *p_sys, ...@@ -3042,7 +3022,7 @@ static void SetAvailControlsByString( vlc_object_t *p_obj, demux_sys_t *p_sys,
if( !strncasecmp( psz_name, psz_parser, i_maxstrlen ) ) if( !strncasecmp( psz_name, psz_parser, i_maxstrlen ) )
{ {
Control( p_obj, p_sys, i_fd, psz_name, i_cid, Control( p_obj, i_fd, psz_name, i_cid,
strtol( ++psz_assign, &psz_parser, 0) ); strtol( ++psz_assign, &psz_parser, 0) );
} }
free( name.psz_string ); free( name.psz_string );
...@@ -3062,7 +3042,7 @@ static void SetAvailControlsByString( vlc_object_t *p_obj, demux_sys_t *p_sys, ...@@ -3062,7 +3042,7 @@ static void SetAvailControlsByString( vlc_object_t *p_obj, demux_sys_t *p_sys,
/***************************************************************************** /*****************************************************************************
* Reset all user-class v4l2 controls to their default value * Reset all user-class v4l2 controls to their default value
*****************************************************************************/ *****************************************************************************/
static int ControlReset( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd ) static int ControlReset( vlc_object_t *p_obj, int i_fd )
{ {
struct v4l2_queryctrl queryctrl; struct v4l2_queryctrl queryctrl;
int i_cid; int i_cid;
...@@ -3091,7 +3071,7 @@ static int ControlReset( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd ) ...@@ -3091,7 +3071,7 @@ static int ControlReset( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd )
for( i = 0; controls[i].psz_name != NULL; i++ ) for( i = 0; controls[i].psz_name != NULL; i++ )
if( controls[i].i_cid == queryctrl.id ) break; if( controls[i].i_cid == queryctrl.id ) break;
name2var( queryctrl.name ); name2var( queryctrl.name );
Control( p_obj, p_sys, i_fd, Control( p_obj, i_fd,
controls[i].psz_name ? controls[i].psz_name controls[i].psz_name ? controls[i].psz_name
: (const char *)queryctrl.name, : (const char *)queryctrl.name,
queryctrl.id, queryctrl.default_value ); queryctrl.id, queryctrl.default_value );
...@@ -3122,7 +3102,7 @@ static int ControlReset( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd ) ...@@ -3122,7 +3102,7 @@ static int ControlReset( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd )
for( i = 0; controls[i].psz_name != NULL; i++ ) for( i = 0; controls[i].psz_name != NULL; i++ )
if( controls[i].i_cid == queryctrl.id ) break; if( controls[i].i_cid == queryctrl.id ) break;
name2var( queryctrl.name ); name2var( queryctrl.name );
Control( p_obj, p_sys, i_fd, Control( p_obj, i_fd,
controls[i].psz_name ? controls[i].psz_name controls[i].psz_name ? controls[i].psz_name
: (const char *)queryctrl.name, : (const char *)queryctrl.name,
queryctrl.id, queryctrl.default_value ); queryctrl.id, queryctrl.default_value );
...@@ -3147,7 +3127,7 @@ static int ControlReset( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd ) ...@@ -3147,7 +3127,7 @@ static int ControlReset( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd )
&& queryctrl.default_value != control.value ) && queryctrl.default_value != control.value )
{ {
name2var( queryctrl.name ); name2var( queryctrl.name );
Control( p_obj, p_sys, i_fd, (const char *)queryctrl.name, Control( p_obj, i_fd, (const char *)queryctrl.name,
queryctrl.id, queryctrl.default_value ); queryctrl.id, queryctrl.default_value );
} }
} }
...@@ -3161,10 +3141,9 @@ static int ControlReset( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd ) ...@@ -3161,10 +3141,9 @@ static int ControlReset( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd )
/***************************************************************************** /*****************************************************************************
* Issue user-class v4l2 controls * Issue user-class v4l2 controls
*****************************************************************************/ *****************************************************************************/
static int Control( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd, static int Control( vlc_object_t *p_obj, int i_fd,
const char *psz_name, int i_cid, int i_value ) const char *psz_name, int i_cid, int i_value )
{ {
(void)p_sys;
struct v4l2_queryctrl queryctrl; struct v4l2_queryctrl queryctrl;
struct v4l2_control control; struct v4l2_control control;
struct v4l2_ext_control ext_control; struct v4l2_ext_control ext_control;
...@@ -3254,7 +3233,7 @@ static int DemuxControlCallback( vlc_object_t *p_this, ...@@ -3254,7 +3233,7 @@ static int DemuxControlCallback( vlc_object_t *p_this,
if( i_fd < 0 ) if( i_fd < 0 )
return VLC_EGENERIC; return VLC_EGENERIC;
Control( p_this, p_sys, i_fd, psz_var, i_cid, newval.i_int ); Control( p_this, i_fd, psz_var, i_cid, newval.i_int );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -3271,7 +3250,7 @@ static int DemuxControlResetCallback( vlc_object_t *p_this, ...@@ -3271,7 +3250,7 @@ static int DemuxControlResetCallback( vlc_object_t *p_this,
if( i_fd < 0 ) if( i_fd < 0 )
return VLC_EGENERIC; return VLC_EGENERIC;
ControlReset( p_this, p_sys, i_fd ); ControlReset( p_this, i_fd );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -3290,7 +3269,7 @@ static int AccessControlCallback( vlc_object_t *p_this, ...@@ -3290,7 +3269,7 @@ static int AccessControlCallback( vlc_object_t *p_this,
if( i_fd < 0 ) if( i_fd < 0 )
return VLC_EGENERIC; return VLC_EGENERIC;
Control( p_this, p_sys, i_fd, psz_var, i_cid, newval.i_int ); Control( p_this, i_fd, psz_var, i_cid, newval.i_int );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -3307,7 +3286,7 @@ static int AccessControlResetCallback( vlc_object_t *p_this, ...@@ -3307,7 +3286,7 @@ static int AccessControlResetCallback( vlc_object_t *p_this,
if( i_fd < 0 ) if( i_fd < 0 )
return VLC_EGENERIC; return VLC_EGENERIC;
ControlReset( p_this, p_sys, i_fd ); ControlReset( p_this, i_fd );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
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