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
qglist_helper_p.h
Go to the documentation of this file.
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 QGLIST_HELPER_P_H
5#define QGLIST_HELPER_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/qtconfigmacros.h>
19
20#include <glib.h>
21#include <iterator>
22
23QT_BEGIN_NAMESPACE
24
25namespace QGstUtils {
26
27template <typename ListType, bool IsConst>
29{
31
32 explicit GListIterator(GListType element = nullptr) : element(element) { }
33
34 const ListType &operator*() const noexcept { return *operator->(); }
35 const ListType *operator->() const noexcept
36 {
37 return reinterpret_cast<const ListType *>(&element->data);
38 }
39
40 GListIterator &operator++() noexcept
41 {
42 if (element)
43 element = element->next;
44
45 return *this;
46 }
47 GListIterator operator++(int n) noexcept
48 {
49 for (int i = 0; i != n; ++i)
50 operator++();
51
52 return *this;
53 }
54
55 bool operator==(const GListIterator &r) const noexcept { return element == r.element; }
56 bool operator!=(const GListIterator &r) const noexcept { return element != r.element; }
57
58 using difference_type = std::ptrdiff_t;
59 using value_type = ListType;
62 using iterator_category = std::input_iterator_tag;
63
64 GListType element = nullptr;
65};
66
67template <typename ListType, bool IsConst>
69{
70 static_assert(std::is_pointer_v<ListType>);
71
73
74 explicit GListRangeAdaptorImpl(GListType list) : head(list) { }
75
76 auto begin() { return GListIterator<ListType, IsConst>(head); }
77 auto end() { return GListIterator<ListType, IsConst>(nullptr); }
78
80};
81
82template <typename ListType>
84template <typename ListType>
86
87} // namespace QGstUtils
88
89QT_END_NAMESPACE
90
91#endif
q23::expected< QGstDiscovererInfo, QUniqueGErrorHandle > discover(const QString &uri)
q23::expected< QGstDiscovererInfo, QUniqueGErrorHandle > discover(QIODevice *)
GListRangeAdaptorImpl< ListType, true > GListConstRangeAdaptor
GListRangeAdaptorImpl< ListType, false > GListRangeAdaptor
QMediaMetaData toStreamMetadata(const QGstDiscovererAudioInfo &info)
static constexpr std::chrono::nanoseconds discovererTimeout
QMediaMetaData toStreamMetadata(const QGstDiscovererSubtitleInfo &info)
QMediaMetaData toStreamMetadata(const QGstDiscovererVideoInfo &info)
QMediaMetaData toContainerMetadata(const QGstDiscovererInfo &info)
static void updateMetadata(QMediaMetaData &metadata, QMediaMetaData::Key key, ValueType value)
void addMissingKeysFromTaglist(QMediaMetaData &metadata, const QGstTagListHandle &tagList)
GListIterator(GListType element=nullptr)
bool operator!=(const GListIterator &r) const noexcept
std::ptrdiff_t difference_type
GListIterator & operator++() noexcept
std::input_iterator_tag iterator_category
const ListType & operator*() const noexcept
const ListType * operator->() const noexcept
GListIterator operator++(int n) noexcept
bool operator==(const GListIterator &r) const noexcept
std::vector< QGstDiscovererAudioInfo > audioStreams
std::vector< QGstDiscovererContainerInfo > containerStreams
std::vector< QGstDiscovererVideoInfo > videoStreams
std::optional< QGstDiscovererContainerInfo > containerInfo
std::vector< QGstDiscovererSubtitleInfo > subtitleStreams
std::optional< std::chrono::nanoseconds > duration