Microsoft DirectX 9.0


The GetTimecode method retrieves the most recent timecode, userbit, and flag values available in the stream.


HRESULT GetTimecode(
  TIMECODE_SAMPLE *pTimecodeSample



[out] Pointer to a TIMECODE_SAMPLE structure.

Return Values

Returns an HRESULT value that depends on the implementation of the interface.


Use this method to monitor the timecode and to parse duplicates and discontinuities.

The timecode contains undefined bits, called userbits. Applications can use these bits to store synchronization information or other custom information.

DV and MPEG Camcorder Implementation

The MSDV driver supports reading SMPTE timecode or absolute track numbers (ATN). The MSTape driver supports reading the relative time counter (RTC). To read time information on these devices, do the following:

Set the dwFlags member of the TIMECODE_SAMPLE structure to one of the following values.

Constant Description
ED_DEVCAP_ATN_READ Absolute track number (DV)
ED_DEVCAP_RTC_READ Relative time counter (MPEG tape)

The timecode member of the TIMECODE_SAMPLE structure is a TIMECODE structure. Initialize that structure's dwFrames member to zero.

All other structure members are ignored.

When the method returns, the dwFrames member contains the time information, in the following format.

Time Information Format
Timecode Hours, minutes, seconds, and frames, as a binary coded decimal (BCD) value: 0xhhmmssff.
ATN Track number.
RTC Hours, minutes, seconds, and frames, as a BCD value: 0xhhmmssff. The most significant bit of the frames byte is a sign bit. If the frame count is not available, the remaining frame bits are set to 0x7F.

Also, the dwUser member receives the blank flag bit from the device, which has one of the following values.

Value Description
0x00 Not a discontinuity.
0x01 Discontinuity.

See Also