[player] Use input progress metadata to update clients

Before, we were ignoring progress metadata, and we were also updating clients
and db too early with input metadata (right when read from the input, instead of
waiting until playback (speakers) were at that position.

This change adds a complicated async chain of events from when the update is
received.
This commit is contained in:
ejurgensen
2020-05-11 17:41:08 +02:00
parent 68022d5c10
commit e570cbdcbd
3 changed files with 253 additions and 78 deletions

View File

@@ -74,9 +74,12 @@ struct input_metadata
// queue_item id
uint32_t item_id;
// Input can override the default player progress by setting this
// FIXME only implemented for Airplay speakers currently
uint32_t pos_ms;
// Input can override the default player progress by setting this. For the
// other fields the receiver can check whether an update happened by checking
// if it is non-zero/null, but not for pos_ms since 0 and even negative values
// are valid.
bool pos_is_updated;
int32_t pos_ms;
// Sets new song length (input will also update queue_item)
uint32_t len_ms;
@@ -87,9 +90,6 @@ struct input_metadata
char *album;
char *genre;
char *artwork_url;
// Indicates whether we are starting playback. Just passed on to output.
int startup;
};
struct input_definition
@@ -219,7 +219,7 @@ void
input_flush(short *flags);
/*
* Free the entire struct
* Free input_metadata
*/
void
input_metadata_free(struct input_metadata *metadata, int content_only);