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
30ae318e
Commit
30ae318e
authored
Sep 06, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enumerate V4L2 frame intervals once fewer
They are still enumerated many times though...
parent
2f4f8cef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
57 deletions
+21
-57
modules/access/v4l2/demux.c
modules/access/v4l2/demux.c
+21
-10
modules/access/v4l2/video.c
modules/access/v4l2/video.c
+0
-47
No files found.
modules/access/v4l2/demux.c
View file @
30ae318e
...
...
@@ -208,7 +208,7 @@ static int Demux( demux_t *demux )
return
1
;
}
static
float
GetMaxFPS
(
int
fd
,
uint32_t
pixel_format
,
static
float
GetMaxFPS
(
vlc_object_t
*
obj
,
int
fd
,
uint32_t
pixel_format
,
uint32_t
width
,
uint32_t
height
)
{
#ifdef VIDIOC_ENUM_FRAMEINTERVALS
...
...
@@ -233,6 +233,9 @@ static float GetMaxFPS( int fd, uint32_t pixel_format,
/
(
float
)
fie
.
discrete
.
numerator
;
if
(
fps
>
max
)
max
=
fps
;
msg_Dbg
(
obj
,
" discrete frame interval %"
PRIu32
"/%"
PRIu32
" supported"
,
fie
.
discrete
.
numerator
,
fie
.
discrete
.
denominator
);
fie
.
index
++
;
}
while
(
v4l2_ioctl
(
fd
,
VIDIOC_ENUM_FRAMEINTERVALS
,
&
fie
)
>=
0
);
return
max
;
...
...
@@ -240,6 +243,14 @@ static float GetMaxFPS( int fd, uint32_t pixel_format,
case
V4L2_FRMIVAL_TYPE_STEPWISE
:
case
V4L2_FRMIVAL_TYPE_CONTINUOUS
:
msg_Dbg
(
obj
,
" frame intervals from %"
PRIu32
"/%"
PRIu32
"to %"
PRIu32
"/%"
PRIu32
" supported"
,
fie
.
stepwise
.
min
.
numerator
,
fie
.
stepwise
.
min
.
denominator
,
fie
.
stepwise
.
max
.
numerator
,
fie
.
stepwise
.
max
.
denominator
);
if
(
fie
.
type
==
V4L2_FRMIVAL_TYPE_STEPWISE
)
msg_Dbg
(
obj
,
" with %"
PRIu32
"/%"
PRIu32
" step"
,
fie
.
stepwise
.
step
.
numerator
,
fie
.
stepwise
.
step
.
denominator
);
return
__MAX
(
(
float
)
fie
.
stepwise
.
max
.
denominator
/
(
float
)
fie
.
stepwise
.
max
.
numerator
,
(
float
)
fie
.
stepwise
.
min
.
denominator
...
...
@@ -267,8 +278,8 @@ float GetAbsoluteMaxFrameRate( vlc_object_t *obj, int fd,
case
V4L2_FRMSIZE_TYPE_DISCRETE
:
do
{
float
fps
=
GetMaxFPS
(
fd
,
pixel_format
,
fse
.
discrete
.
width
,
fse
.
discrete
.
height
);
float
fps
=
GetMaxFPS
(
obj
,
fd
,
pixel_format
,
fse
.
discrete
.
width
,
fse
.
discrete
.
height
);
if
(
fps
>
max
)
max
=
fps
;
msg_Dbg
(
obj
,
" discrete size %"
PRIu32
"x%"
PRIu32
" supported"
,
...
...
@@ -285,7 +296,7 @@ float GetAbsoluteMaxFrameRate( vlc_object_t *obj, int fd,
width
+=
fse
.
stepwise
.
step_width
,
height
+=
fse
.
stepwise
.
step_height
)
{
float
fps
=
GetMaxFPS
(
fd
,
pixel_format
,
width
,
height
);
float
fps
=
GetMaxFPS
(
obj
,
fd
,
pixel_format
,
width
,
height
);
if
(
fps
>
max
)
max
=
fps
;
}
...
...
@@ -299,7 +310,7 @@ float GetAbsoluteMaxFrameRate( vlc_object_t *obj, int fd,
case
V4L2_FRMSIZE_TYPE_CONTINUOUS
:
/* FIXME */
msg_Err
(
obj
,
"V4L2_FRMSIZE_TYPE_CONTINUOUS support incorrect"
);
max
=
GetMaxFPS
(
fd
,
pixel_format
,
fse
.
stepwise
.
max_width
,
max
=
GetMaxFPS
(
obj
,
fd
,
pixel_format
,
fse
.
stepwise
.
max_width
,
fse
.
stepwise
.
max_height
);
msg_Dbg
(
obj
,
" sizes from %"
PRIu32
"x%"
PRIu32
" to %"
PRIu32
"x%"
PRIu32
" all supported"
,
...
...
@@ -333,8 +344,8 @@ void GetMaxDimensions( vlc_object_t *obj, int fd, uint32_t pixel_format,
case
V4L2_FRMSIZE_TYPE_DISCRETE
:
do
{
float
fps
=
GetMaxFPS
(
fd
,
pixel_format
,
fse
.
discrete
.
width
,
fse
.
discrete
.
height
);
float
fps
=
GetMaxFPS
(
obj
,
fd
,
pixel_format
,
fse
.
discrete
.
width
,
fse
.
discrete
.
height
);
if
(
fps
>=
fps_min
&&
fse
.
discrete
.
width
>
*
pwidth
)
{
*
pwidth
=
fse
.
discrete
.
width
;
...
...
@@ -352,7 +363,7 @@ void GetMaxDimensions( vlc_object_t *obj, int fd, uint32_t pixel_format,
width
+=
fse
.
stepwise
.
step_width
,
height
+=
fse
.
stepwise
.
step_height
)
{
float
fps
=
GetMaxFPS
(
fd
,
pixel_format
,
width
,
height
);
float
fps
=
GetMaxFPS
(
obj
,
fd
,
pixel_format
,
width
,
height
);
if
(
fps
>=
fps_min
&&
width
>
*
pwidth
)
{
*
pwidth
=
width
;
...
...
@@ -363,8 +374,8 @@ void GetMaxDimensions( vlc_object_t *obj, int fd, uint32_t pixel_format,
case
V4L2_FRMSIZE_TYPE_CONTINUOUS
:
{
float
fps
=
GetMaxFPS
(
fd
,
pixel_format
,
fse
.
stepwise
.
max_width
,
fse
.
stepwise
.
max_height
);
float
fps
=
GetMaxFPS
(
obj
,
fd
,
pixel_format
,
fse
.
stepwise
.
max_width
,
fse
.
stepwise
.
max_height
);
msg_Err
(
obj
,
"V4L2_FRMSIZE_TYPE_CONTINUOUS support incorrect"
);
if
(
fps
>=
fps_min
&&
fse
.
stepwise
.
max_width
>
*
pwidth
)
{
...
...
modules/access/v4l2/video.c
View file @
30ae318e
...
...
@@ -1273,53 +1273,6 @@ static int InitVideo( vlc_object_t *p_obj, int i_fd, demux_sys_t *p_sys,
if
(
fmt
.
fmt
.
pix
.
sizeimage
<
i_min
)
fmt
.
fmt
.
pix
.
sizeimage
=
i_min
;
#ifdef VIDIOC_ENUM_FRAMEINTERVALS
/* This is new in Linux 2.6.19 */
/* List supported frame rates */
struct
v4l2_frmivalenum
frmival
;
memset
(
&
frmival
,
0
,
sizeof
(
frmival
)
);
frmival
.
pixel_format
=
fmt
.
fmt
.
pix
.
pixelformat
;
frmival
.
width
=
width
;
frmival
.
height
=
height
;
if
(
v4l2_ioctl
(
i_fd
,
VIDIOC_ENUM_FRAMEINTERVALS
,
&
frmival
)
>=
0
)
{
char
psz_fourcc
[
5
];
memset
(
&
psz_fourcc
,
0
,
sizeof
(
psz_fourcc
)
);
vlc_fourcc_to_char
(
p_sys
->
i_fourcc
,
&
psz_fourcc
);
msg_Dbg
(
p_obj
,
"supported frame intervals for %4.4s, %dx%d:"
,
psz_fourcc
,
frmival
.
width
,
frmival
.
height
);
switch
(
frmival
.
type
)
{
case
V4L2_FRMIVAL_TYPE_DISCRETE
:
do
{
msg_Dbg
(
p_obj
,
" supported frame interval: %d/%d"
,
frmival
.
discrete
.
numerator
,
frmival
.
discrete
.
denominator
);
frmival
.
index
++
;
}
while
(
v4l2_ioctl
(
i_fd
,
VIDIOC_ENUM_FRAMEINTERVALS
,
&
frmival
)
>=
0
);
break
;
case
V4L2_FRMIVAL_TYPE_STEPWISE
:
msg_Dbg
(
p_obj
,
" supported frame intervals: %d/%d to "
"%d/%d using %d/%d increments"
,
frmival
.
stepwise
.
min
.
numerator
,
frmival
.
stepwise
.
min
.
denominator
,
frmival
.
stepwise
.
max
.
numerator
,
frmival
.
stepwise
.
max
.
denominator
,
frmival
.
stepwise
.
step
.
numerator
,
frmival
.
stepwise
.
step
.
denominator
);
break
;
case
V4L2_FRMIVAL_TYPE_CONTINUOUS
:
msg_Dbg
(
p_obj
,
" supported frame intervals: %d/%d to %d/%d"
,
frmival
.
stepwise
.
min
.
numerator
,
frmival
.
stepwise
.
min
.
denominator
,
frmival
.
stepwise
.
max
.
numerator
,
frmival
.
stepwise
.
max
.
denominator
);
break
;
}
}
#endif
/* Init I/O method */
switch
(
p_sys
->
io
)
{
...
...
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