Acl::IMediaStreamer
Acl::IMediaStreamer Class Reference
IMediaStreamer is an interface class for MediaStreamers, that can take a single stream of uncompressed video and/or audio frames and encode and output it in some way. This output can either be a stream to a network or writing down the data to a file on the hard drive. This class is configured from two interfaces. The input configuration (input video resolution, frame rate, pixel format, number of audio channels…) is made through this C++ API. The output stream is then started from the System Controller. Any of these configurations can be made first. The actual stream to output will start once the first call to. More…
#include <IMediaStreamer.h>
Public Classes
| Name | |
|---|---|
| struct | Configuration The input configuration of the frames that will be sent to this MediaStreamer. The output stream configuration is made from the System controller via the ISystemControllerInterface. |
| struct | Settings Settings used when creating a new MediaStreamer. |
Public Functions
| Name | |
|---|---|
| virtual | ~IMediaStreamer() =default Destructor. |
| virtual bool | configure(const UUID & uuid, const Settings & settings, CUcontext cudaContext) =0 Configure this MediaStreamer. This must be called before any call to the. |
| virtual bool | setInputFormatAndStart(const Configuration & configuration) =0 Set the input format of this MediaStreamer and start the streamer. The. |
| virtual bool | stopAndResetFormat() =0 Stop streaming and reset the format. A call to this method will stop any output streams set up by the ISystemControllerInterface and reset the input format set by the. |
| virtual bool | hasFormatAndIsRunning() const =0 |
| virtual bool | hasOpenOutputStream() const =0 |
| virtual bool | outputData(const AlignedFramePtr & frame) =0 Output data through this streamer. The AlignedFrame::mRenderingTimestamp of the frame will be used as PTS when encoding the uncompressed frame. |
Detailed Description
class Acl::IMediaStreamer;
IMediaStreamer is an interface class for MediaStreamers, that can take a single stream of uncompressed video and/or audio frames and encode and output it in some way. This output can either be a stream to a network or writing down the data to a file on the hard drive. This class is configured from two interfaces. The input configuration (input video resolution, frame rate, pixel format, number of audio channels…) is made through this C++ API. The output stream is then started from the System Controller. Any of these configurations can be made first. The actual stream to output will start once the first call to.
See: outputData is made.
Public Functions Documentation
function ~IMediaStreamer
virtual ~IMediaStreamer() =default
Destructor.
function configure
virtual bool configure(
const UUID & uuid,
const Settings & settings,
CUcontext cudaContext
) =0
Configure this MediaStreamer. This must be called before any call to the.
Parameters:
- uuid UUID of this MediaStreamer
- settings Settings for this MediaStreamer
- cudaContext The CUDA context to use for this MediaStreamer. The frames passed to this instance should be valid in this CUDA context. The streamer will use this context for preprocessing and encoding.
See:
Return: True if the streamer was successfully configured
function setInputFormatAndStart
virtual bool setInputFormatAndStart(
const Configuration & configuration
) =0
Set the input format of this MediaStreamer and start the streamer. The.
Parameters:
- configuration The configuration with the format of the frames that will be sent to this MediaReceiver
See:
- configure method must be called before this method is called. This method must be called before any call to
- outputData. If the format should be reset, the
- stopAndResetFormat method should be called first and then this method can be called again to reset the format.
Return: True if the streamer was successfully started, false otherwise
function stopAndResetFormat
virtual bool stopAndResetFormat() =0
Stop streaming and reset the format. A call to this method will stop any output streams set up by the ISystemControllerInterface and reset the input format set by the.
See: setInputFormatAndStart method. The connection to the ISystemControllerInterface will be kept.
Return: True if the stream was successfully stopped and the format reset, or if the format was not set before this method was called, false on error.
function hasFormatAndIsRunning
virtual bool hasFormatAndIsRunning() const =0
Return: True if the input format is set and the OutputStreamer is running, false otherwise
function hasOpenOutputStream
virtual bool hasOpenOutputStream() const =0
See:
- outputData will be discarded without being encoded, as there is no stream to output them to. This method can be used to check if the frame even needs to be produced by the rendering engine. Note however, that the
- outputData method will still log the frames sent to it as received, even if they are not encoded when the output stream is closed.
Return: True if the output stream of the MediaStreamer is currently open and outputting the data, false otherwise. In case this returns false all frames passed to
function outputData
virtual bool outputData(
const AlignedFramePtr & frame
) =0
Output data through this streamer. The AlignedFrame::mRenderingTimestamp of the frame will be used as PTS when encoding the uncompressed frame.
Parameters:
- frame The data frame to output, with video data in CUDA memory
See: setInputFormatAndStart method, or if the format has not been set by a call to that method.
Return: True if the frame was accepted (but not necessarily streamed, in case the output stream has not been set up by the ISystemControllerInterface), false in case the frame did not match the configuration made in the
Note: The DeviceMemory in the AlignedFrame passed to this method must not be in use by any CUDA stream. In case the memory has been used in kernels in another CUDA stream, make sure to first synchronize with the stream, before passing it over to the MediaStreamer.