mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-25 20:16:14 -05:00
[misc/player] Introduce output ability to announce supported formats
Also introduce default output format and selected device format, should the user want another format. As part of this, change enum player_format in player.h to enum media_format in misc.h so that it is akin to struct media_quality. Modify json API to support this.
This commit is contained in:
21
src/misc.h
21
src/misc.h
@@ -272,6 +272,21 @@ timespec_reltoabs(struct timespec relative);
|
||||
|
||||
/* ------------------------------- Media quality ---------------------------- */
|
||||
|
||||
// Bit flags for the sake of outputs announcing what they support
|
||||
enum media_format {
|
||||
MEDIA_FORMAT_UNKNOWN = 0,
|
||||
MEDIA_FORMAT_PCM = (1 << 0),
|
||||
MEDIA_FORMAT_WAV = (1 << 1),
|
||||
MEDIA_FORMAT_MP3 = (1 << 2),
|
||||
MEDIA_FORMAT_ALAC = (1 << 3),
|
||||
MEDIA_FORMAT_OPUS = (1 << 4),
|
||||
};
|
||||
|
||||
// For iteration
|
||||
#define MEDIA_FORMAT_FIRST MEDIA_FORMAT_PCM
|
||||
#define MEDIA_FORMAT_LAST MEDIA_FORMAT_OPUS
|
||||
#define MEDIA_FORMAT_NEXT(f) (f << 1)
|
||||
|
||||
// Remember to adjust quality_is_equal() if adding elements
|
||||
struct media_quality {
|
||||
int sample_rate;
|
||||
@@ -283,6 +298,12 @@ struct media_quality {
|
||||
bool
|
||||
quality_is_equal(struct media_quality *a, struct media_quality *b);
|
||||
|
||||
enum media_format
|
||||
media_format_from_string(const char *s);
|
||||
|
||||
const char *
|
||||
media_format_to_string(enum media_format format);
|
||||
|
||||
|
||||
/* -------------------------- Misc utility functions ------------------------ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user