IAMTimecodeReader::GetTimecode method (strmif.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

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

Syntax

HRESULT GetTimecode(
  [out] PTIMECODE_SAMPLE pTimecodeSample
);

Parameters

[out] pTimecodeSample

Pointer to a TIMECODE_SAMPLE structure.

Return value

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

Remarks

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_TIMECODE_READ Timecode (DV)
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.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header strmif.h (include Dshow.h)
Library Strmiids.lib

See also

Error and Success Codes

Getting Timecode from the Device

IAMTimecodeReader Interface