blob: 30dba0a45b2b520f1677685d3fa79bc59a743a3d (
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
|
// 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
#include "qplatformmediarecorder_p.h"
#include "qstandardpaths.h"
#include "qmediastoragelocation_p.h"
#include <QObject>
QT_BEGIN_NAMESPACE
QPlatformMediaRecorder::QPlatformMediaRecorder(QMediaRecorder *parent)
: q(parent)
{
}
void QPlatformMediaRecorder::pause()
{
updateError(QMediaRecorder::FormatError, QMediaRecorder::tr("Pause not supported"));
}
void QPlatformMediaRecorder::resume()
{
updateError(QMediaRecorder::FormatError, QMediaRecorder::tr("Resume not supported"));
}
void QPlatformMediaRecorder::stateChanged(QMediaRecorder::RecorderState state)
{
if (m_state == state)
return;
m_state = state;
emit q->recorderStateChanged(state);
}
void QPlatformMediaRecorder::durationChanged(qint64 duration)
{
if (m_duration == duration)
return;
m_duration = duration;
emit q->durationChanged(duration);
}
void QPlatformMediaRecorder::actualLocationChanged(const QUrl &location)
{
if (m_actualLocation == location)
return;
m_actualLocation = location;
emit q->actualLocationChanged(location);
}
void QPlatformMediaRecorder::updateError(QMediaRecorder::Error error, const QString &errorString)
{
m_error.setAndNotify(error, errorString, *q);
}
void QPlatformMediaRecorder::metaDataChanged()
{
emit q->metaDataChanged();
}
QString QPlatformMediaRecorder::findActualLocation(const QMediaEncoderSettings &settings) const
{
const auto audioOnly = settings.videoCodec() == QMediaFormat::VideoCodec::Unspecified;
const auto primaryLocation =
audioOnly ? QStandardPaths::MusicLocation : QStandardPaths::MoviesLocation;
const QString suffix = settings.mimeType().preferredSuffix();
const QString location = QMediaStorageLocation::generateFileName(
outputLocation().toString(QUrl::PreferLocalFile), primaryLocation, suffix);
Q_ASSERT(!location.isEmpty());
return location;
}
QT_END_NAMESPACE
|