AVBlocks for C++  2.1
Audio and Video Software Development Kit
TranscoderCallback Class Reference

The TranscoderCallback provides a way to receive notifications from the Transcoder and also to control its operation while it is running (Transcoder::run). More...

Inheritance diagram for TranscoderCallback:
Reference

Public Member Functions

virtual bool_t onContinue (double currentTime)
 This method is called by the Transcoder to give the user code a chance to stop the transcoding process started by Transcoder::run(). More...
 
virtual void onInputChange (int32_t inputIndex)
 This method is called by the Transcoder when an input format has been detected or has changed. More...
 
virtual void onProgress (double currentTime, double totalTime)
 This method is called periodically by the Transcoder to report transcoding progress. More...
 
virtual void onStatus (TranscoderStatus::Enum status)
 This method is called by the Transcoder to report the status of current operation. More...
 
int32_t release () const
 The default implementation keeps a constant reference count of 1. More...
 
int32_t retain () const
 The default implementation keeps a constant reference count of 1. More...
 
int32_t retainCount () const
 The default implementation keeps a constant reference count of 1. More...
 

Detailed Description

The TranscoderCallback provides a way to receive notifications from the Transcoder and also to control its operation while it is running (Transcoder::run).

This class is meant to be inherited by the user code and only the required notifications/methods can be overridden.

When a TranscoderCallback instance is set (Transcoder::setCallback) it is retained by the Transcoder. The TranscoderCallback instance is released when the Transcoder itself is being destroyed.

The default implementation of primo::Reference keeps a constant reference count of 1. This can be used when the user code is the sole owner of the implemented callback and does not need to manage it through the primo::Reference interface.

The TranscoderCallback is used only when the transcoding is performed via Transcoder::run.

See Also
Object Management

Member Function Documentation

virtual bool_t onContinue ( double  currentTime)
virtual

This method is called by the Transcoder to give the user code a chance to stop the transcoding process started by Transcoder::run().

Parameters
currentTime[in] The duration of the media stream that has been processed so far. Time is in seconds.
Returns
TRUE if the Transcoder should continue running. FALSE if the Transcoder should stop.

When instructed the Transcoder stops the transcoding process gracefully so that the media data processed is valid (playable).

This notification is called as often as possible so that the user code may stop the transcoding process as soon as it is required. For this reason there should be minimal processing in this method if it is overridden by the user code, otherwise the overall transcoding may be slowed down.

virtual void onInputChange ( int32_t  inputIndex)
virtual

This method is called by the Transcoder when an input format has been detected or has changed.

The user code has a chance to inspect detected inputs, re-configure outputs, connect or disable pins.

Parameters
inputIndex[in] The index of the input socket that has changed. The socket contains pins that describe the new format.

Currently this notification is used by the Transcoder when an input socket is configured without pins and the input stream is pushed via Transcoder::push(). The notification is invoked when the input format is detected and after the appropriate pins are added to the input socket. The user code may inspect the input pins and can decide which pins to connect (via MediaPin::setConnection()). It may also add or remove output sockets and pins. The Transcoder is fully initialized only after all inputs have been detected and the user code returns from this method.

virtual void onProgress ( double  currentTime,
double  totalTime 
)
virtual

This method is called periodically by the Transcoder to report transcoding progress.

See Transcoder::run.

Parameters
currentTime[in] The duration of the media stream that has been processed so far. Time is in seconds.
totalTime[in] The total duration of the media stream that will be processed eventually. Time is in seconds.

For performance reasons this notification is not called for every processed media sample. Currently it is called once for every 0.5 seconds of processed media data. This notification is intended for user interface updates.

The transcoding progress in percents is given by: (currentTime / totalTime * 100).

The Transcoder does not guarantee that currentTime will ever reach totalTime even when the transcoding completes successfully.

virtual void onStatus ( TranscoderStatus::Enum  status)
virtual

This method is called by the Transcoder to report the status of current operation.

Parameters
status[in] Transcoder status.
See Also
TranscoderStatus::Enum
int32_t release ( ) const
virtual

The default implementation keeps a constant reference count of 1.

Returns
1

Implements Reference.

int32_t retain ( ) const
virtual

The default implementation keeps a constant reference count of 1.

Returns
1

Implements Reference.

int32_t retainCount ( ) const
virtual

The default implementation keeps a constant reference count of 1.

Returns
1

Implements Reference.