Developer

API Reference

IAStream

Brew Release
Brew MP 1.0.2
See Also
IBase
Description

The IAStream Interface reads data from an asynchronous stream. It is an abstract interface implemented by classes providing access to data that may not all be available at once and must be retrieved asynchronously. At present, the IFile and ISocket classes implement the IAStream Interface. The IImage Interface and ISoundPlayer Interface implement IImage_SetStream() and ISOUNDPLAYER_SetStream() functions that allow an IAStream Interface to be supplied as the source of image or sound input.
IASTREAM_Read() reads data from the stream and returns the number of bytes read. If no data is available for reading, this function returns the value AEE_STREAM_WOULDBLOCK. In the latter case, call IASTREAM_Readable() to schedule a callback function that is invoked when there is more data available. IASTREAM_Cancel() cancels a callback that was scheduled with IASTREAM_Readable().

To use an IAStream instance to retrieve data asynchronously

1. Call ISHELL_CreateInstance() to create an instance of a class that implements the IAStream interface.
2. Call IASTREAM_Read() to read the required number of bytes of data from the stream. Because IAStream Interface is an abstract interface, call IFILE_Read() for files, or ISOCKET_Read() for sockets.
3. If IASTREAM_Read() returns AEE_STREAM_WOULDBLOCK, call IASTREAM_Readable() to schedule a callback to try again later.
4. If IASTREAM_Read() reads fewer than the required number of bytes, call the function again to read the remaining data.
5. Repeat steps 2-4 until all the data has been received on the stream.

To use an asynchronous stream as the source of image or sound data

1. Call ISHELL_CreateInstance() to create an instance of a class that implements the IAStream Interface.
2. Call ISHELL_CreateInstance() to create an instance of IImage Interface or ISoundPlayer Interface.
3. Call IImage_Notify() or ISOUNDPLAYER_RegisterNotify() to schedule a callback that is invoked when the image or sound data has been completely retrieved.
4. Call IImage_SetStream() or ISOUNDPLAYER_SetStream() to associate the stream created in step 1 with the IImage or ISoundPlayer instance created in step 2. This initiates the retrieval of image or sound data on the stream.
5. When retrieval is complete, the callback registered in step 3 is invoked. Use functions in the IImage Interface or the ISoundPlayer Interface to access the retrieved image or sound data.
The following header file is required:
AEE.h

Usage
See Description
  • Follow