summaryrefslogtreecommitdiffstats
path: root/src/plugins/multimedia/qnx/capture/qqnxmediacapturesession.cpp
blob: d73ca7e5495cc4648b324395ff6d2b66e00670a4 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Copyright (C) 2016 Research In Motion
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qqnxmediacapturesession_p.h"

#include "qqnxaudioinput_p.h"
#include "qqnxplatformcamera_p.h"
#include "qqnximagecapture_p.h"
#include "qqnxmediarecorder_p.h"
#include "qqnxvideosink_p.h"
#include "qvideosink.h"

QT_BEGIN_NAMESPACE

QQnxMediaCaptureSession::QQnxMediaCaptureSession()
    : QPlatformMediaCaptureSession()
{
}

QQnxMediaCaptureSession::~QQnxMediaCaptureSession()
{
}

QPlatformCamera *QQnxMediaCaptureSession::camera()
{
    return m_camera;
}

void QQnxMediaCaptureSession::setCamera(QPlatformCamera *camera)
{
    if (camera == m_camera)
        return;

    if (m_camera)
        m_camera->setCaptureSession(nullptr);

    m_camera = static_cast<QQnxPlatformCamera *>(camera);

    if (m_camera)
        m_camera->setCaptureSession(this);

    emit cameraChanged();
}

QPlatformImageCapture *QQnxMediaCaptureSession::imageCapture()
{
    return m_imageCapture;
}

void QQnxMediaCaptureSession::setImageCapture(QPlatformImageCapture *imageCapture)
{
    if (m_imageCapture == imageCapture)
        return;

    if (m_imageCapture)
        m_imageCapture->setCaptureSession(nullptr);

    m_imageCapture = static_cast<QQnxImageCapture *>(imageCapture);

    if (m_imageCapture)
        m_imageCapture->setCaptureSession(this);

    emit imageCaptureChanged();
}

QPlatformMediaRecorder *QQnxMediaCaptureSession::mediaRecorder()
{
    return m_mediaRecorder;
}

void QQnxMediaCaptureSession::setMediaRecorder(QPlatformMediaRecorder *mediaRecorder)
{
    if (m_mediaRecorder == mediaRecorder)
        return;

    if (m_mediaRecorder)
        m_mediaRecorder->setCaptureSession(nullptr);

    m_mediaRecorder = static_cast<QQnxMediaRecorder *>(mediaRecorder);

    if (m_mediaRecorder)
        m_mediaRecorder->setCaptureSession(this);

    emit encoderChanged();
}

void QQnxMediaCaptureSession::setAudioInput(QPlatformAudioInput *input)
{
    if (m_audioInput == input)
        return;

    m_audioInput = static_cast<QQnxAudioInput*>(input);
}

void QQnxMediaCaptureSession::setVideoPreview(QVideoSink *sink)
{
    auto qnxSink = sink ? static_cast<QQnxVideoSink *>(sink->platformVideoSink()) : nullptr;
    if (m_videoSink == qnxSink)
        return;
    m_videoSink = qnxSink;
}

void QQnxMediaCaptureSession::setAudioOutput(QPlatformAudioOutput *output)
{
    if (m_audioOutput == output)
        return;
    m_audioOutput = output;
}

QQnxAudioInput * QQnxMediaCaptureSession::audioInput() const
{
    return m_audioInput;
}

QQnxVideoSink * QQnxMediaCaptureSession::videoSink() const
{
    return m_videoSink;
}

QT_END_NAMESPACE

#include "moc_qqnxmediacapturesession_p.cpp"