Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/dxva2/dxvahd.c | 286 +++++++++++++++++++++++++++++++++++++- dlls/dxva2/tests/dxvahd.c | 83 +++++++++++ include/dxvahd.idl | 246 ++++++++++++++++++++++++++++++++ 3 files changed, 612 insertions(+), 3 deletions(-)
diff --git a/dlls/dxva2/dxvahd.c b/dlls/dxva2/dxvahd.c index 2feb7eb323..5bb0afe94b 100644 --- a/dlls/dxva2/dxvahd.c +++ b/dlls/dxva2/dxvahd.c @@ -65,6 +65,33 @@ struct dxvahd_device IDirect3DDevice9Ex *d3d_device; };
+struct dxvahd_vp_blt_state +{ + BOOL target_rect_enable; + RECT target_rect; + BOOL bgcolor_ycbcr; + DXVAHD_COLOR bgcolor; +}; + +struct dxvahd_vp_stream_state +{ + D3DFORMAT format; + DXVAHD_FRAME_FORMAT frame_format; + BOOL src_rect_enable; + RECT src_rect; + BOOL dst_rect_enable; + RECT dst_rect; +}; + +struct dxvahd_vp +{ + IDXVAHD_VideoProcessor IDXVAHD_VideoProcessor_iface; + LONG refcount; + GUID guid; + struct dxvahd_vp_blt_state blt; + struct dxvahd_vp_stream_state streams[MAX_STREAM_STATES]; +}; +
/******************************************** * Utility functions @@ -75,6 +102,59 @@ static struct dxvahd_device *impl_from_IDXVAHD_Device(IDXVAHD_Device *iface) return CONTAINING_RECORD(iface, struct dxvahd_device, IDXVAHD_Device_iface); }
+static struct dxvahd_vp *impl_from_IDXVAHD_VideoProcessor(IDXVAHD_VideoProcessor *iface) +{ + return CONTAINING_RECORD(iface, struct dxvahd_vp, IDXVAHD_VideoProcessor_iface); +} + +static const char *debug_dxvahd_bltstate(DXVAHD_BLT_STATE blt_state) +{ + switch (blt_state) + { +#define STATE_TO_STR(e) case e: return #e + STATE_TO_STR(DXVAHD_BLT_STATE_TARGET_RECT); + STATE_TO_STR(DXVAHD_BLT_STATE_BACKGROUND_COLOR); + STATE_TO_STR(DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE); + STATE_TO_STR(DXVAHD_BLT_STATE_ALPHA_FILL); + STATE_TO_STR(DXVAHD_BLT_STATE_CONSTRICTION); + STATE_TO_STR(DXVAHD_BLT_STATE_PRIVATE); +#undef STATE_TO_STR + default: + FIXME("Unrecognized blt state %#x.\n", blt_state); + return "unrecognized"; + } +} + +static const char *debug_dxvahd_streamstate(DXVAHD_STREAM_STATE stream_state) +{ + switch (stream_state) + { +#define STATE_TO_STR(e) case e: return #e + STATE_TO_STR(DXVAHD_STREAM_STATE_D3DFORMAT); + STATE_TO_STR(DXVAHD_STREAM_STATE_FRAME_FORMAT); + STATE_TO_STR(DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE); + STATE_TO_STR(DXVAHD_STREAM_STATE_OUTPUT_RATE); + STATE_TO_STR(DXVAHD_STREAM_STATE_SOURCE_RECT); + STATE_TO_STR(DXVAHD_STREAM_STATE_DESTINATION_RECT); + STATE_TO_STR(DXVAHD_STREAM_STATE_ALPHA); + STATE_TO_STR(DXVAHD_STREAM_STATE_PALETTE); + STATE_TO_STR(DXVAHD_STREAM_STATE_LUMA_KEY); + STATE_TO_STR(DXVAHD_STREAM_STATE_ASPECT_RATIO); + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_BRIGHTNESS); + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_CONTRAST); + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_HUE); + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_SATURATION); + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_NOISE_REDUCTION); + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_EDGE_ENHANCEMENT); + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_ANAMORPHIC_SCALING); + STATE_TO_STR(DXVAHD_STREAM_STATE_PRIVATE); +#undef STATE_TO_STR + default: + FIXME("Unrecognized stream state %#x.\n", stream_state); + return "unrecognized"; + } +} + static const char *debug_dxvahd_surface_type(DXVAHD_SURFACE_TYPE surface_type) { switch (surface_type) @@ -125,6 +205,193 @@ static const char *debug_dxvahd_device_usage(DXVAHD_DEVICE_USAGE usage) }
+/******************************************** + * IDXVAHD_VideoProcessor functions + */ + +static HRESULT WINAPI dxvahd_vp_QueryInterface(IDXVAHD_VideoProcessor *iface, REFIID riid, void **obj) +{ + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj); + + WARN("Unsupported interface %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI dxvahd_vp_AddRef(IDXVAHD_VideoProcessor *iface) +{ + struct dxvahd_vp *processor = impl_from_IDXVAHD_VideoProcessor(iface); + ULONG refcount = InterlockedIncrement(&processor->refcount); + + TRACE("%p, refcount %u.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI dxvahd_vp_Release(IDXVAHD_VideoProcessor *iface) +{ + struct dxvahd_vp *processor = impl_from_IDXVAHD_VideoProcessor(iface); + ULONG refcount = InterlockedDecrement(&processor->refcount); + + TRACE("%p, refcount %u.\n", iface, refcount); + + if (!refcount) + { + heap_free(processor); + } + + return refcount; +} + +static HRESULT WINAPI dxvahd_vp_SetVideoProcessBltState(IDXVAHD_VideoProcessor *iface, + DXVAHD_BLT_STATE State, UINT DataSize, const void *pData) +{ + struct dxvahd_vp *processor = impl_from_IDXVAHD_VideoProcessor(iface); + + TRACE("%p, %s, %u, %p.\n", iface, debug_dxvahd_bltstate(State), DataSize, pData); + + switch (State) + { + case DXVAHD_BLT_STATE_TARGET_RECT: + { + DXVAHD_BLT_STATE_TARGET_RECT_DATA *rect = (DXVAHD_BLT_STATE_TARGET_RECT_DATA *)pData; + TRACE("%s TargetRect (%d,%d)-(%d,%d)\n", rect->Enable ? "Enable" : "Disable", + rect->TargetRect.left, rect->TargetRect.top, + rect->TargetRect.right, rect->TargetRect.bottom); + processor->blt.target_rect_enable = rect->Enable; + memcpy(&processor->blt.target_rect, &rect->TargetRect, sizeof(RECT)); + break; + } + case DXVAHD_BLT_STATE_BACKGROUND_COLOR: + { + DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA *bgcolor = (DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA *)pData; + TRACE("%s BackgroundColor (%f %f %f %f)\n", bgcolor->YCbCr ? "YCbCr" : "RGB", + bgcolor->BackgroundColor.RGB.R, bgcolor->BackgroundColor.RGB.G, + bgcolor->BackgroundColor.RGB.B, bgcolor->BackgroundColor.RGB.A); + processor->blt.bgcolor_ycbcr = bgcolor->YCbCr; + memcpy(&processor->blt.bgcolor, &bgcolor->BackgroundColor, sizeof(DXVAHD_COLOR)); + break; + } + default: + FIXME("%s state not implemented.\n", debug_dxvahd_bltstate(State)); + return E_NOTIMPL; + } + + return S_OK; +} + +static HRESULT WINAPI dxvahd_vp_GetVideoProcessBltState(IDXVAHD_VideoProcessor *iface, + DXVAHD_BLT_STATE State, UINT DataSize, void *pData) +{ + TRACE("%p, %s, %u, %p.\n", iface, debug_dxvahd_bltstate(State), DataSize, pData); + + switch (State) + { + default: + FIXME("%s state not implemented.\n", debug_dxvahd_bltstate(State)); + return E_NOTIMPL; + } + + return S_OK; +} + +static HRESULT WINAPI dxvahd_vp_SetVideoProcessStreamState(IDXVAHD_VideoProcessor *iface, + UINT StreamNumber, DXVAHD_STREAM_STATE State, UINT DataSize, const void *pData) +{ + struct dxvahd_vp *processor = impl_from_IDXVAHD_VideoProcessor(iface); + + TRACE("%p, %u, %s, %u, %p.\n", iface, StreamNumber, debug_dxvahd_streamstate(State), DataSize, pData); + + switch (State) + { + case DXVAHD_STREAM_STATE_D3DFORMAT: + { + DXVAHD_STREAM_STATE_D3DFORMAT_DATA *format = (DXVAHD_STREAM_STATE_D3DFORMAT_DATA *)pData; + TRACE("Format %08x\n", format->Format); + processor->streams[StreamNumber].format = format->Format; + break; + } + case DXVAHD_STREAM_STATE_FRAME_FORMAT: + { + DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA *frame_format = (DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA *)pData; + TRACE("FrameFormat %08x\n", frame_format->FrameFormat); + processor->streams[StreamNumber].frame_format = frame_format->FrameFormat; + break; + } + case DXVAHD_STREAM_STATE_SOURCE_RECT: + { + DXVAHD_STREAM_STATE_SOURCE_RECT_DATA *rect = (DXVAHD_STREAM_STATE_SOURCE_RECT_DATA *)pData; + TRACE("%s SourceRect (%d,%d)-(%d,%d)\n", rect->Enable ? "Enable" : "Disable", + rect->SourceRect.left, rect->SourceRect.top, + rect->SourceRect.right, rect->SourceRect.bottom); + processor->streams[StreamNumber].src_rect_enable = rect->Enable; + memcpy(&processor->streams[StreamNumber].src_rect, &rect->SourceRect, sizeof(RECT)); + break; + } + case DXVAHD_STREAM_STATE_DESTINATION_RECT: + { + DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA *rect = (DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA *)pData; + TRACE("%s DestinationRect (%d,%d)-(%d,%d)\n", rect->Enable ? "Enable" : "Disable", + rect->DestinationRect.left, rect->DestinationRect.top, + rect->DestinationRect.right, rect->DestinationRect.bottom); + processor->streams[StreamNumber].dst_rect_enable = rect->Enable; + memcpy(&processor->streams[StreamNumber].dst_rect, &rect->DestinationRect, sizeof(RECT)); + break; + } + default: + FIXME("%s state not implemented.\n", debug_dxvahd_streamstate(State)); + return E_NOTIMPL; + } + + return S_OK; +} + +static HRESULT WINAPI dxvahd_vp_GetVideoProcessStreamState(IDXVAHD_VideoProcessor *iface, + UINT StreamNumber, DXVAHD_STREAM_STATE State, UINT DataSize, void *pData) +{ + TRACE("%p, %u, %s, %u, %p.\n", iface, StreamNumber, debug_dxvahd_streamstate(State), DataSize, pData); + + switch (State) + { + default: + FIXME("%s state not implemented.\n", debug_dxvahd_streamstate(State)); + return E_NOTIMPL; + } + + return S_OK; +} + +static HRESULT WINAPI dxvahd_vp_VideoProcessBltHD(IDXVAHD_VideoProcessor *iface, + IDirect3DSurface9 *pOutputSurface, UINT OutputFrame, UINT StreamCount, + const DXVAHD_STREAM_DATA *pStreams) +{ + UINT i; + + FIXME("%p, %p, %u, %u, %p.\n", iface, pOutputSurface, OutputFrame, StreamCount, pStreams); + + for (i = 0; i < StreamCount; i++) + { + TRACE("stream[%d]: %d %u %u %u %u %p %p %p\n", i, pStreams[i].Enable, pStreams[i].OutputIndex, + pStreams[i].InputFrameOrField, pStreams[i].PastFrames, pStreams[i].FutureFrames, + pStreams[i].ppPastSurfaces, pStreams[i].pInputSurface, pStreams[i].ppFutureSurfaces); + } + + return S_OK; +} + +static const IDXVAHD_VideoProcessorVtbl dxvahd_vp_vtbl = +{ + dxvahd_vp_QueryInterface, + dxvahd_vp_AddRef, + dxvahd_vp_Release, + dxvahd_vp_SetVideoProcessBltState, + dxvahd_vp_GetVideoProcessBltState, + dxvahd_vp_SetVideoProcessStreamState, + dxvahd_vp_GetVideoProcessStreamState, + dxvahd_vp_VideoProcessBltHD, +}; + + /******************************************** * IDXVAHD_Device functions */ @@ -269,11 +536,24 @@ static HRESULT WINAPI dxvahd_device_GetVideoProcessorFilterRange(IDXVAHD_Device static HRESULT WINAPI dxvahd_device_CreateVideoProcessor(IDXVAHD_Device *iface, const GUID *pVPGuid, IDXVAHD_VideoProcessor **ppVideoProcessor) { - FIXME("%p, %s, %p. stub.\n", iface, debugstr_guid(pVPGuid), ppVideoProcessor); + struct dxvahd_vp *object;
- *ppVideoProcessor = NULL; + FIXME("%p, %s, %p.\n", iface, debugstr_guid(pVPGuid), ppVideoProcessor);
- return E_NOINTERFACE; + /* TODO: use driver function CreateVideoProcessor */ + + if (!(object = heap_alloc_zero(sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDXVAHD_VideoProcessor_iface.lpVtbl = &dxvahd_vp_vtbl; + object->refcount = 1; + memcpy(&object->guid, pVPGuid, sizeof(*pVPGuid)); + memset(&object->blt, 0, sizeof(object->blt)); + memset(&object->streams, 0, sizeof(object->streams)); + + *ppVideoProcessor = &object->IDXVAHD_VideoProcessor_iface; + + return S_OK; }
static const IDXVAHD_DeviceVtbl dxvahd_device_vtbl = diff --git a/dlls/dxva2/tests/dxvahd.c b/dlls/dxva2/tests/dxvahd.c index b99dc15796..e67350dfdb 100644 --- a/dlls/dxva2/tests/dxvahd.c +++ b/dlls/dxva2/tests/dxvahd.c @@ -168,6 +168,88 @@ static void test_dxvahd_device(void) IDXVAHD_Device_Release(device); }
+static void test_dxvahd_processor(void) +{ + IDXVAHD_Device *device; + DXVAHD_CONTENT_DESC desc = {0}; + DXVAHD_VPDEVCAPS caps = {0}; + D3DFORMAT *input_formats; + DXVAHD_VPCAPS *vp_caps; + IDXVAHD_VideoProcessor *processor; + void *data = heap_alloc_zero(64); + HRESULT hr; + int i; + + static struct { + DXVAHD_BLT_STATE state; + ULONG size; + } test_blt[] = { + {DXVAHD_BLT_STATE_TARGET_RECT, sizeof(DXVAHD_BLT_STATE_TARGET_RECT_DATA)}, + {DXVAHD_BLT_STATE_BACKGROUND_COLOR, sizeof(DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA)}, + {DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE, sizeof(DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA)}, + {DXVAHD_BLT_STATE_ALPHA_FILL, sizeof(DXVAHD_BLT_STATE_ALPHA_FILL_DATA)}, + {DXVAHD_BLT_STATE_CONSTRICTION, sizeof(DXVAHD_BLT_STATE_CONSTRICTION_DATA)}, + }; + + static struct { + DXVAHD_STREAM_STATE state; + ULONG size; + } test_stream[] = { + {DXVAHD_STREAM_STATE_D3DFORMAT, sizeof(DXVAHD_STREAM_STATE_D3DFORMAT_DATA)}, + {DXVAHD_STREAM_STATE_FRAME_FORMAT, sizeof(DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA)}, + {DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE, sizeof(DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA)}, + {DXVAHD_STREAM_STATE_OUTPUT_RATE, sizeof(DXVAHD_STREAM_STATE_OUTPUT_RATE_DATA)}, + {DXVAHD_STREAM_STATE_SOURCE_RECT, sizeof(DXVAHD_STREAM_STATE_SOURCE_RECT_DATA)}, + {DXVAHD_STREAM_STATE_DESTINATION_RECT, sizeof(DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA)}, + {DXVAHD_STREAM_STATE_ALPHA, sizeof(DXVAHD_STREAM_STATE_ALPHA_DATA)}, + {DXVAHD_STREAM_STATE_PALETTE, sizeof(DXVAHD_STREAM_STATE_PALETTE_DATA)}, + {DXVAHD_STREAM_STATE_LUMA_KEY, sizeof(DXVAHD_STREAM_STATE_LUMA_KEY_DATA)}, + {DXVAHD_STREAM_STATE_ASPECT_RATIO, sizeof(DXVAHD_STREAM_STATE_ASPECT_RATIO_DATA)}, + {DXVAHD_STREAM_STATE_FILTER_BRIGHTNESS, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)}, + {DXVAHD_STREAM_STATE_FILTER_CONTRAST, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)}, + {DXVAHD_STREAM_STATE_FILTER_HUE, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)}, + {DXVAHD_STREAM_STATE_FILTER_SATURATION, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)}, + {DXVAHD_STREAM_STATE_FILTER_NOISE_REDUCTION, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)}, + {DXVAHD_STREAM_STATE_FILTER_EDGE_ENHANCEMENT, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)}, + {DXVAHD_STREAM_STATE_FILTER_ANAMORPHIC_SCALING, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)}, + }; + + init_desc(&desc); + DXVAHD_CreateDevice(d3d_device, &desc, DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &device); + IDXVAHD_Device_GetVideoProcessorDeviceCaps(device, &caps); + input_formats = heap_alloc_zero(caps.InputFormatCount * sizeof(*input_formats)); + vp_caps = heap_alloc_zero(caps.VideoProcessorCount * sizeof(*vp_caps)); + IDXVAHD_Device_GetVideoProcessorCaps(device, caps.VideoProcessorCount, vp_caps); + + hr = IDXVAHD_Device_CreateVideoProcessor(device, &vp_caps[0].VPGuid, &processor); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + for (i = 0; i < ARRAY_SIZE(test_blt); i++) + { + hr = IDXVAHD_VideoProcessor_GetVideoProcessBltState(processor, test_blt[i].state, test_blt[i].size, data); + ok(hr == S_OK, "Unexpected hr %#x for blt state %#x.\n", hr, test_blt[i].state); + /* Pass wrong data size for state */ + hr = IDXVAHD_VideoProcessor_GetVideoProcessBltState(processor, test_blt[i].state, 64, data); + todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#x for blt state %#x.\n", hr, test_blt[i].state); + } + + for (i = 0; i < ARRAY_SIZE(test_stream); i++) + { + hr = IDXVAHD_VideoProcessor_GetVideoProcessStreamState(processor, 0, test_stream[i].state, test_stream[i].size, data); + ok(hr == S_OK, "Unexpected hr %#x for stream state %#x.\n", hr, test_stream[i].state); + /* Pass wrong data size for state */ + hr = IDXVAHD_VideoProcessor_GetVideoProcessStreamState(processor, 0, test_stream[i].state, 64, data); + todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#x for stream state %#x.\n", hr, test_stream[i].state); + } + + IDXVAHD_VideoProcessor_Release(processor); + + heap_free(data); + heap_free(input_formats); + heap_free(vp_caps); + IDXVAHD_Device_Release(device); +} + START_TEST(dxvahd) { IDXVAHD_Device *device = NULL; @@ -202,6 +284,7 @@ START_TEST(dxvahd) IDXVAHD_Device_Release(device);
test_dxvahd_device(); + test_dxvahd_processor();
done: IDirect3DDevice9_Release(d3d_device); diff --git a/include/dxvahd.idl b/include/dxvahd.idl index 76913c0547..e85d3c4cfc 100644 --- a/include/dxvahd.idl +++ b/include/dxvahd.idl @@ -24,6 +24,7 @@ interface IDirect3DSurface9;
typedef DWORD D3DFORMAT; typedef DWORD D3DPOOL; +typedef DWORD D3DCOLOR; cpp_quote("#endif")
@@ -59,6 +60,38 @@ typedef enum _DXVAHD_SURFACE_TYPE DXVAHD_SURFACE_TYPE_VIDEO_OUTPUT = 2 } DXVAHD_SURFACE_TYPE;
+typedef enum _DXVAHD_BLT_STATE +{ + DXVAHD_BLT_STATE_TARGET_RECT = 0, + DXVAHD_BLT_STATE_BACKGROUND_COLOR = 1, + DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE = 2, + DXVAHD_BLT_STATE_ALPHA_FILL = 3, + DXVAHD_BLT_STATE_CONSTRICTION = 4, + DXVAHD_BLT_STATE_PRIVATE = 1000 +} DXVAHD_BLT_STATE; + +typedef enum _DXVAHD_STREAM_STATE +{ + DXVAHD_STREAM_STATE_D3DFORMAT = 0, + DXVAHD_STREAM_STATE_FRAME_FORMAT = 1, + DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE = 2, + DXVAHD_STREAM_STATE_OUTPUT_RATE = 3, + DXVAHD_STREAM_STATE_SOURCE_RECT = 4, + DXVAHD_STREAM_STATE_DESTINATION_RECT = 5, + DXVAHD_STREAM_STATE_ALPHA = 6, + DXVAHD_STREAM_STATE_PALETTE = 7, + DXVAHD_STREAM_STATE_LUMA_KEY = 8, + DXVAHD_STREAM_STATE_ASPECT_RATIO = 9, + DXVAHD_STREAM_STATE_FILTER_BRIGHTNESS = 100, + DXVAHD_STREAM_STATE_FILTER_CONTRAST = 101, + DXVAHD_STREAM_STATE_FILTER_HUE = 102, + DXVAHD_STREAM_STATE_FILTER_SATURATION = 103, + DXVAHD_STREAM_STATE_FILTER_NOISE_REDUCTION = 104, + DXVAHD_STREAM_STATE_FILTER_EDGE_ENHANCEMENT = 105, + DXVAHD_STREAM_STATE_FILTER_ANAMORPHIC_SCALING = 106, + DXVAHD_STREAM_STATE_PRIVATE = 1000 +} DXVAHD_STREAM_STATE; + typedef enum _DXVAHD_DEVICE_TYPE { DXVAHD_DEVICE_TYPE_HARDWARE = 0, @@ -108,6 +141,21 @@ typedef enum _DXVAHD_INPUT_FORMAT_CAPS DXVAHD_INPUT_FORMAT_CAPS_PALETTE_INTERLACED = 0x08 } DXVAHD_INPUT_FORMAT_CAPS;
+typedef enum _DXVAHD_ALPHA_FILL_MODE +{ + DXVAHD_ALPHA_FILL_MODE_OPAQUE = 0, + DXVAHD_ALPHA_FILL_MODE_BACKGROUND = 1, + DXVAHD_ALPHA_FILL_MODE_DESTINATION = 2, + DXVAHD_ALPHA_FILL_MODE_SOURCE_STREAM = 3 +} DXVAHD_ALPHA_FILL_MODE; + +typedef enum _DXVAHD_OUTPUT_RATE +{ + DXVAHD_OUTPUT_RATE_NORMAL = 0, + DXVAHD_OUTPUT_RATE_HALF = 1, + DXVAHD_OUTPUT_RATE_CUSTOM = 2 +} DXVAHD_OUTPUT_RATE; +
typedef struct _DXVAHD_RATIONAL { @@ -167,12 +215,171 @@ typedef struct _DXVAHD_VPDEVCAPS UINT MaxStreamStates; } DXVAHD_VPDEVCAPS;
+typedef struct _DXVAHD_STREAM_DATA +{ + BOOL Enable; + UINT OutputIndex; + UINT InputFrameOrField; + UINT PastFrames; + UINT FutureFrames; + IDirect3DSurface9 **ppPastSurfaces; + IDirect3DSurface9 *pInputSurface; + IDirect3DSurface9 **ppFutureSurfaces; +} DXVAHD_STREAM_DATA; + +typedef struct _DXVAHD_BLT_STATE_TARGET_RECT_DATA +{ + BOOL Enable; + RECT TargetRect; +} DXVAHD_BLT_STATE_TARGET_RECT_DATA; + +typedef struct _DXVAHD_COLOR_RGBA +{ + FLOAT R; + FLOAT G; + FLOAT B; + FLOAT A; +} DXVAHD_COLOR_RGBA; + +typedef struct _DXVAHD_COLOR_YCbCrA +{ + FLOAT Y; + FLOAT Cb; + FLOAT Cr; + FLOAT A; +} DXVAHD_COLOR_YCbCrA; + +typedef union _DXVAHD_COLOR +{ + DXVAHD_COLOR_RGBA RGB; + DXVAHD_COLOR_YCbCrA YCbCr; +} DXVAHD_COLOR; + +typedef struct _DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA +{ + BOOL YCbCr; + DXVAHD_COLOR BackgroundColor; +} DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA; + +typedef struct _DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA +{ + union + { + struct + { + UINT Usage : 1; + UINT RGB_Range : 1; + UINT YCbCr_Matrix : 1; + UINT YCbCr_xvYCC : 1; + UINT Reserved : 28; + }; + UINT Value; + }; +} DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA; + +typedef struct _DXVAHD_BLT_STATE_ALPHA_FILL_DATA +{ + DXVAHD_ALPHA_FILL_MODE Mode; + UINT StreamNumber; +} DXVAHD_BLT_STATE_ALPHA_FILL_DATA; + +typedef struct _DXVAHD_BLT_STATE_CONSTRICTION_DATA +{ + BOOL Enable; + SIZE Size; +} DXVAHD_BLT_STATE_CONSTRICTION_DATA; + +typedef struct _DXVAHD_BLT_STATE_PRIVATE_DATA +{ + GUID Guid; + UINT DataSize; + void *pData; +} DXVAHD_BLT_STATE_PRIVATE_DATA; + +typedef struct _DXVAHD_STREAM_STATE_D3DFORMAT_DATA +{ + D3DFORMAT Format; +} DXVAHD_STREAM_STATE_D3DFORMAT_DATA; + +typedef struct _DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA +{ + DXVAHD_FRAME_FORMAT FrameFormat; +} DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA; + +typedef struct _DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA +{ + union + { + struct + { + UINT Type : 1; + UINT RGB_Range : 1; + UINT YCbCr_Matrix : 1; + UINT YCbCr_xvYCC : 1; + UINT Reserved : 28; + }; + UINT Value; + }; +} DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA; + +typedef struct _DXVAHD_STREAM_STATE_OUTPUT_RATE_DATA +{ + BOOL RepeatFrame; + DXVAHD_OUTPUT_RATE OutputRate; + DXVAHD_RATIONAL CustomRate; +} DXVAHD_STREAM_STATE_OUTPUT_RATE_DATA; + +typedef struct _DXVAHD_STREAM_STATE_SOURCE_RECT_DATA +{ + BOOL Enable; + RECT SourceRect; +} DXVAHD_STREAM_STATE_SOURCE_RECT_DATA; + +typedef struct _DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA +{ + BOOL Enable; + RECT DestinationRect; +} DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA; + +typedef struct _DXVAHD_STREAM_STATE_ALPHA_DATA +{ + BOOL Enable; + FLOAT Alpha; +} DXVAHD_STREAM_STATE_ALPHA_DATA; + +typedef struct _DXVAHD_STREAM_STATE_PALETTE_DATA +{ + UINT Count; + D3DCOLOR *pEntries; +} DXVAHD_STREAM_STATE_PALETTE_DATA; + +typedef struct _DXVAHD_STREAM_STATE_LUMA_KEY_DATA +{ + BOOL Enable; + FLOAT Lower; + FLOAT Upper; +} DXVAHD_STREAM_STATE_LUMA_KEY_DATA; + +typedef struct _DXVAHD_STREAM_STATE_ASPECT_RATIO_DATA +{ + BOOL Enable; + DXVAHD_RATIONAL SourceAspectRatio; + DXVAHD_RATIONAL DestinationAspectRatio; +} DXVAHD_STREAM_STATE_ASPECT_RATIO_DATA; + +typedef struct _DXVAHD_STREAM_STATE_FILTER_DATA +{ + BOOL Enable; + INT Level; +} DXVAHD_STREAM_STATE_FILTER_DATA; +
/* FIXME */ typedef void* PDXVAHDSW_Plugin;
interface IDXVAHD_Device; +interface IDXVAHD_VideoProcessor;
cpp_quote("HRESULT WINAPI DXVAHD_CreateDevice(IDirect3DDevice9Ex *d3d_device, const DXVAHD_CONTENT_DESC *desc, DXVAHD_DEVICE_USAGE usage, PDXVAHDSW_Plugin plugin, IDXVAHD_Device **device);")
@@ -225,3 +432,42 @@ interface IDXVAHD_Device : IUnknown [in] const GUID *pVPGuid, [out] IDXVAHD_VideoProcessor **ppVideoProcessor); } + +/***************************************************************************** + * IDXVAHD_VideoProcessor interface + */ +[ + object, + uuid(95f4edf4-6e03-4cd7-be1b-3075d665aa52), + local +] +interface IDXVAHD_VideoProcessor : IUnknown +{ + HRESULT SetVideoProcessBltState( + [in] DXVAHD_BLT_STATE State, + [in] UINT DataSize, + [in] const void *pData); + + HRESULT GetVideoProcessBltState( + [in] DXVAHD_BLT_STATE State, + [in] UINT DataSize, + [out] void *pData); + + HRESULT SetVideoProcessStreamState( + [in] UINT StreamNumber, + [in] DXVAHD_STREAM_STATE State, + [in] UINT DataSize, + [in] const void *pData); + + HRESULT GetVideoProcessStreamState( + [in] UINT StreamNumber, + [in] DXVAHD_STREAM_STATE State, + [in] UINT DataSize, + [out] void *pData); + + HRESULT VideoProcessBltHD( + [in, out] IDirect3DSurface9 *pOutputSurface, + [in] UINT OutputFrame, + [in] UINT StreamCount, + [in] const DXVAHD_STREAM_DATA *pStreams); +}