AudioScience HPI Version_4.24.1
Functions

Output Stream

Streams

The following section describes the states a stream uses. More...

Functions

hpi_err_t HPI_OutStreamOpen (const hpi_hsubsys_t *phSubSys, uint16_t wAdapterIndex, uint16_t wOutStreamIndex, hpi_handle_t *phOutStream)
 Open and initializes an output stream.
hpi_err_t HPI_OutStreamClose (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream)
 Closes an output stream and deallocates host buffers if they are being used.
hpi_err_t HPI_OutStreamGetInfoEx (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, uint16_t *pwState, uint32_t *pdwBufferSize, uint32_t *pdwDataToPlay, uint32_t *pdwSamplesPlayed, uint32_t *pdwAuxiliaryDataToPlay)
 Get information about attributes and state of output stream.
hpi_err_t HPI_OutStreamWriteBuf (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, const uint8_t *pbData, uint32_t dwBytesToWrite, const struct hpi_format *pFormat)
 Writes a block of audio data to the specified output stream.
hpi_err_t HPI_OutStreamStart (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream)
 Starts an output stream playing audio data.
hpi_err_t HPI_OutStreamWaitStart (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream)
 Sets an output stream to WAIT state, ready for inter-card syncing.
hpi_err_t HPI_OutStreamStop (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream)
 Stops an output stream playing audio data.
hpi_err_t HPI_OutStreamReset (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream)
 Clears the audio data buffer of an output stream.
hpi_err_t HPI_OutStreamQueryFormat (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, struct hpi_format *pFormat)
 Queries an OutStream to see whether it supports a certain audio format, described in pFormat.
hpi_err_t HPI_OutStreamSetFormat (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, struct hpi_format *pFormat)
 Sets an OutStream to a certain audio format, described in pFormat.
hpi_err_t HPI_OutStreamSetVelocity (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, short nVelocity)
 Sets the playback velocity for scrubbing.
hpi_err_t HPI_OutStreamAncillaryReset (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, uint16_t wMode)
 Resets MPEG ancillary data extraction.
hpi_err_t HPI_OutStreamAncillaryGetInfo (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, uint32_t *pdwFramesAvailable)
 Returns information about the Ancillary stream.
hpi_err_t HPI_OutStreamAncillaryRead (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, struct hpi_anc_frame *pAncFrameBuffer, uint32_t dwAncFrameBufferSizeInBytes, uint32_t dwNumberOfAncillaryFramesToRead)
 Reads frames of ancillary data from a stream's ancillary data buffer to pdwBuffer.
hpi_err_t HPI_OutStreamSetTimeScale (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, uint32_t dwTimeScale)
 Sets the playback timescale with pitch and content preservation.
hpi_err_t HPI_OutStreamHostBufferAllocate (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, uint32_t dwSizeInBytes)
 Allocates a buffer inside the driver for bus mastering transfers.
hpi_err_t HPI_OutStreamHostBufferFree (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream)
 Free any buffers allocated by HPI_OutStreamHostBufferAllocate().
hpi_err_t HPI_OutStreamGroupAdd (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, hpi_handle_t hStream)
 This function adds a stream to a group of streams.
hpi_err_t HPI_OutStreamGroupGetMap (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, uint32_t *pdwOutStreamMap, uint32_t *pdwInStreamMap)
 This function returns information about the streams that form a group.
hpi_err_t HPI_OutStreamGroupReset (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream)
 Resets stream grouping information for a given out stream.
hpi_err_t HPI_OutStreamWait (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, uint32_t dwThresholdBytes)
 Returns when the output stream hits the threshold.
hpi_err_t HPI_OutStreamGetTimestamp (const hpi_hsubsys_t *phSubSys, hpi_handle_t hOutStream, uint32_t *pdwSample, uint32_t *pdwNanosPerSample, int64_t *pqwTimestamp)
 Returns the timestamp from the last stream update.

Detailed Description

The following section describes the states a stream uses.

outstream_states.png

The state HPI_STATE_DRAINED indicates that the stream has run out of decoded data.

This can happen for two reasons:
Intentionally, when the end of the currently playing audio is reached.
A transient error condition when the adapter DSP was unable to decode audio fast enough.

The dwDataToPlay count returned from HPI_OutStreamGetInfoEx() measures the amount of encoded data (MPEG, PCM, etc.) in the stream's buffer. When there is less than a whole frame of encoded data left, it cannot be decoded for mixing and output. It is possible that HPI_OutStreamGetInfoEx() indicates that there is still a small amount of data to play, but the stream enters the DRAINED state, and the amount of data to play never gets to zero.

The size of a frame varies depending on the audio format. Compressed formats such as MPEG require whole frames of data in order to decode audio. The size of the input frame depends on the samplerate and bitrate (e.g. MPEG frame_bytes = bitrate/8 * 1152/samplerate).

AudioScience's implementation of PCM decoding also requires a minimum amount of input data. ASI4xxx adapters require 4608 bytes, whereas ASI6xxx adapters require 1536 bytes for stereo, half this for mono.

Conservative conditions to detect end of play:

Input data requirements for different algorithms.

BytesPCM-16MP1MP2 MP3

AC-2

AX4608<3456<3456-380
AX44608<3456<34563456-
AX61536<=700<=7001100380

Function Documentation

hpi_err_t HPI_OutStreamOpen ( const hpi_hsubsys_t *  phSubSys,
uint16_t  wAdapterIndex,
uint16_t  wOutStreamIndex,
hpi_handle_t phOutStream 
)

Open and initializes an output stream.

The handle is used for all future calls to that OutStream. An output stream may only be open by only one application at a time.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
wAdapterIndexIndex of adapter to be opened. Ranges from 0 to 15 and corresponds to the Adapter Index set on the adapter hardware.
wOutStreamIndexIndex of the OutStream to be opened. Ranges from 0 to wNumOutStreams-1 (returned by HPI_AdapterGetInfo()).
phOutStreamReturned Handle to the OutStream.

References HPI_IndexesToHandle().

hpi_err_t HPI_OutStreamClose ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream 
)

Closes an output stream and deallocates host buffers if they are being used.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle of the OutStream to close.
hpi_err_t HPI_OutStreamGetInfoEx ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
uint16_t *  pwState,
uint32_t *  pdwBufferSize,
uint32_t *  pdwDataToPlay,
uint32_t *  pdwSamplesPlayed,
uint32_t *  pdwAuxiliaryDataToPlay 
)

Get information about attributes and state of output stream.

This is similar to HPI_OutStreamGetInfo() but returns extended information including the size of the streams buffer in pdwBufferSize. It also returns whether the stream is currently playing (the state) and the amount of audio data left to play.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to opened OutStream.
pwStateState of stream, one of the HPI_STREAM_STATES
pdwBufferSizeSize (in bytes) of stream data buffer.
pdwDataToPlayBytes left in the buffer to play.
pdwSamplesPlayedThe SamplesPlayed parameter returns the number of samples played since the last HPI_OutStreamReset command was issued. It reflects the number of stereo samples for a stereo stream and the number of mono samples for a mono stream. This means that if a 44.1kHz stereo and mono stream were both playing they would both return SamplesPlayed=44100 after 1 second.
pdwAuxiliaryDataToPlayAuxiliaryDataToPlay is only relevant when BBM is active (see HPI_OutStreamHostBufferAllocate). In this case DataToPlay refers to the host side buffer state while AuxiliaryDataToPlay refers to the data remaining in the card's own buffers.
hpi_err_t HPI_OutStreamWriteBuf ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
const uint8_t *  pbData,
uint32_t  dwBytesToWrite,
const struct hpi_format pFormat 
)

Writes a block of audio data to the specified output stream.

dwBytesToWrite bytes are copied from *pbData array to the output stream hardware. On return the memory used to hold that data may be reused.

A different format will only be accepted in the first write after the stream is opened or reset.

The size of the data block that may be written is limited to half the size of the streams internal data buffer (specified by dwBufferSize returned by HPI_OutStreamGetInfo()).

outstream_buf.png
err = HPI_FormatCreate(
                        &hpiFormat,
                        2,                 // stereo channel
                        HPI_FORMAT_MPEG_L2,// MPEG Layer II
                        44100L,            //sample rate
                        128000L,           //128k bits/sec
                        0                  // no attributes
                        );

err = HPI_OutStreamWriteBuf(phSubSys, hOutStream, &aData, dwBytes, &hpiFormat);
Returns:
0 on success, or one of the HPI_ERROR_CODES.
Return values:
0The data was written to the stream
HPI_INVALID_DATASIZEtried to write more data than buffer space available - no data was written
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to opened OutStream.
pbDataPointer to buffer containing data to be written to the playback buffer.
dwBytesToWriteNumber of bytes to write, must be <= space available.
pFormatFormat of the data (compression,channels,samplerate)
hpi_err_t HPI_OutStreamStart ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream 
)

Starts an output stream playing audio data.

Data is taken from the circular buffer on the adapter hardware that has already been partially filled by HPI_OutStreamWrite commands. Audio is played from the current position in the buffer (which may be reset using HPI_OutStreamReset()).

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
hpi_err_t HPI_OutStreamWaitStart ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream 
)

Sets an output stream to WAIT state, ready for inter-card syncing.

Only adapters with inter-card sync headers support this function. This function should be called on each adapter before issueing an HPI_OutStreamStart() call. This function supports grouped streams.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
hpi_err_t HPI_OutStreamStop ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream 
)

Stops an output stream playing audio data.

The audio data buffer is not cleared, so a subsequent OutStreamStart will resume playing at the position in the buffer where the playback had been stopped.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
hpi_err_t HPI_OutStreamReset ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream 
)

Clears the audio data buffer of an output stream.

If the stream was playing at the time, it will be stopped.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
hpi_err_t HPI_OutStreamQueryFormat ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
struct hpi_format pFormat 
)

Queries an OutStream to see whether it supports a certain audio format, described in pFormat.

The result, returned in the error code, is 0 if supported and HPI_ERROR_INVALID_FORMAT if not supported.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Return values:
HPI_ERROR_INVALID_FORMATif the format is not supported.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
pFormatFormat to query.
hpi_err_t HPI_OutStreamSetFormat ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
struct hpi_format pFormat 
)

Sets an OutStream to a certain audio format, described in pFormat.

The result, returned in the error code, is 0 if the call succeeded and HPI_ERROR_INVALID_FORMAT if not supported.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Return values:
HPI_ERROR_INVALID_FORMATif the format is not supported.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
pFormatFormat to set, created using HPI_FormatCreate().
hpi_err_t HPI_OutStreamSetVelocity ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
short  nVelocity 
)

Sets the playback velocity for scrubbing.

Velocity range is +/- 4.0. nVelocity is set by

nVelocity = (uint16_t)(fVelocity * HPI_VELOCITY_UNITS);

where fVelocity is a floating point number in the range of -4.0 to +4.0. This call puts the stream in "scrub" mode. The first call to HPI_OutStreamSetVelocity() should be made while the stream is reset so that scrubbing can be performed after starting playback.

Note:
This functionality is only available on the ASI4300 series adapters.

Call sequence

A typical playback call sequence without scrubbing is:

Write
Write
Start
Write
.....

Stop

A typical playback sequence with scrubbing is:

Write
Write
SetVelocity
Start
Write
SetVelocity
.....

Stop - automatically turns of velocity/scrub mode.

Data flow

The scrubbing approach taken here is to decode audio to a "scrub buffer" that contains many seconds of PCM that can be traversed in at a variable rate.

outstream_scrub.png

Forward scrubbing does not have any limitations whatsoever, apart from the maximum speed, as specified by HPI_OutStreamSetVelocity().

Reverse scrubbing operates under the following constraints:
1) The user may not scrub on audio prior to the HPI_OutStreamStart() data point.
2) The user may not reverse scrub further than -10 seconds from the forward most scrub position.
If either of these constraints is broken, the stream state will return HPI_STATE_DRAINED and audio playback will cease. The user can then forward scrub again after this error condition.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
nVelocityThe velocity in units HPI_VELOCITY_UNITS.
hpi_err_t HPI_OutStreamAncillaryReset ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
uint16_t  wMode 
)

Resets MPEG ancillary data extraction.

Initializes the MPEG Layer II / III Ancillary data channel to support the extraction of wBytesPerFrame bytes from the MPEG bitstream.

Note:
This call must be made after HPI_OutStreamOpen() or HPI_OutStreamReset() and before the first HPI_OutStreamWrite() call.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamOutStream handle
wModeOne of the HPI_MPEG_ANC_MODES The mode for the ancillary data extraction to operate in. Valid settings are HPI_MPEG_ANC_RAW and HPI_MPEG_ANC_HASENERGY. The "RAW" mode indicates that the entire ancillary data field is taken up by data from the Anc data buffer. The "HASENERGY" option tells the decoder that the MPEG frames have energy information stored in them (5 bytes per stereo frame, 3 per mono).
Returns:
0 on success, or one of the HPI_ERROR_CODES.
hpi_err_t HPI_OutStreamAncillaryGetInfo ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
uint32_t *  pdwFramesAvailable 
)

Returns information about the Ancillary stream.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
pdwFramesAvailableNumber of HPI_ANC_FRAMEs in the hardware buffer available for reading.
hpi_err_t HPI_OutStreamAncillaryRead ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
struct hpi_anc_frame *  pAncFrameBuffer,
uint32_t  dwAncFrameBufferSizeInBytes,
uint32_t  dwNumberOfAncillaryFramesToRead 
)

Reads frames of ancillary data from a stream's ancillary data buffer to pdwBuffer.

Note that in the situation where energy level information is embedded in the ancillary data stream along with ancillary data, only the ancillary data will be returned in the ancillary data buffer.

Bytes are filled in the bData[] array of the struct hpi_anc_frame structures in the following order:

The first bit of ancillary information that follows the valid audio data is placed in bit 7 of bData[0]. The first 8 bits of ancillary information following valid audio data are all placed in bData[0]. In the case where there are 6 bytes total of ancillary information (48 bits) the last byte filled is bData[5].

Note:
If OutStreamAncillaryReset() was called with mode=HPI_MPEG_ANC_RAW, the ancillary data in its entirety is placed in the AncFrameBuffer, so if the file was recorded with energy information in the ancillary data field, the energy information will be included in the extracted ancillary data.
If OutStreamAncillaryReset() was called with mode=HPI_MPEG_ANC_HASENERGY, the ancillary data minus the energy information is placed in the AncFrameBuffer.
Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
pAncFrameBufferA pointer to a buffer where the read Ancillary data frames should be placed.
dwAncFrameBufferSizeInBytesThe size of the Ancillary data buffer in bytes (used for a sanity check).
dwNumberOfAncillaryFramesToReadHow many frames to read.

References HPI_ERROR_INVALID_DATASIZE.

hpi_err_t HPI_OutStreamSetTimeScale ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
uint32_t  dwTimeScale 
)

Sets the playback timescale with pitch and content preservation.

Range is 0.8-1.2 ( to 120%) of original time.
dwTimeScale in set by:

dwTimeScale = (uint32_t)(fTimeScale * HPI_OSTREAM_TIMESCALE_UNITS);

where fTimeScale in a floating point number in the range of 0.8 < fTimeScale < 1.2. The actual granularity of this setting is 1 / 2048 or approximately 0.05% (approx 5 HPI_OSTREAM_TIMESCALE_UNITS).

The first call to HPI_OutStreamSetTimeScale should be made while the stream is reset so that time scaling can be performed after starting playback. Subsequent calls to HPI_OutStreamSetTimeScale can be made when the stream is playing to modify the timescale factor.

If the desired timescale factor is not known at stream reset time, the timescale should be set to HPI_OSTREAM_TIMESCALE_PASSTHROUGH. This turns on timescaling, but in passthrough mode. ie no scaling takes place. After OStream buffer preload, the timescale value may be updated with the desired scale facter.

Note:
This functionality is only available on ASI6000 series adapters.
Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
dwTimeScaleThe time scale in units of HPI_OSTREAM_TIMESCALE_UNITS.
hpi_err_t HPI_OutStreamHostBufferAllocate ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
uint32_t  dwSizeInBytes 
)

Allocates a buffer inside the driver for bus mastering transfers.

Once the buffer is allocated, OutStream data will be transferred from it in the background (rather than the application having to wait for the transfer).

This function is provided so that the application can match the size of its transfers to the size of the buffer.

After a call to HPI_OutStreamHostBufferAllocate(), HPI_OutStreamGetInfoEx() returns the size and data available in host buffer rather than the buffers on the adapter. However, while there is space in the adapter buffers, data will be quickly transferred to the adapter, providing additional buffering against delays in sending more audio data.

Note:
There is a minimum buffer size that will work with a given audio format and polling rate. An appropriate size for the buffer can be calculated using HPI_StreamEstimateBufferSize().

If an error occurs or the adapter doesn't support host buffering then no buffer is allocated. Stream transfers still take place using foreground transfers (all drivers pre 2004). Performance will be relatively worse.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Return values:
HPI_ERROR_INVALID_DATASIZEmemory can't be allocated (retrying the call with a smaller size may succeed)
HPI_ERROR_INVALID_FUNCthe adapter doesn't support busmastering
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
dwSizeInBytesBuffer size in bytes to allocate.
hpi_err_t HPI_OutStreamHostBufferFree ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream 
)

Free any buffers allocated by HPI_OutStreamHostBufferAllocate().

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
hpi_err_t HPI_OutStreamGroupAdd ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
hpi_handle_t  hStream 
)

This function adds a stream to a group of streams.

Stream groups are used to synchronise starting and stopping of multiple streams at once. The application of this is to support playing (or recording) multiple streams at once, enabling multi-channel recording and playback.

When using the "Group" functions all streams that are to be grouped together should be opened. One of the streams should be selected to be the master stream and the other streams should be added to it's group. Both in streams and out streams can be added to the same group. Once a group has been formed, HPI_OutStreamStart() called on the master will cause all streams to start at once.

Note:
This function is only supported on on ASI6000 and ASI5000 adapters.
Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
hStreamHandle to an In or Out Stream

References HPI_ERROR_INVALID_OBJ, and HPI_ERROR_NO_INTERADAPTER_GROUPS.

hpi_err_t HPI_OutStreamGroupGetMap ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
uint32_t *  pdwOutStreamMap,
uint32_t *  pdwInStreamMap 
)

This function returns information about the streams that form a group.

Given an out stream handle, it returns a bit mapped representation of which streams belong to the group.

Note:
This function is only supported on on ASI6000 and ASI5000 adapters.
Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
pdwOutStreamMapBitmapped representation of OutStreams grouped with this output stream. b0 represents OutStream 0, b1 OutStream 1, b2 OutStream 2 etc.
pdwInStreamMapBitmapped representation of InStreams grouped with this output stream. b0 represents InStream 0, b1 InStream 1, b2 InStream 2 etc.
hpi_err_t HPI_OutStreamGroupReset ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream 
)

Resets stream grouping information for a given out stream.

Note:
This function is only supported on on ASI6000 and ASI5000 adapters.
Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
hpi_err_t HPI_OutStreamWait ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
uint32_t  dwThresholdBytes 
)

Returns when the output stream hits the threshold.

This function will block in the driver until the count of bytes in the player buffer (BBM buffer plus on adapter) falls at or below the specified threshold. This should be called from a background thread.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamHandle to OutStream.
dwThresholdBytesThreshold
hpi_err_t HPI_OutStreamGetTimestamp ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hOutStream,
uint32_t *  pdwSample,
uint32_t *  pdwNanosPerSample,
int64_t *  pqwTimestamp 
)

Returns the timestamp from the last stream update.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hOutStreamOutStream handle
pdwSampleSample
pdwNanosPerSampleNanoseconds Per Sample
pqwTimestampTimestamp