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
43e70580
Commit
43e70580
authored
Aug 25, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat/tests: Add some tests for legacy media type conersion functions.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
9eaeebf0
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
438 additions
and
4 deletions
+438
-4
evr.spec
dlls/evr/evr.spec
+1
-1
mediatype.c
dlls/mfplat/mediatype.c
+34
-0
mfplat.spec
dlls/mfplat/mfplat.spec
+3
-3
mfplat.c
dlls/mfplat/tests/mfplat.c
+355
-0
ksmedia.h
include/ksmedia.h
+25
-0
mfapi.h
include/mfapi.h
+20
-0
No files found.
dlls/evr/evr.spec
View file @
43e70580
...
...
@@ -12,7 +12,7 @@
@ stub MFCreateVideoMediaTypeFromBitMapInfoHeader
@ stdcall -import MFCreateVideoMediaTypeFromSubtype(ptr ptr)
@ stub MFCreateVideoMediaTypeFromVideoInfoHeader2
@ st
ub MFCreateVideoMediaTypeFromVideoInfoHeader
@ st
dcall -import MFCreateVideoMediaTypeFromVideoInfoHeader(ptr long long long long int64 ptr ptr)
@ stdcall MFCreateVideoMixer(ptr ptr ptr ptr)
@ stdcall MFCreateVideoMixerAndPresenter(ptr ptr ptr ptr ptr ptr)
@ stub MFCreateVideoOTA
...
...
dlls/mfplat/mediatype.c
View file @
43e70580
...
...
@@ -3557,3 +3557,37 @@ HRESULT WINAPI MFInitVideoFormat_RGB(MFVIDEOFORMAT *format, DWORD width, DWORD h
return
S_OK
;
}
/***********************************************************************
* MFCreateVideoMediaTypeFromVideoInfoHeader (mfplat.@)
*/
HRESULT
WINAPI
MFCreateVideoMediaTypeFromVideoInfoHeader
(
const
KS_VIDEOINFOHEADER
*
vih
,
DWORD
size
,
DWORD
pixel_aspect_ratio_x
,
DWORD
pixel_aspect_ratio_y
,
MFVideoInterlaceMode
interlace_mode
,
QWORD
video_flags
,
const
GUID
*
subtype
,
IMFVideoMediaType
**
ret
)
{
FIXME
(
"%p, %lu, %lu, %lu, %d, %I64x, %s, %p.
\n
"
,
vih
,
size
,
pixel_aspect_ratio_x
,
pixel_aspect_ratio_y
,
interlace_mode
,
video_flags
,
debugstr_guid
(
subtype
),
ret
);
return
E_NOTIMPL
;
}
/***********************************************************************
* MFInitMediaTypeFromVideoInfoHeader (mfplat.@)
*/
HRESULT
WINAPI
MFInitMediaTypeFromVideoInfoHeader
(
IMFMediaType
*
media_type
,
const
VIDEOINFOHEADER
*
vih
,
UINT32
size
,
const
GUID
*
subtype
)
{
FIXME
(
"%p, %p, %u, %s.
\n
"
,
media_type
,
vih
,
size
,
debugstr_guid
(
subtype
));
return
E_NOTIMPL
;
}
/***********************************************************************
* MFInitMediaTypeFromAMMediaType (mfplat.@)
*/
HRESULT
WINAPI
MFInitMediaTypeFromAMMediaType
(
IMFMediaType
*
media_type
,
const
AM_MEDIA_TYPE
*
am_type
)
{
FIXME
(
"%p, %p.
\n
"
,
media_type
,
am_type
);
return
E_NOTIMPL
;
}
dlls/mfplat/mfplat.spec
View file @
43e70580
...
...
@@ -81,7 +81,7 @@
@ stub MFCreateVideoMediaTypeFromBitMapInfoHeaderEx
@ stdcall MFCreateVideoMediaTypeFromSubtype(ptr ptr)
@ stub MFCreateVideoMediaTypeFromVideoInfoHeader2
@ st
ub MFCreateVideoMediaTypeFromVideoInfoHeader
@ st
dcall MFCreateVideoMediaTypeFromVideoInfoHeader(ptr long long long long int64 ptr ptr)
@ stdcall MFCreateVideoSampleAllocatorEx(ptr ptr)
@ stdcall MFCreateWaveFormatExFromMFMediaType(ptr ptr ptr long)
@ stub MFDeserializeAttributesFromStream
...
...
@@ -119,12 +119,12 @@
@ stdcall MFHeapFree(ptr)
@ stub MFInitAMMediaTypeFromMFMediaType
@ stdcall MFInitAttributesFromBlob(ptr ptr long)
@ st
ub MFInitMediaTypeFromAMMediaType
@ st
dcall MFInitMediaTypeFromAMMediaType(ptr ptr)
@ stub MFInitMediaTypeFromMFVideoFormat
@ stub MFInitMediaTypeFromMPEG1VideoInfo
@ stub MFInitMediaTypeFromMPEG2VideoInfo
@ stub MFInitMediaTypeFromVideoInfoHeader2
@ st
ub MFInitMediaTypeFromVideoInfoHeader
@ st
dcall MFInitMediaTypeFromVideoInfoHeader(ptr ptr long ptr)
@ stdcall MFInitMediaTypeFromWaveFormatEx(ptr ptr long)
@ stub MFInitVideoFormat
@ stdcall MFInitVideoFormat_RGB(ptr long long long)
...
...
dlls/mfplat/tests/mfplat.c
View file @
43e70580
...
...
@@ -29,13 +29,18 @@
#include "winuser.h"
#include "winreg.h"
#include "ole2.h"
#include "ks.h"
#include "ksmedia.h"
#include "amvideo.h"
#include "mfapi.h"
#include "mfidl.h"
#include "mferror.h"
#include "mfreadwrite.h"
#include "propvarutil.h"
#include "strsafe.h"
#include "uuids.h"
#include "evr.h"
#include "mfmediaengine.h"
#include "wine/test.h"
...
...
@@ -8142,6 +8147,353 @@ static void test_MFInitVideoFormat_RGB(void)
}
}
static
void
test_MFCreateVideoMediaTypeFromVideoInfoHeader
(
void
)
{
IMFVideoMediaType
*
media_type
;
KS_VIDEOINFOHEADER
vih
;
UINT32
value32
;
UINT64
value64
;
HRESULT
hr
;
GUID
guid
;
hr
=
MFCreateVideoMediaTypeFromVideoInfoHeader
(
NULL
,
0
,
0
,
0
,
MFVideoInterlace_Unknown
,
0
,
NULL
,
&
media_type
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
memset
(
&
vih
,
0
,
sizeof
(
vih
));
hr
=
MFCreateVideoMediaTypeFromVideoInfoHeader
(
&
vih
,
0
,
0
,
0
,
MFVideoInterlace_Unknown
,
0
,
NULL
,
&
media_type
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
MFCreateVideoMediaTypeFromVideoInfoHeader
(
&
vih
,
sizeof
(
vih
),
0
,
0
,
MFVideoInterlace_Unknown
,
0
,
NULL
,
&
media_type
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
vih
.
bmiHeader
.
biSize
=
sizeof
(
vih
.
bmiHeader
);
hr
=
MFCreateVideoMediaTypeFromVideoInfoHeader
(
&
vih
,
sizeof
(
vih
),
0
,
0
,
MFVideoInterlace_Unknown
,
0
,
NULL
,
&
media_type
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
vih
.
bmiHeader
.
biSize
=
sizeof
(
vih
.
bmiHeader
);
vih
.
bmiHeader
.
biPlanes
=
1
;
vih
.
bmiHeader
.
biWidth
=
16
;
vih
.
bmiHeader
.
biHeight
=
32
;
vih
.
bmiHeader
.
biBitCount
=
32
;
hr
=
MFCreateVideoMediaTypeFromVideoInfoHeader
(
&
vih
,
sizeof
(
vih
),
3
,
2
,
MFVideoInterlace_Progressive
,
MFVideoFlag_AnalogProtected
,
&
GUID_NULL
,
&
media_type
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
IMFVideoMediaType_Release
(
media_type
);
hr
=
MFCreateVideoMediaTypeFromVideoInfoHeader
(
&
vih
,
sizeof
(
vih
),
3
,
2
,
MFVideoInterlace_Progressive
,
MFVideoFlag_AnalogProtected
,
NULL
,
&
media_type
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFVideoMediaType_GetGUID
(
media_type
,
&
MF_MT_MAJOR_TYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFMediaType_Video
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFVideoMediaType_GetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB32
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFVideoMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
16
<<
32
|
32
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFVideoMediaType_GetUINT64
(
media_type
,
&
MF_MT_PIXEL_ASPECT_RATIO
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
3
<<
32
|
2
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFVideoMediaType_GetUINT32
(
media_type
,
&
MF_MT_DRM_FLAGS
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
MFVideoDRMFlag_AnalogProtected
,
"Unexpected value %#x.
\n
"
,
value32
);
hr
=
IMFVideoMediaType_GetUINT32
(
media_type
,
&
MF_MT_INTERLACE_MODE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
MFVideoInterlace_Progressive
,
"Unexpected value %#x.
\n
"
,
value32
);
hr
=
IMFVideoMediaType_GetUINT32
(
media_type
,
&
MF_MT_SAMPLE_SIZE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
2048
,
"Unexpected value %u.
\n
"
,
value32
);
hr
=
IMFVideoMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
-
64
,
"Unexpected value %d.
\n
"
,
value32
);
hr
=
IMFVideoMediaType_GetUINT32
(
media_type
,
&
MF_MT_FIXED_SIZE_SAMPLES
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!
value32
,
"Unexpected value %#x.
\n
"
,
value32
);
hr
=
IMFVideoMediaType_GetUINT32
(
media_type
,
&
MF_MT_ALL_SAMPLES_INDEPENDENT
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!
value32
,
"Unexpected value %#x.
\n
"
,
value32
);
IMFVideoMediaType_Release
(
media_type
);
/* Negative height. */
vih
.
bmiHeader
.
biHeight
=
-
32
;
hr
=
MFCreateVideoMediaTypeFromVideoInfoHeader
(
&
vih
,
sizeof
(
vih
),
3
,
2
,
MFVideoInterlace_Progressive
,
MFVideoFlag_AnalogProtected
,
NULL
,
&
media_type
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFVideoMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
16
<<
32
|
32
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFVideoMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
64
,
"Unexpected value %d.
\n
"
,
value32
);
IMFVideoMediaType_Release
(
media_type
);
}
static
void
test_MFInitMediaTypeFromVideoInfoHeader
(
void
)
{
IMFMediaType
*
media_type
;
VIDEOINFOHEADER
vih
;
UINT32
value32
;
UINT64
value64
;
HRESULT
hr
;
GUID
guid
;
hr
=
MFCreateMediaType
(
&
media_type
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
memset
(
&
vih
,
0
,
sizeof
(
vih
));
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
0
,
NULL
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
NULL
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
vih
.
bmiHeader
.
biSize
=
sizeof
(
vih
.
bmiHeader
);
vih
.
bmiHeader
.
biPlanes
=
1
;
vih
.
bmiHeader
.
biWidth
=
16
;
vih
.
bmiHeader
.
biHeight
=
32
;
vih
.
bmiHeader
.
biBitCount
=
32
;
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
&
GUID_NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IMFMediaType_Release
(
media_type
);
return
;
}
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_MAJOR_TYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFMediaType_Video
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
GUID_NULL
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
16
<<
32
|
32
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_PIXEL_ASPECT_RATIO
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
1
<<
32
|
1
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_INTERLACE_MODE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
MFVideoInterlace_Progressive
,
"Unexpected value %#x.
\n
"
,
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_FIXED_SIZE_SAMPLES
,
&
value32
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_SAMPLE_SIZE
,
&
value32
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_ALL_SAMPLES_INDEPENDENT
,
&
value32
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#lx.
\n
"
,
hr
);
vih
.
bmiHeader
.
biHeight
=
-
32
;
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
&
GUID_NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
16
<<
32
|
32
),
"Unexpected value %#I64x.
\n
"
,
value64
);
vih
.
bmiHeader
.
biHeight
=
32
;
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
goto
failed
;
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_MAJOR_TYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFMediaType_Video
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB32
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
16
<<
32
|
32
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_PIXEL_ASPECT_RATIO
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
1
<<
32
|
1
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_INTERLACE_MODE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
MFVideoInterlace_Progressive
,
"Unexpected value %#x.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_SAMPLE_SIZE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
2048
,
"Unexpected value %u.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
-
64
,
"Unexpected value %d.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_FIXED_SIZE_SAMPLES
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!
value32
,
"Unexpected value %#x.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_ALL_SAMPLES_INDEPENDENT
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!
value32
,
"Unexpected value %#x.
\n
"
,
value32
);
/* Negative height. */
vih
.
bmiHeader
.
biHeight
=
-
32
;
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
64
,
"Unexpected value %d.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
16
<<
32
|
32
),
"Unexpected value %#I64x.
\n
"
,
value64
);
failed:
IMFMediaType_Release
(
media_type
);
}
static
void
test_MFInitMediaTypeFromAMMediaType
(
void
)
{
IMFMediaType
*
media_type
;
AM_MEDIA_TYPE
mt
;
UINT32
value32
;
UINT64
value64
;
HRESULT
hr
;
GUID
guid
;
VIDEOINFOHEADER
vih
=
{
{
0
},
{
0
},
0
,
0
,
0
,
{
sizeof
(
BITMAPINFOHEADER
),
32
,
24
,
1
,
0
,
0xdeadbeef
}
};
hr
=
MFCreateMediaType
(
&
media_type
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
memset
(
&
mt
,
0
,
sizeof
(
mt
));
mt
.
majortype
=
MEDIATYPE_Video
;
mt
.
formattype
=
FORMAT_VideoInfo
;
mt
.
cbFormat
=
sizeof
(
VIDEOINFOHEADER
);
mt
.
pbFormat
=
(
BYTE
*
)
&
vih
;
hr
=
IMFMediaType_SetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
123
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
MFInitMediaTypeFromAMMediaType
(
media_type
,
&
mt
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IMFMediaType_Release
(
media_type
);
return
;
}
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_MAJOR_TYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFMediaType_Video
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
GUID_NULL
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
32
<<
32
|
24
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_PIXEL_ASPECT_RATIO
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
1
<<
32
|
1
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_INTERLACE_MODE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
MFVideoInterlace_Progressive
,
"Unexpected value %#x.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_ALL_SAMPLES_INDEPENDENT
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!
value32
,
"Unexpected value %#x.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_FIXED_SIZE_SAMPLES
,
&
value32
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_SAMPLE_SIZE
,
&
value32
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#lx.
\n
"
,
hr
);
vih
.
bmiHeader
.
biHeight
=
-
24
;
hr
=
MFInitMediaTypeFromAMMediaType
(
media_type
,
&
mt
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
32
<<
32
|
24
),
"Unexpected value %#I64x.
\n
"
,
value64
);
memcpy
(
&
mt
.
subtype
,
&
MEDIASUBTYPE_RGB32
,
sizeof
(
GUID
));
vih
.
bmiHeader
.
biHeight
=
24
;
hr
=
MFInitMediaTypeFromAMMediaType
(
media_type
,
&
mt
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_MAJOR_TYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFMediaType_Video
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB32
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
32
<<
32
|
24
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_PIXEL_ASPECT_RATIO
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
1
<<
32
|
1
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_INTERLACE_MODE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
MFVideoInterlace_Progressive
,
"Unexpected value %#x.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_SAMPLE_SIZE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
3072
,
"Unexpected value %u.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_ALL_SAMPLES_INDEPENDENT
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!
value32
,
"Unexpected value %#x.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_FIXED_SIZE_SAMPLES
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!
value32
,
"Unexpected value %u.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
-
128
,
"Unexpected value %d.
\n
"
,
value32
);
/* Negative height. */
vih
.
bmiHeader
.
biHeight
=
-
24
;
hr
=
MFInitMediaTypeFromAMMediaType
(
media_type
,
&
mt
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_MAJOR_TYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFMediaType_Video
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
&
guid
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB32
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
32
<<
32
|
24
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFMediaType_GetUINT64
(
media_type
,
&
MF_MT_PIXEL_ASPECT_RATIO
,
&
value64
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value64
==
((
UINT64
)
1
<<
32
|
1
),
"Unexpected value %#I64x.
\n
"
,
value64
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_INTERLACE_MODE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
MFVideoInterlace_Progressive
,
"Unexpected value %#x.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_SAMPLE_SIZE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
3072
,
"Unexpected value %u.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_ALL_SAMPLES_INDEPENDENT
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!
value32
,
"Unexpected value %#x.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_FIXED_SIZE_SAMPLES
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!
value32
,
"Unexpected value %u.
\n
"
,
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
128
,
"Unexpected value %d.
\n
"
,
value32
);
IMFMediaType_Release
(
media_type
);
}
START_TEST
(
mfplat
)
{
char
**
argv
;
...
...
@@ -8222,6 +8574,9 @@ START_TEST(mfplat)
test_MFllMulDiv
();
test_shared_dxgi_device_manager
();
test_MFInitVideoFormat_RGB
();
test_MFCreateVideoMediaTypeFromVideoInfoHeader
();
test_MFInitMediaTypeFromVideoInfoHeader
();
test_MFInitMediaTypeFromAMMediaType
();
CoUninitialize
();
}
include/ksmedia.h
View file @
43e70580
...
...
@@ -143,4 +143,29 @@ typedef struct _tagKSJACK_DESCRIPTION2
typedef
struct
_tagKSJACK_DESCRIPTION2
*
PKSJACK_DESCRIPTION2
;
typedef
struct
tagKS_BITMAPINFOHEADER
{
DWORD
biSize
;
LONG
biWidth
;
LONG
biHeight
;
WORD
biPlanes
;
WORD
biBitCount
;
DWORD
biCompression
;
DWORD
biSizeImage
;
LONG
biXPelsPerMeter
;
LONG
biYPelsPerMeter
;
DWORD
biClrUsed
;
DWORD
biClrImportant
;
}
KS_BITMAPINFOHEADER
,
*
PKS_BITMAPINFOHEADER
;
typedef
struct
tagKS_VIDEOINFOHEADER
{
RECT
rcSource
;
RECT
rcTarget
;
DWORD
dwBitRate
;
DWORD
dwBitErrorRate
;
REFERENCE_TIME
AvgTimePerFrame
;
KS_BITMAPINFOHEADER
bmiHeader
;
}
KS_VIDEOINFOHEADER
,
*
PKS_VIDEOINFOHEADER
;
#endif
/* _KSMEDIA_ */
include/mfapi.h
View file @
43e70580
...
...
@@ -222,6 +222,13 @@ typedef enum _EAllocationType
eAllocationTypeIgnore
}
EAllocationType
;
typedef
enum
_MFVideoDRMFlags
{
MFVideoDRMFlag_None
=
0
,
MFVideoDRMFlag_AnalogProtected
,
MFVideoDRMFlag_DigitallyProtected
,
}
MFVideoDRMFlags
;
#ifdef MF_INIT_GUIDS
#include <initguid.h>
#endif
...
...
@@ -497,6 +504,9 @@ typedef enum
#define MF_E_DXGI_NEW_VIDEO_DEVICE ((HRESULT)0x80041001)
#define MF_E_DXGI_VIDEO_DEVICE_LOCKED ((HRESULT)0x80041002)
struct
tagVIDEOINFOHEADER
;
typedef
struct
tagVIDEOINFOHEADER
VIDEOINFOHEADER
;
HRESULT
WINAPI
MFAddPeriodicCallback
(
MFPERIODICCALLBACK
callback
,
IUnknown
*
context
,
DWORD
*
key
);
HRESULT
WINAPI
MFAllocateSerialWorkQueue
(
DWORD
target_queue
,
DWORD
*
queue
);
HRESULT
WINAPI
MFAllocateWorkQueue
(
DWORD
*
queue
);
...
...
@@ -538,6 +548,13 @@ HRESULT WINAPI MFCreateSample(IMFSample **sample);
HRESULT
WINAPI
MFCreateTempFile
(
MF_FILE_ACCESSMODE
accessmode
,
MF_FILE_OPENMODE
openmode
,
MF_FILE_FLAGS
flags
,
IMFByteStream
**
bytestream
);
HRESULT
WINAPI
MFCreateVideoMediaTypeFromSubtype
(
const
GUID
*
subtype
,
IMFVideoMediaType
**
media_type
);
#ifdef _KSMEDIA_
HRESULT
WINAPI
MFCreateVideoMediaTypeFromVideoInfoHeader
(
const
KS_VIDEOINFOHEADER
*
vih
,
DWORD
size
,
DWORD
pixel_aspect_ratio_x
,
DWORD
pixel_aspect_ratio_y
,
MFVideoInterlaceMode
interlace_mode
,
QWORD
video_flags
,
const
GUID
*
subtype
,
IMFVideoMediaType
**
media_type
);
#endif
HRESULT
WINAPI
MFCreateVideoSampleAllocatorEx
(
REFIID
riid
,
void
**
allocator
);
HRESULT
WINAPI
MFCreateMemoryBuffer
(
DWORD
max_length
,
IMFMediaBuffer
**
buffer
);
HRESULT
WINAPI
MFCreateWaveFormatExFromMFMediaType
(
IMFMediaType
*
type
,
WAVEFORMATEX
**
format
,
UINT32
*
size
,
UINT32
flags
);
...
...
@@ -567,6 +584,9 @@ HRESULT WINAPI MFTGetInfo(CLSID clsid, WCHAR **name, MFT_REGISTER_TYPE_INFO **in
MFT_REGISTER_TYPE_INFO
**
output_types
,
UINT32
*
output_types_count
,
IMFAttributes
**
attributes
);
BOOL
WINAPI
MFIsFormatYUV
(
DWORD
format
);
HRESULT
WINAPI
MFInitAttributesFromBlob
(
IMFAttributes
*
attributes
,
const
UINT8
*
buffer
,
UINT
size
);
HRESULT
WINAPI
MFInitMediaTypeFromAMMediaType
(
IMFMediaType
*
mediatype
,
const
AM_MEDIA_TYPE
*
am_type
);
HRESULT
WINAPI
MFInitMediaTypeFromVideoInfoHeader
(
IMFMediaType
*
media_type
,
const
VIDEOINFOHEADER
*
vih
,
UINT32
size
,
const
GUID
*
subtype
);
HRESULT
WINAPI
MFInitMediaTypeFromWaveFormatEx
(
IMFMediaType
*
mediatype
,
const
WAVEFORMATEX
*
format
,
UINT32
size
);
HRESULT
WINAPI
MFInitVideoFormat_RGB
(
MFVIDEOFORMAT
*
format
,
DWORD
width
,
DWORD
height
,
DWORD
d3dformat
);
HRESULT
WINAPI
MFInvokeCallback
(
IMFAsyncResult
*
result
);
...
...
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