The play queue of an OpenHome playlist: tracks in an order, each with an id that is never used twice (a counter from 1; a deleted track's id does not come back soon, so a control point that still holds it cannot hit another track by mistake).
More...
|
|
| OhQueue (int tracksMax) |
| |
|
int | tracksMax () |
| |
| synchronized long | insert (long afterId, String uri, String metadata) |
| | Puts a track into the queue.
|
| |
| synchronized void | delete (long id) |
| |
| synchronized void | move (long id, long afterId) |
| | Moves a track to the place behind another one; the id stays.
|
| |
|
synchronized void | deleteAll () |
| |
| synchronized Entry | read (long id) |
| |
|
synchronized List< Entry > | readList (List< Long > ids) |
| | The tracks of the ids that are in the queue, in the order of the ids asked for; others are skipped.
|
| |
|
synchronized List< Long > | idArray () |
| |
|
synchronized long | token () |
| | A number that changes with every edit of the queue: the token of the IdArray.
|
| |
|
synchronized int | size () |
| |
| synchronized int | indexOf (long id) |
| |
| synchronized long | idAt (int index) |
| |
|
synchronized List< Entry > | snapshot () |
| |
The play queue of an OpenHome playlist: tracks in an order, each with an id that is never used twice (a counter from 1; a deleted track's id does not come back soon, so a control point that still holds it cannot hit another track by mistake).
The queue is the model only: Insert puts a track after another one (or at the start), the edits change the token(), which a control point uses to see that its copy of the IdArray is old. The limits are checked here (number of tracks, length of address and metadata), so nothing a control point sends can make the queue grow without bound. Thread safe.