Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
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
Hide 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 @@
...
@@ -20,6 +20,9 @@
*/
*/
#include "libavformat/avformat.h"
#include "libavformat/avformat.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include <windows.h>
#include <windows.h>
#include <vfw.h>
#include <vfw.h>
...
@@ -34,12 +37,14 @@
...
@@ -34,12 +37,14 @@
/* End of missing MinGW defines */
/* End of missing MinGW defines */
struct
vfw_ctx
{
struct
vfw_ctx
{
const
AVClass
*
class
;
HWND
hwnd
;
HWND
hwnd
;
HANDLE
mutex
;
HANDLE
mutex
;
HANDLE
event
;
HANDLE
event
;
AVPacketList
*
pktl
;
AVPacketList
*
pktl
;
unsigned
int
curbufsize
;
unsigned
int
curbufsize
;
unsigned
int
frame_num
;
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
)
static
enum
PixelFormat
vfw_pixfmt
(
DWORD
biCompression
,
WORD
biBitCount
)
...
@@ -230,6 +235,8 @@ static int vfw_read_close(AVFormatContext *s)
...
@@ -230,6 +235,8 @@ static int vfw_read_close(AVFormatContext *s)
pktl
=
next
;
pktl
=
next
;
}
}
av_freep
(
&
ctx
->
video_size
);
return
0
;
return
0
;
}
}
...
@@ -244,8 +251,6 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
...
@@ -244,8 +251,6 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
CAPTUREPARMS
cparms
;
CAPTUREPARMS
cparms
;
DWORD
biCompression
;
DWORD
biCompression
;
WORD
biBitCount
;
WORD
biBitCount
;
int
width
;
int
height
;
int
ret
;
int
ret
;
if
(
!
strcmp
(
s
->
filename
,
"list"
))
{
if
(
!
strcmp
(
s
->
filename
,
"list"
))
{
...
@@ -318,10 +323,20 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
...
@@ -318,10 +323,20 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
dump_bih
(
s
,
&
bi
->
bmiHeader
);
dump_bih
(
s
,
&
bi
->
bmiHeader
);
width
=
ap
->
width
?
ap
->
width
:
bi
->
bmiHeader
.
biWidth
;
height
=
ap
->
height
?
ap
->
height
:
bi
->
bmiHeader
.
biHeight
;
if
(
ctx
->
video_size
)
{
bi
->
bmiHeader
.
biWidth
=
width
;
ret
=
av_parse_video_size
(
&
bi
->
bmiHeader
.
biWidth
,
&
bi
->
bmiHeader
.
biHeight
,
ctx
->
video_size
);
bi
->
bmiHeader
.
biHeight
=
height
;
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
)
{
if
(
0
)
{
/* For testing yet unsupported compressions
/* For testing yet unsupported compressions
...
@@ -370,8 +385,8 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
...
@@ -370,8 +385,8 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec
=
st
->
codec
;
codec
=
st
->
codec
;
codec
->
time_base
=
ap
->
time_base
;
codec
->
time_base
=
ap
->
time_base
;
codec
->
codec_type
=
AVMEDIA_TYPE_VIDEO
;
codec
->
codec_type
=
AVMEDIA_TYPE_VIDEO
;
codec
->
width
=
w
idth
;
codec
->
width
=
bi
->
bmiHeader
.
biW
idth
;
codec
->
height
=
h
eight
;
codec
->
height
=
bi
->
bmiHeader
.
biH
eight
;
codec
->
pix_fmt
=
vfw_pixfmt
(
biCompression
,
biBitCount
);
codec
->
pix_fmt
=
vfw_pixfmt
(
biCompression
,
biBitCount
);
if
(
codec
->
pix_fmt
==
PIX_FMT_NONE
)
{
if
(
codec
->
pix_fmt
==
PIX_FMT_NONE
)
{
codec
->
codec_id
=
vfw_codecid
(
biCompression
);
codec
->
codec_id
=
vfw_codecid
(
biCompression
);
...
@@ -452,6 +467,20 @@ static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -452,6 +467,20 @@ static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt)
return
pkt
->
size
;
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
=
{
AVInputFormat
ff_vfwcap_demuxer
=
{
"vfwcap"
,
"vfwcap"
,
NULL_IF_CONFIG_SMALL
(
"VFW video capture"
),
NULL_IF_CONFIG_SMALL
(
"VFW video capture"
),
...
@@ -461,4 +490,5 @@ AVInputFormat ff_vfwcap_demuxer = {
...
@@ -461,4 +490,5 @@ AVInputFormat ff_vfwcap_demuxer = {
vfw_read_packet
,
vfw_read_packet
,
vfw_read_close
,
vfw_read_close
,
.
flags
=
AVFMT_NOFILE
,
.
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