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 QFFMPEGPACKET_P_H
5#define QFFMPEGPACKET_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 "qffmpeg_p.h"
19#include "QtCore/qsharedpointer.h"
20#include "playbackengine/qffmpegpositionwithoffset_p.h"
21
22QT_BEGIN_NAMESPACE
23
24namespace QFFmpeg {
25
26struct Packet
27{
28 struct Data
29 {
30 Data(const LoopOffset &offset, AVPacketUPtr p, quint64 sourceId)
31 : loopOffset(offset), packet(std::move(p)), sourceId(sourceId)
32 {
33 }
34
35 QAtomicInt ref;
36 LoopOffset loopOffset;
37 AVPacketUPtr packet;
38 quint64 sourceId;
39 };
40 Packet() = default;
41 Packet(const LoopOffset &offset, AVPacketUPtr p, quint64 sourceId)
42 : d(new Data(offset, std::move(p), sourceId))
43 {
44 }
45
46 bool isValid() const { return !!d; }
47 AVPacket *avPacket() const { return d->packet.get(); }
48 const LoopOffset &loopOffset() const { return d->loopOffset; }
49 quint64 sourceId() const { return d->sourceId; }
50
51private:
52 QExplicitlySharedDataPointer<Data> d;
53};
54
55} // namespace QFFmpeg
56
57QT_END_NAMESPACE
58
59Q_DECLARE_METATYPE(QFFmpeg::Packet)
60
61#endif // QFFMPEGPACKET_P_H
62

source code of qtmultimedia/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegpacket_p.h