YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.sendspin.player.SendspinPlayerHost Class Reference

This phone as a Sendspin player: it takes the connections of servers that dial the phone, one PlayerSession each, and lets one server at a time play (the one whose stream started last; the server that is displaced gets client/goodbye another_server, as the multi-server rules ask). More...

Collaboration diagram for de.yaacc.sendspin.player.SendspinPlayerHost:
Collaboration graph

Classes

interface  Engine
 An engine that plays one stream; closed when the stream ends. More...
 
interface  EngineFactory
 Makes the engine for a stream; the offsets are those of the session that plays. More...
 
interface  Listener
 
class  SessionInfo
 One connected server, for the card of this phone.
 
interface  Store
 What the player keeps between runs and what the user sees. More...
 

Public Member Functions

 SendspinPlayerHost (Identity identity, SendspinClientPairings credentials, BooleanSupplier unpairedAllowed, String name, EngineFactory engines, MicroClock micro, SecureRandom random, Store store, Listener listener)
 
 SendspinPlayerHost (Identity identity, SendspinClientPairings credentials, BooleanSupplier unpairedAllowed, java.util.function.Supplier< List< String > > codecs, String name, EngineFactory engines, MicroClock micro, SecureRandom random, Store store, Listener listener)
 
void accept (Connector.Link link)
 A server dialled the phone: its connection becomes a session.
 
void accept (Connector.Link link, boolean local)
 As accept(Connector.Link); local is true for a connection over the loopback address, which is this app's own hub playing on its own phone: it needs no pairing, whatever the setting for unpaired servers says (it is not a device on the network).
 
void setDisplayRoles (java.util.function.Supplier< List< String > > roles)
 The display roles (metadata, artwork, color) offered to servers: read for every new connection (task 11.5).
 
DisplaySnapshot displaySnapshot ()
 What the display screen shows: the state of the connection that has something to show (the first one that has a title, an image or colours), or null if no connection has display roles active.
 
void setCodePairing (ClientCodePairing pairing)
 Pairing with a code (task 11.1): the connections that come after this call offer the methods of pairing.
 
ClientCodePairing codePairing ()
 
void openPairingWindow ()
 The operator's gesture on this phone: opens the pairing window (5 minutes) and lets the connections that wait for it start their attempt.
 
String playingServerName ()
 The server that plays now, or null.
 
String playingServerId ()
 The id of the server that streams to this phone's player, or null (nothing plays, or the app's own hub does).
 
int sessionCount ()
 
de.yaacc.sendspin.client.ServerControl controlOf (String serverId)
 The controller role of the connection of the server with this id (the server uses the connection of the player for it), or null if that server is not connected to the player.
 
de.yaacc.sendspin.client.ServerControl activeControl ()
 The controller role of the server that the card of this phone controls: the one that plays to it, else any connected server (not the app's own hub) that has activated the role on the connection of the player.
 
List< SessionInfo > sessionInfos ()
 
void disconnect (int index)
 Ends the connection of the server at this position of sessionInfos().
 
void setVolumeOnPhone (int percent)
 The user set the volume on the phone: the servers are told.
 
void setMutedOnPhone (boolean mute)
 
List< String > sessionPhases ()
 The phase of every session, for a log line.
 
boolean isPlaying ()
 
int volume ()
 
boolean muted ()
 
void close ()
 Ends every session and the stream; the host takes no more connections.
 

Static Public Attributes

static final int MAX_SESSIONS = 3
 

Detailed Description

This phone as a Sendspin player: it takes the connections of servers that dial the phone, one PlayerSession each, and lets one server at a time play (the one whose stream started last; the server that is displaced gets client/goodbye another_server, as the multi-server rules ask).

The sound goes through one SendspinAudioEngine that exists while a stream plays. At most MAX_SESSIONS sessions at once. The Android parts (the output, the decoders, the threads, the service, the lock) are passed in. Thread safe: the sessions call on their own threads.

Constructor & Destructor Documentation

◆ SendspinPlayerHost()

de.yaacc.sendspin.player.SendspinPlayerHost.SendspinPlayerHost ( Identity identity,
SendspinClientPairings credentials,
BooleanSupplier unpairedAllowed,
java.util.function.Supplier< List< String > > codecs,
String name,
EngineFactory engines,
MicroClock micro,
SecureRandom random,
Store store,
Listener listener )
Parameters
codecsthe codecs to offer, in the order of the offer (pcm, flac, opus); read for every new connection
Here is the call graph for this function:

Member Function Documentation

◆ accept()

void de.yaacc.sendspin.player.SendspinPlayerHost.accept ( Connector.Link link)

A server dialled the phone: its connection becomes a session.

A connection beyond the limit is closed at once.

Referenced by de.yaacc.sendspin.player.SendspinPlayerHost.accept().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ activeControl()

de.yaacc.sendspin.client.ServerControl de.yaacc.sendspin.player.SendspinPlayerHost.activeControl ( )

The controller role of the server that the card of this phone controls: the one that plays to it, else any connected server (not the app's own hub) that has activated the role on the connection of the player.

Null if there is none.

◆ codePairing()

ClientCodePairing de.yaacc.sendspin.player.SendspinPlayerHost.codePairing ( )
Returns
the code pairing of this player, or null if it offers none

◆ controlOf()

de.yaacc.sendspin.client.ServerControl de.yaacc.sendspin.player.SendspinPlayerHost.controlOf ( String serverId)

The controller role of the connection of the server with this id (the server uses the connection of the player for it), or null if that server is not connected to the player.

Not the app's own hub.

Referenced by de.yaacc.sendspin.SendspinHub.serverControl().

Here is the caller graph for this function:

◆ displaySnapshot()

DisplaySnapshot de.yaacc.sendspin.player.SendspinPlayerHost.displaySnapshot ( )

What the display screen shows: the state of the connection that has something to show (the first one that has a title, an image or colours), or null if no connection has display roles active.

Any thread.

Here is the call graph for this function:

◆ openPairingWindow()

void de.yaacc.sendspin.player.SendspinPlayerHost.openPairingWindow ( )

The operator's gesture on this phone: opens the pairing window (5 minutes) and lets the connections that wait for it start their attempt.

A server that asks to pair with a code gets the window only through this call.

Referenced by de.yaacc.sendspin.SendspinHub.openPairingWindow().

Here is the caller graph for this function:

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