1// Copyright (C) 2024 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 QGST_PLAY_P_H
5#define QGST_PLAY_P_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 <QtCore/qglobal.h>
19#include <QtCore/qlocale.h>
20
21#include <QtMultimedia/private/qmultimediautils_p.h>
22
23#include "common/qgst_handle_types_p.h"
24
25#include <gst/play/gstplay.h>
26
27QT_BEGIN_NAMESPACE
28
29namespace QGstPlaySupport {
30
31using QUniqueGstPlayMediaInfoHandle =
32 QGstImpl::QGObjectHandleHelper<GstPlayMediaInfo>::UniqueHandle;
33using QUniqueGstPlayAudioInfoHandle =
34 QGstImpl::QGObjectHandleHelper<GstPlayAudioInfo>::UniqueHandle;
35using QUniqueGstPlayVideoInfoHandle =
36 QGstImpl::QGObjectHandleHelper<GstPlayVideoInfo>::UniqueHandle;
37using QUniqueGstPlaySubtitleInfoHandle =
38 QGstImpl::QGObjectHandleHelper<GstPlaySubtitleInfo>::UniqueHandle;
39
40struct VideoInfo
41{
42 int bitrate{};
43 int maxBitrate{};
44 QSize size;
45 Fraction framerate{};
46 Fraction pixelAspectRatio{};
47};
48
49VideoInfo parseGstPlayVideoInfo(const GstPlayVideoInfo *);
50
51struct AudioInfo
52{
53 int channels{};
54 int sampleRate{};
55 int bitrate{};
56 int maxBitrate{};
57 QLocale::Language language{};
58};
59
60AudioInfo parseGstPlayAudioInfo(const GstPlayAudioInfo *);
61
62struct SubtitleInfo
63{
64 QLocale::Language language{};
65};
66
67SubtitleInfo parseGstPlaySubtitleInfo(const GstPlaySubtitleInfo *);
68
69template <typename T>
70constexpr bool isStreamType = std::is_same_v<std::decay_t<T>, GstPlayVideoInfo>
71 || std::is_same_v<std::decay_t<T>, GstPlayAudioInfo>
72 || std::is_same_v<std::decay_t<T>, GstPlaySubtitleInfo>;
73
74int getStreamIndex(const GstPlayStreamInfo *);
75
76template <typename T, typename Enabler = std::enable_if_t<isStreamType<T>>>
77int getStreamIndex(const T *info)
78{
79 return getStreamIndex(GST_PLAY_STREAM_INFO(info));
80}
81
82} // namespace QGstPlaySupport
83
84QT_END_NAMESPACE
85
86#endif
87

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of qtmultimedia/src/plugins/multimedia/gstreamer/common/qgst_play_p.h