Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qffmpegmediadataholder_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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 QFFMPEGMEDIADATAHOLDER_P_H
5#define QFFMPEGMEDIADATAHOLDER_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 "qmediametadata.h"
19#include "private/qplatformmediaplayer_p.h"
20#include "qffmpeg_p.h"
21
22#include <array>
23#include <optional>
24
26
27namespace QFFmpeg {
28
30{
31 void operator()(AVFormatContext *avFormat) const { avformat_close_input(&avFormat); }
32};
33
35{
36public:
38 {
39 int avStreamIndex = -1;
40 bool isDefault = false;
42 };
43
45 {
46 int code = 0;
48 };
49
50 using StreamsMap = std::array<QList<StreamInfo>, QPlatformMediaPlayer::NTrackTypes>;
51 using StreamIndexes = std::array<int, QPlatformMediaPlayer::NTrackTypes>;
52
54
56
58
59 qint64 duration() const { return m_duration; }
60
61 const QMediaMetaData &metaData() const { return m_metaData; }
62
63 bool isSeekable() const { return m_isSeekable; }
64
65protected:
66 std::optional<ContextError> recreateAVFormatContext(const QUrl &media, QIODevice *stream);
67
69
71
73
74protected:
75 std::unique_ptr<AVFormatContext, AVFormatContextDeleter> m_context;
76 bool m_isSeekable = false;
77
80 StreamIndexes m_requestedStreams = { { -1, -1, -1 } };
83};
84
85} // namespace QFFmpeg
86
88
89#endif // QFFMPEGMEDIADATAHOLDER_P_H
std::unique_ptr< AVFormatContext, AVFormatContextDeleter > m_context
bool setActiveTrack(QPlatformMediaPlayer::TrackType type, int streamNumber)
const QList< StreamInfo > & streamInfo(QPlatformMediaPlayer::TrackType trackType) const
static QPlatformMediaPlayer::TrackType trackTypeFromMediaType(int mediaType)
const QMediaMetaData & metaData() const
std::array< int, QPlatformMediaPlayer::NTrackTypes > StreamIndexes
int activeTrack(QPlatformMediaPlayer::TrackType type) const
std::optional< ContextError > recreateAVFormatContext(const QUrl &media, QIODevice *stream)
std::array< QList< StreamInfo >, QPlatformMediaPlayer::NTrackTypes > StreamsMap
\inmodule QtCore \reentrant
Definition qiodevice.h:34
Definition qlist.h:74
\inmodule QtMultimedia
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
EGLStreamKHR stream
GLenum type
long long qint64
Definition qtypes.h:55
void operator()(AVFormatContext *avFormat) const