Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qavfhelpers_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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#ifndef QAVFHELPERS_P_H
4#define QAVFHELPERS_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <QtMultimedia/private/qsharedhandle_p.h>
18#include <QtMultimedia/qvideoframe.h>
19#include <QtMultimedia/qvideoframeformat.h>
20
21#include <CoreMedia/CoreMedia.h>
22#include <CoreVideo/CVBase.h>
23#include <CoreVideo/CVPixelBuffer.h>
24#include <CoreVideo/CVImageBuffer.h>
25
26#include <chrono>
27
28QT_BEGIN_NAMESPACE
29
30using CvPixelFormat = unsigned;
32
33namespace QAVFHelpers
34{
35
37{
39 static constexpr Type invalidValue() noexcept { return nullptr; }
40 static Type ref(Type handle) noexcept
41 {
42 CVPixelBufferRetain(handle);
43 return handle;
44 }
45 static bool unref(Type handle) noexcept
46 {
47 CVPixelBufferRelease(handle);
48 return true;
49 }
50};
52
55Q_MULTIMEDIA_EXPORT CvPixelFormat toCVPixelFormat(QVideoFrameFormat::PixelFormat pixFmt,
57
58Q_MULTIMEDIA_EXPORT QVideoFrameFormat videoFormatForImageBuffer(CVImageBufferRef buffer, bool openGL = false);
59
60[[nodiscard]] Q_MULTIMEDIA_EXPORT std::chrono::microseconds CMTimeToMicroseconds(const CMTime &);
61
62};
63
64QT_END_NAMESPACE
65
66#endif // QAVFHELPERS_P_H
constexpr CvPixelFormat CvPixelFormatInvalid
static constexpr Type invalidValue() noexcept
static Type ref(Type handle) noexcept
static bool unref(Type handle) noexcept