IMFTimecodeTranslate::BeginConvertTimecodeToHNS method (mfidl.h)

Starts an asynchronous call to convert Society of Motion Picture and Television Engineers (SMPTE) time code to 100-nanosecond units.

Syntax

HRESULT BeginConvertTimecodeToHNS(
  [in] const PROPVARIANT *pPropVarTimecode,
  [in] IMFAsyncCallback  *pCallback,
  [in] IUnknown          *punkState
);

Parameters

[in] pPropVarTimecode

Time in SMPTE time code to convert. The vt member of the PROPVARIANT structure is set to VT_I8. The hVal.QuadPart member contains the time in binary coded decimal (BCD) form. See Remarks.

[in] pCallback

Pointer to the IMFAsyncCallback interface of a callback object. The caller must implement this interface.

[in] punkState

PPointer to the IUnknown interface of a state object, defined by the caller. This parameter can be NULL. You can use this object to hold state information. The object is returned to the caller when the callback is invoked.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
E_INVALIDARG
pPropVarTimecode is not VT_I8.
MF_E_SHUTDOWN
The object's Shutdown method was called.
MF_E_BYTESTREAM_NOT_SEEKABLE
The byte stream is not seekable. The time code cannot be read from the end of the byte stream.

Remarks

When the asynchronous method completes, the callback object's IMFAsyncCallback::Invoke method is called. At that point, the application must call IMFTimecodeTranslate::EndConvertTimecodeToHNS to complete the asynchronous request.

The value of pPropVarTimecode is a 64-bit unsigned value typed as a LONGLONG. The upper DWORD contains the range. (A range is a continuous series of time codes.) The lower DWORD contains the time code in the form of a hexadecimal number 0xhhmmssff, where each 2-byte sequence is read as a decimal value.

void CreateTimeCode(
    DWORD dwFrames,
    DWORD dwSeconds,
    DWORD dwMinutes,
    DWORD dwHours,
    DWORD dwRange,
    PROPVARIANT *pvar
    )
{
    ULONGLONG ullTimecode = ((ULONGLONG)dwRange) << 32;

    ullTimecode +=   dwFrames  % 10;
    ullTimecode += (( (ULONGLONG)dwFrames )  / 10) << 4;
    ullTimecode += (( (ULONGLONG)dwSeconds ) % 10) << 8;
    ullTimecode += (( (ULONGLONG)dwSeconds ) / 10) << 12;
    ullTimecode += (( (ULONGLONG)dwMinutes ) % 10) << 16;
    ullTimecode += (( (ULONGLONG)dwMinutes ) / 10) << 20;
    ullTimecode += (( (ULONGLONG)dwHours )   % 10) << 24;
    ullTimecode += (( (ULONGLONG)dwHours )   / 10) << 28;

    pvar->vt = VT_I8;
    pvar->hVal.QuadPart = (LONGLONG)ullTimecode;
}

Requirements

   
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header mfidl.h

See also

Calling Asynchronous Methods

IMFTimecodeTranslate