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
16477a09
Commit
16477a09
authored
Mar 22, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat: Implement media type wrapping.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
52cca8e8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
135 additions
and
2 deletions
+135
-2
main.c
dlls/mfplat/main.c
+1
-0
mediatype.c
dlls/mfplat/mediatype.c
+72
-0
mfplat.spec
dlls/mfplat/mfplat.spec
+2
-2
mfplat.c
dlls/mfplat/tests/mfplat.c
+57
-0
mfapi.h
include/mfapi.h
+3
-0
No files found.
dlls/mfplat/main.c
View file @
16477a09
...
@@ -559,6 +559,7 @@ static const char *debugstr_attr(const GUID *guid)
...
@@ -559,6 +559,7 @@ static const char *debugstr_attr(const GUID *guid)
X
(
MF_SOURCE_READER_ENABLE_TRANSCODE_ONLY_TRANSFORMS
),
X
(
MF_SOURCE_READER_ENABLE_TRANSCODE_ONLY_TRANSFORMS
),
X
(
MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS
),
X
(
MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS
),
X
(
MF_MT_PIXEL_ASPECT_RATIO
),
X
(
MF_MT_PIXEL_ASPECT_RATIO
),
X
(
MF_MT_WRAPPED_TYPE
),
X
(
MF_MT_AVG_BITRATE
),
X
(
MF_MT_AVG_BITRATE
),
X
(
MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING
),
X
(
MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING
),
X
(
MF_PD_PMPHOST_CONTEXT
),
X
(
MF_PD_PMPHOST_CONTEXT
),
...
...
dlls/mfplat/mediatype.c
View file @
16477a09
...
@@ -1515,3 +1515,75 @@ BOOL WINAPI MFCompareFullToPartialMediaType(IMFMediaType *full_type, IMFMediaTyp
...
@@ -1515,3 +1515,75 @@ BOOL WINAPI MFCompareFullToPartialMediaType(IMFMediaType *full_type, IMFMediaTyp
return
result
;
return
result
;
}
}
/***********************************************************************
* MFWrapMediaType (mfplat.@)
*/
HRESULT
WINAPI
MFWrapMediaType
(
IMFMediaType
*
original
,
REFGUID
major
,
REFGUID
subtype
,
IMFMediaType
**
ret
)
{
IMFMediaType
*
mediatype
;
UINT8
*
buffer
;
UINT32
size
;
HRESULT
hr
;
TRACE
(
"%p, %s, %s, %p.
\n
"
,
original
,
debugstr_guid
(
major
),
debugstr_guid
(
subtype
),
ret
);
if
(
FAILED
(
hr
=
MFGetAttributesAsBlobSize
((
IMFAttributes
*
)
original
,
&
size
)))
return
hr
;
if
(
!
(
buffer
=
heap_alloc
(
size
)))
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
MFGetAttributesAsBlob
((
IMFAttributes
*
)
original
,
buffer
,
size
)))
goto
failed
;
if
(
FAILED
(
hr
=
MFCreateMediaType
(
&
mediatype
)))
goto
failed
;
if
(
FAILED
(
hr
=
IMFMediaType_SetGUID
(
mediatype
,
&
MF_MT_MAJOR_TYPE
,
major
)))
goto
failed
;
if
(
FAILED
(
hr
=
IMFMediaType_SetGUID
(
mediatype
,
&
MF_MT_SUBTYPE
,
subtype
)))
goto
failed
;
if
(
FAILED
(
hr
=
IMFMediaType_SetBlob
(
mediatype
,
&
MF_MT_WRAPPED_TYPE
,
buffer
,
size
)))
goto
failed
;
*
ret
=
mediatype
;
failed:
heap_free
(
buffer
);
return
hr
;
}
/***********************************************************************
* MFUnwrapMediaType (mfplat.@)
*/
HRESULT
WINAPI
MFUnwrapMediaType
(
IMFMediaType
*
wrapper
,
IMFMediaType
**
ret
)
{
IMFMediaType
*
mediatype
;
UINT8
*
buffer
;
UINT32
size
;
HRESULT
hr
;
TRACE
(
"%p, %p.
\n
"
,
wrapper
,
ret
);
if
(
FAILED
(
hr
=
MFCreateMediaType
(
&
mediatype
)))
return
hr
;
if
(
FAILED
(
hr
=
IMFMediaType_GetAllocatedBlob
(
wrapper
,
&
MF_MT_WRAPPED_TYPE
,
&
buffer
,
&
size
)))
{
IMFMediaType_Release
(
mediatype
);
return
hr
;
}
hr
=
MFInitAttributesFromBlob
((
IMFAttributes
*
)
mediatype
,
buffer
,
size
);
CoTaskMemFree
(
buffer
);
if
(
FAILED
(
hr
))
return
hr
;
*
ret
=
mediatype
;
return
S_OK
;
}
dlls/mfplat/mfplat.spec
View file @
16477a09
...
@@ -152,9 +152,9 @@
...
@@ -152,9 +152,9 @@
@ stub MFUnblockThread
@ stub MFUnblockThread
@ stdcall MFUnlockPlatform()
@ stdcall MFUnlockPlatform()
@ stdcall MFUnlockWorkQueue(long)
@ stdcall MFUnlockWorkQueue(long)
@ st
ub MFUnwrapMediaType
@ st
dcall MFUnwrapMediaType(ptr ptr)
@ stub MFValidateMediaTypeSize
@ stub MFValidateMediaTypeSize
@ st
ub MFWrapMediaType
@ st
dcall MFWrapMediaType(ptr ptr ptr ptr)
@ stub MFllMulDiv
@ stub MFllMulDiv
@ stub PropVariantFromStream
@ stub PropVariantFromStream
@ stub PropVariantToStream
@ stub PropVariantToStream
dlls/mfplat/tests/mfplat.c
View file @
16477a09
...
@@ -2616,6 +2616,62 @@ static void test_attributes_serialization(void)
...
@@ -2616,6 +2616,62 @@ static void test_attributes_serialization(void)
IMFAttributes_Release
(
dest
);
IMFAttributes_Release
(
dest
);
}
}
static
void
test_wrapped_media_type
(
void
)
{
IMFMediaType
*
mediatype
,
*
mediatype2
;
UINT32
count
,
type
;
HRESULT
hr
;
GUID
guid
;
hr
=
MFCreateMediaType
(
&
mediatype
);
ok
(
hr
==
S_OK
,
"Failed to create media type, hr %#x.
\n
"
,
hr
);
hr
=
MFUnwrapMediaType
(
mediatype
,
&
mediatype2
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_SetUINT32
(
mediatype
,
&
GUID_NULL
,
1
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_SetUINT32
(
mediatype
,
&
DUMMY_GUID1
,
2
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_SetGUID
(
mediatype
,
&
MF_MT_MAJOR_TYPE
,
&
MFMediaType_Video
);
ok
(
hr
==
S_OK
,
"Failed to set GUID value, hr %#x.
\n
"
,
hr
);
hr
=
MFWrapMediaType
(
mediatype
,
&
MFMediaType_Audio
,
&
IID_IUnknown
,
&
mediatype2
);
ok
(
hr
==
S_OK
,
"Failed to create wrapped media type, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_GetGUID
(
mediatype2
,
&
MF_MT_MAJOR_TYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Failed to get major type, hr %#x.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFMediaType_Audio
),
"Unexpected major type.
\n
"
);
hr
=
IMFMediaType_GetGUID
(
mediatype2
,
&
MF_MT_SUBTYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Failed to get subtype, hr %#x.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
IID_IUnknown
),
"Unexpected major type.
\n
"
);
hr
=
IMFMediaType_GetCount
(
mediatype2
,
&
count
);
ok
(
hr
==
S_OK
,
"Failed to get item count, hr %#x.
\n
"
,
hr
);
ok
(
count
==
3
,
"Unexpected count %u.
\n
"
,
count
);
hr
=
IMFMediaType_GetItemType
(
mediatype2
,
&
MF_MT_WRAPPED_TYPE
,
&
type
);
ok
(
hr
==
S_OK
,
"Failed to get item type, hr %#x.
\n
"
,
hr
);
ok
(
type
==
MF_ATTRIBUTE_BLOB
,
"Unexpected item type.
\n
"
);
IMFMediaType_Release
(
mediatype
);
hr
=
MFUnwrapMediaType
(
mediatype2
,
&
mediatype
);
ok
(
hr
==
S_OK
,
"Failed to unwrap, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_GetGUID
(
mediatype
,
&
MF_MT_MAJOR_TYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Failed to get major type, hr %#x.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFMediaType_Video
),
"Unexpected major type.
\n
"
);
hr
=
IMFMediaType_GetGUID
(
mediatype
,
&
MF_MT_SUBTYPE
,
&
guid
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#x.
\n
"
,
hr
);
IMFMediaType_Release
(
mediatype
);
IMFMediaType_Release
(
mediatype2
);
}
START_TEST
(
mfplat
)
START_TEST
(
mfplat
)
{
{
CoInitialize
(
NULL
);
CoInitialize
(
NULL
);
...
@@ -2648,6 +2704,7 @@ START_TEST(mfplat)
...
@@ -2648,6 +2704,7 @@ START_TEST(mfplat)
test_MFCalculateImageSize
();
test_MFCalculateImageSize
();
test_MFCompareFullToPartialMediaType
();
test_MFCompareFullToPartialMediaType
();
test_attributes_serialization
();
test_attributes_serialization
();
test_wrapped_media_type
();
CoUninitialize
();
CoUninitialize
();
}
}
include/mfapi.h
View file @
16477a09
...
@@ -105,6 +105,7 @@ DEFINE_GUID(MF_MT_ALL_SAMPLES_INDEPENDENT, 0xc9173739, 0x5e56, 0x461c, 0xb7, 0x1
...
@@ -105,6 +105,7 @@ DEFINE_GUID(MF_MT_ALL_SAMPLES_INDEPENDENT, 0xc9173739, 0x5e56, 0x461c, 0xb7, 0x1
DEFINE_GUID
(
MF_MT_USER_DATA
,
0xb6bc765f
,
0x4c3b
,
0x40a4
,
0xbd
,
0x51
,
0x25
,
0x35
,
0xb6
,
0x6f
,
0xe0
,
0x9d
);
DEFINE_GUID
(
MF_MT_USER_DATA
,
0xb6bc765f
,
0x4c3b
,
0x40a4
,
0xbd
,
0x51
,
0x25
,
0x35
,
0xb6
,
0x6f
,
0xe0
,
0x9d
);
DEFINE_GUID
(
MF_MT_FRAME_RATE_RANGE_MIN
,
0xd2e7558c
,
0xdc1f
,
0x403f
,
0x9a
,
0x72
,
0xd2
,
0x8b
,
0xb1
,
0xeb
,
0x3b
,
0x5e
);
DEFINE_GUID
(
MF_MT_FRAME_RATE_RANGE_MIN
,
0xd2e7558c
,
0xdc1f
,
0x403f
,
0x9a
,
0x72
,
0xd2
,
0x8b
,
0xb1
,
0xeb
,
0x3b
,
0x5e
);
DEFINE_GUID
(
MF_MT_FRAME_RATE_RANGE_MAX
,
0xe3371d41
,
0xb4cf
,
0x4a05
,
0xbd
,
0x4e
,
0x20
,
0xb8
,
0x8b
,
0xb2
,
0xc4
,
0xd6
);
DEFINE_GUID
(
MF_MT_FRAME_RATE_RANGE_MAX
,
0xe3371d41
,
0xb4cf
,
0x4a05
,
0xbd
,
0x4e
,
0x20
,
0xb8
,
0x8b
,
0xb2
,
0xc4
,
0xd6
);
DEFINE_GUID
(
MF_MT_WRAPPED_TYPE
,
0x4d3f7b23
,
0xd02f
,
0x4e6c
,
0x9b
,
0xee
,
0xe4
,
0xbf
,
0x2c
,
0x6c
,
0x69
,
0x5d
);
DEFINE_GUID
(
MFT_CATEGORY_VIDEO_DECODER
,
0xd6c02d4b
,
0x6833
,
0x45b4
,
0x97
,
0x1a
,
0x05
,
0xa4
,
0xb0
,
0x4b
,
0xab
,
0x91
);
DEFINE_GUID
(
MFT_CATEGORY_VIDEO_DECODER
,
0xd6c02d4b
,
0x6833
,
0x45b4
,
0x97
,
0x1a
,
0x05
,
0xa4
,
0xb0
,
0x4b
,
0xab
,
0x91
);
DEFINE_GUID
(
MFT_CATEGORY_VIDEO_ENCODER
,
0xf79eac7d
,
0xe545
,
0x4387
,
0xbd
,
0xee
,
0xd6
,
0x47
,
0xd7
,
0xbd
,
0xe4
,
0x2a
);
DEFINE_GUID
(
MFT_CATEGORY_VIDEO_ENCODER
,
0xf79eac7d
,
0xe545
,
0x4387
,
0xbd
,
0xee
,
0xd6
,
0x47
,
0xd7
,
0xbd
,
0xe4
,
0x2a
);
...
@@ -236,6 +237,8 @@ HRESULT WINAPI MFUnlockWorkQueue(DWORD queue);
...
@@ -236,6 +237,8 @@ HRESULT WINAPI MFUnlockWorkQueue(DWORD queue);
HRESULT
WINAPI
MFTUnregister
(
CLSID
clsid
);
HRESULT
WINAPI
MFTUnregister
(
CLSID
clsid
);
HRESULT
WINAPI
MFTUnregisterLocal
(
IClassFactory
*
factory
);
HRESULT
WINAPI
MFTUnregisterLocal
(
IClassFactory
*
factory
);
HRESULT
WINAPI
MFGetPluginControl
(
IMFPluginControl
**
);
HRESULT
WINAPI
MFGetPluginControl
(
IMFPluginControl
**
);
HRESULT
WINAPI
MFWrapMediaType
(
IMFMediaType
*
original
,
REFGUID
major
,
REFGUID
subtype
,
IMFMediaType
**
wrapped
);
HRESULT
WINAPI
MFUnwrapMediaType
(
IMFMediaType
*
wrapped
,
IMFMediaType
**
original
);
#if defined(__cplusplus)
#if defined(__cplusplus)
}
}
...
...
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