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
24ed16e8
Commit
24ed16e8
authored
Apr 30, 2019
by
Damjan Jovanovic
Committed by
Alexandre Julliard
May 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qcap/vfwcapture: Implement IPin::CheckMediaType().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d425d519
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
178 additions
and
10 deletions
+178
-10
capture.h
dlls/qcap/capture.h
+1
-0
Makefile.in
dlls/qcap/tests/Makefile.in
+2
-1
videocapture.c
dlls/qcap/tests/videocapture.c
+133
-0
v4l.c
dlls/qcap/v4l.c
+39
-6
vfwcapture.c
dlls/qcap/vfwcapture.c
+3
-3
No files found.
dlls/qcap/capture.h
View file @
24ed16e8
...
...
@@ -25,6 +25,7 @@ typedef struct _Capture Capture;
Capture
*
qcap_driver_init
(
IPin
*
,
USHORT
)
DECLSPEC_HIDDEN
;
HRESULT
qcap_driver_destroy
(
Capture
*
)
DECLSPEC_HIDDEN
;
HRESULT
qcap_driver_check_format
(
Capture
*
,
const
AM_MEDIA_TYPE
*
)
DECLSPEC_HIDDEN
;
HRESULT
qcap_driver_set_format
(
Capture
*
,
AM_MEDIA_TYPE
*
)
DECLSPEC_HIDDEN
;
HRESULT
qcap_driver_get_format
(
const
Capture
*
,
AM_MEDIA_TYPE
**
)
DECLSPEC_HIDDEN
;
HRESULT
qcap_driver_get_prop_range
(
Capture
*
,
VideoProcAmpProperty
,
LONG
*
,
LONG
*
,
LONG
*
,
LONG
*
,
LONG
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/qcap/tests/Makefile.in
View file @
24ed16e8
...
...
@@ -5,4 +5,5 @@ C_SRCS = \
audiorecord.c
\
avico.c
\
qcap.c
\
smartteefilter.c
smartteefilter.c
\
videocapture.c
dlls/qcap/tests/videocapture.c
0 → 100644
View file @
24ed16e8
/*
* WDM video capture filter unit tests
*
* Copyright 2019 Damjan Jovanovic
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "dshow.h"
#include "wine/test.h"
static
void
test_media_types
(
IPin
*
pin
)
{
IEnumMediaTypes
*
enum_media_types
;
AM_MEDIA_TYPE
mt
,
*
pmt
;
HRESULT
hr
;
hr
=
IPin_EnumMediaTypes
(
pin
,
&
enum_media_types
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
while
(
IEnumMediaTypes_Next
(
enum_media_types
,
1
,
&
pmt
,
NULL
)
==
S_OK
)
{
hr
=
IPin_QueryAccept
(
pin
,
pmt
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
CoTaskMemFree
(
pmt
);
}
IEnumMediaTypes_Release
(
enum_media_types
);
hr
=
IPin_QueryAccept
(
pin
,
NULL
);
todo_wine
ok
(
hr
==
E_POINTER
,
"Got hr %#x.
\n
"
,
hr
);
memset
(
&
mt
,
0
,
sizeof
(
mt
));
hr
=
IPin_QueryAccept
(
pin
,
&
mt
);
ok
(
hr
!=
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
mt
.
majortype
=
MEDIATYPE_Video
;
hr
=
IPin_QueryAccept
(
pin
,
&
mt
);
ok
(
hr
!=
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
mt
.
formattype
=
FORMAT_VideoInfo
;
hr
=
IPin_QueryAccept
(
pin
,
&
mt
);
ok
(
hr
!=
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
mt
.
formattype
=
FORMAT_None
;
hr
=
IPin_QueryAccept
(
pin
,
&
mt
);
ok
(
hr
!=
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
}
static
void
test_capture
(
IBaseFilter
*
filter
)
{
IEnumPins
*
enum_pins
;
IPin
*
pin
;
HRESULT
hr
;
hr
=
IBaseFilter_EnumPins
(
filter
,
&
enum_pins
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
while
((
hr
=
IEnumPins_Next
(
enum_pins
,
1
,
&
pin
,
NULL
))
==
S_OK
)
{
PIN_DIRECTION
pin_direction
;
IPin_QueryDirection
(
pin
,
&
pin_direction
);
if
(
pin_direction
==
PINDIR_OUTPUT
)
test_media_types
(
pin
);
IPin_Release
(
pin
);
}
IEnumPins_Release
(
enum_pins
);
}
START_TEST
(
videocapture
)
{
ICreateDevEnum
*
dev_enum
;
IEnumMoniker
*
class_enum
;
IBaseFilter
*
filter
;
IMoniker
*
moniker
;
WCHAR
*
name
;
HRESULT
hr
;
ULONG
ref
;
CoInitialize
(
NULL
);
hr
=
CoCreateInstance
(
&
CLSID_SystemDeviceEnum
,
NULL
,
CLSCTX_INPROC
,
&
IID_ICreateDevEnum
,
(
void
**
)
&
dev_enum
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
ICreateDevEnum_CreateClassEnumerator
(
dev_enum
,
&
CLSID_VideoInputDeviceCategory
,
&
class_enum
,
0
);
if
(
hr
==
S_FALSE
)
{
skip
(
"No video capture devices present.
\n
"
);
ICreateDevEnum_Release
(
dev_enum
);
CoUninitialize
();
return
;
}
ok
(
hr
==
S_OK
,
"Got hr=%#x.
\n
"
,
hr
);
while
(
IEnumMoniker_Next
(
class_enum
,
1
,
&
moniker
,
NULL
)
==
S_OK
)
{
hr
=
IMoniker_GetDisplayName
(
moniker
,
NULL
,
NULL
,
&
name
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
trace
(
"Testing device %s.
\n
"
,
wine_dbgstr_w
(
name
));
CoTaskMemFree
(
name
);
hr
=
IMoniker_BindToObject
(
moniker
,
NULL
,
NULL
,
&
IID_IBaseFilter
,
(
void
**
)
&
filter
);
if
(
hr
==
S_OK
)
{
test_capture
(
filter
);
IBaseFilter_Release
(
filter
);
}
else
skip
(
"Failed to open capture device, hr=%#x.
\n
"
,
hr
);
ref
=
IBaseFilter_Release
(
filter
);
ok
(
!
ref
,
"Got outstanding refcount %d.
\n
"
,
ref
);
IMoniker_Release
(
moniker
);
}
ICreateDevEnum_Release
(
dev_enum
);
IEnumMoniker_Release
(
class_enum
);
CoUninitialize
();
}
dlls/qcap/v4l.c
View file @
24ed16e8
...
...
@@ -131,20 +131,48 @@ HRESULT qcap_driver_destroy(Capture *capBox)
return
S_OK
;
}
HRESULT
qcap_driver_check_format
(
Capture
*
device
,
const
AM_MEDIA_TYPE
*
mt
)
{
HRESULT
hr
;
TRACE
(
"device %p, mt %p.
\n
"
,
device
,
mt
);
dump_AM_MEDIA_TYPE
(
mt
);
if
(
!
mt
)
return
E_POINTER
;
if
(
!
IsEqualGUID
(
&
mt
->
majortype
,
&
MEDIATYPE_Video
))
return
S_FALSE
;
if
(
IsEqualGUID
(
&
mt
->
formattype
,
&
FORMAT_VideoInfo
)
&&
mt
->
pbFormat
&&
mt
->
cbFormat
>=
sizeof
(
VIDEOINFOHEADER
))
{
VIDEOINFOHEADER
*
vih
=
(
VIDEOINFOHEADER
*
)
mt
->
pbFormat
;
if
(
vih
->
bmiHeader
.
biBitCount
==
24
&&
vih
->
bmiHeader
.
biCompression
==
BI_RGB
)
hr
=
S_OK
;
else
{
FIXME
(
"Unsupported compression %#x, bpp %u.
\n
"
,
vih
->
bmiHeader
.
biCompression
,
vih
->
bmiHeader
.
biBitCount
);
hr
=
S_FALSE
;
}
}
else
hr
=
VFW_E_INVALIDMEDIATYPE
;
return
hr
;
}
HRESULT
qcap_driver_set_format
(
Capture
*
device
,
AM_MEDIA_TYPE
*
mt
)
{
struct
v4l2_format
format
=
{
0
};
int
newheight
,
newwidth
;
VIDEOINFOHEADER
*
vih
;
int
fd
=
device
->
fd
;
HRESULT
hr
;
if
(
FAILED
(
hr
=
qcap_driver_check_format
(
device
,
mt
)))
return
hr
;
vih
=
(
VIDEOINFOHEADER
*
)
mt
->
pbFormat
;
if
(
vih
->
bmiHeader
.
biBitCount
!=
24
||
vih
->
bmiHeader
.
biCompression
!=
BI_RGB
)
{
FIXME
(
"Unsupported compression %#x, bpp %u.
\n
"
,
vih
->
bmiHeader
.
biCompression
,
vih
->
bmiHeader
.
biBitCount
);
return
VFW_E_INVALIDMEDIATYPE
;
}
newwidth
=
vih
->
bmiHeader
.
biWidth
;
newheight
=
vih
->
bmiHeader
.
biHeight
;
...
...
@@ -655,6 +683,11 @@ HRESULT qcap_driver_destroy(Capture *capBox)
FAIL_WITH_ERR
;
}
HRESULT
qcap_driver_check_format
(
Capture
*
device
,
const
AM_MEDIA_TYPE
*
mt
)
{
FAIL_WITH_ERR
;
}
HRESULT
qcap_driver_set_format
(
Capture
*
capBox
,
AM_MEDIA_TYPE
*
mT
)
{
FAIL_WITH_ERR
;
...
...
dlls/qcap/vfwcapture.c
View file @
24ed16e8
...
...
@@ -658,10 +658,10 @@ static inline VfwPinImpl *impl_from_BasePin(BasePin *pin)
return
CONTAINING_RECORD
(
pin
,
VfwPinImpl
,
pin
.
pin
);
}
static
HRESULT
WINAPI
VfwPin_CheckMediaType
(
BasePin
*
pin
,
const
AM_MEDIA_TYPE
*
a
mt
)
static
HRESULT
WINAPI
VfwPin_CheckMediaType
(
BasePin
*
pin
,
const
AM_MEDIA_TYPE
*
mt
)
{
FIXME
(
"(%p) stub
\n
"
,
pin
);
return
E_NOTIMPL
;
VfwPinImpl
*
filter
=
impl_from_BasePin
(
pin
);
return
qcap_driver_check_format
(
filter
->
parent
->
driver_info
,
mt
)
;
}
static
HRESULT
WINAPI
VfwPin_GetMediaType
(
BasePin
*
pin
,
int
iPosition
,
AM_MEDIA_TYPE
*
pmt
)
...
...
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