Twitch SDK (Internal)
Public Member Functions | List of all members
ttv::broadcast::IVideoEncoder Class Referenceabstract

#include <ivideoencoder.h>

Inheritance diagram for ttv::broadcast::IVideoEncoder:
ttv::broadcast::AppleVideoEncoder ttv::broadcast::IntelVideoEncoder ttv::broadcast::PassThroughVideoEncoder

Public Member Functions

virtual ~IVideoEncoder ()
 
virtual std::string GetName () const =0
 
virtual bool SupportsBitRateAdjustment () const =0
 
virtual TTV_ErrorCode Initialize ()=0
 
virtual TTV_ErrorCode Shutdown ()=0
 
virtual TTV_ErrorCode SetFrameWriter (const std::shared_ptr< IFrameWriter > &frameWriter)=0
 
virtual TTV_ErrorCode ValidateVideoParams (const VideoParams &videoParams) const =0
 
virtual TTV_ErrorCode Start (uint32_t streamIndex, const VideoParams &videoParams)=0
 
virtual TTV_ErrorCode SubmitFrame (const std::shared_ptr< VideoFrame > &videoFrame)=0
 
virtual TTV_ErrorCode Stop ()=0
 
virtual TTV_ErrorCode GetSpsPps (std::vector< uint8_t > &sps, std::vector< uint8_t > &pps)=0
 
virtual TTV_ErrorCode ValidateFrame (const std::shared_ptr< VideoFrame > &videoframe)=0
 
virtual TTV_ErrorCode SetTargetBitRate (uint32_t kbps)=0
 
template<typename T >
bool SupportsReceiverProtocol () const
 
virtual bool SupportsReceiverProtocol (IVideoFrameReceiver::ReceiverTypeId typeId) const =0
 
virtual std::shared_ptr< IVideoFrameReceiverGetReceiverImplementation (IVideoFrameReceiver::ReceiverTypeId typeId)=0
 

Detailed Description

The interface for a video encoder.

The following methods should be called by the client. Initialize() should be called by the client prior to adding it to the system. Shutdown() should be called after removing from the system.

The following methods will be called by the system during use. SetFrameWriter() will be called prior to starting encoding. Start() and Stop() will be called by the system when capture is to be started and stopped. SubmitFrame() will be called periodically to kick off an encode of a frame.

Constructor & Destructor Documentation

◆ ~IVideoEncoder()

virtual ttv::broadcast::IVideoEncoder::~IVideoEncoder ( )
virtual

Member Function Documentation

◆ GetName()

virtual std::string ttv::broadcast::IVideoEncoder::GetName ( ) const
pure virtual

◆ GetReceiverImplementation()

virtual std::shared_ptr<IVideoFrameReceiver> ttv::broadcast::IVideoEncoder::GetReceiverImplementation ( IVideoFrameReceiver::ReceiverTypeId  typeId)
pure virtual

Obtains the receiver for the given protocol. If not implemented, null will be returned.

Implemented in ttv::broadcast::PassThroughVideoEncoder, ttv::broadcast::IntelVideoEncoder, and ttv::broadcast::AppleVideoEncoder.

◆ GetSpsPps()

virtual TTV_ErrorCode ttv::broadcast::IVideoEncoder::GetSpsPps ( std::vector< uint8_t > &  sps,
std::vector< uint8_t > &  pps 
)
pure virtual

Called by the system to get the Sps/Pps data from the encoder.

Implemented in ttv::broadcast::PassThroughVideoEncoder, ttv::broadcast::IntelVideoEncoder, and ttv::broadcast::AppleVideoEncoder.

◆ Initialize()

virtual TTV_ErrorCode ttv::broadcast::IVideoEncoder::Initialize ( )
pure virtual

Initializes the encoder. The client is responsible for calling this before

Implemented in ttv::broadcast::PassThroughVideoEncoder, ttv::broadcast::IntelVideoEncoder, and ttv::broadcast::AppleVideoEncoder.

◆ SetFrameWriter()

virtual TTV_ErrorCode ttv::broadcast::IVideoEncoder::SetFrameWriter ( const std::shared_ptr< IFrameWriter > &  frameWriter)
pure virtual

Called by the system before encoding begins.

Implemented in ttv::broadcast::PassThroughVideoEncoder, ttv::broadcast::IntelVideoEncoder, and ttv::broadcast::AppleVideoEncoder.

◆ SetTargetBitRate()

virtual TTV_ErrorCode ttv::broadcast::IVideoEncoder::SetTargetBitRate ( uint32_t  kbps)
pure virtual

Sets the desired bitrate in 1000s of bits per second. This will only have an effect if SupportsBitrateAdjustment() returns true. TTV_EC_UNSUPPORTED will be returned if not supported.

Implemented in ttv::broadcast::PassThroughVideoEncoder, ttv::broadcast::IntelVideoEncoder, and ttv::broadcast::AppleVideoEncoder.

◆ Shutdown()

virtual TTV_ErrorCode ttv::broadcast::IVideoEncoder::Shutdown ( )
pure virtual

◆ Start()

virtual TTV_ErrorCode ttv::broadcast::IVideoEncoder::Start ( uint32_t  streamIndex,
const VideoParams videoParams 
)
pure virtual

◆ Stop()

virtual TTV_ErrorCode ttv::broadcast::IVideoEncoder::Stop ( )
pure virtual

Called by the system when the stream is stopping.

Implemented in ttv::broadcast::PassThroughVideoEncoder, ttv::broadcast::IntelVideoEncoder, and ttv::broadcast::AppleVideoEncoder.

◆ SubmitFrame()

virtual TTV_ErrorCode ttv::broadcast::IVideoEncoder::SubmitFrame ( const std::shared_ptr< VideoFrame > &  videoFrame)
pure virtual

This will be called periodically to kick off an encode of a frame. This should not block to encode the frame synchronously.

Implemented in ttv::broadcast::PassThroughVideoEncoder, ttv::broadcast::IntelVideoEncoder, and ttv::broadcast::AppleVideoEncoder.

◆ SupportsBitRateAdjustment()

virtual bool ttv::broadcast::IVideoEncoder::SupportsBitRateAdjustment ( ) const
pure virtual

Determines whether or not the encoder supports changing the target bitrate on the fly.

Implemented in ttv::broadcast::PassThroughVideoEncoder, ttv::broadcast::IntelVideoEncoder, and ttv::broadcast::AppleVideoEncoder.

◆ SupportsReceiverProtocol() [1/2]

template<typename T >
bool ttv::broadcast::IVideoEncoder::SupportsReceiverProtocol ( ) const
inline

Determines if the concrete implementation supports the given protocol. The template parameter must be known to derive from IVideoFrameReceiver.

◆ SupportsReceiverProtocol() [2/2]

virtual bool ttv::broadcast::IVideoEncoder::SupportsReceiverProtocol ( IVideoFrameReceiver::ReceiverTypeId  typeId) const
pure virtual

Determines if the concrete implementation supports the given protocol.

Implemented in ttv::broadcast::PassThroughVideoEncoder, ttv::broadcast::IntelVideoEncoder, and ttv::broadcast::AppleVideoEncoder.

◆ ValidateFrame()

virtual TTV_ErrorCode ttv::broadcast::IVideoEncoder::ValidateFrame ( const std::shared_ptr< VideoFrame > &  videoframe)
pure virtual

Called by the system to validate each frame as it is processed.

Implemented in ttv::broadcast::PassThroughVideoEncoder, ttv::broadcast::IntelVideoEncoder, and ttv::broadcast::AppleVideoEncoder.

◆ ValidateVideoParams()

virtual TTV_ErrorCode ttv::broadcast::IVideoEncoder::ValidateVideoParams ( const VideoParams videoParams) const
pure virtual

The documentation for this class was generated from the following file: