Conceptual background


In designing a subscriber, it's useful to understand some conceptual background. This section discusses the following topics:

Buffering

Data that a subscriber needs should be delivered before it is needed. The subscriber retains this data until it is used, then returns it to the streamer so that the memory can be reused. To make the best use of memory for overall streaming throughput, a subscriber should return data buffers to the streamer as soon as possible. Data that is used repeatedly should never be kept in a stream buffer. If you load such data in a stream data block, copy it to long-term storage allocated specifically for that purpose.

The Join subscriber makes it possible to work with data that are used repeatedly. See Displaying persistent data with the Join subscriber for more information. The SCEL subscriber and the Text subscriber allow for a stream header flag that copies a specified chunk out of the stream buffer. See the Attic folder for more information.

Logical channels

Logical channels make it possible to weave several independent data tracks into the stream and deal with them independently. Most subscribers support logical channels.

For example, an application could have three logical channels for audio: a sound track, English voice-over, and French voice-over. Users should be able to select their native language, and control music output separately. Control of the channel is handled by the subscriber, and usually accessed through DSControl().

Logical channels are also helpful when you stream video into different cels. You can use a different channel for each cel, and manipulate them differently.

Control calls

The playback application has to be able to control the different subscriber threads. Control over a subscriber is generally implemented through a message API to the subscriber thread via the streamer thread. The playback application has access to this API through the DSControl() call. DSControl() messages are relayed to the subscribers by the streamer. Please see the header files and documentation for the subscriber you're interested in details on the features supported by each subscriber.