YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.openhome.OhQueue Class Reference

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...

Collaboration diagram for de.yaacc.openhome.OhQueue:
Collaboration graph

Classes

class  Entry
 One track of the queue.
 

Public Member Functions

 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 ()
 

Static Public Attributes

static final int DEFAULT_TRACKS_MAX = 1000
 
static final int MAX_URI_LENGTH = 4096
 
static final int MAX_METADATA_LENGTH = 16384
 
static final int MAX_TOTAL_LENGTH = 4_000_000
 The most characters of all addresses and metadata together: the queue lives in the memory of the phone.
 

Detailed Description

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.

Member Function Documentation

◆ delete()

synchronized void de.yaacc.openhome.OhQueue.delete ( long id)
Exceptions
OhError800 if the id is not in the queue

◆ idAt()

synchronized long de.yaacc.openhome.OhQueue.idAt ( int index)
Exceptions
OhError802 if there is no track at the position

Referenced by de.yaacc.upnp.server.openhome.OpenHomeRenderer.trackDeleted().

Here is the caller graph for this function:

◆ indexOf()

synchronized int de.yaacc.openhome.OhQueue.indexOf ( long id)
Returns
the position of the track, -1 if it is not in the queue

Referenced by de.yaacc.openhome.OhQueue.insert(), de.yaacc.openhome.OhQueue.move(), and de.yaacc.upnp.server.openhome.OpenHomeRenderer.seekToTrack().

Here is the caller graph for this function:

◆ insert()

synchronized long de.yaacc.openhome.OhQueue.insert ( long afterId,
String uri,
String metadata )

Puts a track into the queue.

Parameters
afterIdthe track it follows, OhIds#NONE for the start of the queue
urithe address; not empty, at most MAX_URI_LENGTH characters
metadatathe DIDL-Lite text of the track; may be empty, at most MAX_METADATA_LENGTH characters
Returns
the id of the new track
Exceptions
OhError800 if afterId is not in the queue, 801 if the queue is full, 402 for an address or metadata that is empty or too long
Here is the call graph for this function:

◆ move()

synchronized void de.yaacc.openhome.OhQueue.move ( long id,
long afterId )

Moves a track to the place behind another one; the id stays.

Parameters
afterIdthe track it follows, OhIds#NONE for the start of the queue
Exceptions
OhError800 if one of the ids is not in the queue
Here is the call graph for this function:

◆ read()

synchronized Entry de.yaacc.openhome.OhQueue.read ( long id)
Exceptions
OhError800 if the id is not in the queue

The documentation for this class was generated from the following file: