Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
78a05dbc
Commit
78a05dbc
authored
Nov 20, 2007
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch by Richard Hosking: Allow users specified width and height of v4l2 source.
parent
0d38084b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
5 deletions
+36
-5
modules/access/v4l2.c
modules/access/v4l2.c
+36
-5
No files found.
modules/access/v4l2.c
View file @
78a05dbc
...
...
@@ -81,6 +81,12 @@ static void Close( vlc_object_t * );
#define IOMETHOD_TEXT N_( "IO Method" )
#define IOMETHOD_LONGTEXT N_( \
"IO Method (READ, MMAP, USERPTR)." )
#define WIDTH_TEXT N_( "Width" )
#define WIDTH_LONGTEXT N_( \
"Force width (-1 for autodetect)." )
#define HEIGHT_TEXT N_( "Height" )
#define HEIGHT_LONGTEXT N_( \
"Force height (-1 for autodetect)." )
#define FPS_TEXT N_( "Framerate" )
#define FPS_LONGTEXT N_( "Framerate to capture, if applicable " \
"(-1 for autodetect)." )
...
...
@@ -129,8 +135,12 @@ vlc_module_begin();
add_integer
(
"v4l2-input"
,
0
,
NULL
,
INPUT_TEXT
,
INPUT_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"v4l2-io"
,
IO_METHOD_MMAP
,
NULL
,
IOMETHOD_TEXT
,
IOMETHOD_LONGTEXT
,
VLC_
FALS
E
);
IOMETHOD_LONGTEXT
,
VLC_
TRU
E
);
change_integer_list
(
i_iomethod_list
,
psz_iomethod_list_text
,
0
);
add_integer
(
"v4l2-width"
,
0
,
NULL
,
WIDTH_TEXT
,
WIDTH_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"v4l2-height"
,
0
,
NULL
,
HEIGHT_TEXT
,
HEIGHT_LONGTEXT
,
VLC_TRUE
);
add_float
(
"v4l2-fps"
,
0
,
NULL
,
FPS_TEXT
,
FPS_LONGTEXT
,
VLC_TRUE
);
add_bool
(
"v4l2-stereo"
,
VLC_TRUE
,
NULL
,
STEREO_TEXT
,
STEREO_LONGTEXT
,
VLC_TRUE
);
...
...
@@ -289,6 +299,9 @@ static int Open( vlc_object_t *p_this )
p_sys
->
io
=
var_CreateGetInteger
(
p_demux
,
"v4l2-io"
);
p_sys
->
i_width
=
var_CreateGetInteger
(
p_demux
,
"v4l2-width"
);
p_sys
->
i_height
=
var_CreateGetInteger
(
p_demux
,
"v4l2-height"
);
var_Create
(
p_demux
,
"v4l2-fps"
,
VLC_VAR_FLOAT
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_demux
,
"v4l2-fps"
,
&
val
);
p_sys
->
f_fps
=
val
.
f_float
;
...
...
@@ -527,6 +540,20 @@ static void ParseMRL( demux_t *p_demux )
p_sys
->
io
=
strtol
(
psz_parser
,
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"width="
,
strlen
(
"width="
)
)
)
{
p_sys
->
i_width
=
strtol
(
psz_parser
+
strlen
(
"width="
),
&
psz_parser
,
0
);
}
else
if
(
!
strncmp
(
psz_parser
,
"height="
,
strlen
(
"height="
)
)
)
{
p_sys
->
i_height
=
strtol
(
psz_parser
+
strlen
(
"height="
),
&
psz_parser
,
0
);
}
else
if
(
!
strncmp
(
psz_parser
,
"samplerate="
,
strlen
(
"samplerate="
)
)
)
{
...
...
@@ -1185,11 +1212,11 @@ int OpenVideoDev( demux_t *p_demux, char *psz_device )
}
/* Try and find default resolution if not specified */
if
(
!
p_sys
->
i_width
&&
!
p_sys
->
i_height
)
{
memset
(
&
fmt
,
0
,
sizeof
(
fmt
)
);
fmt
.
type
=
V4L2_BUF_TYPE_VIDEO_CAPTURE
;
memset
(
&
fmt
,
0
,
sizeof
(
fmt
)
);
fmt
.
type
=
V4L2_BUF_TYPE_VIDEO_CAPTURE
;
if
(
p_sys
->
i_width
<=
0
||
p_sys
->
i_height
<=
0
)
{
if
(
ioctl
(
i_fd
,
VIDIOC_G_FMT
,
&
fmt
)
<
0
)
{
msg_Err
(
p_demux
,
"Cannot get default width and height."
);
...
...
@@ -1204,6 +1231,10 @@ int OpenVideoDev( demux_t *p_demux, char *psz_device )
p_sys
->
i_height
=
p_sys
->
i_height
*
2
;
}
}
else
{
msg_Dbg
(
p_demux
,
"trying specified size %dx%d"
,
p_sys
->
i_width
,
p_sys
->
i_height
);
}
fmt
.
fmt
.
pix
.
width
=
p_sys
->
i_width
;
fmt
.
fmt
.
pix
.
height
=
p_sys
->
i_height
;
...
...
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