2010-04-04 12:43:15 +02:00
|
|
|
|
|
|
|
#ifndef __PLAYER_H__
|
|
|
|
#define __PLAYER_H__
|
|
|
|
|
2018-02-07 22:18:09 +01:00
|
|
|
#include <stdbool.h>
|
2010-04-04 12:43:15 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2015-05-01 10:54:58 +02:00
|
|
|
#include "db.h"
|
2023-05-06 01:00:22 +02:00
|
|
|
#include "misc.h" // for struct media_quality
|
2015-05-01 10:54:58 +02:00
|
|
|
|
2019-01-11 19:32:50 +01:00
|
|
|
// Maximum number of previously played songs that are remembered
|
2014-04-19 17:18:20 +02:00
|
|
|
#define MAX_HISTORY_COUNT 20
|
|
|
|
|
2010-04-04 12:43:15 +02:00
|
|
|
enum play_status {
|
|
|
|
PLAY_STOPPED = 2,
|
|
|
|
PLAY_PAUSED = 3,
|
|
|
|
PLAY_PLAYING = 4,
|
|
|
|
};
|
|
|
|
|
2016-11-08 21:27:38 +01:00
|
|
|
enum repeat_mode {
|
|
|
|
REPEAT_OFF = 0,
|
|
|
|
REPEAT_SONG = 1,
|
|
|
|
REPEAT_ALL = 2,
|
|
|
|
};
|
|
|
|
|
2019-09-22 09:18:53 +02:00
|
|
|
enum player_seek_mode {
|
|
|
|
PLAYER_SEEK_POSITION = 1,
|
|
|
|
PLAYER_SEEK_RELATIVE = 2,
|
|
|
|
};
|
|
|
|
|
2019-01-22 17:47:15 +01:00
|
|
|
struct player_speaker_info {
|
2018-02-07 22:18:09 +01:00
|
|
|
uint64_t id;
|
2020-01-02 17:48:40 +01:00
|
|
|
uint32_t active_remote;
|
2019-01-21 09:34:37 +01:00
|
|
|
char name[255];
|
|
|
|
char output_type[50];
|
2018-02-07 22:18:09 +01:00
|
|
|
int relvol;
|
|
|
|
int absvol;
|
2011-03-05 10:29:05 +01:00
|
|
|
|
2024-01-07 23:12:03 +01:00
|
|
|
enum media_format format;
|
|
|
|
uint32_t supported_formats;
|
2024-01-07 00:00:18 +01:00
|
|
|
|
2018-02-07 22:18:09 +01:00
|
|
|
bool selected;
|
|
|
|
bool has_password;
|
|
|
|
bool requires_auth;
|
|
|
|
bool needs_auth_key;
|
|
|
|
|
2020-04-10 20:40:23 +02:00
|
|
|
bool prevent_playback;
|
|
|
|
bool busy;
|
|
|
|
|
2018-02-07 22:18:09 +01:00
|
|
|
bool has_video;
|
2011-03-05 10:25:44 +01:00
|
|
|
};
|
|
|
|
|
2010-04-04 12:43:15 +02:00
|
|
|
struct player_status {
|
|
|
|
enum play_status status;
|
|
|
|
enum repeat_mode repeat;
|
|
|
|
char shuffle;
|
2016-10-23 10:16:04 +02:00
|
|
|
char consume;
|
2010-04-04 12:43:15 +02:00
|
|
|
|
|
|
|
int volume;
|
|
|
|
|
2014-12-21 20:41:44 +01:00
|
|
|
/* Playlist id */
|
2010-07-31 12:30:51 +02:00
|
|
|
uint32_t plid;
|
2015-09-19 08:23:41 +02:00
|
|
|
/* Id of the playing file/item in the files database */
|
2010-04-04 12:43:15 +02:00
|
|
|
uint32_t id;
|
2015-09-19 08:23:41 +02:00
|
|
|
/* Item-Id of the playing file/item in the queue */
|
2015-10-03 09:01:26 +02:00
|
|
|
uint32_t item_id;
|
2015-02-14 22:36:52 +01:00
|
|
|
/* Elapsed time in ms of playing item */
|
2010-04-04 12:43:15 +02:00
|
|
|
uint32_t pos_ms;
|
2015-02-14 22:36:52 +01:00
|
|
|
/* Length in ms of playing item */
|
|
|
|
uint32_t len_ms;
|
2010-04-04 12:43:15 +02:00
|
|
|
};
|
|
|
|
|
2019-01-22 17:47:15 +01:00
|
|
|
typedef void (*spk_enum_cb)(struct player_speaker_info *spk, void *arg);
|
2010-04-04 12:43:15 +02:00
|
|
|
|
2014-04-19 17:18:20 +02:00
|
|
|
struct player_history
|
|
|
|
{
|
|
|
|
/* Buffer index of the oldest remembered song */
|
|
|
|
unsigned int start_index;
|
|
|
|
|
|
|
|
/* Count of song ids in the buffer */
|
|
|
|
unsigned int count;
|
|
|
|
|
2021-04-09 20:21:20 +02:00
|
|
|
/* Circular buffer of song ids previously played */
|
2014-05-03 19:44:26 +02:00
|
|
|
uint32_t id[MAX_HISTORY_COUNT];
|
2015-10-03 09:01:26 +02:00
|
|
|
uint32_t item_id[MAX_HISTORY_COUNT];
|
2014-04-19 17:18:20 +02:00
|
|
|
};
|
|
|
|
|
2010-04-04 12:43:15 +02:00
|
|
|
int
|
|
|
|
player_get_status(struct player_status *status);
|
|
|
|
|
|
|
|
int
|
2019-02-16 19:34:36 +01:00
|
|
|
player_playing_now(uint32_t *id);
|
2010-04-04 12:43:15 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
player_speaker_enumerate(spk_enum_cb cb, void *arg);
|
|
|
|
|
|
|
|
int
|
|
|
|
player_speaker_set(uint64_t *ids);
|
|
|
|
|
2019-01-21 09:34:37 +01:00
|
|
|
int
|
2020-01-03 19:38:52 +01:00
|
|
|
player_speaker_get_byid(struct player_speaker_info *spk, uint64_t id);
|
2019-01-21 09:34:37 +01:00
|
|
|
|
2020-01-02 17:48:40 +01:00
|
|
|
int
|
|
|
|
player_speaker_get_byactiveremote(struct player_speaker_info *spk, uint32_t active_remote);
|
|
|
|
|
2018-02-07 23:05:23 +01:00
|
|
|
int
|
|
|
|
player_speaker_enable(uint64_t id);
|
|
|
|
|
|
|
|
int
|
|
|
|
player_speaker_disable(uint64_t id);
|
|
|
|
|
2020-04-10 20:40:23 +02:00
|
|
|
int
|
|
|
|
player_speaker_prevent_playback_set(uint64_t id, bool prevent_playback);
|
|
|
|
|
|
|
|
int
|
|
|
|
player_speaker_busy_set(uint64_t id, bool busy);
|
|
|
|
|
2020-05-01 20:11:45 +02:00
|
|
|
void
|
|
|
|
player_speaker_resurrect(void *arg);
|
|
|
|
|
2020-05-26 22:45:38 +02:00
|
|
|
int
|
|
|
|
player_speaker_authorize(uint64_t id, const char *pin);
|
|
|
|
|
2024-01-07 00:00:18 +01:00
|
|
|
int
|
2024-01-07 23:12:03 +01:00
|
|
|
player_speaker_format_set(uint64_t id, enum media_format format);
|
2024-01-07 00:00:18 +01:00
|
|
|
|
2023-05-06 01:00:22 +02:00
|
|
|
int
|
2024-01-07 23:12:03 +01:00
|
|
|
player_streaming_register(int *audio_fd, int *metadata_fd, enum media_format format, struct media_quality quality);
|
2023-05-06 01:00:22 +02:00
|
|
|
|
|
|
|
int
|
|
|
|
player_streaming_deregister(int id);
|
|
|
|
|
2010-04-04 12:43:15 +02:00
|
|
|
int
|
2017-01-15 23:23:36 +01:00
|
|
|
player_playback_start(void);
|
2010-04-04 12:43:15 +02:00
|
|
|
|
2014-12-21 20:41:44 +01:00
|
|
|
int
|
2016-11-08 21:27:38 +01:00
|
|
|
player_playback_start_byitem(struct db_queue_item *queue_item);
|
2014-12-21 20:41:44 +01:00
|
|
|
|
2017-02-08 22:25:20 +01:00
|
|
|
int
|
|
|
|
player_playback_start_byid(uint32_t id);
|
|
|
|
|
2010-04-04 12:43:15 +02:00
|
|
|
int
|
|
|
|
player_playback_stop(void);
|
|
|
|
|
|
|
|
int
|
|
|
|
player_playback_pause(void);
|
|
|
|
|
2021-03-07 14:02:23 +01:00
|
|
|
int
|
|
|
|
player_playback_flush(void);
|
|
|
|
|
2010-04-04 12:43:15 +02:00
|
|
|
int
|
2019-09-22 09:18:53 +02:00
|
|
|
player_playback_seek(int seek_ms, enum player_seek_mode seek_mode);
|
2019-09-01 08:50:32 +02:00
|
|
|
|
2010-04-04 12:43:15 +02:00
|
|
|
int
|
|
|
|
player_playback_next(void);
|
|
|
|
|
|
|
|
int
|
|
|
|
player_playback_prev(void);
|
|
|
|
|
|
|
|
int
|
|
|
|
player_volume_set(int vol);
|
|
|
|
|
2010-11-19 22:51:46 +01:00
|
|
|
int
|
|
|
|
player_volume_setrel_speaker(uint64_t id, int relvol);
|
|
|
|
|
|
|
|
int
|
|
|
|
player_volume_setabs_speaker(uint64_t id, int vol);
|
|
|
|
|
2018-05-27 01:42:39 +02:00
|
|
|
int
|
2021-05-25 23:39:11 +02:00
|
|
|
player_volume_setraw_speaker(uint64_t id, const char *volstr);
|
2018-05-27 01:42:39 +02:00
|
|
|
|
2010-04-04 12:43:15 +02:00
|
|
|
int
|
|
|
|
player_repeat_set(enum repeat_mode mode);
|
|
|
|
|
|
|
|
int
|
|
|
|
player_shuffle_set(int enable);
|
|
|
|
|
2016-10-23 10:16:04 +02:00
|
|
|
int
|
|
|
|
player_consume_set(int enable);
|
|
|
|
|
2014-05-17 14:06:50 +02:00
|
|
|
void
|
2015-08-08 18:02:49 +02:00
|
|
|
player_queue_clear_history(void);
|
2014-05-17 14:06:50 +02:00
|
|
|
|
2010-07-31 12:30:51 +02:00
|
|
|
void
|
|
|
|
player_queue_plid(uint32_t plid);
|
|
|
|
|
2017-07-06 22:13:04 +02:00
|
|
|
struct player_history *
|
|
|
|
player_history_get(void);
|
|
|
|
|
2016-01-24 01:14:07 +01:00
|
|
|
int
|
|
|
|
player_device_add(void *device);
|
|
|
|
|
|
|
|
int
|
|
|
|
player_device_remove(void *device);
|
2015-08-08 18:02:49 +02:00
|
|
|
|
2017-06-19 21:52:01 +02:00
|
|
|
void
|
|
|
|
player_raop_verification_kickoff(char **arglist);
|
|
|
|
|
2019-02-12 21:25:27 +01:00
|
|
|
const char *
|
|
|
|
player_pmap(void *p);
|
|
|
|
|
2010-04-04 12:43:15 +02:00
|
|
|
int
|
|
|
|
player_init(void);
|
|
|
|
|
|
|
|
void
|
|
|
|
player_deinit(void);
|
|
|
|
|
|
|
|
#endif /* !__PLAYER_H__ */
|