Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qffmpegvideoframeencoder_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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 QFFMPEGVIDEOFRAMEENCODER_P_H
4#define QFFMPEGVIDEOFRAMEENCODER_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
17#include "qffmpeghwaccel_p.h"
18#include "qvideoframeformat.h"
19#include "private/qplatformmediarecorder_p.h"
20
22
23namespace QFFmpeg {
24
26{
27 class Data final
28 {
29 public:
30 ~Data();
31
32 QAtomicInt ref = 0;
34 float frameRate = 0.;
35 QSize sourceSize;
36
37 std::unique_ptr<HWAccel> accel;
38 const AVCodec *codec = nullptr;
39 AVStream *stream = nullptr;
40 AVCodecContextUPtr codecContext;
41 SwsContext *converter = nullptr;
42 AVPixelFormat sourceFormat = AV_PIX_FMT_NONE;
43 AVPixelFormat sourceSWFormat = AV_PIX_FMT_NONE;
44 AVPixelFormat targetFormat = AV_PIX_FMT_NONE;
45 AVPixelFormat targetSWFormat = AV_PIX_FMT_NONE;
46 bool downloadFromHW = false;
47 bool uploadToHW = false;
48 };
49
51public:
52 VideoFrameEncoder() = default;
53 VideoFrameEncoder(const QMediaEncoderSettings &encoderSettings, const QSize &sourceSize, float frameRate, AVPixelFormat sourceFormat, AVPixelFormat swFormat);
55
56 void initWithFormatContext(AVFormatContext *formatContext);
57 bool open();
58
59 bool isNull() const { return !d; }
60
61 AVPixelFormat sourceFormat() const { return d ? d->sourceFormat : AV_PIX_FMT_NONE; }
62 AVPixelFormat targetFormat() const { return d ? d->targetFormat : AV_PIX_FMT_NONE; }
63
64 qint64 getPts(qint64 ms) const;
65
66 const AVRational &getTimeBase() const;
67
69 AVPacket *retrievePacket();
70};
71
72
73}
74
76
77#endif
\inmodule QtCore
Definition qatomic.h:112
VideoFrameEncoder(const QMediaEncoderSettings &encoderSettings, const QSize &sourceSize, float frameRate, AVPixelFormat sourceFormat, AVPixelFormat swFormat)
void initWithFormatContext(AVFormatContext *formatContext)
const AVRational & getTimeBase() const
qint64 getPts(qint64 ms) const
int sendFrame(AVFrameUPtr frame)
\inmodule QtCore
Definition qsize.h:25
std::unique_ptr< AVCodecContext, AVDeleter< decltype(&avcodec_free_context), &avcodec_free_context > > AVCodecContextUPtr
Definition qffmpeg_p.h:129
std::unique_ptr< AVFrame, AVDeleter< decltype(&av_frame_free), &av_frame_free > > AVFrameUPtr
Definition qffmpeg_p.h:117
Combined button and popup list for selecting options.
EGLStreamKHR stream
QMediaFormat::AudioCodec codec
GLint ref
long long qint64
Definition qtypes.h:55
QSettings settings("MySoft", "Star Runner")
[0]
QFrame frame
[0]