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
3e15ea21
Commit
3e15ea21
authored
May 24, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vfwcap: add video_size private option.
parent
8fe7b644
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
8 deletions
+38
-8
vfwcap.c
libavdevice/vfwcap.c
+38
-8
No files found.
libavdevice/vfwcap.c
View file @
3e15ea21
...
...
@@ -20,6 +20,9 @@
*/
#include "libavformat/avformat.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include <windows.h>
#include <vfw.h>
...
...
@@ -34,12 +37,14 @@
/* End of missing MinGW defines */
struct
vfw_ctx
{
const
AVClass
*
class
;
HWND
hwnd
;
HANDLE
mutex
;
HANDLE
event
;
AVPacketList
*
pktl
;
unsigned
int
curbufsize
;
unsigned
int
frame_num
;
char
*
video_size
;
/**< A string describing video size, set by a private option. */
};
static
enum
PixelFormat
vfw_pixfmt
(
DWORD
biCompression
,
WORD
biBitCount
)
...
...
@@ -230,6 +235,8 @@ static int vfw_read_close(AVFormatContext *s)
pktl
=
next
;
}
av_freep
(
&
ctx
->
video_size
);
return
0
;
}
...
...
@@ -244,8 +251,6 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
CAPTUREPARMS
cparms
;
DWORD
biCompression
;
WORD
biBitCount
;
int
width
;
int
height
;
int
ret
;
if
(
!
strcmp
(
s
->
filename
,
"list"
))
{
...
...
@@ -318,10 +323,20 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
dump_bih
(
s
,
&
bi
->
bmiHeader
);
width
=
ap
->
width
?
ap
->
width
:
bi
->
bmiHeader
.
biWidth
;
height
=
ap
->
height
?
ap
->
height
:
bi
->
bmiHeader
.
biHeight
;
bi
->
bmiHeader
.
biWidth
=
width
;
bi
->
bmiHeader
.
biHeight
=
height
;
if
(
ctx
->
video_size
)
{
ret
=
av_parse_video_size
(
&
bi
->
bmiHeader
.
biWidth
,
&
bi
->
bmiHeader
.
biHeight
,
ctx
->
video_size
);
if
(
ret
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Couldn't parse video size.
\n
"
);
goto
fail_bi
;
}
}
#if FF_API_FORMAT_PARAMETERS
if
(
ap
->
width
>
0
)
bi
->
bmiHeader
.
biWidth
=
ap
->
width
;
if
(
ap
->
height
>
0
)
bi
->
bmiHeader
.
biHeight
=
ap
->
height
;
#endif
if
(
0
)
{
/* For testing yet unsupported compressions
...
...
@@ -370,8 +385,8 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec
=
st
->
codec
;
codec
->
time_base
=
ap
->
time_base
;
codec
->
codec_type
=
AVMEDIA_TYPE_VIDEO
;
codec
->
width
=
w
idth
;
codec
->
height
=
h
eight
;
codec
->
width
=
bi
->
bmiHeader
.
biW
idth
;
codec
->
height
=
bi
->
bmiHeader
.
biH
eight
;
codec
->
pix_fmt
=
vfw_pixfmt
(
biCompression
,
biBitCount
);
if
(
codec
->
pix_fmt
==
PIX_FMT_NONE
)
{
codec
->
codec_id
=
vfw_codecid
(
biCompression
);
...
...
@@ -452,6 +467,20 @@ static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt)
return
pkt
->
size
;
}
#define OFFSET(x) offsetof(struct vfw_ctx, x)
#define DEC AV_OPT_FLAG_DECODING_PARAM
static
const
AVOption
options
[]
=
{
{
"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
},
};
static
const
AVClass
vfw_class
=
{
.
class_name
=
"VFW indev"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
AVInputFormat
ff_vfwcap_demuxer
=
{
"vfwcap"
,
NULL_IF_CONFIG_SMALL
(
"VFW video capture"
),
...
...
@@ -461,4 +490,5 @@ AVInputFormat ff_vfwcap_demuxer = {
vfw_read_packet
,
vfw_read_close
,
.
flags
=
AVFMT_NOFILE
,
.
priv_class
=
&
vfw_class
,
};
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