Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
06bf999c
Commit
06bf999c
authored
Dec 02, 2007
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add v4l2-gamma control. Also print control details for private controls.
parent
dc6c106f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
57 deletions
+95
-57
modules/access/v4l2.c
modules/access/v4l2.c
+95
-57
No files found.
modules/access/v4l2.c
View file @
06bf999c
...
@@ -74,10 +74,6 @@ static void Close( vlc_object_t * );
...
@@ -74,10 +74,6 @@ static void Close( vlc_object_t * );
#define DEV_LONGTEXT N_( \
#define DEV_LONGTEXT N_( \
"Name of the device to use. " \
"Name of the device to use. " \
"If you don't specify anything, /dev/video0 will be used.")
"If you don't specify anything, /dev/video0 will be used.")
#define ADEV_TEXT N_("Audio device name")
#define ADEV_LONGTEXT N_( \
"Name of the audio device to use. " \
"If you don't specify anything, /dev/dsp will be used.")
#define STANDARD_TEXT N_( "Standard" )
#define STANDARD_TEXT N_( "Standard" )
#define STANDARD_LONGTEXT N_( \
#define STANDARD_LONGTEXT N_( \
"Video standard (Default, SECAM, PAL, or NTSC)." )
"Video standard (Default, SECAM, PAL, or NTSC)." )
...
@@ -98,6 +94,10 @@ static void Close( vlc_object_t * );
...
@@ -98,6 +94,10 @@ static void Close( vlc_object_t * );
#define HEIGHT_TEXT N_( "Height" )
#define HEIGHT_TEXT N_( "Height" )
#define HEIGHT_LONGTEXT N_( \
#define HEIGHT_LONGTEXT N_( \
"Force height (-1 for autodetect)." )
"Force height (-1 for autodetect)." )
#define FPS_TEXT N_( "Framerate" )
#define FPS_LONGTEXT N_( "Framerate to capture, if applicable " \
"(-1 for autodetect)." )
#define BRIGHTNESS_TEXT N_( "Brightness" )
#define BRIGHTNESS_TEXT N_( "Brightness" )
#define BRIGHTNESS_LONGTEXT N_( \
#define BRIGHTNESS_LONGTEXT N_( \
"Brightness of the video input." )
"Brightness of the video input." )
...
@@ -110,9 +110,14 @@ static void Close( vlc_object_t * );
...
@@ -110,9 +110,14 @@ static void Close( vlc_object_t * );
#define HUE_TEXT N_( "Hue" )
#define HUE_TEXT N_( "Hue" )
#define HUE_LONGTEXT N_( \
#define HUE_LONGTEXT N_( \
"Hue of the video input." )
"Hue of the video input." )
#define FPS_TEXT N_( "Framerate" )
#define GAMMA_TEXT N_( "Gamma" )
#define FPS_LONGTEXT N_( "Framerate to capture, if applicable " \
#define GAMMA_LONGTEXT N_( \
"(-1 for autodetect)." )
"Gamma of the video input." )
#define ADEV_TEXT N_("Audio device name")
#define ADEV_LONGTEXT N_( \
"Name of the audio device to use. " \
"If you don't specify anything, /dev/dsp will be used.")
#define ALSA_TEXT N_( "Use Alsa" )
#define ALSA_TEXT N_( "Use Alsa" )
#define ALSA_LONGTEXT N_( \
#define ALSA_LONGTEXT N_( \
"Use ALSA instead of OSS for audio" )
"Use ALSA instead of OSS for audio" )
...
@@ -122,6 +127,7 @@ static void Close( vlc_object_t * );
...
@@ -122,6 +127,7 @@ static void Close( vlc_object_t * );
#define SAMPLERATE_TEXT N_( "Samplerate" )
#define SAMPLERATE_TEXT N_( "Samplerate" )
#define SAMPLERATE_LONGTEXT N_( \
#define SAMPLERATE_LONGTEXT N_( \
"Samplerate of the captured audio stream, in Hz (eg: 11025, 22050, 44100, 48000)" )
"Samplerate of the captured audio stream, in Hz (eg: 11025, 22050, 44100, 48000)" )
#define CACHING_TEXT N_("Caching value in ms")
#define CACHING_TEXT N_("Caching value in ms")
#define CACHING_LONGTEXT N_( \
#define CACHING_LONGTEXT N_( \
"Caching value for V4L2 captures. This " \
"Caching value for V4L2 captures. This " \
...
@@ -149,10 +155,9 @@ vlc_module_begin();
...
@@ -149,10 +155,9 @@ vlc_module_begin();
set_category
(
CAT_INPUT
);
set_category
(
CAT_INPUT
);
set_subcategory
(
SUBCAT_INPUT_ACCESS
);
set_subcategory
(
SUBCAT_INPUT_ACCESS
);
set_section
(
N_
(
"Video input"
),
NULL
);
add_string
(
"v4l2-dev"
,
"/dev/video0"
,
0
,
DEV_TEXT
,
DEV_LONGTEXT
,
add_string
(
"v4l2-dev"
,
"/dev/video0"
,
0
,
DEV_TEXT
,
DEV_LONGTEXT
,
VLC_FALSE
);
VLC_FALSE
);
add_string
(
"v4l2-adev"
,
"/dev/dsp"
,
0
,
ADEV_TEXT
,
ADEV_LONGTEXT
,
VLC_FALSE
);
add_integer
(
"v4l2-standard"
,
0
,
NULL
,
STANDARD_TEXT
,
STANDARD_LONGTEXT
,
add_integer
(
"v4l2-standard"
,
0
,
NULL
,
STANDARD_TEXT
,
STANDARD_LONGTEXT
,
VLC_FALSE
);
VLC_FALSE
);
change_integer_list
(
i_standards_list
,
psz_standards_list_text
,
0
);
change_integer_list
(
i_standards_list
,
psz_standards_list_text
,
0
);
...
@@ -167,6 +172,9 @@ vlc_module_begin();
...
@@ -167,6 +172,9 @@ vlc_module_begin();
WIDTH_LONGTEXT
,
VLC_TRUE
);
WIDTH_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"v4l2-height"
,
0
,
NULL
,
HEIGHT_TEXT
,
add_integer
(
"v4l2-height"
,
0
,
NULL
,
HEIGHT_TEXT
,
HEIGHT_LONGTEXT
,
VLC_TRUE
);
HEIGHT_LONGTEXT
,
VLC_TRUE
);
add_float
(
"v4l2-fps"
,
0
,
NULL
,
FPS_TEXT
,
FPS_LONGTEXT
,
VLC_TRUE
);
set_section
(
N_
(
"Video controls"
),
NULL
);
add_integer
(
"v4l2-brightness"
,
-
1
,
NULL
,
BRIGHTNESS_TEXT
,
add_integer
(
"v4l2-brightness"
,
-
1
,
NULL
,
BRIGHTNESS_TEXT
,
BRIGHTNESS_LONGTEXT
,
VLC_TRUE
);
BRIGHTNESS_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"v4l2-contrast"
,
-
1
,
NULL
,
CONTRAST_TEXT
,
add_integer
(
"v4l2-contrast"
,
-
1
,
NULL
,
CONTRAST_TEXT
,
...
@@ -175,7 +183,12 @@ vlc_module_begin();
...
@@ -175,7 +183,12 @@ vlc_module_begin();
SATURATION_LONGTEXT
,
VLC_TRUE
);
SATURATION_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"v4l2-hue"
,
-
1
,
NULL
,
HUE_TEXT
,
add_integer
(
"v4l2-hue"
,
-
1
,
NULL
,
HUE_TEXT
,
HUE_LONGTEXT
,
VLC_TRUE
);
HUE_LONGTEXT
,
VLC_TRUE
);
add_float
(
"v4l2-fps"
,
0
,
NULL
,
FPS_TEXT
,
FPS_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"v4l2-gamma"
,
-
1
,
NULL
,
GAMMA_TEXT
,
GAMMA_LONGTEXT
,
VLC_TRUE
);
set_section
(
N_
(
"Audio input"
),
NULL
);
add_string
(
"v4l2-adev"
,
"/dev/dsp"
,
0
,
ADEV_TEXT
,
ADEV_LONGTEXT
,
VLC_FALSE
);
#ifdef HAVE_ALSA
#ifdef HAVE_ALSA
add_bool
(
"v4l2-alsa"
,
VLC_FALSE
,
NULL
,
ALSA_TEXT
,
ALSA_LONGTEXT
,
add_bool
(
"v4l2-alsa"
,
VLC_FALSE
,
NULL
,
ALSA_TEXT
,
ALSA_LONGTEXT
,
VLC_TRUE
);
VLC_TRUE
);
...
@@ -300,6 +313,7 @@ struct demux_sys_t
...
@@ -300,6 +313,7 @@ struct demux_sys_t
int
i_contrast
;
int
i_contrast
;
int
i_saturation
;
int
i_saturation
;
int
i_hue
;
int
i_hue
;
int
i_gamma
;
picture_t
pic
;
picture_t
pic
;
int
i_video_frame_size
;
int
i_video_frame_size
;
...
@@ -369,11 +383,14 @@ static int Open( vlc_object_t *p_this )
...
@@ -369,11 +383,14 @@ static int Open( vlc_object_t *p_this )
var_CreateGetIntegerCommand
(
p_demux
,
"v4l2-saturation"
);
var_CreateGetIntegerCommand
(
p_demux
,
"v4l2-saturation"
);
p_sys
->
i_hue
=
p_sys
->
i_hue
=
var_CreateGetIntegerCommand
(
p_demux
,
"v4l2-hue"
);
var_CreateGetIntegerCommand
(
p_demux
,
"v4l2-hue"
);
p_sys
->
i_gamma
=
var_CreateGetIntegerCommand
(
p_demux
,
"v4l2-gamma"
);
var_AddCallback
(
p_demux
,
"v4l2-brightness"
,
VideoControlCallback
,
NULL
);
var_AddCallback
(
p_demux
,
"v4l2-brightness"
,
VideoControlCallback
,
NULL
);
var_AddCallback
(
p_demux
,
"v4l2-contrast"
,
VideoControlCallback
,
NULL
);
var_AddCallback
(
p_demux
,
"v4l2-contrast"
,
VideoControlCallback
,
NULL
);
var_AddCallback
(
p_demux
,
"v4l2-saturation"
,
VideoControlCallback
,
NULL
);
var_AddCallback
(
p_demux
,
"v4l2-saturation"
,
VideoControlCallback
,
NULL
);
var_AddCallback
(
p_demux
,
"v4l2-hue"
,
VideoControlCallback
,
NULL
);
var_AddCallback
(
p_demux
,
"v4l2-hue"
,
VideoControlCallback
,
NULL
);
var_AddCallback
(
p_demux
,
"v4l2-gamma"
,
VideoControlCallback
,
NULL
);
var_Create
(
p_demux
,
"v4l2-fps"
,
VLC_VAR_FLOAT
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_demux
,
"v4l2-fps"
,
VLC_VAR_FLOAT
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_demux
,
"v4l2-fps"
,
&
val
);
var_Get
(
p_demux
,
"v4l2-fps"
,
&
val
);
...
@@ -666,6 +683,13 @@ static void ParseMRL( demux_t *p_demux )
...
@@ -666,6 +683,13 @@ static void ParseMRL( demux_t *p_demux )
strtol
(
psz_parser
+
strlen
(
"hue="
),
strtol
(
psz_parser
+
strlen
(
"hue="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"gamma="
,
strlen
(
"gamma="
)
)
)
{
p_sys
->
i_gamma
=
strtol
(
psz_parser
+
strlen
(
"gamma="
),
&
psz_parser
,
0
);
}
else
if
(
!
strncmp
(
psz_parser
,
"samplerate="
,
else
if
(
!
strncmp
(
psz_parser
,
"samplerate="
,
strlen
(
"samplerate="
)
)
)
strlen
(
"samplerate="
)
)
)
{
{
...
@@ -1536,6 +1560,7 @@ int OpenVideoDev( demux_t *p_demux, char *psz_device )
...
@@ -1536,6 +1560,7 @@ int OpenVideoDev( demux_t *p_demux, char *psz_device )
VideoControl
(
p_demux
,
i_fd
,
VideoControl
(
p_demux
,
i_fd
,
"saturation"
,
V4L2_CID_SATURATION
,
p_sys
->
i_saturation
);
"saturation"
,
V4L2_CID_SATURATION
,
p_sys
->
i_saturation
);
VideoControl
(
p_demux
,
i_fd
,
"hue"
,
V4L2_CID_HUE
,
p_sys
->
i_hue
);
VideoControl
(
p_demux
,
i_fd
,
"hue"
,
V4L2_CID_HUE
,
p_sys
->
i_hue
);
VideoControl
(
p_demux
,
i_fd
,
"gamma"
,
V4L2_CID_GAMMA
,
p_sys
->
i_gamma
);
/* Init vout Picture */
/* Init vout Picture */
vout_InitPicture
(
VLC_OBJECT
(
p_demux
),
&
p_sys
->
pic
,
p_sys
->
i_fourcc
,
vout_InitPicture
(
VLC_OBJECT
(
p_demux
),
&
p_sys
->
pic
,
p_sys
->
i_fourcc
,
...
@@ -2282,24 +2307,10 @@ open_failed:
...
@@ -2282,24 +2307,10 @@ open_failed:
/*****************************************************************************
/*****************************************************************************
* List available controls
* List available controls
*****************************************************************************/
*****************************************************************************/
static
int
VideoControlList
(
demux_t
*
p_demux
,
int
i_fd
)
static
void
VideoControlListPrint
(
demux_t
*
p_demux
,
int
i_fd
,
struct
v4l2_queryctrl
queryctrl
)
{
{
struct
v4l2_queryctrl
queryctrl
;
struct
v4l2_querymenu
querymenu
;
struct
v4l2_querymenu
querymenu
;
memset
(
&
queryctrl
,
0
,
sizeof
(
queryctrl
)
);
/* List public controls */
for
(
queryctrl
.
id
=
V4L2_CID_BASE
;
queryctrl
.
id
<
V4L2_CID_LASTP1
;
queryctrl
.
id
++
)
{
if
(
ioctl
(
i_fd
,
VIDIOC_QUERYCTRL
,
&
queryctrl
)
>=
0
)
{
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_DISABLED
)
continue
;
msg_Dbg
(
p_demux
,
"Available control: %s (%x)"
,
queryctrl
.
name
,
queryctrl
.
id
);
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_GRABBED
)
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_GRABBED
)
msg_Dbg
(
p_demux
,
" control is busy"
);
msg_Dbg
(
p_demux
,
" control is busy"
);
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_READ_ONLY
)
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_READ_ONLY
)
...
@@ -2344,6 +2355,26 @@ static int VideoControlList( demux_t *p_demux, int i_fd )
...
@@ -2344,6 +2355,26 @@ static int VideoControlList( demux_t *p_demux, int i_fd )
/* FIXME */
/* FIXME */
break
;
break
;
}
}
}
static
int
VideoControlList
(
demux_t
*
p_demux
,
int
i_fd
)
{
struct
v4l2_queryctrl
queryctrl
;
memset
(
&
queryctrl
,
0
,
sizeof
(
queryctrl
)
);
/* List public controls */
for
(
queryctrl
.
id
=
V4L2_CID_BASE
;
queryctrl
.
id
<
V4L2_CID_LASTP1
;
queryctrl
.
id
++
)
{
if
(
ioctl
(
i_fd
,
VIDIOC_QUERYCTRL
,
&
queryctrl
)
>=
0
)
{
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_DISABLED
)
continue
;
msg_Dbg
(
p_demux
,
"Available control: %s (%x)"
,
queryctrl
.
name
,
queryctrl
.
id
);
VideoControlListPrint
(
p_demux
,
i_fd
,
queryctrl
);
}
}
}
}
...
@@ -2356,8 +2387,9 @@ static int VideoControlList( demux_t *p_demux, int i_fd )
...
@@ -2356,8 +2387,9 @@ static int VideoControlList( demux_t *p_demux, int i_fd )
{
{
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_DISABLED
)
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_DISABLED
)
continue
;
continue
;
msg_Dbg
(
p_demux
,
"Available private control: %s"
,
msg_Dbg
(
p_demux
,
"Available private control: %s (%x)"
,
queryctrl
.
name
);
queryctrl
.
name
,
queryctrl
.
id
);
VideoControlListPrint
(
p_demux
,
i_fd
,
queryctrl
);
}
}
else
else
break
;
break
;
...
@@ -2447,6 +2479,12 @@ static int VideoControlCallback( vlc_object_t *p_this,
...
@@ -2447,6 +2479,12 @@ static int VideoControlCallback( vlc_object_t *p_this,
return
VideoControl
(
p_demux
,
i_fd
,
return
VideoControl
(
p_demux
,
i_fd
,
"hue"
,
V4L2_CID_HUE
,
p_sys
->
i_hue
);
"hue"
,
V4L2_CID_HUE
,
p_sys
->
i_hue
);
}
}
else
if
(
!
strcmp
(
psz_var
,
"v4l2-gamma"
)
)
{
p_sys
->
i_gamma
=
newval
.
i_int
;
return
VideoControl
(
p_demux
,
i_fd
,
"gamma"
,
V4L2_CID_HUE
,
p_sys
->
i_gamma
);
}
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment