DSWaitEndOfStream

Waits for end of stream

Synopsis

int32 DSWaitEndOfStream (Item msgItem, DSRequestMsgPtr reqMsg, DSStreamCBPtr streamCBPtr)

Description

Waits for the DataStreamer to reach the end of the stream. The DataStreamer checks each chunk of stream data for an end of stream marker. When one is detected, the DataStreamer issues an end of stream message to all threads that have requested one. DSWaitEndOfStream() requests an end of stream message from the DataStreamer.

DSWaitEndOfStream() also needs to be called after an EOS message has been received if the application wishes to receive further notification. The EOS message gets replied to when DSStopStream() is called, so DSWaitEndOfStream() should be called before DSStartStream()

The value of reqMsg determines whether or not DSWaitEndOfStream() returns immediately or waits for the end of stream message. If reqMsg specifies a request message, DSWaitEndOfStream() requests an asynchronous notification that the DataStreamer has reached the end of the stream. If reqMsg is NULL, however, DSWaitEndOfStream() will not return until the DataStreamer has reached the end of the stream.

Arguments

msgItem
Item of the request message
reqMsg
Pointer to the DSRequestMsg message that is formatted and sent to the DataStreamer. A value of NULL forces creation of an internal DSRequestMsg message and synchronous operation.
streamCBPtr
Pointer to the stream context block

Messages

The members of reqMsg are set to the following values:

whatToDo
kDSOpWaitEndOfStream

Return Value

Value
Error Condition
0
None
These values are returned if the DataStreamer encounters an error while processing the message request:

kDSInvalidDSRequest
Invalid message (whatToDo set to invalid value)
kDSNoReplyPortErr
Could not locate item of the reply port
-1
Could not locate pointer to msgItem
(Portfolio error code)
SendMsg() or WaitPort() failed
The DataStreamer checks the validity of messages only if message checking is enabled when the DataStreamer is compiled (if the VALIDATE_REQUEST_CODE symbol is enabled).

See "Error Messages" in the 3DO Portfolio Reference Manual for a listing of error messages returned by SendMsg() and WaitPort().

Associated Files

DataStreamLib.h