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
qffmpegstreamdecoder_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#ifndef QFFMPEGSTREAMDECODER_P_H
4#define QFFMPEGSTREAMDECODER_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#include <QtFFmpegMediaPluginImpl/private/qffmpeg_p.h>
17#include <QtFFmpegMediaPluginImpl/private/qffmpegplaybackengineobject_p.h>
18#include <QtFFmpegMediaPluginImpl/private/qffmpegframe_p.h>
19#include <QtFFmpegMediaPluginImpl/private/qffmpegpacket_p.h>
20#include <QtFFmpegMediaPluginImpl/private/qffmpegplaybackutils_p.h>
21#include <QtMultimedia/private/qplatformmediaplayer_p.h>
22
23#include <QtCore/qqueue.h>
24
25QT_BEGIN_NAMESPACE
26
27namespace QFFmpeg {
28
30{
32public:
34
35 StreamDecoder(const PlaybackEngineObjectID &id, const CodecContext &codecContext,
36 TrackPosition absSeekPos);
37
39
40 void seek(quint64 sessionID, TrackPosition pos, const LoopOffset &offset);
41
42 TrackType trackType() const;
43
44 // Maximum number of frames that we are allowed to keep in render queue
45 static qint32 maxQueueSize(TrackType type);
46
47public slots:
48
49 void decode(Packet);
50
51 void onFinalPacketReceived(PlaybackEngineObjectID sourceID);
52
53 void onFrameProcessed(const Frame &frame);
54
57
59
60protected:
61 bool canDoNextStep() const override;
62
63 void doNextStep() override;
64
65private:
66 void decodeMedia(const Packet &packet);
67
68 void decodeSubtitle(const Packet &packet);
69
70 void onFrameFound(const Frame &frame);
71
72 int sendAVPacket(const Packet &packet);
73
74 void receiveAVFrames(bool flushPacket = false);
75
76private:
77 CodecContext m_codecContext;
78
79 const TrackType m_trackType;
80
81 struct SessionContext
82 {
83 TrackPosition absSeekPos = TrackPosition(0);
84 qint32 pendingFramesCount = 0;
85 LoopOffset offset = {};
86 QQueue<Packet> packets = {};
87 };
88
89 SessionContext m_sessionCtx;
90};
91
92QString subtitleTextFromAVSubtitle(const AVSubtitle &subtitle);
93
94} // namespace QFFmpeg
95
96QT_END_NAMESPACE
97
98#endif // QFFMPEGSTREAMDECODER_P_H
bool canDoNextStep() const override
StreamDecoder(const PlaybackEngineObjectID &id, const CodecContext &codecContext, TrackPosition absSeekPos)
void onFrameProcessed(const Frame &frame)
void onFinalPacketReceived(PlaybackEngineObjectID sourceID)
void packetProcessed(Packet)
static qint32 maxQueueSize(TrackType type)
void seek(quint64 sessionID, TrackPosition pos, const LoopOffset &offset)
QString subtitleTextFromAVSubtitle(const AVSubtitle &subtitle)
static QString extractSubtitleText(const AVSubtitleRect &r)
Combined button and popup list for selecting options.