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
af37f3b0
Commit
af37f3b0
authored
Nov 03, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat: Implement MFMapDXGIFormatToDX9Format().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b911e560
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
174 additions
and
0 deletions
+174
-0
mediatype.c
dlls/mfplat/mediatype.c
+98
-0
mfplat.spec
dlls/mfplat/mfplat.spec
+1
-0
mfplat.c
dlls/mfplat/tests/mfplat.c
+73
-0
mfapi.h
include/mfapi.h
+2
-0
No files found.
dlls/mfplat/mediatype.c
View file @
af37f3b0
...
@@ -3211,3 +3211,101 @@ HRESULT WINAPI MFFrameRateToAverageTimePerFrame(UINT32 numerator, UINT32 denomin
...
@@ -3211,3 +3211,101 @@ HRESULT WINAPI MFFrameRateToAverageTimePerFrame(UINT32 numerator, UINT32 denomin
return
S_OK
;
return
S_OK
;
}
}
/***********************************************************************
* MFMapDXGIFormatToDX9Format (mfplat.@)
*/
DWORD
WINAPI
MFMapDXGIFormatToDX9Format
(
DXGI_FORMAT
dxgi_format
)
{
switch
(
dxgi_format
)
{
case
DXGI_FORMAT_R32G32B32A32_FLOAT
:
return
D3DFMT_A32B32G32R32F
;
case
DXGI_FORMAT_R16G16B16A16_FLOAT
:
return
D3DFMT_A16B16G16R16F
;
case
DXGI_FORMAT_R16G16B16A16_UNORM
:
return
D3DFMT_A16B16G16R16
;
case
DXGI_FORMAT_R16G16B16A16_SNORM
:
return
D3DFMT_Q16W16V16U16
;
case
DXGI_FORMAT_R32G32_FLOAT
:
return
D3DFMT_G32R32F
;
case
DXGI_FORMAT_R10G10B10A2_UNORM
:
return
D3DFMT_A2B10G10R10
;
case
DXGI_FORMAT_R8G8B8A8_SNORM
:
return
D3DFMT_Q8W8V8U8
;
case
DXGI_FORMAT_R16G16_FLOAT
:
return
D3DFMT_G16R16F
;
case
DXGI_FORMAT_R16G16_UNORM
:
return
D3DFMT_G16R16
;
case
DXGI_FORMAT_R16G16_SNORM
:
return
D3DFMT_V16U16
;
case
DXGI_FORMAT_D32_FLOAT
:
return
D3DFMT_D32F_LOCKABLE
;
case
DXGI_FORMAT_R32_FLOAT
:
return
D3DFMT_R32F
;
case
DXGI_FORMAT_D24_UNORM_S8_UINT
:
return
D3DFMT_D24S8
;
case
DXGI_FORMAT_R8G8_SNORM
:
return
D3DFMT_V8U8
;
case
DXGI_FORMAT_R16_FLOAT
:
return
D3DFMT_R16F
;
case
DXGI_FORMAT_D16_UNORM
:
return
D3DFMT_D16_LOCKABLE
;
case
DXGI_FORMAT_R16_UNORM
:
return
D3DFMT_L16
;
case
DXGI_FORMAT_R8_UNORM
:
return
D3DFMT_L8
;
case
DXGI_FORMAT_A8_UNORM
:
return
D3DFMT_A8
;
case
DXGI_FORMAT_BC1_UNORM
:
case
DXGI_FORMAT_BC1_UNORM_SRGB
:
return
D3DFMT_DXT1
;
case
DXGI_FORMAT_BC2_UNORM
:
case
DXGI_FORMAT_BC2_UNORM_SRGB
:
return
D3DFMT_DXT2
;
case
DXGI_FORMAT_BC3_UNORM
:
case
DXGI_FORMAT_BC3_UNORM_SRGB
:
return
D3DFMT_DXT4
;
case
DXGI_FORMAT_R8G8B8A8_UNORM
:
return
D3DFMT_A8B8G8R8
;
case
DXGI_FORMAT_B8G8R8A8_UNORM
:
case
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
:
case
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
:
return
D3DFMT_A8R8G8B8
;
case
DXGI_FORMAT_B8G8R8X8_UNORM
:
case
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB
:
return
D3DFMT_X8R8G8B8
;
case
DXGI_FORMAT_AYUV
:
return
MAKEFOURCC
(
'A'
,
'Y'
,
'U'
,
'V'
);
case
DXGI_FORMAT_Y410
:
return
MAKEFOURCC
(
'Y'
,
'4'
,
'1'
,
'0'
);
case
DXGI_FORMAT_Y416
:
return
MAKEFOURCC
(
'Y'
,
'4'
,
'1'
,
'6'
);
case
DXGI_FORMAT_NV12
:
return
MAKEFOURCC
(
'N'
,
'V'
,
'1'
,
'2'
);
case
DXGI_FORMAT_P010
:
return
MAKEFOURCC
(
'P'
,
'0'
,
'1'
,
'0'
);
case
DXGI_FORMAT_P016
:
return
MAKEFOURCC
(
'P'
,
'0'
,
'1'
,
'6'
);
case
DXGI_FORMAT_420_OPAQUE
:
return
MAKEFOURCC
(
'4'
,
'2'
,
'0'
,
'O'
);
case
DXGI_FORMAT_YUY2
:
return
D3DFMT_YUY2
;
case
DXGI_FORMAT_Y210
:
return
MAKEFOURCC
(
'Y'
,
'2'
,
'1'
,
'0'
);
case
DXGI_FORMAT_Y216
:
return
MAKEFOURCC
(
'Y'
,
'2'
,
'1'
,
'6'
);
case
DXGI_FORMAT_NV11
:
return
MAKEFOURCC
(
'N'
,
'V'
,
'1'
,
'1'
);
case
DXGI_FORMAT_AI44
:
return
MAKEFOURCC
(
'A'
,
'I'
,
'4'
,
'4'
);
case
DXGI_FORMAT_IA44
:
return
MAKEFOURCC
(
'I'
,
'A'
,
'4'
,
'4'
);
case
DXGI_FORMAT_P8
:
return
D3DFMT_P8
;
case
DXGI_FORMAT_A8P8
:
return
D3DFMT_A8P8
;
default:
return
0
;
}
}
dlls/mfplat/mfplat.spec
View file @
af37f3b0
...
@@ -131,6 +131,7 @@
...
@@ -131,6 +131,7 @@
@ stdcall MFJoinWorkQueue(long long ptr) rtworkq.RtwqJoinWorkQueue
@ stdcall MFJoinWorkQueue(long long ptr) rtworkq.RtwqJoinWorkQueue
@ stdcall MFLockPlatform() rtworkq.RtwqLockPlatform
@ stdcall MFLockPlatform() rtworkq.RtwqLockPlatform
@ stdcall MFLockWorkQueue(long) rtworkq.RtwqLockWorkQueue
@ stdcall MFLockWorkQueue(long) rtworkq.RtwqLockWorkQueue
@ stdcall MFMapDXGIFormatToDX9Format(long)
@ stdcall MFPutWaitingWorkItem(long long ptr ptr) rtworkq.RtwqPutWaitingWorkItem
@ stdcall MFPutWaitingWorkItem(long long ptr ptr) rtworkq.RtwqPutWaitingWorkItem
@ stdcall MFPutWorkItem(long ptr ptr)
@ stdcall MFPutWorkItem(long ptr ptr)
@ stdcall MFPutWorkItem2(long long ptr ptr)
@ stdcall MFPutWorkItem2(long long ptr ptr)
...
...
dlls/mfplat/tests/mfplat.c
View file @
af37f3b0
...
@@ -108,6 +108,7 @@ static HRESULT (WINAPI *pMFCreateMediaBufferFromMediaType)(IMFMediaType *media_t
...
@@ -108,6 +108,7 @@ static HRESULT (WINAPI *pMFCreateMediaBufferFromMediaType)(IMFMediaType *media_t
DWORD
min_alignment
,
IMFMediaBuffer
**
buffer
);
DWORD
min_alignment
,
IMFMediaBuffer
**
buffer
);
static
HRESULT
(
WINAPI
*
pMFCreateDXSurfaceBuffer
)(
REFIID
riid
,
IUnknown
*
surface
,
BOOL
bottom_up
,
IMFMediaBuffer
**
buffer
);
static
HRESULT
(
WINAPI
*
pMFCreateDXSurfaceBuffer
)(
REFIID
riid
,
IUnknown
*
surface
,
BOOL
bottom_up
,
IMFMediaBuffer
**
buffer
);
static
HRESULT
(
WINAPI
*
pMFCreateTrackedSample
)(
IMFTrackedSample
**
sample
);
static
HRESULT
(
WINAPI
*
pMFCreateTrackedSample
)(
IMFTrackedSample
**
sample
);
static
DWORD
(
WINAPI
*
pMFMapDXGIFormatToDX9Format
)(
DXGI_FORMAT
dxgi_format
);
static
HWND
create_window
(
void
)
static
HWND
create_window
(
void
)
{
{
...
@@ -742,6 +743,7 @@ static void init_functions(void)
...
@@ -742,6 +743,7 @@ static void init_functions(void)
X
(
MFCreateTransformActivate
);
X
(
MFCreateTransformActivate
);
X
(
MFGetPlaneSize
);
X
(
MFGetPlaneSize
);
X
(
MFGetStrideForBitmapInfoHeader
);
X
(
MFGetStrideForBitmapInfoHeader
);
X
(
MFMapDXGIFormatToDX9Format
);
X
(
MFPutWaitingWorkItem
);
X
(
MFPutWaitingWorkItem
);
X
(
MFRegisterLocalByteStreamHandler
);
X
(
MFRegisterLocalByteStreamHandler
);
X
(
MFRegisterLocalSchemeHandler
);
X
(
MFRegisterLocalSchemeHandler
);
...
@@ -5911,6 +5913,76 @@ static void test_MFFrameRateToAverageTimePerFrame(void)
...
@@ -5911,6 +5913,76 @@ static void test_MFFrameRateToAverageTimePerFrame(void)
}
}
}
}
static
void
test_MFMapDXGIFormatToDX9Format
(
void
)
{
static
const
struct
format_pair
{
DXGI_FORMAT
dxgi_format
;
DWORD
d3d9_format
;
}
formats_map
[]
=
{
{
DXGI_FORMAT_R32G32B32A32_FLOAT
,
D3DFMT_A32B32G32R32F
},
{
DXGI_FORMAT_R16G16B16A16_FLOAT
,
D3DFMT_A16B16G16R16F
},
{
DXGI_FORMAT_R16G16B16A16_UNORM
,
D3DFMT_A16B16G16R16
},
{
DXGI_FORMAT_R16G16B16A16_SNORM
,
D3DFMT_Q16W16V16U16
},
{
DXGI_FORMAT_R32G32_FLOAT
,
D3DFMT_G32R32F
},
{
DXGI_FORMAT_R10G10B10A2_UNORM
,
D3DFMT_A2B10G10R10
},
{
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
,
D3DFMT_A8R8G8B8
},
{
DXGI_FORMAT_R8G8B8A8_SNORM
,
D3DFMT_Q8W8V8U8
},
{
DXGI_FORMAT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'
)
},
{
DXGI_FORMAT_NV12
,
MAKEFOURCC
(
'N'
,
'V'
,
'1'
,
'2'
)
},
{
DXGI_FORMAT_P010
,
MAKEFOURCC
(
'P'
,
'0'
,
'1'
,
'0'
)
},
{
DXGI_FORMAT_P016
,
MAKEFOURCC
(
'P'
,
'0'
,
'1'
,
'6'
)
},
{
DXGI_FORMAT_420_OPAQUE
,
MAKEFOURCC
(
'4'
,
'2'
,
'0'
,
'O'
)
},
{
DXGI_FORMAT_YUY2
,
D3DFMT_YUY2
},
{
DXGI_FORMAT_Y210
,
MAKEFOURCC
(
'Y'
,
'2'
,
'1'
,
'0'
)
},
{
DXGI_FORMAT_Y216
,
MAKEFOURCC
(
'Y'
,
'2'
,
'1'
,
'6'
)
},
{
DXGI_FORMAT_NV11
,
MAKEFOURCC
(
'N'
,
'V'
,
'1'
,
'1'
)
},
{
DXGI_FORMAT_AI44
,
MAKEFOURCC
(
'A'
,
'I'
,
'4'
,
'4'
)
},
{
DXGI_FORMAT_IA44
,
MAKEFOURCC
(
'I'
,
'A'
,
'4'
,
'4'
)
},
{
DXGI_FORMAT_P8
,
D3DFMT_P8
},
{
DXGI_FORMAT_A8P8
,
D3DFMT_A8P8
},
};
unsigned
int
i
;
DWORD
format
;
if
(
!
pMFMapDXGIFormatToDX9Format
)
{
win_skip
(
"MFMapDXGIFormatToDX9Format is not available.
\n
"
);
return
;
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
formats_map
);
++
i
)
{
format
=
pMFMapDXGIFormatToDX9Format
(
formats_map
[
i
].
dxgi_format
);
ok
(
format
==
formats_map
[
i
].
d3d9_format
,
"Unexpected d3d9 format %#x, dxgi format %#x.
\n
"
,
format
,
formats_map
[
i
].
dxgi_format
);
}
}
START_TEST
(
mfplat
)
START_TEST
(
mfplat
)
{
{
char
**
argv
;
char
**
argv
;
...
@@ -5970,6 +6042,7 @@ START_TEST(mfplat)
...
@@ -5970,6 +6042,7 @@ START_TEST(mfplat)
test_MFCreateDXSurfaceBuffer
();
test_MFCreateDXSurfaceBuffer
();
test_MFCreateTrackedSample
();
test_MFCreateTrackedSample
();
test_MFFrameRateToAverageTimePerFrame
();
test_MFFrameRateToAverageTimePerFrame
();
test_MFMapDXGIFormatToDX9Format
();
CoUninitialize
();
CoUninitialize
();
}
}
include/mfapi.h
View file @
af37f3b0
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include <mfobjects.h>
#include <mfobjects.h>
#include <mmreg.h>
#include <mmreg.h>
#include <avrt.h>
#include <avrt.h>
#include <dxgiformat.h>
#if defined(__cplusplus)
#if defined(__cplusplus)
extern
"C"
{
extern
"C"
{
...
@@ -549,6 +550,7 @@ HRESULT WINAPI MFInitAttributesFromBlob(IMFAttributes *attributes, const UINT8 *
...
@@ -549,6 +550,7 @@ HRESULT WINAPI MFInitAttributesFromBlob(IMFAttributes *attributes, const UINT8 *
HRESULT
WINAPI
MFInitMediaTypeFromWaveFormatEx
(
IMFMediaType
*
mediatype
,
const
WAVEFORMATEX
*
format
,
UINT32
size
);
HRESULT
WINAPI
MFInitMediaTypeFromWaveFormatEx
(
IMFMediaType
*
mediatype
,
const
WAVEFORMATEX
*
format
,
UINT32
size
);
HRESULT
WINAPI
MFInvokeCallback
(
IMFAsyncResult
*
result
);
HRESULT
WINAPI
MFInvokeCallback
(
IMFAsyncResult
*
result
);
HRESULT
WINAPI
MFLockPlatform
(
void
);
HRESULT
WINAPI
MFLockPlatform
(
void
);
DWORD
WINAPI
MFMapDXGIFormatToDX9Format
(
DXGI_FORMAT
dxgi_format
);
HRESULT
WINAPI
MFPutWaitingWorkItem
(
HANDLE
event
,
LONG
priority
,
IMFAsyncResult
*
result
,
MFWORKITEM_KEY
*
key
);
HRESULT
WINAPI
MFPutWaitingWorkItem
(
HANDLE
event
,
LONG
priority
,
IMFAsyncResult
*
result
,
MFWORKITEM_KEY
*
key
);
HRESULT
WINAPI
MFPutWorkItem
(
DWORD
queue
,
IMFAsyncCallback
*
callback
,
IUnknown
*
state
);
HRESULT
WINAPI
MFPutWorkItem
(
DWORD
queue
,
IMFAsyncCallback
*
callback
,
IUnknown
*
state
);
HRESULT
WINAPI
MFPutWorkItem2
(
DWORD
queue
,
LONG
priority
,
IMFAsyncCallback
*
callback
,
IUnknown
*
state
);
HRESULT
WINAPI
MFPutWorkItem2
(
DWORD
queue
,
LONG
priority
,
IMFAsyncCallback
*
callback
,
IUnknown
*
state
);
...
...
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