MediaReceiver
MediaReceiver Class Reference
A MediaReceiver contains the logic for receiving, decoding and aligning incoming media sources from the Ingests. The aligned data is then delivered to the Rendering Engine which is also responsible for setting up the MediaReceiver. The MediaReceiver has a builtin multi view generator, which can create output streams containing composited subsets of the incoming video sources. This class is controlled using an ISystemControllerInterface provided when starting it.
#include <MediaReceiver.h>
Public Classes
| Name | |
|---|---|
| struct | NewStreamParameters A struct containing information on the format of an incoming stream. |
| struct | Settings Settings for a MediaReceiver. |
Public Types
| Name | |
|---|---|
| enum class uint32_t | TallyBorderColor { kNone, kRed, kGreen, kYellow} Available colors for tally border in multi view. |
Public Functions
| Name | |
|---|---|
| MediaReceiver() Default constructor. | |
| ~MediaReceiver() Default destructor. | |
| bool | start(const std::shared_ptr< ISystemControllerInterface > & controllerInterface, CUcontext cudaContext, const Settings & settings, const ControlDataReceiver::Settings & receiverSettings) Start the MediaReceiver. This method will call connect on the System controller interface and set up the callbacks from the interface to call internal methods. |
| void | stop() Stop the MediaReceiver. |
| std::function< void(const AlignedFramePtr &)> | getCustomMultiViewSourceInput(uint32_t inputSlot, const std::string & name ="") This method allows the Rendering Engine to provide custom input sources to the Multi-view generator to send video streams that can be added to the multi-views. This could for instance be used for adding a “preview” of the video stream the rendering engine is about to cut to. |
| bool | removeCustomMultiViewSourceInput(uint32_t inputSlot) Remove a custom multi-view generator source input earlier registered using the getCustomMultiViewSourceInput method. |
| std::shared_ptr< IMediaStreamer > | createMediaStreamerOutput(const MediaStreamer::Settings & settings) Create a new MediaStreamer instance to output data from this MediaReceiver. |
| bool | removeMediaStreamerOutput(const std::string & uuid) Remove an MediaStreamer created via the. |
| std::shared_ptr< IControlDataReceiver > | getControlDataReceiver() Get a pointer to the ControlDataReceiver instance of this MediaReceiver. A call to this method will always return the same instance. |
| void | setTallyBorder(uint32_t inputSlot, TallyBorderColor color) Set tally border color in the multi-views for a specific input slot. |
| void | clearTallyBorder(uint32_t inputSlot) Remove tally border in the multi-views for a specific input slot. |
| void | clearAllTallyBorders() Remove all tally borders. |
| MediaReceiver::TallyBorderColor | getTallyBorder(uint32_t inputSlot) const get tally border color for an input slot |
| MediaReceiver(MediaReceiver const & ) =delete MediaReceiver is neither copyable nor movable. | |
| MediaReceiver(MediaReceiver && ) =delete | |
| MediaReceiver & | operator=(MediaReceiver const & ) =delete |
| MediaReceiver & | operator=(MediaReceiver && ) =delete |
| std::string | getVersion() Get application version. |
| std::string | getLibraryVersions() Get versions of the libraries available at runtime, among others, CUDA runtime and driver versions. |
Public Types Documentation
enum TallyBorderColor
| Enumerator | Value | Description |
|---|---|---|
| kNone | ||
| kRed | ||
| kGreen | ||
| kYellow |
Available colors for tally border in multi view.
Public Functions Documentation
function MediaReceiver
MediaReceiver()
Default constructor.
function ~MediaReceiver
~MediaReceiver()
Default destructor.
function start
bool start(
const std::shared_ptr< ISystemControllerInterface > & controllerInterface,
CUcontext cudaContext,
const Settings & settings,
const ControlDataReceiver::Settings & receiverSettings
)
Start the MediaReceiver. This method will call connect on the System controller interface and set up the callbacks from the interface to call internal methods.
Parameters:
- controllerInterface The ISystemControllerInterface to use for this MediaReceiver. The interface should be configured (Such as setting the IP address and port of the System Controller if a server based System Controller is used) but not connected before passed to this method. This method will internally set the callbacks before connecting to the controller. If the controller is already connected or if the controller is not configured, this method will return false. This class will take ownership of the smart pointer.
- cudaContext The CUDA context to use for this MediaReceiver. The frames will delivered as CUDA pointers, valid in this context, and the multi-view generator will use this context for rendering and encoding.
- settings The settings to use for the MediaReceiver.
- receiverSettings The settings to use for the ControlDataReceiver.
Return: True if the MediaReceiver was started successfully, false otherwise.
function stop
void stop()
Stop the MediaReceiver.
function getCustomMultiViewSourceInput
std::function< void(const AlignedFramePtr &)> getCustomMultiViewSourceInput(
uint32_t inputSlot,
const std::string & name =""
)
This method allows the Rendering Engine to provide custom input sources to the Multi-view generator to send video streams that can be added to the multi-views. This could for instance be used for adding a “preview” of the video stream the rendering engine is about to cut to.
Parameters:
- inputSlot The input slot this source will be “plugged in” to. The custom input sources share the input slots with the streams connected from Ingests. This means that it is probably a good idea to use higher numbered slots for these custom inputs, such as numbers from 1000, so that the lower numbers, 1 and up, can be used by the connected video cameras, as the input slot number will also be used when cutting.
- name Optional human readable name of this stream, to be presented to the System Controller.
See: MediaReceiver::Settings::mDecodedFormat.
Return: A function to where the Rendering Engine should send the frames. In case the requested inputSlot is already used by another custom input source, or a stream from an ingest, the returned function will be nullptr.
Note: Make sure no CUDA stream will write to the DeviceMemory in the AlignedFrame passed to the function. Failing to do so will lead to undefined behavior. In case another CUDA stream has written to the DeviceMemory, make sure to synchronize with the stream before passing the AlignedFrame.
Precondition: The AlignedFrame sent to this function must have the same pixel format as this MediaReceiver is configured to deliver to the Rendering Engine,
function removeCustomMultiViewSourceInput
bool removeCustomMultiViewSourceInput(
uint32_t inputSlot
)
Remove a custom multi-view generator source input earlier registered using the getCustomMultiViewSourceInput method.
Parameters:
- inputSlot The input slot the custom multi-view source input is connected to, that should be removed
Return: True if the custom multi-view source input was successfully removed, false in case there was no custom input registered for the given input slot, or in case of an internal error.
function createMediaStreamerOutput
std::shared_ptr< IMediaStreamer > createMediaStreamerOutput(
const MediaStreamer::Settings & settings
)
Create a new MediaStreamer instance to output data from this MediaReceiver.
Parameters:
- settings The settings for the new MediaStreamer
Return: A shared pointer to the MediaStreamer instance in case of a successful creation, otherwise nullptr
function removeMediaStreamerOutput
bool removeMediaStreamerOutput(
const std::string & uuid
)
Remove an MediaStreamer created via the.
Parameters:
- uuid The UUID of the MediaStreamer to remove
See: createMediaStreamerOutput method by its UUID.
Return: True if the MediaStreamer was successfully removed, false in case no MediaStreamer with the given UUID was found.
function getControlDataReceiver
std::shared_ptr< IControlDataReceiver > getControlDataReceiver()
Get a pointer to the ControlDataReceiver instance of this MediaReceiver. A call to this method will always return the same instance.
See: start.
Return: Pointer to the ControlDataReceiver instance. Nullptr if called before a successful call to
function setTallyBorder
void setTallyBorder(
uint32_t inputSlot,
TallyBorderColor color
)
Set tally border color in the multi-views for a specific input slot.
Parameters:
- inputSlot the input slot for a source
- color the color to set
function clearTallyBorder
void clearTallyBorder(
uint32_t inputSlot
)
Remove tally border in the multi-views for a specific input slot.
Parameters:
- inputSlot the input slot for a source
function clearAllTallyBorders
void clearAllTallyBorders()
Remove all tally borders.
function getTallyBorder
MediaReceiver::TallyBorderColor getTallyBorder(
uint32_t inputSlot
) const
get tally border color for an input slot
Parameters:
- inputSlot the input slot to get color for
Return: the tally border color for the given input slot
function MediaReceiver
MediaReceiver(
MediaReceiver const &
) =delete
MediaReceiver is neither copyable nor movable.
function MediaReceiver
MediaReceiver(
MediaReceiver &&
) =delete
function operator=
MediaReceiver & operator=(
MediaReceiver const &
) =delete
function operator=
MediaReceiver & operator=(
MediaReceiver &&
) =delete
function getVersion
static std::string getVersion()
Get application version.
Return: a string with the current version, e.g. “6.0.0-39-g60a35937”
function getLibraryVersions
static std::string getLibraryVersions()
Get versions of the libraries available at runtime, among others, CUDA runtime and driver versions.
Return: a string with the currently found versions of the libraries used by this application