Music Hub
..
A session-wide music playback service
output_observer.h
Go to the documentation of this file.
1
/*
2
* Copyright © 2014 Canonical Ltd.
3
*
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as published by the Free Software Foundation.
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
12
*
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* Authored by: Thomas Voß <thomas.voss@canonical.com>
17
*/
18
#ifndef CORE_UBUNTU_MEDIA_AUDIO_OUTPUT_OBSERVER_H_
19
#define CORE_UBUNTU_MEDIA_AUDIO_OUTPUT_OBSERVER_H_
20
21
#include <core/property.h>
22
23
#include <iosfwd>
24
#include <memory>
25
26
namespace
core
27
{
28
namespace
ubuntu
29
{
30
namespace
media
31
{
32
namespace
audio
33
{
34
// All known states of an audio output.
35
enum class
OutputState
36
{
37
// The output is via a private earpiece (i.e. headphones, headset)
38
Earpiece
,
39
// The output is via the internal speaker.
40
Speaker
,
41
// The output is via an external device (a2dp, etc)
42
External
,
43
};
44
45
// Models observation of audio outputs of a device.
46
// Right now, we are only interested in monitoring the
47
// state of external outputs to react accordingly if
48
// wired or bluetooth outputs are connected/disconnected.
49
class
OutputObserver
50
{
51
public
:
52
// Save us some typing.
53
typedef
std::shared_ptr<OutputObserver>
Ptr
;
54
55
virtual
~OutputObserver
() =
default
;
56
57
// Getable/observable property holding the state of external outputs.
58
virtual
const
core::Property<OutputState>&
external_output_state
()
const
= 0;
59
60
protected
:
61
OutputObserver
() =
default
;
62
OutputObserver
(
const
OutputObserver
&) =
delete
;
63
OutputObserver
&
operator=
(
const
OutputObserver
&) =
delete
;
64
};
65
66
// Pretty prints the given state to the given output stream.
67
std::ostream&
operator<<
(std::ostream&,
OutputState
);
68
69
// Creats a platform default instance for observing audio outputs.
70
OutputObserver::Ptr
make_platform_default_output_observer
();
71
}
72
}
73
}
74
}
75
76
#endif // CORE_UBUNTU_MEDIA_AUDIO_OUTPUT_OBSERVER_H_
core::ubuntu::media::audio::OutputObserver
Definition:
output_observer.h:49
core
Definition:
player.h:33
core::ubuntu::media::audio::OutputState
OutputState
Definition:
output_observer.h:35
core::ubuntu::media::audio::OutputObserver::OutputObserver
OutputObserver()=default
core::ubuntu::media::audio::OutputState::Earpiece
core::ubuntu::media::audio::OutputState::Speaker
core::ubuntu::media::audio::operator<<
std::ostream & operator<<(std::ostream &, OutputState)
Definition:
output_observer.cpp:28
core::ubuntu::media::audio::OutputObserver::~OutputObserver
virtual ~OutputObserver()=default
core::ubuntu::media
Definition:
player.h:37
core::ubuntu::media::audio::OutputObserver::operator=
OutputObserver & operator=(const OutputObserver &)=delete
core::ubuntu::media::audio
Definition:
ostream_reporter.h:31
core::ubuntu::media::audio::OutputObserver::external_output_state
virtual const core::Property< OutputState > & external_output_state() const =0
core::ubuntu::media::audio::OutputObserver::Ptr
std::shared_ptr< OutputObserver > Ptr
Definition:
output_observer.h:53
core::ubuntu::media::audio::make_platform_default_output_observer
OutputObserver::Ptr make_platform_default_output_observer()
Definition:
output_observer.cpp:43
core::ubuntu::media::audio::OutputState::External
src
core
media
audio
output_observer.h
Generated on Fri Jul 10 2015 18:43:01 for Music Hub by
1.8.9.1