From OpenHome
Contents |
Songcast Direct
Overview
Songcast Direct (SCD) can be used to send decoded audio from any computing device to an OpenHome device. The Sender device is responsible for decoding audio to PCM, framing this in a simple protocol and making it available via a simple TCP server. The Receiver pulls data from this server, giving the Receiver complete control of the audio clock.
A Songcast Direct sender performs a broadly similar role to a Songcast sender. Applications that perform their own decoding to PCM will find SCD is easier to integrate and offers higher audio performance:
- There is a constant TCP connection between sender and receiver, avoiding the need for application-level resend support
- It uses the clock of the receiver, allowing for higher quality playback if the sender is on a desktop computer
- It offers the receiver limited control over the stream – initially seeking within a track or skipping between tracks. While the primary control UI may reside on the sender device, this allows for integration with any Ir handset for the receiver.
Sample Code
Sample code exists for all key aspects of the Sender – server, framing and control.
Discovery
SSDP
First search for av-openhome-org:service:Product:2 then either
- Check Attributes on Product service for "Transport"
- Check Modes on Transport service for "scd"
mDNS
Search for _openhome._odp service to identify ODP endpoint
Control
Control of the Receiver is out of band, via the standard OpenHome network APIs. These are available over UPnP or ODP (a single connected socket).
Protocol
The protocol used for communication between Sender and Receiver contains the following message types:
Type | Description | Sent by |
---|---|---|
Ready | Signals availability and version support to other party | Receiver & Sender |
MetadataDidl | Metadata relevant until the end of the next track. Will cause the receiver to reset its reported time indicator for the audio stream. Should be sent after all Audio for any preceding track. Uses DIDL-Lite. | Sender |
MetadataOh | Metadata relevant until the end of the next track. Will cause the receiver to reset its reported time indicator for the audio stream. Should be sent after all Audio for any preceding track. Uses OpenHome Metadata format. | Sender |
Format | Format for the following audio. Must be sent before any audio. | Sender |
Audio | Decoded audio. Can only be sent after a Format message describing its sample rate etc. | Sender |
MetatextDidl | Metadata relevant to a portion of a track. May be sent [0..n] times during a track. Uses DIDL-Lite. | Sender |
MetatextOh | Metadata relevant to a portion of a track. May be sent [0..n] times during a track. Uses OpenHome Metadata format. | Sender |
Halt | Indicates that a break in audio follows. E.g. at the end of a track with no further tracks to be played, or when the Sender has paused. | Sender |
Disconnect | Indicates that the originator of the message is closing its SCD session. No further audio will be available. The message receiver should disconnect its socket. | Receiver & Sender |
Seek | Indicates that the Receiver wants to jump to a different point in the current track. Is only sent for tracks that the Sender has indicated support seeking. | Receiver |
Skip | Indicates that the Receiver wants to immediately jump to the next or previous track. | Receiver |