SHC_STOP - Remarks

Commands the stream handler to stop streaming data. The flags will indicate the type of stop (discard, flush, pause) initiated through SPI. The pause stop immediately pauses the stream by sending an SHC_STOP message to both the source and target stream handlers. Both stream handlers must shut down and not request any more buffers from the Sync/Stream Manager. The Sync/Stream Manager fails any get buffer requests, so that a stream handler cannot continue to stream. All stream data remains valid. The stream can be restarted by issuing SpiStartStream.

The discard stop immediately stops the stream by sending an SHC_STOP message to both the source and target stream handlers. Both stream handlers must shut down and not request any more buffers from the Sync/Stream Manager. But they must return all buffers to the Sync/Stream Manager. The Sync/Stream Manager fails any get buffer requests, so that a stream handler cannot continue to stream. All stream data is discarded. The stream can be restarted, but the data in the discarded buffers is lost.

The flush stop sends an SHC_STOP message to both the source and target stream handlers. The stream does not stop, however. The source stream handler must shut down and not request any more buffers from the Sync/Stream Manager. It must return any buffers to the Sync/Stream Manager. The Sync/Stream Manager fails any get buffer requests from the source stream handler, so that it cannot continue to fill buffers. The target stream handler continues to stream data until all buffers are empty. The stream can be restarted with no loss of data.

For discard and flush stops, the Sync/Stream Manager detects when the stream handlers have stopped and returned all buffers. At this point, the Sync/Stream Manager notifies the application media control device with an EVENT_STREAM_STOPPED message. Also, both stream handlers must return all owned buffers to the Sync/Stream Manager before the stream EVENT_STREAM_STOPPED message is sent to the application media control device.

If a stream is paused and the application issues a discard stop, the stream buffers is discarded and the stream is put in a stopped state. If a stream is paused and a flush stop is issued, the remaining stream buffers is transferred to the target stream handler. In other words, the stream begins playing again.

Slave streams can be stopped independently of the master stream. When a slave stream stops, the synchronized relationship is not broken, but the slave stream is quiesced. The master stream and any other slaves continue to stream. If the stopped slave stream is restarted, a new master-to-slave time offset is established which the slave stream maintains until it is either stopped again, or the master is stopped. This enables slave streams to regain synchronization at any asynchronous point in time, for example, in response to another stream event from the master. Slave stream time and master-stream time are not always identical. Once a slave stream is stopped, the master stream time can continue to increment. When the slave stream is restarted, its stream time increments at the same rate as the master stream. Any slave in a synchronized relationship can be arbitrarily started or stopped without affecting the activity of the master stream or any other slave stream. When the SPI_STOP_SLAVES flag is set, the master streams, as well as the slave streams stop.

Note: Typically, data streaming continues until the end of the stream. Then the Sync/Stream Manager sends an EVENT_EOS message to the application media control device's event routine. The Sync/Stream Manager detects EVENT_EOS and EVENT_STREAM_STOPPED and notifies the application. Therefore, the stream handler does not report these events to the Sync/Stream Manager.