Commit 7873bfc0 authored by Antoine Cellerier's avatar Antoine Cellerier

If the v4l2 driver supports the extended controls API, use it to list controls...

If the v4l2 driver supports the extended controls API, use it to list controls (instead of the user control API).
parent 978ed0ef
...@@ -2715,6 +2715,10 @@ static void ControlListPrint( vlc_object_t *p_obj, int i_fd, ...@@ -2715,6 +2715,10 @@ static void ControlListPrint( vlc_object_t *p_obj, int i_fd,
var_Create( p_obj, psz_name, var_Create( p_obj, psz_name,
VLC_VAR_VOID | VLC_VAR_ISCOMMAND ); VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
break; break;
case V4L2_CTRL_TYPE_CTRL_CLASS:
msg_Dbg( p_obj, " control class" );
var_Create( p_obj, psz_name, VLC_VAR_VOID );
break;
default: default:
msg_Dbg( p_obj, " unknown control type (FIXME)" ); msg_Dbg( p_obj, " unknown control type (FIXME)" );
/* FIXME */ /* FIXME */
...@@ -2821,39 +2825,73 @@ static int ControlList( vlc_object_t *p_obj, int i_fd, ...@@ -2821,39 +2825,73 @@ static int ControlList( vlc_object_t *p_obj, int i_fd,
else else
var_AddCallback( p_obj, "controls-reset", AccessControlResetCallback, NULL ); var_AddCallback( p_obj, "controls-reset", AccessControlResetCallback, NULL );
/* List public controls */ queryctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
for( i_cid = V4L2_CID_BASE; if( ioctl( i_fd, VIDIOC_QUERYCTRL, &queryctrl ) >= 0 )
i_cid < V4L2_CID_LASTP1;
i_cid ++ )
{ {
queryctrl.id = i_cid; msg_Dbg( p_obj, "Extended control API supported by v4l2 driver" );
if( ioctl( i_fd, VIDIOC_QUERYCTRL, &queryctrl ) >= 0 )
/* List extended controls */
queryctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
while( ioctl( i_fd, VIDIOC_QUERYCTRL, &queryctrl ) >= 0 )
{ {
if( queryctrl.flags & V4L2_CTRL_FLAG_DISABLED ) switch( V4L2_CTRL_ID2CLASS( queryctrl.id ) )
continue; {
msg_Dbg( p_obj, "Available control: %s (%x)", case V4L2_CTRL_CLASS_USER:
queryctrl.name, queryctrl.id ); msg_Dbg( p_obj, "Available control: %s (%x)",
queryctrl.name, queryctrl.id );
break;
case V4L2_CTRL_CLASS_MPEG:
msg_Dbg( p_obj, "Available MPEG control: %s (%x)",
queryctrl.name, queryctrl.id );
break;
default:
msg_Dbg( p_obj, "Available private control: %s (%x)",
queryctrl.name, queryctrl.id );
break;
}
ControlListPrint( p_obj, i_fd, queryctrl, b_reset, b_demux ); ControlListPrint( p_obj, i_fd, queryctrl, b_reset, b_demux );
queryctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
} }
} }
else
/* List private controls */
for( i_cid = V4L2_CID_PRIVATE_BASE;
;
i_cid ++ )
{ {
queryctrl.id = i_cid; msg_Dbg( p_obj, "Extended control API not supported by v4l2 driver" );
if( ioctl( i_fd, VIDIOC_QUERYCTRL, &queryctrl ) >= 0 )
/* List public controls */
for( i_cid = V4L2_CID_BASE;
i_cid < V4L2_CID_LASTP1;
i_cid ++ )
{ {
if( queryctrl.flags & V4L2_CTRL_FLAG_DISABLED ) queryctrl.id = i_cid;
continue; if( ioctl( i_fd, VIDIOC_QUERYCTRL, &queryctrl ) >= 0 )
msg_Dbg( p_obj, "Available private control: %s (%x)", {
queryctrl.name, queryctrl.id ); if( queryctrl.flags & V4L2_CTRL_FLAG_DISABLED )
ControlListPrint( p_obj, i_fd, queryctrl, b_reset, b_demux ); continue;
msg_Dbg( p_obj, "Available control: %s (%x)",
queryctrl.name, queryctrl.id );
ControlListPrint( p_obj, i_fd, queryctrl, b_reset, b_demux );
}
}
/* List private controls */
for( i_cid = V4L2_CID_PRIVATE_BASE;
;
i_cid ++ )
{
queryctrl.id = i_cid;
if( ioctl( i_fd, VIDIOC_QUERYCTRL, &queryctrl ) >= 0 )
{
if( queryctrl.flags & V4L2_CTRL_FLAG_DISABLED )
continue;
msg_Dbg( p_obj, "Available private control: %s (%x)",
queryctrl.name, queryctrl.id );
ControlListPrint( p_obj, i_fd, queryctrl, b_reset, b_demux );
}
else
break;
} }
else
break;
} }
return VLC_SUCCESS; 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