Block¶
primo::avblocks::Block
-
class Block : public primo::Reference¶
A Block is a unit that can produce, consume or transform media samples from/to multiple inputs/outputs.
Subclassed by primo::avblocks::MediaInfo, primo::avblocks::Transcoder
Public Functions
-
virtual MediaSocketList *inputs() const = 0¶
Returns a modifiable collection of MediaSocket objects which describe the input data of the block.
- Returns:
A pointer to a collection of input sockets. Cannot be NULL.
-
virtual MediaSocketList *outputs() const = 0¶
Returns a modifiable collection of MediaSocket objects which describe the output data of the block.
- Returns:
A pointer to a collection of output sockets. Cannot be NULL.
-
virtual bool_t open() = 0¶
Initializes the block based on the specified inputs and outputs.
- Returns:
TRU The block is successfully initialized and is ready to process data, otherwise FALSE.
-
virtual bool_t push(int32_t inputIndex, primo::codecs::MediaSample *inputSample) = 0¶
Pushes input data to the block.
- Parameters:
inputIndex – [in] Specifies the index of the input socket whose data is pushed to the block.
inputSample – [in] A pointer to a MediaSample object that contains the input data.
- Returns:
TRUE The block has successfully processed the input data, otherwise FALSE.
-
virtual bool_t pull(int32_t &outputIndex, primo::codecs::MediaSample *outputData) = 0¶
Pulls output data from the block.
- Parameters:
outputIndex – [out] contains the index of the output socket to which the data belongs.
outputData – [out] A pointer to a MediaSample object that receives the output data.
- Returns:
TRUE The block has successfully generated output, otherwise FALSE.
-
virtual void close() = 0¶
Closes the block.
When closed it can neither accept, nor deliver data.
-
virtual bool_t flush() = 0¶
Flushes the data buffered in the block to the output.
This method can be used only in push mode.
Remark
This method also marks the end-of-stream for all inputs. No data should be pushed to the block after it is flushed.
- Returns:
TRUE if the buffered data is successfully flushed, otherwise FALSE.
-
virtual bool_t endOfStream(int32_t inputIndex) = 0¶
Tells the block that there’s no more data for the specified input socket.
This method can be used only in push mode.
- Parameters:
inputIndex – [in] specifies the index of the input socket for which there’s no more data.
- Returns:
TRUE if the operation is successful, otherwise FALSE.
-
virtual MediaSocketList *inputs() const = 0¶