Microsoft DirectX 8.1 (C++)

Issuing Raw AV/C Commands

The IAMExtDevice, IAMExtTransport, and IAMTimecodeReader interfaces work by translating the method calls into commands for the driver, and then interpreting the driver's response and returning it through an HRESULT or an output parameter. However, some device functions might not be accessible through these methods. Therefore, MSDV supports sending raw AV/C commands to the device, using the IAMExtTransport::GetTransportBasicParameters method.

You should keep the following points in mind when using this feature:

To send an AV/C command, format the command as an array of bytes. Then call the GetTransportBasicParameters method, passing in the ED_RAW_EXT_DEV_CMD flag, the array size, and the array.

The following example shows how an application might issue an AV/C command to search for an absolute track number (ATN):

LONG cbCmd = 8;
BYTE AvcCmd[8] = { 0x00, 0x20, 0x52, 0x20, 0xFF, 0xFF, 0xFF, 0xFF };
AvcCmd[4] = (BYTE) (ulTrackNumber & 0x000000FF);
AvcCmd[5] = (BYTE)((ulTrackNumber & 0x0000FF00) >> 8);
AvcCmd[6] = (BYTE)((ulTrackNumber & 0x00FF0000) >> 16);
hr = pTransport->GetTransportBasicParameters(
    ED_RAW_EXT_DEV_CMD, 
    &cbCmd,
    (LPOLESTR*) AvcCmd);

The AvcCmd array is initialized with the AV/C command (0x52 = ATN, 0x20 = Search mode); except for the track number, which is specified in bytes 4, 5, and 6. (For more information, see AV/C Digital Interface Command Set.) The track number is obtained from the ulTrackNumber variable and packed into the array using bitwise-AND operations. You must cast the array address to an LPOLESTR pointer value, because the original purpose of this parameter was to return a string value. When the method returns, the array contains the response from the device.