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
e9d65404
Commit
e9d65404
authored
Aug 26, 2009
by
Ilkka Ollakka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: add aspect-ratio option to give picture aspect-ratio for input
parent
0b2e8550
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
modules/access/v4l2.c
modules/access/v4l2.c
+33
-1
No files found.
modules/access/v4l2.c
View file @
e9d65404
...
...
@@ -203,6 +203,9 @@ static void AccessClose( vlc_object_t * );
"please use 'v4l2:/""/ :input-slave=alsa:/""/' or " \
"'v4l2:/""/ :input-slave=oss:/""/' instead." )
#define ASPECT_TEXT N_("Picture aspect-ratio n:m")
#define ASPECT_LONGTEXT N_("Define input picture aspect-ratio to use. Default is 4:3" )
typedef
enum
{
IO_METHOD_READ
,
IO_METHOD_MMAP
,
...
...
@@ -257,6 +260,8 @@ vlc_module_begin ()
WIDTH_LONGTEXT
,
true
)
add_integer
(
CFG_PREFIX
"height"
,
-
1
,
NULL
,
HEIGHT_TEXT
,
HEIGHT_LONGTEXT
,
true
)
add_string
(
CFG_PREFIX
"aspect-ratio"
,
"4:3"
,
NULL
,
ASPECT_TEXT
,
ASPECT_LONGTEXT
,
true
)
add_float
(
CFG_PREFIX
"fps"
,
0
,
NULL
,
FPS_TEXT
,
FPS_LONGTEXT
,
true
)
add_integer
(
CFG_PREFIX
"caching"
,
DEFAULT_PTS_DELAY
/
1000
,
NULL
,
CACHING_TEXT
,
CACHING_LONGTEXT
,
true
)
...
...
@@ -523,6 +528,7 @@ struct demux_sys_t
int
i_width
;
int
i_height
;
unsigned
int
i_aspect
;
float
f_fps
;
/* <= 0.0 mean to grab at full rate */
mtime_t
i_video_pts
;
/* only used when f_fps > 0 */
int
i_fourcc
;
...
...
@@ -685,6 +691,19 @@ static void GetV4L2Params( demux_sys_t *p_sys, vlc_object_t *p_obj )
p_sys
->
psz_set_ctrls
=
var_CreateGetString
(
p_obj
,
"v4l2-set-ctrls"
);
char
*
psz_aspect
=
var_CreateGetString
(
p_obj
,
"v4l2-aspect-ratio"
);
if
(
psz_aspect
&&
*
psz_aspect
&&
strchr
(
psz_aspect
,
":"
)
)
{
char
psz_delim
=
strchr
(
psz_aspect
,
":"
);
p_sys
->
i_aspect
=
atoi
(
psz_aspect
)
*
VOUT_ASPECT_FACTOR
/
atoi
(
psz_delim
+
1
);
}
else
{
p_sys
->
i_aspect
=
4
*
VOUT_ASPECT_FACTOR
/
3
;
}
free
(
psz_aspect
);
p_sys
->
psz_device
=
NULL
;
p_sys
->
i_fd
=
-
1
;
...
...
@@ -810,6 +829,17 @@ static void ParseMRL( demux_sys_t *p_sys, char *psz_path, vlc_object_t *p_obj )
strtol
(
psz_parser
+
strlen
(
"height="
),
&
psz_parser
,
0
);
}
else
if
(
!
strncmp
(
psz_parser
,
"aspect-ratio="
,
strlen
(
"aspect-ratio="
)
)
)
{
unsigned
int
num
,
den
;
num
=
strtol
(
psz_parser
+
strlen
(
"aspect-ratio="
),
&
psz_parser
,
0
);
den
=
strtol
(
psz_parser
+
strlen
(
":"
),
&
psz_parser
,
0
);
if
(
num
&&
den
)
p_sys
->
i_aspect
=
num
*
VOUT_ASPECT_FACTOR
/
den
;
}
else
if
(
!
strncmp
(
psz_parser
,
"controls-reset"
,
strlen
(
"controls-reset"
)
)
)
{
...
...
@@ -2115,7 +2145,9 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux )
/* Add */
es_fmt
.
video
.
i_width
=
p_sys
->
i_width
;
es_fmt
.
video
.
i_height
=
p_sys
->
i_height
;
es_fmt
.
video
.
i_aspect
=
4
*
VOUT_ASPECT_FACTOR
/
3
;
/* Get aspect-ratio */
es_fmt
.
video
.
i_aspect
=
p_sys
->
i_aspect
;
if
(
b_demux
)
{
...
...
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