mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-28 05:04:16 -05:00
[input] Adapt input_buffer so it can handle dynamic quality (sample rates etc)
Still WIP, player and outputs cannot handle this yet
This commit is contained in:
20
src/input.h
20
src/input.h
@@ -29,6 +29,8 @@ enum input_flags
|
||||
INPUT_FLAG_ERROR = (1 << 2),
|
||||
// Flags possible new stream metadata
|
||||
INPUT_FLAG_METADATA = (1 << 3),
|
||||
// Flags new stream quality
|
||||
INPUT_FLAG_QUALITY = (1 << 4),
|
||||
};
|
||||
|
||||
struct player_source
|
||||
@@ -81,6 +83,13 @@ struct player_source
|
||||
|
||||
typedef int (*input_cb)(void);
|
||||
|
||||
struct input_quality
|
||||
{
|
||||
int sample_rate;
|
||||
int bits_per_sample;
|
||||
// Maybe some day also add channels here
|
||||
};
|
||||
|
||||
struct input_metadata
|
||||
{
|
||||
uint32_t item_id;
|
||||
@@ -146,14 +155,13 @@ int input_loop_break;
|
||||
* until the write can be made (unless INPUT_FILE_NONBLOCK is set).
|
||||
*
|
||||
* @in evbuf Raw PCM_LE audio data to write
|
||||
* @in evbuf Sample rate of the data
|
||||
* @in evbuf Bits per sample (typically 16 or 24)
|
||||
* @in evbuf Quality of the PCM (sample rate etc.)
|
||||
* @in flags One or more INPUT_FLAG_*
|
||||
* @return 0 on success, EAGAIN if buffer was full (and _NONBLOCK is set),
|
||||
* -1 on error
|
||||
*/
|
||||
int
|
||||
input_write(struct evbuffer *evbuf, int sample_rate, int bits_per_sample, short flags);
|
||||
input_write(struct evbuffer *evbuf, struct input_quality *quality, short flags);
|
||||
|
||||
/*
|
||||
* Input modules can use this to wait in the playback loop (like input_write()
|
||||
@@ -224,6 +232,12 @@ input_seek(struct player_source *ps, int seek_ms);
|
||||
void
|
||||
input_flush(short *flags);
|
||||
|
||||
/*
|
||||
* Returns the current quality of data returned by intput_read().
|
||||
*/
|
||||
int
|
||||
input_quality_get(struct input_quality *quality);
|
||||
|
||||
/*
|
||||
* Gets metadata from the input, returns 0 if metadata is set, otherwise -1
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user