Documentation ¶
Overview ¶
The raop package implements a server library for AirPlay. It allows creating multiple AirPlay endpoints on a single machine for proxying sound to other systems and environments.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Sink ¶
type Sink interface { // Get the service info for the service. Info() *SinkInfo // Called when a source has connected Connected(name string) // SetCoverArt will set the cover art of the currently playing track. // May be ignored and can be disables by setting SupportsCoverArt to // false in AirplaySinkInfo. SetCoverArt(mimetype string, content []byte) // SetMetadata will set the metadata of the currently playing track. // The data is DMAP data in a JSON or XML representation. This is controlled // by setting SupportsMetadata in AirplaySinkInfo to "JSON" or "XML" SetMetadata(content string) // Set the volume of the output device. The volume value may be an absolute // value from 0 - 100, or it may be up down values using UP=1000 and DOWN=-1000 SetVolume(volume float32) // Shows the progress of the track in milliseconds. // pos is the current position, length is the total length of the current track SetProgress(pos, length int) // Called when the stream is started. Play() // Called when the stream is paused Pause() // Called when the connection to source is terminated Stopped() // Called when the sink has been closed and removed Closed() }
AirplaySink is the interface necessary to implement to act as an Airplay output device. This interface should be registered with the AirplaySinkCollection and will then be available as an airplay output.
type SinkCollection ¶
type SinkCollection struct {
// contains filtered or unexported fields
}
AirplaySinkCollection is is used to register AirplayerSink instances
func NewSinkCollection ¶
func NewSinkCollection(keyfilename string) (*SinkCollection, error)
NewAirplaySinkCollection creates a new collection to register services.
func (*SinkCollection) Close ¶
func (sc *SinkCollection) Close()
Close all services created in this registry
func (*SinkCollection) Register ¶
func (sc *SinkCollection) Register(sink Sink) (*Source, error)
Register will create and publish a new Airplay output.
func (*SinkCollection) Unregister ¶
func (sc *SinkCollection) Unregister(sink Sink)
Register will create and publish a new Airplay output.
type SinkInfo ¶
type SinkInfo struct { // If the sink wants coverart. See SetCoverArt in AirplaySink SupportsCoverArt bool // If the client wants metadata, song info, artist and track name. // Should be "XML" or "JSON", if it is "" then no metadata will be supplied. SupportsMetaData string // The name of the sink Name string // The hardware address of the sink. This is used as an identifier to avoid // identity collision and does not need to use a real hardware address. If it is // set to nil the server hardware address will be used. HardwareAddress net.HardwareAddr // The port the RAOP server should start at. Set to 0 to get an ephemeral port selected at random. Port uint16 }
AirplaySinkInfo contains data about the AirplaySink instance.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
AirplaySource can be used by the audio output to emit commands back to the source.
func (*Source) Command ¶
Command will send a DACP command to the connected source.
beginff begin fast forward beginrew begin rewind mutetoggle toggle mute status nextitem play next item in playlist previtem play previous item in playlist pause pause playback playpause toggle between play and pauses play start playback stop stop playback playresume play after fast forward or rewind shuffle_songs shuffle playlist volumedown turn audio volume down (*) volumeup turn audio volume up (*)
(*) Do not use these, this will only affect the display and the volume sent to AirplaySink. Volume control is maintained by setting the displayed volume using the Volume and VolumeMode functions of AirplaySource.
func (*Source) NewAudioStream ¶
NewAudioStream will start a new audio output stream for the source. Only raw PCM with two channel 16-bit depth at 44100 samples/second is currently supported. The parameter ctx is a context used to close the audio output. The streamed data is sent to the writer w.
func (*Source) Port ¶
Returns the port of the RAOP server. This is useful if the service was created with an ephemeral port, i.e. port==0.
func (*Source) String ¶
String returns a brief description of the service. Useful for logging and debugging.
func (*Source) Volume ¶
Volume will set the displayed volume on the source device if it is in AbsoluteMode. The vol parameters can be in range -30 to 0
func (*Source) VolumeMode ¶
VolumeMode will set the volume mode of the source device. If absolute is false then the volume changes sent to SetVolume of the AirplaySink interface will be relative, i.e. up and down volume commands. This is done by setting the volume slider on the source device to middle position and check if it is dragged right (volume up) or dragged left (volume down). Also the volume up/down buttons on the source device will send volume up/down commands to SetVolume.
If absolute is true then the volume sent to SetVolume will be in the range 0..100. and the volume slider will reflect the volume send using the Volume function in AirplaySource.