blob: 8eef92cad75e1153d852b6a6d65644501d342316 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFFMPEGIMAGECAPTURE_H
#define QFFMPEGIMAGECAPTURE_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <private/qplatformimagecapture_p.h>
#include "qffmpegmediacapturesession_p.h"
#include <qqueue.h>
QT_BEGIN_NAMESPACE
class QFFmpegImageCapture : public QPlatformImageCapture
{
Q_OBJECT
public:
QFFmpegImageCapture(QImageCapture *parent);
virtual ~QFFmpegImageCapture();
bool isReadyForCapture() const override;
int capture(const QString &fileName) override;
int captureToBuffer() override;
QImageEncoderSettings imageSettings() const override;
void setImageSettings(const QImageEncoderSettings &settings) override;
void setCaptureSession(QPlatformMediaCaptureSession *session);
void updateReadyForCapture();
public Q_SLOTS:
void cameraActiveChanged(bool active);
void newVideoFrame(const QVideoFrame &frame);
void onCameraChanged();
protected:
virtual int doCapture(const QString &fileName);
virtual void setupCameraConnections();
QPlatformCamera *m_camera = nullptr;
private:
QFFmpegMediaCaptureSession *m_session = nullptr;
int m_lastId = 0;
QImageEncoderSettings m_settings;
struct PendingImage {
int id;
QString filename;
QMediaMetaData metaData;
};
QQueue<PendingImage> pendingImages;
bool passImage = false;
bool cameraActive = false;
bool m_isReadyForCapture = false;
};
QT_END_NAMESPACE
#endif // QGSTREAMERCAPTURECORNTROL_H
|