YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.snapcast.server.SnapcastServer Class Reference

The built-in Snapcast server (issue #330): the stream port with its clients, the streams with their pipelines, and the state. More...

Inheritance diagram for de.yaacc.snapcast.server.SnapcastServer:
Inheritance graph
Collaboration diagram for de.yaacc.snapcast.server.SnapcastServer:
Collaboration graph

Classes

interface  SourceFactory
 Opens the source of a stream (a tcp listener in the app; tests give their own). More...
 

Public Member Functions

 SnapcastServer (ServerState state, MicroClock clock, Predicate< InetAddress > accept, int maxClients, Consumer< List< JSONObject > > notifier)
 
void setNotifier (Consumer< List< JSONObject > > notifier)
 Where the notifications go (the control port); set once before the server runs.
 
void setSourceFactory (SourceFactory factory)
 
void setOpusEncoderFactory (OpusEncoderFactory factory)
 Makes the Opus encoder of a stream; null (the default) where the device has none: a stream with the codec opus is then refused.
 
ServerState state ()
 
MicroClock clock ()
 
synchronized void start (int port) throws IOException
 Opens the stream port (0: any free port).
 
int streamPort ()
 The port that is bound, or -1.
 
StreamPipeline addStream (String id, String uri, int sampleRate, int channels, int bitsPerSample, ChunkEncoder encoder)
 Adds a stream with its pipeline; returns the pipeline for the producer.
 
List< JSONObject > addTcpStream (StreamSpec spec)
 A stream from the control port (Stream.AddStream): its source is opened (a taken port fails at once), the stream is added.
 
List< JSONObject > removeStreamNotifying (String id)
 Stream.RemoveStream: the source is closed and the stream goes; returns the notifications for the caller to send.
 
void removeStream (String id)
 
StreamPipeline pipeline (String id)
 
void chunk (String streamId, long timestampMicros, byte[] payload)
 A chunk is ready for the clients of the stream.
 
void status (String streamId, StreamActivity.Status status)
 The stream became idle or playing.
 
void applyChange ()
 The state changed through the control port or a stream came or went: every client is brought to what the state says (its stream with the header of it, its settings).
 
StreamClientSession.Join joined (StreamClientSession session, HelloMessage hello, String ip) throws StreamClientSession.Refused
 The client said Hello.
 
void clientInfo (String clientId, int volume, boolean muted)
 
void left (StreamClientSession session)
 The session ended (once).
 
StreamClientSession sessionOf (String clientId)
 The session of a connected client (for tests and the control side), or null.
 
void close ()
 
- Public Member Functions inherited from de.yaacc.snapcast.server.StreamClientSession.Host
- Public Member Functions inherited from de.yaacc.snapcast.server.StreamPipeline.Sink

Detailed Description

The built-in Snapcast server (issue #330): the stream port with its clients, the streams with their pipelines, and the state.

The listener takes only the addresses the filter allows (never read before the check, rule S2) and at most maxClients at a time (S3). The control port, the sources and the service are separate parts that use this one.

Constructor & Destructor Documentation

◆ SnapcastServer()

de.yaacc.snapcast.server.SnapcastServer.SnapcastServer ( ServerState state,
MicroClock clock,
Predicate< InetAddress > accept,
int maxClients,
Consumer< List< JSONObject > > notifier )
Parameters
notifiergets the notifications that changes make, to send to the control connections (called without a lock of this class)

Member Function Documentation

◆ addTcpStream()

List< JSONObject > de.yaacc.snapcast.server.SnapcastServer.addTcpStream ( StreamSpec spec)

A stream from the control port (Stream.AddStream): its source is opened (a taken port fails at once), the stream is added.

Returns
the notifications of the change, for the caller to send
Here is the call graph for this function:

◆ chunk()

void de.yaacc.snapcast.server.SnapcastServer.chunk ( String streamId,
long timestampMicros,
byte[] payload )

A chunk is ready for the clients of the stream.

Implements de.yaacc.snapcast.server.StreamPipeline.Sink.

Here is the call graph for this function:

◆ clientInfo()

void de.yaacc.snapcast.server.SnapcastServer.clientInfo ( String clientId,
int volume,
boolean muted )

◆ joined()

StreamClientSession.Join de.yaacc.snapcast.server.SnapcastServer.joined ( StreamClientSession session,
HelloMessage hello,
String ip ) throws StreamClientSession.Refused

The client said Hello.

Returns what it gets first, or throws Refused to say no.

Implements de.yaacc.snapcast.server.StreamClientSession.Host.

Here is the call graph for this function:

◆ left()

void de.yaacc.snapcast.server.SnapcastServer.left ( StreamClientSession session)

The session ended (once).

Implements de.yaacc.snapcast.server.StreamClientSession.Host.

◆ status()

void de.yaacc.snapcast.server.SnapcastServer.status ( String streamId,
StreamActivity.Status status )

The stream became idle or playing.

Implements de.yaacc.snapcast.server.StreamPipeline.Sink.

Referenced by de.yaacc.snapcast.server.SnapcastServer.status().

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

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