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
89779c4a
Commit
89779c4a
authored
Sep 04, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V4L2: merge two switches
parent
7a82c844
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
51 deletions
+35
-51
modules/access/v4l2/video.c
modules/access/v4l2/video.c
+35
-51
No files found.
modules/access/v4l2/video.c
View file @
89779c4a
...
...
@@ -1931,7 +1931,7 @@ static int OpenVideoDev( vlc_object_t *p_obj, const char *path,
#endif
/* Init IO method */
/* Init I
/
O method */
switch
(
p_sys
->
io
)
{
case
IO_METHOD_READ
:
...
...
@@ -1942,55 +1942,6 @@ static int OpenVideoDev( vlc_object_t *p_obj, const char *path,
case
IO_METHOD_MMAP
:
if
(
InitMmap
(
p_obj
,
p_sys
,
i_fd
)
)
goto
error
;
break
;
case
IO_METHOD_USERPTR
:
if
(
InitUserP
(
p_obj
,
p_sys
,
i_fd
,
fmt
.
fmt
.
pix
.
sizeimage
)
)
goto
error
;
break
;
}
if
(
b_demux
)
{
int
ar
=
4
*
VOUT_ASPECT_FACTOR
/
3
;
char
*
str
=
var_InheritString
(
p_obj
,
CFG_PREFIX
"aspect-ratio"
);
if
(
likely
(
str
!=
NULL
)
)
{
const
char
*
delim
=
strchr
(
str
,
':'
);
if
(
delim
)
ar
=
atoi
(
str
)
*
VOUT_ASPECT_FACTOR
/
atoi
(
delim
+
1
);
free
(
str
);
}
/* Add */
es_fmt
.
video
.
i_width
=
width
;
es_fmt
.
video
.
i_height
=
height
;
/* Get aspect-ratio */
es_fmt
.
video
.
i_sar_num
=
ar
*
es_fmt
.
video
.
i_height
;
es_fmt
.
video
.
i_sar_den
=
VOUT_ASPECT_FACTOR
*
es_fmt
.
video
.
i_width
;
/* Framerate */
es_fmt
.
video
.
i_frame_rate
=
lround
(
f_fps
*
1000000
.);
es_fmt
.
video
.
i_frame_rate_base
=
1000000
;
demux_t
*
p_demux
=
(
demux_t
*
)
p_obj
;
msg_Dbg
(
p_demux
,
"added new video es %4.4s %dx%d"
,
(
char
*
)
&
es_fmt
.
i_codec
,
es_fmt
.
video
.
i_width
,
es_fmt
.
video
.
i_height
);
msg_Dbg
(
p_obj
,
" frame rate: %f"
,
f_fps
);
p_sys
->
p_es
=
es_out_Add
(
p_demux
->
out
,
&
es_fmt
);
}
/* Start Capture */
switch
(
p_sys
->
io
)
{
case
IO_METHOD_READ
:
/* Nothing to do */
break
;
case
IO_METHOD_MMAP
:
for
(
unsigned
int
i
=
0
;
i
<
p_sys
->
i_nbuffers
;
++
i
)
{
struct
v4l2_buffer
buf
;
...
...
@@ -2013,10 +1964,11 @@ static int OpenVideoDev( vlc_object_t *p_obj, const char *path,
msg_Err
(
p_obj
,
"VIDIOC_STREAMON failed"
);
goto
error
;
}
break
;
case
IO_METHOD_USERPTR
:
if
(
InitUserP
(
p_obj
,
p_sys
,
i_fd
,
fmt
.
fmt
.
pix
.
sizeimage
)
)
goto
error
;
for
(
unsigned
int
i
=
0
;
i
<
p_sys
->
i_nbuffers
;
++
i
)
{
struct
v4l2_buffer
buf
;
...
...
@@ -2045,6 +1997,38 @@ static int OpenVideoDev( vlc_object_t *p_obj, const char *path,
}
free
(
codecs
);
if
(
b_demux
)
{
int
ar
=
4
*
VOUT_ASPECT_FACTOR
/
3
;
char
*
str
=
var_InheritString
(
p_obj
,
CFG_PREFIX
"aspect-ratio"
);
if
(
likely
(
str
!=
NULL
)
)
{
const
char
*
delim
=
strchr
(
str
,
':'
);
if
(
delim
)
ar
=
atoi
(
str
)
*
VOUT_ASPECT_FACTOR
/
atoi
(
delim
+
1
);
free
(
str
);
}
/* Add */
es_fmt
.
video
.
i_width
=
width
;
es_fmt
.
video
.
i_height
=
height
;
/* Get aspect-ratio */
es_fmt
.
video
.
i_sar_num
=
ar
*
es_fmt
.
video
.
i_height
;
es_fmt
.
video
.
i_sar_den
=
VOUT_ASPECT_FACTOR
*
es_fmt
.
video
.
i_width
;
/* Framerate */
es_fmt
.
video
.
i_frame_rate
=
lround
(
f_fps
*
1000000
.);
es_fmt
.
video
.
i_frame_rate_base
=
1000000
;
demux_t
*
p_demux
=
(
demux_t
*
)
p_obj
;
msg_Dbg
(
p_demux
,
"added new video es %4.4s %dx%d"
,
(
char
*
)
&
es_fmt
.
i_codec
,
es_fmt
.
video
.
i_width
,
es_fmt
.
video
.
i_height
);
msg_Dbg
(
p_obj
,
" frame rate: %f"
,
f_fps
);
p_sys
->
p_es
=
es_out_Add
(
p_demux
->
out
,
&
es_fmt
);
}
return
i_fd
;
error:
...
...
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