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 QFFMPEGENCODINGFORMATCONTEXT_P_H
5#define QFFMPEGENCODINGFORMATCONTEXT_P_H
6
7#include "qffmpegdefs_p.h"
8#include "qmediaformat.h"
9
10//
11// W A R N I N G
12// -------------
13//
14// This file is not part of the Qt API. It exists purely as an
15// implementation detail. This header file may change from version to
16// version without notice, or even be removed.
17//
18// We mean it.
19//
20
21QT_BEGIN_NAMESPACE
22
23class QIODevice;
24class QFile;
25
26namespace QFFmpeg {
27
28class EncodingFormatContext
29{
30public:
31 explicit EncodingFormatContext(QMediaFormat::FileFormat fileFormat);
32 ~EncodingFormatContext();
33
34 void openAVIO(const QString &filePath);
35
36 void openAVIO(QIODevice *device);
37
38 bool isAVIOOpen() const { return m_avFormatContext->pb != nullptr; }
39
40 void closeAVIO();
41
42 AVFormatContext *avFormatContext() { return m_avFormatContext; }
43
44 const AVFormatContext *avFormatContext() const { return m_avFormatContext; }
45
46private:
47 Q_DISABLE_COPY_MOVE(EncodingFormatContext)
48
49 void openAVIOWithQFile(const QString &filePath);
50
51private:
52 AVFormatContext *m_avFormatContext;
53 std::unique_ptr<QFile> m_outputFile;
54};
55
56} // namespace QFFmpeg
57
58QT_END_NAMESPACE
59
60#endif // QFFMPEGENCODINGFORMATCONTEXT_P_H
61

source code of qtmultimedia/src/plugins/multimedia/ffmpeg/qffmpegencodingformatcontext_p.h