2.5.34 IDeckLinkEncoderInput Interface¶
The IDeckLinkEncoderInput
interface allows an application to capture an encoded video and audio stream from a DeckLink device.
An IDeckLinkEncoderInput
interface can be obtained from an IDeckLink
interface using QueryInterface. If QueryInterface for an input interface is called on a device which does not support encoded capture, then QueryInterface will fail and return E_NOINTERFACE.
Encoded Video capture operates in a push model with encoded video data delivered to an IDeckLinkEncoderInputCallback
interface. Audio capture is optional and can be handled by using the same callback object.
Interface |
Interface ID |
Description |
---|---|---|
IID_IDeckLink |
An |
|
IID_IDeckLinkDisplayMode |
|
|
IID_IDeckLinkDisplayModeIterator |
|
|
IID_IDeckLinkEncoderInputCallback |
An |
|
IID_IDeckLinkEncoderConfiguration |
An |
2.5.34.1 IDeckLinkEncoderInput::DoesSupportVideoMode method¶
-
HRESULT IDeckLinkEncoderInput::DoesSupportVideoMode(BMDVideoConnection connection, BMDDisplayMode requestedMode, BMDPixelFormat requestedCodec, uint32_t requestedCodecProfile, BMDSupportedVideoModeFlags flags, Boolean *supported);¶
The DoesSupportVideoMode method indicates whether a given display mode is supported on encoder input.
- Parameters:
connection – Input connection to check, or
bmdVideoConnectionUnspecified
to check against any input connection (seeBMDVideoConnection
for details).requestedMode – Display mode to check.
requestedCodec – Encoded pixel format to check, or
bmdFormatUnspecified
to check against any pixel format (seeBMDPixelFormat
for details).requestedCodecProfile – Codec profile to check.
flags – Input video mode flags (see
BMDSupportedVideoModeFlags
for details).supported – Returns true if the display mode is supported.
- Return values:
E_INVALIDARG – Either parameter requestedMode has an invalid value or parameter supported variable is NULL.
E_FAIL – Failure
S_OK – Success
2.5.34.2 IDeckLinkEncoderInput::GetDisplayMode method¶
-
HRESULT IDeckLinkEncoderInput::GetDisplayMode(BMDDisplayMode displayMode, IDeckLinkDisplayMode **resultDisplayMode);¶
The GetDisplayMode method returns the
IDeckLinkDisplayMode
interface for an input display mode identifier.- Parameters:
displayMode – The display mode ID (See
BMDDisplayMode
).resultDisplayMode – Pointer to the display mode with matching ID. The object must be released by the caller when no longer required.
- Return values:
E_INVALIDARG – Either parameter displayMode has an invalid value or parameter resultDisplayMode variable is NULL.
E_OUTOFMEMORY – Insufficient memory to create the result display mode object.
S_OK – Success
2.5.34.3 IDeckLinkEncoderInput::GetDisplayModeIterator method¶
-
HRESULT IDeckLinkEncoderInput::GetDisplayModeIterator(IDeckLinkDisplayModeIterator **iterator);¶
The GetDisplayModeIterator method returns an iterator which enumerates the available display modes.
- Parameters:
iterator – Display mode iterator
- Return values:
E_FAIL – Failure
S_OK – Success
2.5.34.4 IDeckLinkEncoderInput::EnableVideoInput method¶
-
HRESULT IDeckLinkEncoderInput::EnableVideoInput(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDVideoInputFlags flags);¶
The EnableVideoInput method configures video input and puts the hardware into encoded video capture mode. Video input (and optionally audio input) is started by calling StartStreams.
- Parameters:
displayMode – Video mode to capture
pixelFormat – Pixel format to capture
flags – Capture flags
- Return values:
E_INVALIDARG – Is returned on invalid mode or video flags
E_ACCESSDENIED – Unable to access the hardware or input stream currently active
E_OUTOFMEMORY – Unable to create a new frame
E_FAIL – Failure
S_OK – Success
2.5.34.5 IDeckLinkEncoderInput::DisableVideoInput method¶
-
HRESULT IDeckLinkEncoderInput::DisableVideoInput();¶
The DisableVideoInput method disables the hardware video capture mode.
- Return values:
E_FAIL – Failure
S_OK – Success
2.5.34.6 IDeckLinkEncoderInput::GetAvailablePacketsCount method¶
-
HRESULT IDeckLinkEncoderInput::GetAvailablePacketsCount(uint32_t *availablePacketsCount);¶
The GetAvailablePacketsCount method provides the number of encoded video packets that are queued to be delivered to the
IDeckLinkEncoderInputCallback::VideoPacketArrived()
callback.- Parameters:
availablePacketsCount – Number of available encoded packets
- Return values:
S_OK – Success
2.5.34.7 IDeckLinkEncoderInput::EnableAudioInput method¶
-
HRESULT IDeckLinkEncoderInput::EnableAudioInput(BMDAudioFormat audioFormat, BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, uint32_t channelCount);¶
The EnableAudioInput method configures audio input and puts the hardware into audio capture mode. Encoded audio and video input is started by calling StartStreams.
- Parameters:
audioFormat – Audio format to encode.
sampleRate – Sample rate to capture
sampleType – Sample type to capture
channelCount – Number of audio channels to capture - only 2, 8 or 16 channel capture is supported.
- Return values:
E_INVALIDARG – Invalid audio format or number of channels requested.
E_ACCESSDENIED – Unable to access the hardware or input stream currently active.
E_FAIL – Failure
S_OK – Success
2.5.34.8 IDeckLinkEncoderInput::DisableAudioInput method¶
-
HRESULT IDeckLinkEncoderInput::DisableAudioInput();¶
The DisableAudioInput method disables the hardware audio capture mode.
- Return values:
E_FAIL – Failure
S_OK – Success
2.5.34.9 IDeckLinkEncoderInput::GetAvailableAudioSampleFrameCount method¶
-
HRESULT IDeckLinkEncoderInput::GetAvailableAudioSampleFrameCount(uint32_t *availableSampleFrameCount);¶
The GetAvailableAudioSampleFrameCount method returns the number of audio sample frames currently buffered.
- Parameters:
availableSampleFrameCount – The number of buffered audio frames currently available.
- Return values:
E_FAIL – Failure
S_OK – Success
2.5.34.10 IDeckLinkEncoderInput::StartStreams method¶
-
HRESULT IDeckLinkEncoderInput::StartStreams();¶
The StartStreams method starts encoded video and audio capture as configured with EnableVideoInput and optionally EnableAudioInput.
- Return values:
E_ACCESSDENIED – Input stream is already running.
E_UNEXPECTED – Neither video or audio inputs have been enabled.
E_FAIL – Failure
S_OK – Success
2.5.34.11 IDeckLinkEncoderInput::StopStreams method¶
-
HRESULT IDeckLinkEncoderInput::StopStreams();¶
The StopStreams method stops encoded video and audio capture.
- Return values:
E_ACCESSDENIED – Input stream already stopped.
S_OK – Success
2.5.34.12 IDeckLinkEncoderInput::PauseStreams method¶
-
HRESULT IDeckLinkEncoderInput::PauseStreams();¶
The PauseStreams method pauses encoded video and audio capture. Capture time continues while the streams are paused but no video or audio will be captured.
Paused capture may be resumed by calling PauseStreams again. Capture may also be resumed by calling StartStreams but capture time will be reset.
- Return values:
E_FAIL – Failure
S_OK – Success
2.5.34.13 IDeckLinkEncoderInput::FlushStreams method¶
-
HRESULT IDeckLinkEncoderInput::FlushStreams();¶
The FlushStreams method removes any buffered video and audio packets.
- Return values:
E_FAIL – Failure
S_OK – Success
2.5.34.14 IDeckLinkEncoderInput::SetCallback method¶
-
HRESULT IDeckLinkEncoderInput::SetCallback(IDeckLinkEncoderInputCallback *theCallback);¶
The SetCallback method configures a callback which will be called as new encoded video, and audio packets become available. Encoder capture is started with StartStreams, stopped with StopStreams and may be paused with PauseStreams.
- Parameters:
theCallback – Callback object implementing the
IDeckLinkEncoderInputCallback
interface- Return values:
E_FAIL – Failure
S_OK – Success
2.5.34.15 IDeckLinkEncoderInput::GetHardwareReferenceClock method¶
-
HRESULT IDeckLinkEncoderInput::GetHardwareReferenceClock(BMDTimeScale desiredTimeScale, BMDTimeValue *hardwareTime, BMDTimeValue *timeInFrame, BMDTimeValue *ticksPerFrame);¶
The GetHardwareReferenceClock method returns a clock that is locked to the system clock.
The absolute values returned by this method are meaningless, however the relative differences between subsequent calls can be used to determine elapsed time.
This method can be called while video input is enabled (see
IDeckLinkEncoderInput::EnableVideoInput()
for details).- Parameters:
desiredTimeScale – Desired time scale
hardwareTime – Hardware reference time (in units of desiredTimeScale)
timeInFrame – Time elapsed since the start of the frame (in units of desiredTimeScale)
ticksPerFrame – Number of ticks for a frame (in units of desiredTimeScale)
- Return values:
E_FAIL – Failure
S_OK – Success