// acxstreams.h
EVT_ACX_STREAM_GET_PRESENTATION_POSITION EvtAcxStreamGetPresentationPosition;
NTSTATUS EvtAcxStreamGetPresentationPosition(
ACXSTREAM Stream,
PULONGLONG PositionInBlocks,
PULONGLONG QPCPosition
)
{...}
View the official Windows Driver Kit DDI referenceNo description available.
EvtAcxStreamGetPresentationPosition tells the driver to indicate the current position along with the QPC value at the time the current position was calculated.
StreamAn ACXSTREAM object represents an audio stream created by a circuit. The stream is composed of a list of elements created based on the parent circuit's elements. For more information, see ACX - Summary of ACX Objects.
PositionInBlocksSpecifies the block offset from the start of the stream to the current post-decoded, uncompressed position in the stream. A "block" refers to the group of channels in the same sample. So, for example, in a PCM stream a block is the same as a frame. However, for compressed formats a block is a single sample within a frame. This means that for a typical MP3 stream that has 1152 samples in a frame, there are 1152 blocks.
QPCPositionSpecifies the value of the performance counter at the time that the audio driver reads the presentation position in response to the KSAUDIO_PRESENTATION_POSITION call. A driver writes to this field with the value read from calling KeQueryPerformanceCounter when a snapshot is taken of the presentation position.
Returns STATUS_SUCCESS if the call was successful. Otherwise, it returns an appropriate error code. For more information, see Using NTSTATUS Values.
Example usage is shown below.
//
// Init streaming callbacks.
//
ACX_RT_STREAM_CALLBACKS rtCallbacks;
ACX_RT_STREAM_CALLBACKS_INIT(&rtCallbacks);
rtCallbacks.EvtAcxStreamGetPresentationPosition = EvtStreamGetPresentationPosition;
status = AcxStreamInitAssignAcxRtStreamCallbacks(StreamInit, &rtCallbacks);
PAGED_CODE_SEG
NTSTATUS
EvtStreamGetPresentationPosition(
_In_ ACXSTREAM Stream,
_Out_ PULONGLONG PositionInBlocks,
_Out_ PULONGLONG QPCPosition
)
{
PSTREAM_CONTEXT ctx;
ULONG blockAlign;
LARGE_INTEGER qpc;
PAGED_CODE();
ctx = GetStreamContext(Stream);
blockAlign = AcxDataFormatGetBlockAlign(ctx->StreamFormat);
// Recalculate the stream position that is stored in ctx->StreamPosition
UpdateStreamPosition(Stream);
qpc = KeQueryPerformanceCounter(NULL);
*PositionInBlocks = ctx->StreamPosition / blockAlign;
*QPCPosition = qpc;
return STATUS_SUCCESS;
}
Minimum ACX version: 1.0
For more information about ACX versions, see ACX version overview.