Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
streamer.H
Go to the documentation of this file.
1/*
2 * This file is part of the Home2L project.
3 *
4 * (C) 2015-2021 Gundolf Kiefer
5 *
6 * Home2L is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Home2L 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 General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Home2L. If not, see <https://www.gnu.org/licenses/>.
18 *
19 */
20
21
22#ifndef _STREAMER_
23#define _STREAMER_
24
25
33#include "base.H"
34
35
38 strOff = 0,
41 strOn
42};
43
44
45static inline bool StreamerStateIsActive (EStreamerState s) { return s >= strBusy; }
48
49
50// Note on concurrency: All interface methods here must be called from the main UI thread.
51
52void StreamerInit ();
53void StreamerDone ();
54
55void StreamerStart (const char *host, int port, TTicks bufferDuration);
56void StreamerStop ();
57
58EStreamerState StreamerIterate ();
59
60EStreamerState StreamerState ();
61static inline bool StreamerIsRunning () { return StreamerStateIsActive (StreamerState ()); }
62
63const char *StreamerGetError (CString *s);
64
65
66#define STREAMER_LEVEL_UNKNOWN -INT_MAX
67
68
76
77
79
80
81#endif
Dynamically allocated string.
Definition: base.H:635
int64_t TTicks
Time value (relative, absolute, or monotonic).
Definition: base.H:1378
int StreamerGetDbLevel()
Return the current level in DB (<= 0, 0 = maximum) or STREAMER_LEVEL_UNKNOWN (= -INT_MAX / very,...
EStreamerState
State of the streamer.
Definition: streamer.H:37
const char * StreamerGetError(CString *s)
Return readable error message and reset the text internally.
static bool StreamerStateIsActive(EStreamerState s)
Active states are those requiring eventual calls to 'StreamerIterate'. 'StreamerStop' reliably switch...
Definition: streamer.H:45
@ strError
Connection failed or other error.
Definition: streamer.H:39
@ strBusy
Connecting or buffering.
Definition: streamer.H:40
@ strOff
No background thread, hands off the audio device.
Definition: streamer.H:38
@ strOn
Audio should be hearable.
Definition: streamer.H:41