Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
evrhelpers_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef EVRHELPERS_H
5#define EVRHELPERS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <qvideoframe.h>
19#include <d3d9.h>
20#include <dxva2api.h>
21#include <evr9.h>
22#include <evr.h>
23#include <mfidl.h>
24#include <mfapi.h>
25#include <mferror.h>
26#include <private/quniquehandle_p.h>
27
29
30template<class T>
31static inline void qt_evr_safe_release(T **unk)
32{
33 if (*unk) {
34 (*unk)->Release();
35 *unk = NULL;
36 }
37}
38
39HRESULT qt_evr_getFourCC(IMFMediaType *type, DWORD *fourCC);
40
41bool qt_evr_areMediaTypesEqual(IMFMediaType *type1, IMFMediaType *type2);
42
43HRESULT qt_evr_validateVideoArea(const MFVideoArea& area, UINT32 width, UINT32 height);
44
45bool qt_evr_isSampleTimePassed(IMFClock *clock, IMFSample *sample);
46
47inline float qt_evr_MFOffsetToFloat(const MFOffset& offset)
48{
49 return offset.value + (float(offset.fract) / 65536);
50}
51
52inline MFOffset qt_evr_makeMFOffset(float v)
53{
54 MFOffset offset;
55 offset.value = short(v);
56 offset.fract = WORD(65536 * (v-offset.value));
57 return offset;
58}
59
60inline MFVideoArea qt_evr_makeMFArea(float x, float y, DWORD width, DWORD height)
61{
62 MFVideoArea area;
63 area.OffsetX = qt_evr_makeMFOffset(x);
64 area.OffsetY = qt_evr_makeMFOffset(y);
65 area.Area.cx = width;
66 area.Area.cy = height;
67 return area;
68}
69
70inline HRESULT qt_evr_getFrameRate(IMFMediaType *pType, MFRatio *pRatio)
71{
72 return MFGetAttributeRatio(pType, MF_MT_FRAME_RATE,
73 reinterpret_cast<UINT32*>(&pRatio->Numerator),
74 reinterpret_cast<UINT32*>(&pRatio->Denominator));
75}
76
79
81{
82 using Type = HANDLE;
83 static Type invalidValue() { return nullptr; }
84 static bool close(Type handle) { return CloseHandle(handle) != 0; }
85};
86
87using EventHandle = QUniqueHandle<NullHandleTraits>;
88using ThreadHandle = QUniqueHandle<NullHandleTraits>;
89
91
92#endif // EVRHELPERS_H
93
PixelFormat
Enumerates video data types.
MFOffset qt_evr_makeMFOffset(float v)
D3DFORMAT qt_evr_D3DFormatFromPixelFormat(QVideoFrameFormat::PixelFormat format)
bool qt_evr_areMediaTypesEqual(IMFMediaType *type1, IMFMediaType *type2)
HRESULT qt_evr_getFrameRate(IMFMediaType *pType, MFRatio *pRatio)
MFVideoArea qt_evr_makeMFArea(float x, float y, DWORD width, DWORD height)
float qt_evr_MFOffsetToFloat(const MFOffset &offset)
QVideoFrameFormat::PixelFormat qt_evr_pixelFormatFromD3DFormat(DWORD format)
static QT_BEGIN_NAMESPACE void qt_evr_safe_release(T **unk)
HRESULT qt_evr_getFourCC(IMFMediaType *type, DWORD *fourCC)
bool qt_evr_isSampleTimePassed(IMFClock *clock, IMFSample *sample)
HRESULT qt_evr_validateVideoArea(const MFVideoArea &area, UINT32 width, UINT32 height)
Combined button and popup list for selecting options.
static int area(const QSize &s)
Definition qicon.cpp:153
GLsizei const GLfloat * v
[13]
GLuint64 GLenum void * handle
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLint GLsizei width
GLenum type
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLint y
long HRESULT
static bool close(Type handle)
static Type invalidValue()
Definition moc.h:23