diff options
author | Piotr Srebrny <piotr.srebrny@qt.io> | 2021-06-28 16:16:14 +0200 |
---|---|---|
committer | Piotr Srebrny <piotr.srebrny@qt.io> | 2021-07-03 11:58:59 +0200 |
commit | 7d56d37d5968a62f13816f63513b7515ca7bb3c7 (patch) | |
tree | de5c05d0cc83ddd705e84968d8835d5d47cc2ce6 /tests | |
parent | 755f013ca25874145ba954bf03de863059b79b1f (diff) |
Use command like interface to control recorder backend
Recording backends use command like interfaces record/pause/stop. Thus,
reflecting it at the platform level simplifies code.
Additionally, the record function takes the encoder settings, which
helps to further simplify the code. The settings should be apllied when
starting the encoder but not before. The only gain of providing settings
before the record command would be a reduction of the recording startup
time. However, it is doubtful that this speedup is observable.
Change-Id: Iab68594fa0763f67d6e82555627bcdaf08e3d9d3
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/unit/mockbackend/qmockmediaencoder.h | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/tests/auto/unit/mockbackend/qmockmediaencoder.h b/tests/auto/unit/mockbackend/qmockmediaencoder.h index dcf33ee48..8cea0f40f 100644 --- a/tests/auto/unit/mockbackend/qmockmediaencoder.h +++ b/tests/auto/unit/mockbackend/qmockmediaencoder.h @@ -76,7 +76,7 @@ public: using QPlatformMediaEncoder::error; public: - void record() + void record(const QMediaEncoderSettings &) { m_state = QMediaRecorder::RecordingState; m_position=1; @@ -93,26 +93,17 @@ public: emit stateChanged(m_state); } - void stop() + void resume() { - m_position=0; - m_state = QMediaRecorder::StoppedState; + m_state = QMediaRecorder::RecordingState; emit stateChanged(m_state); } - void setState(QMediaRecorder::RecorderState state) + void stop() { - switch (state) { - case QMediaRecorder::StoppedState: - stop(); - break; - case QMediaRecorder::PausedState: - pause(); - break; - case QMediaRecorder::RecordingState: - record(); - break; - } + m_position=0; + m_state = QMediaRecorder::StoppedState; + emit stateChanged(m_state); } public: |