The stricter checks imposed by commit ac39b313b618ab8d1613302c3604ba505afff0df, while being valid in general, require that media source attaches to media types the attributes that application can request.
This patch exposes the MF_MT_VIDEO_ROTATION attribute, which is for example requested by Legend of Keepers.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- The same attribute is also set by Windows for media sources obtained from the standard source resolver.
Currently MFVideoRotationFormat_0 is always set, because I couldn't find anyway to query this property in GStreamer. The obvious place for this metadata item would probably be GstVideoInfo, but I cannot see anything related there. Can some GStreamer wizard help?
v2: * add test; * reformat enumeration in a way which, I hope, is more correct.
dlls/mfplat/tests/mfplat.c | 7 +++++++ dlls/winegstreamer/mfplat.c | 1 + include/mfapi.h | 7 +++++++ 3 files changed, 15 insertions(+)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index ff24c2c0ec0..f1c041b7eb4 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -664,6 +664,7 @@ static void test_source_resolver(void) HRESULT hr; GUID guid; float rate; + UINT32 rotation;
if (!pMFCreateSourceResolver) { @@ -849,6 +850,12 @@ static void test_source_resolver(void) ok(hr == S_OK, "Failed to get media sub type, hr %#x.\n", hr); todo_wine ok(IsEqualGUID(&guid, &MFVideoFormat_M4S2), "Unexpected sub type %s.\n", debugstr_guid(&guid)); + + hr = IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_ROTATION, &rotation); + ok(hr == S_OK || broken(hr == MF_E_ATTRIBUTENOTFOUND) /* Win7 */, "Failed to get rotation, hr %#x.\n", hr); + if (hr == S_OK) + ok(rotation == MFVideoRotationFormat_0, "Got wrong rotation %u.\n", rotation); + IMFMediaType_Release(media_type);
hr = IMFPresentationDescriptor_SelectStream(descriptor, 0); diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index bb632c2cc2c..dfa448afcfe 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -596,6 +596,7 @@ static IMFMediaType *mf_media_type_from_wg_format_video(const struct wg_format * make_uint64(format->u.video.fps_n, format->u.video.fps_d)); IMFMediaType_SetUINT32(type, &MF_MT_COMPRESSED, FALSE); IMFMediaType_SetUINT32(type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); + IMFMediaType_SetUINT32(type, &MF_MT_VIDEO_ROTATION, MFVideoRotationFormat_0);
return type; } diff --git a/include/mfapi.h b/include/mfapi.h index e4a1f6a3dc0..28798f734a5 100644 --- a/include/mfapi.h +++ b/include/mfapi.h @@ -449,6 +449,13 @@ typedef enum _MFWaveFormatExConvertFlags MFWaveFormatExConvertFlag_ForceExtensible = 1, } MFWaveFormatExConvertFlags;
+typedef enum _MFVideoRotationFormat { + MFVideoRotationFormat_0 = 0, + MFVideoRotationFormat_90 = 1, + MFVideoRotationFormat_180 = 2, + MFVideoRotationFormat_270 = 3 +} MFVideoRotationFormat; + enum _MFT_ENUM_FLAG { MFT_ENUM_FLAG_SYNCMFT = 0x00000001,
On 6/16/21 5:24 PM, Giovanni Mascellani wrote:
+typedef enum _MFVideoRotationFormat {
- MFVideoRotationFormat_0 = 0,
- MFVideoRotationFormat_90 = 1,
- MFVideoRotationFormat_180 = 2,
- MFVideoRotationFormat_270 = 3
+} MFVideoRotationFormat;
enum _MFT_ENUM_FLAG { MFT_ENUM_FLAG_SYNCMFT = 0x00000001,
This is still wrong. Please check actual headers to see what it should look like. Regarding formatting, opening braces on new lines is better.