Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
786451c1
Commit
786451c1
authored
Nov 24, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Nov 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qcap: Move the allocator management to vfwcapture.c.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
26cbb3dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
51 deletions
+31
-51
qcap_private.h
dlls/qcap/qcap_private.h
+1
-3
v4l.c
dlls/qcap/v4l.c
+2
-38
vfwcapture.c
dlls/qcap/vfwcapture.c
+28
-10
No files found.
dlls/qcap/qcap_private.h
View file @
786451c1
...
...
@@ -42,7 +42,7 @@ HRESULT vfw_capture_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
struct
video_capture_funcs
{
struct
video_capture_device
*
(
*
create
)(
struct
strmbase_source
*
pin
,
USHORT
index
);
struct
video_capture_device
*
(
*
create
)(
USHORT
index
);
void
(
*
destroy
)(
struct
video_capture_device
*
device
);
HRESULT
(
*
check_format
)(
struct
video_capture_device
*
device
,
const
AM_MEDIA_TYPE
*
mt
);
HRESULT
(
*
set_format
)(
struct
video_capture_device
*
device
,
const
AM_MEDIA_TYPE
*
mt
);
...
...
@@ -55,8 +55,6 @@ struct video_capture_funcs
HRESULT
(
*
get_prop
)(
struct
video_capture_device
*
device
,
VideoProcAmpProperty
property
,
LONG
*
value
,
LONG
*
flags
);
HRESULT
(
*
set_prop
)(
struct
video_capture_device
*
device
,
VideoProcAmpProperty
property
,
LONG
value
,
LONG
flags
);
BOOL
(
*
read_frame
)(
struct
video_capture_device
*
device
,
BYTE
*
data
);
void
(
*
init_stream
)(
struct
video_capture_device
*
device
);
void
(
*
cleanup_stream
)(
struct
video_capture_device
*
device
);
};
extern
const
struct
video_capture_funcs
v4l_funcs
;
...
...
dlls/qcap/v4l.c
View file @
786451c1
...
...
@@ -97,7 +97,6 @@ struct video_capture_device
int
image_size
,
image_pitch
;
BYTE
*
image_data
;
struct
strmbase_source
*
pin
;
int
fd
,
mmap
;
};
...
...
@@ -338,37 +337,6 @@ static BOOL v4l_device_read_frame(struct video_capture_device *device, BYTE *dat
return
TRUE
;
}
static
void
v4l_device_init_stream
(
struct
video_capture_device
*
device
)
{
ALLOCATOR_PROPERTIES
req_props
,
ret_props
;
HRESULT
hr
;
req_props
.
cBuffers
=
3
;
req_props
.
cbBuffer
=
device
->
image_size
;
req_props
.
cbAlign
=
1
;
req_props
.
cbPrefix
=
0
;
hr
=
IMemAllocator_SetProperties
(
device
->
pin
->
pAllocator
,
&
req_props
,
&
ret_props
);
if
(
FAILED
(
hr
))
ERR
(
"Failed to set allocator properties (buffer size %u), hr %#x.
\n
"
,
req_props
.
cbBuffer
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
if
(
FAILED
(
hr
=
IMemAllocator_Commit
(
device
->
pin
->
pAllocator
)))
ERR
(
"Failed to commit allocator, hr %#x.
\n
"
,
hr
);
}
}
static
void
v4l_device_cleanup_stream
(
struct
video_capture_device
*
device
)
{
HRESULT
hr
;
hr
=
IMemAllocator_Decommit
(
device
->
pin
->
pAllocator
);
if
(
hr
!=
S_OK
&&
hr
!=
VFW_E_NOT_COMMITTED
)
ERR
(
"Failed to decommit allocator, hr %#x.
\n
"
,
hr
);
}
static
void
fill_caps
(
__u32
pixelformat
,
__u32
width
,
__u32
height
,
__u32
max_fps
,
__u32
min_fps
,
struct
caps
*
caps
)
{
...
...
@@ -425,7 +393,7 @@ static LONG v4l_device_get_caps_count(struct video_capture_device *device)
return
device
->
caps_count
;
}
struct
video_capture_device
*
v4l_device_create
(
struct
strmbase_source
*
pin
,
USHORT
index
)
struct
video_capture_device
*
v4l_device_create
(
USHORT
index
)
{
struct
v4l2_frmsizeenum
frmsize
=
{
0
};
struct
video_capture_device
*
device
;
...
...
@@ -562,8 +530,6 @@ struct video_capture_device *v4l_device_create(struct strmbase_source *pin, USHO
goto
error
;
}
device
->
pin
=
pin
;
TRACE
(
"Format: %d bpp - %dx%d.
\n
"
,
device
->
current_caps
->
video_info
.
bmiHeader
.
biBitCount
,
device
->
current_caps
->
video_info
.
bmiHeader
.
biWidth
,
device
->
current_caps
->
video_info
.
bmiHeader
.
biHeight
);
...
...
@@ -589,13 +555,11 @@ const struct video_capture_funcs v4l_funcs =
.
get_prop
=
v4l_device_get_prop
,
.
set_prop
=
v4l_device_set_prop
,
.
read_frame
=
v4l_device_read_frame
,
.
init_stream
=
v4l_device_init_stream
,
.
cleanup_stream
=
v4l_device_cleanup_stream
,
};
#else
static
struct
video_capture_device
*
v4l_device_create
(
struct
strmbase_source
*
pin
,
USHORT
index
)
static
struct
video_capture_device
*
v4l_device_create
(
USHORT
index
)
{
ERR
(
"v4l2 was not present at compilation time.
\n
"
);
return
NULL
;
...
...
dlls/qcap/vfwcapture.c
View file @
786451c1
...
...
@@ -94,11 +94,7 @@ static void vfw_capture_destroy(struct strmbase_filter *iface)
struct
vfw_capture
*
filter
=
impl_from_strmbase_filter
(
iface
);
if
(
filter
->
init
)
{
if
(
filter
->
filter
.
state
!=
State_Stopped
)
capture_funcs
->
cleanup_stream
(
filter
->
device
);
capture_funcs
->
destroy
(
filter
->
device
);
}
if
(
filter
->
source
.
pin
.
peer
)
{
...
...
@@ -132,12 +128,17 @@ static HRESULT vfw_capture_query_interface(struct strmbase_filter *iface, REFIID
return
S_OK
;
}
static
unsigned
int
get_image_size
(
struct
vfw_capture
*
filter
)
{
const
VIDEOINFOHEADER
*
format
=
(
const
VIDEOINFOHEADER
*
)
filter
->
source
.
pin
.
mt
.
pbFormat
;
return
format
->
bmiHeader
.
biWidth
*
format
->
bmiHeader
.
biHeight
*
format
->
bmiHeader
.
biBitCount
/
8
;
}
static
DWORD
WINAPI
stream_thread
(
void
*
arg
)
{
struct
vfw_capture
*
filter
=
arg
;
const
VIDEOINFOHEADER
*
format
=
(
const
VIDEOINFOHEADER
*
)
filter
->
source
.
pin
.
mt
.
pbFormat
;
const
unsigned
int
image_size
=
format
->
bmiHeader
.
biWidth
*
format
->
bmiHeader
.
biHeight
*
format
->
bmiHeader
.
biBitCount
/
8
;
const
unsigned
int
image_size
=
get_image_size
(
filter
);
for
(;;)
{
...
...
@@ -188,8 +189,21 @@ static DWORD WINAPI stream_thread(void *arg)
static
HRESULT
vfw_capture_init_stream
(
struct
strmbase_filter
*
iface
)
{
struct
vfw_capture
*
filter
=
impl_from_strmbase_filter
(
iface
);
ALLOCATOR_PROPERTIES
req_props
,
ret_props
;
HRESULT
hr
;
capture_funcs
->
init_stream
(
filter
->
device
);
req_props
.
cBuffers
=
3
;
req_props
.
cbBuffer
=
get_image_size
(
filter
);
req_props
.
cbAlign
=
1
;
req_props
.
cbPrefix
=
0
;
if
(
FAILED
(
hr
=
IMemAllocator_SetProperties
(
filter
->
source
.
pAllocator
,
&
req_props
,
&
ret_props
)))
{
ERR
(
"Failed to set allocator properties (buffer size %u), hr %#x.
\n
"
,
req_props
.
cbBuffer
,
hr
);
return
hr
;
}
if
(
FAILED
(
hr
=
IMemAllocator_Commit
(
filter
->
source
.
pAllocator
)))
ERR
(
"Failed to commit allocator, hr %#x.
\n
"
,
hr
);
EnterCriticalSection
(
&
filter
->
state_cs
);
filter
->
state
=
State_Paused
;
...
...
@@ -224,6 +238,7 @@ static HRESULT vfw_capture_stop_stream(struct strmbase_filter *iface)
static
HRESULT
vfw_capture_cleanup_stream
(
struct
strmbase_filter
*
iface
)
{
struct
vfw_capture
*
filter
=
impl_from_strmbase_filter
(
iface
);
HRESULT
hr
;
EnterCriticalSection
(
&
filter
->
state_cs
);
filter
->
state
=
State_Stopped
;
...
...
@@ -234,7 +249,10 @@ static HRESULT vfw_capture_cleanup_stream(struct strmbase_filter *iface)
CloseHandle
(
filter
->
thread
);
filter
->
thread
=
NULL
;
capture_funcs
->
cleanup_stream
(
filter
->
device
);
hr
=
IMemAllocator_Decommit
(
filter
->
source
.
pAllocator
);
if
(
hr
!=
S_OK
&&
hr
!=
VFW_E_NOT_COMMITTED
)
ERR
(
"Failed to decommit allocator, hr %#x.
\n
"
,
hr
);
return
S_OK
;
}
...
...
@@ -478,7 +496,7 @@ static HRESULT WINAPI PPB_Load(IPersistPropertyBag *iface, IPropertyBag *bag, IE
if
(
FAILED
(
hr
=
IPropertyBag_Read
(
bag
,
VFWIndex
,
&
var
,
error_log
)))
return
hr
;
if
(
!
(
filter
->
device
=
capture_funcs
->
create
(
&
filter
->
source
,
V_I4
(
&
var
))))
if
(
!
(
filter
->
device
=
capture_funcs
->
create
(
V_I4
(
&
var
))))
return
E_FAIL
;
filter
->
init
=
TRUE
;
...
...
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