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
a6166a5e
Commit
a6166a5e
authored
Oct 12, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat/mediatype: Enable IMFVideoMediaType based on major type.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
62fa286e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
60 deletions
+101
-60
mediatype.c
dlls/mfplat/mediatype.c
+49
-59
mfplat.c
dlls/mfplat/tests/mfplat.c
+52
-1
No files found.
dlls/mfplat/mediatype.c
View file @
a6166a5e
...
@@ -96,20 +96,32 @@ static struct presentation_desc *impl_from_IMFPresentationDescriptor(IMFPresenta
...
@@ -96,20 +96,32 @@ static struct presentation_desc *impl_from_IMFPresentationDescriptor(IMFPresenta
static
HRESULT
WINAPI
mediatype_QueryInterface
(
IMFMediaType
*
iface
,
REFIID
riid
,
void
**
out
)
static
HRESULT
WINAPI
mediatype_QueryInterface
(
IMFMediaType
*
iface
,
REFIID
riid
,
void
**
out
)
{
{
struct
media_type
*
media_type
=
impl_from_IMFMediaType
(
iface
);
GUID
major
=
{
0
};
TRACE
(
"%p, %s, %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
out
);
TRACE
(
"%p, %s, %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
out
);
if
(
IsEqualIID
(
riid
,
&
IID_IMFMediaType
)
||
attributes_GetGUID
(
&
media_type
->
attributes
,
&
MF_MT_MAJOR_TYPE
,
&
major
);
if
(
IsEqualGUID
(
&
major
,
&
MFMediaType_Video
)
&&
IsEqualIID
(
riid
,
&
IID_IMFVideoMediaType
))
{
*
out
=
&
media_type
->
IMFVideoMediaType_iface
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IMFMediaType
)
||
IsEqualIID
(
riid
,
&
IID_IMFAttributes
)
||
IsEqualIID
(
riid
,
&
IID_IMFAttributes
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
{
*
out
=
iface
;
*
out
=
&
media_type
->
IMFMediaType_iface
;
IMFMediaType_AddRef
(
iface
);
}
return
S_OK
;
else
{
WARN
(
"Unsupported %s.
\n
"
,
debugstr_guid
(
riid
));
*
out
=
NULL
;
return
E_NOINTERFACE
;
}
}
WARN
(
"Unsupported %s.
\n
"
,
debugstr_guid
(
riid
));
IUnknown_AddRef
((
IUnknown
*
)
*
out
);
*
out
=
NULL
;
return
S_OK
;
return
E_NOINTERFACE
;
}
}
static
ULONG
WINAPI
mediatype_AddRef
(
IMFMediaType
*
iface
)
static
ULONG
WINAPI
mediatype_AddRef
(
IMFMediaType
*
iface
)
...
@@ -613,48 +625,20 @@ static const IMFMediaTypeVtbl mediatypevtbl =
...
@@ -613,48 +625,20 @@ static const IMFMediaTypeVtbl mediatypevtbl =
static
HRESULT
WINAPI
video_mediatype_QueryInterface
(
IMFVideoMediaType
*
iface
,
REFIID
riid
,
void
**
out
)
static
HRESULT
WINAPI
video_mediatype_QueryInterface
(
IMFVideoMediaType
*
iface
,
REFIID
riid
,
void
**
out
)
{
{
TRACE
(
"%p, %s, %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
out
);
struct
media_type
*
media_type
=
impl_from_IMFVideoMediaType
(
iface
);
return
IMFMediaType_QueryInterface
(
&
media_type
->
IMFMediaType_iface
,
riid
,
out
);
if
(
IsEqualIID
(
riid
,
&
IID_IMFVideoMediaType
)
||
IsEqualIID
(
riid
,
&
IID_IMFMediaType
)
||
IsEqualIID
(
riid
,
&
IID_IMFAttributes
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
out
=
iface
;
IMFVideoMediaType_AddRef
(
iface
);
return
S_OK
;
}
WARN
(
"Unsupported %s.
\n
"
,
debugstr_guid
(
riid
));
*
out
=
NULL
;
return
E_NOINTERFACE
;
}
}
static
ULONG
WINAPI
video_mediatype_AddRef
(
IMFVideoMediaType
*
iface
)
static
ULONG
WINAPI
video_mediatype_AddRef
(
IMFVideoMediaType
*
iface
)
{
{
struct
media_type
*
media_type
=
impl_from_IMFVideoMediaType
(
iface
);
struct
media_type
*
media_type
=
impl_from_IMFVideoMediaType
(
iface
);
ULONG
refcount
=
InterlockedIncrement
(
&
media_type
->
attributes
.
ref
);
return
IMFMediaType_AddRef
(
&
media_type
->
IMFMediaType_iface
);
TRACE
(
"%p, refcount %u.
\n
"
,
iface
,
refcount
);
return
refcount
;
}
}
static
ULONG
WINAPI
video_mediatype_Release
(
IMFVideoMediaType
*
iface
)
static
ULONG
WINAPI
video_mediatype_Release
(
IMFVideoMediaType
*
iface
)
{
{
struct
media_type
*
media_type
=
impl_from_IMFVideoMediaType
(
iface
);
struct
media_type
*
media_type
=
impl_from_IMFVideoMediaType
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
media_type
->
attributes
.
ref
);
return
IMFMediaType_Release
(
&
media_type
->
IMFMediaType_iface
);
TRACE
(
"%p, refcount %u.
\n
"
,
iface
,
refcount
);
if
(
!
refcount
)
{
clear_attributes_object
(
&
media_type
->
attributes
);
CoTaskMemFree
(
media_type
->
video_format
);
heap_free
(
media_type
);
}
return
refcount
;
}
}
static
HRESULT
WINAPI
video_mediatype_GetItem
(
IMFVideoMediaType
*
iface
,
REFGUID
key
,
PROPVARIANT
*
value
)
static
HRESULT
WINAPI
video_mediatype_GetItem
(
IMFVideoMediaType
*
iface
,
REFGUID
key
,
PROPVARIANT
*
value
)
...
@@ -1039,6 +1023,28 @@ static const IMFVideoMediaTypeVtbl videomediatypevtbl =
...
@@ -1039,6 +1023,28 @@ static const IMFVideoMediaTypeVtbl videomediatypevtbl =
video_mediatype_GetVideoRepresentation
,
video_mediatype_GetVideoRepresentation
,
};
};
static
HRESULT
create_media_type
(
struct
media_type
**
ret
)
{
struct
media_type
*
object
;
HRESULT
hr
;
object
=
heap_alloc_zero
(
sizeof
(
*
object
));
if
(
!
object
)
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
init_attributes_object
(
&
object
->
attributes
,
0
)))
{
heap_free
(
object
);
return
hr
;
}
object
->
IMFMediaType_iface
.
lpVtbl
=
&
mediatypevtbl
;
object
->
IMFVideoMediaType_iface
.
lpVtbl
=
&
videomediatypevtbl
;
*
ret
=
object
;
return
S_OK
;
}
/***********************************************************************
/***********************************************************************
* MFCreateMediaType (mfplat.@)
* MFCreateMediaType (mfplat.@)
*/
*/
...
@@ -1052,16 +1058,8 @@ HRESULT WINAPI MFCreateMediaType(IMFMediaType **media_type)
...
@@ -1052,16 +1058,8 @@ HRESULT WINAPI MFCreateMediaType(IMFMediaType **media_type)
if
(
!
media_type
)
if
(
!
media_type
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
object
=
heap_alloc
(
sizeof
(
*
object
));
if
(
FAILED
(
hr
=
create_media_type
(
&
object
)))
if
(
!
object
)
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
init_attributes_object
(
&
object
->
attributes
,
0
)))
{
heap_free
(
object
);
return
hr
;
return
hr
;
}
object
->
IMFMediaType_iface
.
lpVtbl
=
&
mediatypevtbl
;
*
media_type
=
&
object
->
IMFMediaType_iface
;
*
media_type
=
&
object
->
IMFMediaType_iface
;
...
@@ -2633,19 +2631,11 @@ HRESULT WINAPI MFCreateVideoMediaTypeFromSubtype(const GUID *subtype, IMFVideoMe
...
@@ -2633,19 +2631,11 @@ HRESULT WINAPI MFCreateVideoMediaTypeFromSubtype(const GUID *subtype, IMFVideoMe
if
(
!
media_type
)
if
(
!
media_type
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
object
=
heap_alloc
(
sizeof
(
*
object
));
if
(
FAILED
(
hr
=
create_media_type
(
&
object
)))
if
(
!
object
)
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
init_attributes_object
(
&
object
->
attributes
,
0
)))
{
heap_free
(
object
);
return
hr
;
return
hr
;
}
object
->
IMFVideoMediaType_iface
.
lpVtbl
=
&
videomediatypevtbl
;
IMF
VideoMediaType_SetGUID
(
&
object
->
IMFVideo
MediaType_iface
,
&
MF_MT_MAJOR_TYPE
,
&
MFMediaType_Video
);
IMF
MediaType_SetGUID
(
&
object
->
IMF
MediaType_iface
,
&
MF_MT_MAJOR_TYPE
,
&
MFMediaType_Video
);
IMF
VideoMediaType_SetGUID
(
&
object
->
IMFVideo
MediaType_iface
,
&
MF_MT_SUBTYPE
,
subtype
);
IMF
MediaType_SetGUID
(
&
object
->
IMF
MediaType_iface
,
&
MF_MT_SUBTYPE
,
subtype
);
*
media_type
=
&
object
->
IMFVideoMediaType_iface
;
*
media_type
=
&
object
->
IMFVideoMediaType_iface
;
...
...
dlls/mfplat/tests/mfplat.c
View file @
a6166a5e
...
@@ -763,8 +763,10 @@ static void init_functions(void)
...
@@ -763,8 +763,10 @@ static void init_functions(void)
static
void
test_media_type
(
void
)
static
void
test_media_type
(
void
)
{
{
IMFMediaType
*
mediatype
,
*
mediatype2
;
IMFMediaType
*
mediatype
,
*
mediatype2
;
IMFVideoMediaType
*
video_type
;
IUnknown
*
unk
,
*
unk2
;
DWORD
count
,
flags
;
BOOL
compressed
;
BOOL
compressed
;
DWORD
flags
;
HRESULT
hr
;
HRESULT
hr
;
GUID
guid
;
GUID
guid
;
...
@@ -862,6 +864,55 @@ if(0)
...
@@ -862,6 +864,55 @@ if(0)
IMFMediaType_Release
(
mediatype2
);
IMFMediaType_Release
(
mediatype2
);
IMFMediaType_Release
(
mediatype
);
IMFMediaType_Release
(
mediatype
);
/* IMFVideoMediaType */
hr
=
MFCreateMediaType
(
&
mediatype
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_QueryInterface
(
mediatype
,
&
IID_IMFVideoMediaType
,
(
void
**
)
&
unk
);
ok
(
hr
==
E_NOINTERFACE
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_QueryInterface
(
mediatype
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
unk
==
(
IUnknown
*
)
mediatype
,
"Unexpected pointer.
\n
"
);
IUnknown_Release
(
unk
);
hr
=
IMFMediaType_SetGUID
(
mediatype
,
&
MF_MT_MAJOR_TYPE
,
&
MFMediaType_Video
);
ok
(
hr
==
S_OK
,
"Failed to set GUID value, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_QueryInterface
(
mediatype
,
&
IID_IMFVideoMediaType
,
(
void
**
)
&
unk
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IUnknown_QueryInterface
(
unk
,
&
IID_IUnknown
,
(
void
**
)
&
unk2
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
unk2
==
(
IUnknown
*
)
mediatype
,
"Unexpected pointer.
\n
"
);
IUnknown_Release
(
unk2
);
IUnknown_Release
(
unk
);
hr
=
MFCreateVideoMediaTypeFromSubtype
(
&
MFVideoFormat_RGB555
,
&
video_type
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFVideoMediaType_QueryInterface
(
video_type
,
&
IID_IMFMediaType
,
(
void
**
)
&
unk
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
IUnknown_Release
(
unk
);
hr
=
IMFVideoMediaType_QueryInterface
(
video_type
,
&
IID_IMFVideoMediaType
,
(
void
**
)
&
unk
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
IUnknown_Release
(
unk
);
/* Major and subtype are set on creation. */
hr
=
IMFVideoMediaType_GetCount
(
video_type
,
&
count
);
ok
(
count
==
2
,
"Unexpected attribute count %#x.
\n
"
,
hr
);
hr
=
IMFVideoMediaType_DeleteAllItems
(
video_type
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFVideoMediaType_GetCount
(
video_type
,
&
count
);
ok
(
!
count
,
"Unexpected attribute count %#x.
\n
"
,
hr
);
hr
=
IMFVideoMediaType_QueryInterface
(
video_type
,
&
IID_IMFVideoMediaType
,
(
void
**
)
&
unk
);
ok
(
hr
==
E_NOINTERFACE
,
"Unexpected hr %#x.
\n
"
,
hr
);
IMFVideoMediaType_Release
(
video_type
);
IMFMediaType_Release
(
mediatype
);
}
}
static
void
test_MFCreateMediaEvent
(
void
)
static
void
test_MFCreateMediaEvent
(
void
)
...
...
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