Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
8fe7b644
Commit
8fe7b644
authored
May 24, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: add video_size private option.
parent
82b5aa0a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
v4l2.c
libavdevice/v4l2.c
+16
-2
No files found.
libavdevice/v4l2.c
View file @
8fe7b644
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
#include "libavutil/imgutils.h"
#include "libavutil/imgutils.h"
#include "libavutil/log.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
static
const
int
desired_video_buffers
=
256
;
static
const
int
desired_video_buffers
=
256
;
...
@@ -69,6 +70,7 @@ struct video_data {
...
@@ -69,6 +70,7 @@ struct video_data {
unsigned
int
*
buf_len
;
unsigned
int
*
buf_len
;
char
*
standard
;
char
*
standard
;
int
channel
;
int
channel
;
char
*
video_size
;
/**< String describing video size, set by a private option. */
};
};
struct
buff_data
{
struct
buff_data
{
...
@@ -588,8 +590,16 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
...
@@ -588,8 +590,16 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
}
}
av_set_pts_info
(
st
,
64
,
1
,
1000000
);
/* 64 bits pts in us */
av_set_pts_info
(
st
,
64
,
1
,
1000000
);
/* 64 bits pts in us */
if
(
s
->
video_size
&&
(
res
=
av_parse_video_size
(
&
s
->
width
,
&
s
->
height
,
s
->
video_size
))
<
0
)
{
av_log
(
s1
,
AV_LOG_ERROR
,
"Couldn't parse video size.
\n
"
);
goto
out
;
}
#if FF_API_FORMAT_PARAMETERS
if
(
ap
->
width
>
0
)
s
->
width
=
ap
->
width
;
s
->
width
=
ap
->
width
;
if
(
ap
->
height
>
0
)
s
->
height
=
ap
->
height
;
s
->
height
=
ap
->
height
;
#endif
capabilities
=
0
;
capabilities
=
0
;
s
->
fd
=
device_open
(
s1
,
&
capabilities
);
s
->
fd
=
device_open
(
s1
,
&
capabilities
);
...
@@ -659,6 +669,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
...
@@ -659,6 +669,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st
->
codec
->
bit_rate
=
s
->
frame_size
*
1
/
av_q2d
(
st
->
codec
->
time_base
)
*
8
;
st
->
codec
->
bit_rate
=
s
->
frame_size
*
1
/
av_q2d
(
st
->
codec
->
time_base
)
*
8
;
out:
out:
av_freep
(
&
s
->
video_size
);
return
res
;
return
res
;
}
}
...
@@ -702,9 +713,12 @@ static int v4l2_read_close(AVFormatContext *s1)
...
@@ -702,9 +713,12 @@ static int v4l2_read_close(AVFormatContext *s1)
return
0
;
return
0
;
}
}
#define OFFSET(x) offsetof(struct video_data, x)
#define DEC AV_OPT_FLAG_DECODING_PARAM
static
const
AVOption
options
[]
=
{
static
const
AVOption
options
[]
=
{
{
"standard"
,
""
,
offsetof
(
struct
video_data
,
standard
),
FF_OPT_TYPE_STRING
,
{.
str
=
"NTSC"
},
0
,
0
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"standard"
,
""
,
offsetof
(
struct
video_data
,
standard
),
FF_OPT_TYPE_STRING
,
{.
str
=
"NTSC"
},
0
,
0
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"channel"
,
""
,
offsetof
(
struct
video_data
,
channel
),
FF_OPT_TYPE_INT
,
{.
dbl
=
0
},
0
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"channel"
,
""
,
offsetof
(
struct
video_data
,
channel
),
FF_OPT_TYPE_INT
,
{.
dbl
=
0
},
0
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"video_size"
,
"A string describing frame size, such as 640x480 or hd720."
,
OFFSET
(
video_size
),
FF_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
NULL
},
{
NULL
},
};
};
...
...
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