Twitch SDK (Internal)
Classes | Public Member Functions | List of all members
ITTVPluginVideoEncoder Class Referenceabstract

#include <ivideoencoderplugin.h>

Classes

struct  EncodeInput
 
struct  EncodeOutput
 

Public Member Functions

virtual TTV_ErrorCode Start (const ttv::broadcast::VideoParams &videoParams)=0
 
virtual TTV_ErrorCode EncodeFrame (const EncodeInput &input, EncodeOutput &output)=0
 
virtual TTV_ErrorCode GetSpsPps (ITTVBuffer *outSps, ITTVBuffer *outPps)=0
 
virtual ttv::broadcast::YUVFormat GetRequiredYUVFormat () const =0
 
virtual const char * GetName () const =0
 

Detailed Description

ITTVPluginVideoEncoder - Pure Interface for video encoders

Implement this class if you would like twitchSDK to use your own encoder instead of the supplied default encoders.


Class Documentation

◆ ITTVPluginVideoEncoder::EncodeInput

struct ITTVPluginVideoEncoder::EncodeInput

Structure passed into EncodeFrame with details about the source data

Class Members
const uint8_t * source

source - Parameter that will hold the pointer to the surface that was passed in during the call to TTV_SubmitVideoFrame. The data pointed to will not have been modified.

uint64_t timeStamp

timeStamp - The internal timestamp of the frame being encoded. Ensure that the output frame that corresponds to the inputframe has the corresponding timestamp

const uint8_t * yuvPlanes[4]

yuvPlanes - Buffers that will contain the converted and flipped if requested image data. The pointers will correspond to the buffers of the YUV conversion requested in GetRequiredYUVFormat(). If the YUV conversion is not requested (TTV_YUV_NONE) these pointers will be null

◆ ITTVPluginVideoEncoder::EncodeOutput

struct ITTVPluginVideoEncoder::EncodeOutput

Structure passed into EncodeFrame that will receieve details about the encoded data

Class Members
ITTVBuffer * frameData

frameData - Buffer to store the output of the encoding. Do not persist this pointer, it will become invalid after EncodeFrame returns

uint64_t frameTimeStamp

frameTimeStamp - The timestamp of the input frame that this output frame corresponds to

bool isKeyFrame

isKeyFrame - Denotes if the encoded frame is a keyframe (IDR or I)

Member Function Documentation

◆ EncodeFrame()

virtual TTV_ErrorCode ITTVPluginVideoEncoder::EncodeFrame ( const EncodeInput input,
EncodeOutput output 
)
pure virtual

EncodeFrame - Encode a frame of video.

Parameters
[in]input- See remarks
[out]output- See remarks
Returns
TTV_EC_SUCCESS on success TTV_WRN_NOMOREDATA on success without any output
Remarks

Due to the async / buffered nature of encoders, not even call to EncodeFrame has to return the h264 encoded data for that specific frame

If the encoder needs to buffer up the input frame before an output frame can be emitted, return TTV_WRN_NOMOREDATA and make sure not to add data to the frameData member of output

When shutting down the encoder, EncodeFrame will be called with empty input packets (source pointer will be null). This will happen until there is no output received

◆ GetName()

virtual const char* ITTVPluginVideoEncoder::GetName ( ) const
pure virtual

GetName - Return a string to identify the encoder used. Please use a descriptive enough string for us at twitch to be able to differentiate what encoders are used.

◆ GetRequiredYUVFormat()

virtual ttv::broadcast::YUVFormat ITTVPluginVideoEncoder::GetRequiredYUVFormat ( ) const
pure virtual

GetRequiredYUVFormat - If the encoder requires image data to be converted to YUV, return the value of the specific format you would like. If you need the image flipped vertically, this is where it will be done too.

◆ GetSpsPps()

virtual TTV_ErrorCode ITTVPluginVideoEncoder::GetSpsPps ( ITTVBuffer outSps,
ITTVBuffer outPps 
)
pure virtual

GetSpsPps - Get the Sps/Pps values for the encode session

Returns
TTV_EC_SUCCESS on success

◆ Start()

virtual TTV_ErrorCode ITTVPluginVideoEncoder::Start ( const ttv::broadcast::VideoParams videoParams)
pure virtual

Start - Called when the encoder is started up

Parameters
[in]videoParams- Parameters needed by the encoder.
Returns
TTV_EC_SUCCESS on success

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