include: Use nameless unions in dxva2api.idl helpers.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50836
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-03-22 18:31:39 +01:00 committed by Alexandre Julliard
parent b39b9eea39
commit ee587da9e5
6 changed files with 49 additions and 52 deletions

View File

@ -1,7 +1,6 @@
MODULE = mfplat.dll
IMPORTLIB = mfplat
IMPORTS = advapi32 ole32 mfuuid propsys rtworkq
EXTRADEFS = -DWINE_NO_NAMELESS_EXTENSION
EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native

View File

@ -2216,7 +2216,7 @@ static HRESULT attributes_get_item(struct attributes *attributes, const GUID *ke
attribute = attributes_find_item(attributes, key, NULL);
if (attribute)
{
if (attribute->value.vt == value->vt && !(value->vt == VT_UNKNOWN && !attribute->value.u.punkVal))
if (attribute->value.vt == value->vt && !(value->vt == VT_UNKNOWN && !attribute->value.punkVal))
hr = PropVariantCopy(value, &attribute->value);
else
hr = MF_E_INVALIDTYPE;
@ -2372,7 +2372,7 @@ HRESULT attributes_GetUINT32(struct attributes *attributes, REFGUID key, UINT32
attrval.vt = VT_UI4;
hr = attributes_get_item(attributes, key, &attrval);
if (SUCCEEDED(hr))
*value = attrval.u.ulVal;
*value = attrval.ulVal;
return hr;
}
@ -2386,7 +2386,7 @@ HRESULT attributes_GetUINT64(struct attributes *attributes, REFGUID key, UINT64
attrval.vt = VT_UI8;
hr = attributes_get_item(attributes, key, &attrval);
if (SUCCEEDED(hr))
*value = attrval.u.uhVal.QuadPart;
*value = attrval.uhVal.QuadPart;
return hr;
}
@ -2400,7 +2400,7 @@ HRESULT attributes_GetDouble(struct attributes *attributes, REFGUID key, double
attrval.vt = VT_R8;
hr = attributes_get_item(attributes, key, &attrval);
if (SUCCEEDED(hr))
*value = attrval.u.dblVal;
*value = attrval.dblVal;
return hr;
}
@ -2416,7 +2416,7 @@ HRESULT attributes_GetGUID(struct attributes *attributes, REFGUID key, GUID *val
if (attribute)
{
if (attribute->value.vt == MF_ATTRIBUTE_GUID)
*value = *attribute->value.u.puuid;
*value = *attribute->value.puuid;
else
hr = MF_E_INVALIDTYPE;
}
@ -2439,7 +2439,7 @@ HRESULT attributes_GetStringLength(struct attributes *attributes, REFGUID key, U
if (attribute)
{
if (attribute->value.vt == MF_ATTRIBUTE_STRING)
*length = lstrlenW(attribute->value.u.pwszVal);
*length = lstrlenW(attribute->value.pwszVal);
else
hr = MF_E_INVALIDTYPE;
}
@ -2464,7 +2464,7 @@ HRESULT attributes_GetString(struct attributes *attributes, REFGUID key, WCHAR *
{
if (attribute->value.vt == MF_ATTRIBUTE_STRING)
{
int len = lstrlenW(attribute->value.u.pwszVal);
int len = lstrlenW(attribute->value.pwszVal);
if (length)
*length = len;
@ -2472,7 +2472,7 @@ HRESULT attributes_GetString(struct attributes *attributes, REFGUID key, WCHAR *
if (size <= len)
hr = STRSAFE_E_INSUFFICIENT_BUFFER;
else
memcpy(value, attribute->value.u.pwszVal, (len + 1) * sizeof(WCHAR));
memcpy(value, attribute->value.pwszVal, (len + 1) * sizeof(WCHAR));
}
else
hr = MF_E_INVALIDTYPE;
@ -2495,7 +2495,7 @@ HRESULT attributes_GetAllocatedString(struct attributes *attributes, REFGUID key
hr = attributes_get_item(attributes, key, &attrval);
if (SUCCEEDED(hr))
{
*value = attrval.u.pwszVal;
*value = attrval.pwszVal;
*length = lstrlenW(*value);
}
@ -2513,7 +2513,7 @@ HRESULT attributes_GetBlobSize(struct attributes *attributes, REFGUID key, UINT3
if (attribute)
{
if (attribute->value.vt == MF_ATTRIBUTE_BLOB)
*size = attribute->value.u.caub.cElems;
*size = attribute->value.caub.cElems;
else
hr = MF_E_INVALIDTYPE;
}
@ -2537,7 +2537,7 @@ HRESULT attributes_GetBlob(struct attributes *attributes, REFGUID key, UINT8 *bu
{
if (attribute->value.vt == MF_ATTRIBUTE_BLOB)
{
UINT32 size = attribute->value.u.caub.cElems;
UINT32 size = attribute->value.caub.cElems;
if (bufsize >= size)
hr = PropVariantToBuffer(&attribute->value, buf, size);
@ -2567,8 +2567,8 @@ HRESULT attributes_GetAllocatedBlob(struct attributes *attributes, REFGUID key,
hr = attributes_get_item(attributes, key, &attrval);
if (SUCCEEDED(hr))
{
*buf = attrval.u.caub.pElems;
*size = attrval.u.caub.cElems;
*buf = attrval.caub.pElems;
*size = attrval.caub.cElems;
}
return hr;
@ -2583,7 +2583,7 @@ HRESULT attributes_GetUnknown(struct attributes *attributes, REFGUID key, REFIID
attrval.vt = VT_UNKNOWN;
hr = attributes_get_item(attributes, key, &attrval);
if (SUCCEEDED(hr))
hr = IUnknown_QueryInterface(attrval.u.punkVal, riid, out);
hr = IUnknown_QueryInterface(attrval.punkVal, riid, out);
PropVariantClear(&attrval);
return hr;
}
@ -2683,7 +2683,7 @@ HRESULT attributes_SetUINT32(struct attributes *attributes, REFGUID key, UINT32
PROPVARIANT attrval;
attrval.vt = VT_UI4;
attrval.u.ulVal = value;
attrval.ulVal = value;
return attributes_set_item(attributes, key, &attrval);
}
@ -2692,7 +2692,7 @@ HRESULT attributes_SetUINT64(struct attributes *attributes, REFGUID key, UINT64
PROPVARIANT attrval;
attrval.vt = VT_UI8;
attrval.u.uhVal.QuadPart = value;
attrval.uhVal.QuadPart = value;
return attributes_set_item(attributes, key, &attrval);
}
@ -2701,7 +2701,7 @@ HRESULT attributes_SetDouble(struct attributes *attributes, REFGUID key, double
PROPVARIANT attrval;
attrval.vt = VT_R8;
attrval.u.dblVal = value;
attrval.dblVal = value;
return attributes_set_item(attributes, key, &attrval);
}
@ -2710,7 +2710,7 @@ HRESULT attributes_SetGUID(struct attributes *attributes, REFGUID key, REFGUID v
PROPVARIANT attrval;
attrval.vt = VT_CLSID;
attrval.u.puuid = (CLSID *)value;
attrval.puuid = (CLSID *)value;
return attributes_set_item(attributes, key, &attrval);
}
@ -2719,7 +2719,7 @@ HRESULT attributes_SetString(struct attributes *attributes, REFGUID key, const W
PROPVARIANT attrval;
attrval.vt = VT_LPWSTR;
attrval.u.pwszVal = (WCHAR *)value;
attrval.pwszVal = (WCHAR *)value;
return attributes_set_item(attributes, key, &attrval);
}
@ -2728,8 +2728,8 @@ HRESULT attributes_SetBlob(struct attributes *attributes, REFGUID key, const UIN
PROPVARIANT attrval;
attrval.vt = VT_VECTOR | VT_UI1;
attrval.u.caub.cElems = size;
attrval.u.caub.pElems = (UINT8 *)buf;
attrval.caub.cElems = size;
attrval.caub.pElems = (UINT8 *)buf;
return attributes_set_item(attributes, key, &attrval);
}
@ -2738,7 +2738,7 @@ HRESULT attributes_SetUnknown(struct attributes *attributes, REFGUID key, IUnkno
PROPVARIANT attrval;
attrval.vt = VT_UNKNOWN;
attrval.u.punkVal = unknown;
attrval.punkVal = unknown;
return attributes_set_item(attributes, key, &attrval);
}
@ -3340,22 +3340,22 @@ HRESULT WINAPI MFGetAttributesAsBlob(IMFAttributes *attributes, UINT8 *buffer, U
{
case MF_ATTRIBUTE_UINT32:
case MF_ATTRIBUTE_UINT64:
item.u.i64 = value.u.uhVal.QuadPart;
item.u.i64 = value.uhVal.QuadPart;
break;
case MF_ATTRIBUTE_DOUBLE:
item.u.f = value.u.dblVal;
item.u.f = value.dblVal;
break;
case MF_ATTRIBUTE_GUID:
item.u.subheader.size = sizeof(*value.u.puuid);
data = value.u.puuid;
item.u.subheader.size = sizeof(*value.puuid);
data = value.puuid;
break;
case MF_ATTRIBUTE_STRING:
item.u.subheader.size = (lstrlenW(value.u.pwszVal) + 1) * sizeof(WCHAR);
data = value.u.pwszVal;
item.u.subheader.size = (lstrlenW(value.pwszVal) + 1) * sizeof(WCHAR);
data = value.pwszVal;
break;
case MF_ATTRIBUTE_BLOB:
item.u.subheader.size = value.u.caub.cElems;
data = value.u.caub.pElems;
item.u.subheader.size = value.caub.cElems;
data = value.caub.pElems;
break;
case MF_ATTRIBUTE_IUNKNOWN:
break;
@ -7236,7 +7236,7 @@ static HRESULT WINAPI eventqueue_QueueEventParamUnk(IMFMediaEventQueue *iface, M
TRACE("%p, %s, %s, %#x, %p.\n", iface, debugstr_eventid(event_type), debugstr_guid(extended_type), status, unk);
value.vt = VT_UNKNOWN;
value.u.punkVal = unk;
value.punkVal = unk;
if (FAILED(hr = MFCreateMediaEvent(event_type, extended_type, status, &value, &event)))
return hr;

View File

@ -129,19 +129,19 @@ static inline const char *debugstr_propvar(const PROPVARIANT *v)
case VT_NULL:
return wine_dbg_sprintf("%p {VT_NULL}", v);
case VT_UI4:
return wine_dbg_sprintf("%p {VT_UI4: %d}", v, v->u.ulVal);
return wine_dbg_sprintf("%p {VT_UI4: %d}", v, v->ulVal);
case VT_UI8:
return wine_dbg_sprintf("%p {VT_UI8: %s}", v, wine_dbgstr_longlong(v->u.uhVal.QuadPart));
return wine_dbg_sprintf("%p {VT_UI8: %s}", v, wine_dbgstr_longlong(v->uhVal.QuadPart));
case VT_R8:
return wine_dbg_sprintf("%p {VT_R8: %lf}", v, v->u.dblVal);
return wine_dbg_sprintf("%p {VT_R8: %lf}", v, v->dblVal);
case VT_CLSID:
return wine_dbg_sprintf("%p {VT_CLSID: %s}", v, debugstr_mf_guid(v->u.puuid));
return wine_dbg_sprintf("%p {VT_CLSID: %s}", v, debugstr_mf_guid(v->puuid));
case VT_LPWSTR:
return wine_dbg_sprintf("%p {VT_LPWSTR: %s}", v, wine_dbgstr_w(v->u.pwszVal));
return wine_dbg_sprintf("%p {VT_LPWSTR: %s}", v, wine_dbgstr_w(v->pwszVal));
case VT_VECTOR | VT_UI1:
return wine_dbg_sprintf("%p {VT_VECTOR|VT_UI1: %p}", v, v->u.caub.pElems);
return wine_dbg_sprintf("%p {VT_VECTOR|VT_UI1: %p}", v, v->caub.pElems);
case VT_UNKNOWN:
return wine_dbg_sprintf("%p {VT_UNKNOWN: %p}", v, v->u.punkVal);
return wine_dbg_sprintf("%p {VT_UNKNOWN: %p}", v, v->punkVal);
default:
return wine_dbg_sprintf("%p {vt %#x}", v, v->vt);
}

View File

@ -1,7 +1,6 @@
MODULE = mfreadwrite.dll
IMPORTLIB = mfreadwrite
IMPORTS = mfuuid uuid mfplat ole32
EXTRADEFS = -DWINE_NO_NAMELESS_EXTENSION
EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native

View File

@ -302,14 +302,14 @@ static HRESULT media_event_get_object(IMFMediaEvent *event, REFIID riid, void **
return hr;
}
if (value.vt != VT_UNKNOWN || !value.u.punkVal)
if (value.vt != VT_UNKNOWN || !value.punkVal)
{
WARN("Unexpected value type %d.\n", value.vt);
PropVariantClear(&value);
return E_UNEXPECTED;
}
hr = IUnknown_QueryInterface(value.u.punkVal, riid, obj);
hr = IUnknown_QueryInterface(value.punkVal, riid, obj);
PropVariantClear(&value);
if (FAILED(hr))
{
@ -841,7 +841,7 @@ static HRESULT source_reader_media_stream_state_handler(struct source_reader *re
case MEStreamTick:
value.vt = VT_EMPTY;
hr = SUCCEEDED(IMFMediaEvent_GetValue(event, &value)) && value.vt == VT_I8 ? S_OK : E_UNEXPECTED;
timestamp = SUCCEEDED(hr) ? value.u.hVal.QuadPart : 0;
timestamp = SUCCEEDED(hr) ? value.hVal.QuadPart : 0;
PropVariantClear(&value);
source_reader_queue_response(reader, stream, hr, MF_SOURCE_READERF_STREAMTICK, timestamp, NULL);
@ -1014,7 +1014,7 @@ static HRESULT source_reader_start_source(struct source_reader *reader)
}
}
position.u.hVal.QuadPart = 0;
position.hVal.QuadPart = 0;
if (reader->source_state != SOURCE_STATE_STARTED || selection_changed)
{
position.vt = reader->source_state == SOURCE_STATE_STARTED ? VT_EMPTY : VT_I8;
@ -2155,7 +2155,7 @@ static HRESULT WINAPI src_reader_GetPresentationAttribute(IMFSourceReader *iface
return hr;
value->vt = VT_UI4;
value->u.ulVal = flags;
value->ulVal = flags;
return S_OK;
}
else

View File

@ -805,24 +805,23 @@ cpp_quote("#endif")
cpp_quote("static inline DXVA2_Fixed32 DXVA2_Fixed32OpaqueAlpha(void) {")
cpp_quote(" DXVA2_Fixed32 f32;")
cpp_quote(" *(LONG *)&f32 = 0 + (1 << 16);")
cpp_quote(" f32.ll = 0 + (1 << 16);")
cpp_quote(" return f32;")
cpp_quote("}")
cpp_quote("")
cpp_quote("static inline DXVA2_Fixed32 DXVA2_Fixed32TransparentAlpha(void) {")
cpp_quote(" DXVA2_Fixed32 f32 = {{{ 0 }}};")
cpp_quote(" DXVA2_Fixed32 f32;")
cpp_quote(" f32.ll = 0;")
cpp_quote(" return f32;")
cpp_quote("}")
cpp_quote("")
cpp_quote("static inline float DXVA2FixedToFloat(DXVA2_Fixed32 f32) {")
cpp_quote(" struct { USHORT Fraction; SHORT Value; } *_f32 = (void *)&f32;")
cpp_quote(" return (float)_f32->Value + (float)_f32->Fraction / (1 << 16);")
cpp_quote(" return (float)f32.Value + (float)f32.Fraction / (1 << 16);")
cpp_quote("}")
cpp_quote("")
cpp_quote("static inline DXVA2_Fixed32 DXVA2FloatToFixed(float f) {")
cpp_quote(" DXVA2_Fixed32 f32;")
cpp_quote(" struct { USHORT Fraction; SHORT Value; } *_f32 = (void *)&f32;")
cpp_quote(" _f32->Value = ((ULONG) (f * (1 << 16))) >> 16;")
cpp_quote(" _f32->Fraction = ((ULONG) (f * (1 << 16))) & 0xFFFF;")
cpp_quote(" f32.Value = ((ULONG) (f * (1 << 16))) >> 16;")
cpp_quote(" f32.Fraction = ((ULONG) (f * (1 << 16))) & 0xFFFF;")
cpp_quote(" return f32;")
cpp_quote("}")