Music Hub  ..
A session-wide music playback service
recorder_observer.cpp
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 Canonical Ltd.
3  * Copyright © 2022 UBports Foundation.
4  *
5  * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License version 3,
9  * as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Authored by: Thomas Voß <thomas.voss@canonical.com>
20  */
21 
22 #include "recorder_observer.h"
23 
25 #include "logging.h"
26 #include "player.h"
27 #include "stub_recorder_observer.h"
28 
29 namespace media = lomiri::MediaHubService;
30 
31 using namespace media;
32 
33 namespace {
34 
36 make_platform_default_recorder_observer(RecorderObserver *q)
37 {
39  switch (b)
40  {
41  case media::AVBackend::Backend::hybris:
42  return new media::HybrisRecorderObserver(q);
43  case media::AVBackend::Backend::mir:
44  case media::AVBackend::Backend::none:
45  MH_WARNING(
46  "No video backend selected. Video recording functionality won't work."
47  );
48  return new media::StubRecorderObserver(q);
49  default:
50  MH_INFO("Invalid or no A/V backend specified, using \"hybris\" as a default.");
51  return new media::HybrisRecorderObserver(q);
52  }
53 }
54 
55 } // namespace
56 
58  QObject(parent),
59  d_ptr(make_platform_default_recorder_observer(this))
60 {
61 }
62 
64 
66 {
67  Q_D(const RecorderObserver);
68  return d->recordingState();
69 }
QObject
recorder_observer.h
lomiri::MediaHubService::AVBackend::Backend
Backend
Definition: player.h:36
hybris_recorder_observer.h
lomiri::MediaHubService::AVBackend::get_backend_type
static Backend get_backend_type()
Returns the type of audio/video decoding/encoding backend being used.
Definition: backend.cpp:28
lomiri::MediaHubService::RecordingState
RecordingState
Definition: recorder_observer.h:33
lomiri::MediaHubService
Definition: context.h:28
lomiri::MediaHubService::RecorderObserver::RecorderObserver
RecorderObserver(QObject *parent=nullptr)
Definition: recorder_observer.cpp:57
player.h
lomiri::MediaHubService::RecorderObserver::~RecorderObserver
virtual ~RecorderObserver()
stub_recorder_observer.h
MH_INFO
#define MH_INFO(...)
Definition: logging.h:39
lomiri::MediaHubService::RecorderObserver::recordingState
RecordingState recordingState() const
Definition: recorder_observer.cpp:65
lomiri::MediaHubService::StubRecorderObserver
Definition: stub_recorder_observer.h:31
media::HybrisRecorderObserver
MH_WARNING
#define MH_WARNING(...)
Definition: logging.h:40
logging.h
lomiri::MediaHubService::RecorderObserverPrivate
Definition: recorder_observer_p.h:27
lomiri::MediaHubService::RecorderObserver
Definition: recorder_observer.h:44