Qt 6.x
The Qt SDK
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
28
29template<class T>
30static inline void qt_evr_safe_release(T **unk)
31{
32 if (*unk) {
33 (*unk)->Release();
34 *unk = NULL;
35 }
36}
37
38HRESULT qt_evr_getFourCC(IMFMediaType *type, DWORD *fourCC);
39
40bool qt_evr_areMediaTypesEqual(IMFMediaType *type1, IMFMediaType *type2);
41
42HRESULT qt_evr_validateVideoArea(const MFVideoArea& area, UINT32 width, UINT32 height);
43
44bool qt_evr_isSampleTimePassed(IMFClock *clock, IMFSample *sample);
45
46inline float qt_evr_MFOffsetToFloat(const MFOffset& offset)
47{
48 return offset.value + (float(offset.fract) / 65536);
49}
50
51inline MFOffset qt_evr_makeMFOffset(float v)
52{
53 MFOffset offset;
54 offset.value = short(v);
55 offset.fract = WORD(65536 * (v-offset.value));
56 return offset;
57}
58
59inline MFVideoArea qt_evr_makeMFArea(float x, float y, DWORD width, DWORD height)
60{
61 MFVideoArea area;
62 area.OffsetX = qt_evr_makeMFOffset(x);
63 area.OffsetY = qt_evr_makeMFOffset(y);
64 area.Area.cx = width;
65 area.Area.cy = height;
66 return area;
67}
68
69inline HRESULT qt_evr_getFrameRate(IMFMediaType *pType, MFRatio *pRatio)
70{
71 return MFGetAttributeRatio(pType, MF_MT_FRAME_RATE,
72 reinterpret_cast<UINT32*>(&pRatio->Numerator),
73 reinterpret_cast<UINT32*>(&pRatio->Denominator));
74}
75
78
80
81#endif // EVRHELPERS_H
82
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:152
GLsizei const GLfloat * v
[13]
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