include/MediaReceiver.h
include/MediaReceiver.h File Reference
Namespaces
| Name |
|---|
| Acl |
Classes
| Name | |
|---|---|
| class | Acl::MediaReceiver 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. |
| struct | Acl::MediaReceiver::NewStreamParameters A struct containing information on the format of an incoming stream. |
| struct | Acl::MediaReceiver::CustomSystemControllerCallResponse A struct containing the data returned from the Rendering Engine on a custom System Controller call, with information that will be propagated back to the System Controller and its client. |
| struct | Acl::MediaReceiver::Settings Settings for a MediaReceiver. |
Source code
// Copyright (c) 2024, Ateliere. All rights reserved.
#pragma once
#include <memory>
#include <utility>
#include <cuda.h>
#include "AlignedFrame.h"
#include "ControlDataReceiver.h"
#include "ISystemControllerInterface.h"
#include "MediaStreamer.h"
namespace Acl {
class MediaReceiver {
public:
struct NewStreamParameters {
uint32_t mVideoHeight = 0; // Height of the video in pixels. 0 if the stream does not contain any video
uint32_t mVideoWidth = 0; // Width of the video in pixels. 0 if the stream does not contain any video
uint32_t mFrameRateN = 0; // Frame rate numerator
uint32_t mFrameRateD = 1; // Frame rate denominator
uint32_t mAudioSampleRate = 0; // Sample rate of the audio in Hz. 0 if the stream does not contain any audio
};
struct CustomSystemControllerCallResponse {
ISystemControllerInterface::StatusCode mCode;
nlohmann::json mParameters; // Only used if mCode == SUCCESS
std::string mErrorMessage; // Only used if mCode != SUCCESS
};
struct Settings {
PixelFormat mDecodedFormat = PixelFormat::kRgba64Le;
std::function<std::function<void(const AlignedFramePtr&)>(uint32_t inputSlot,
const std::string& streamID,
const NewStreamParameters& newStreamParameters)>
mNewConnectionCallback;
std::function<void(uint32_t inputSlot)> mClosedConnectionCallback;
std::function<CustomSystemControllerCallResponse(const std::string& request, const nlohmann::json& parameters)>
mCustomSystemControllerRequestCallback;
bool mUseMultiViewer = false;
bool mDeliverOld = false;
CUstream mAlignedFrameFreeStream = nullptr;
};
enum class TallyBorderColor : uint32_t { kNone, kRed, kGreen, kYellow };
MediaReceiver();
~MediaReceiver();
bool start(const std::shared_ptr<ISystemControllerInterface>& controllerInterface,
CUcontext cudaContext,
const Settings& settings,
const ControlDataReceiver::Settings& receiverSettings);
void stop();
std::function<void(const AlignedFramePtr&)>
getCustomMultiViewSourceInput(uint32_t inputSlot, bool fixedFramerate, const std::string& name = "");
bool removeCustomMultiViewSourceInput(uint32_t inputSlot);
void clearCustomMultiViewSourceInputs();
std::shared_ptr<IMediaStreamer> createMediaStreamerOutput(const MediaStreamer::Settings& settings);
bool removeMediaStreamerOutput(const UUID& uuid);
void clearMediaStreamerOutputs();
std::shared_ptr<IControlDataReceiver> getControlDataReceiver();
void setTallyBorder(uint32_t inputSlot, TallyBorderColor color);
void clearTallyBorder(uint32_t inputSlot);
void clearAllTallyBorders();
[[nodiscard]] MediaReceiver::TallyBorderColor getTallyBorder(uint32_t inputSlot) const;
MediaReceiver(MediaReceiver const&) = delete; // Copy construct
MediaReceiver(MediaReceiver&&) = delete; // Move construct
MediaReceiver& operator=(MediaReceiver const&) = delete; // Copy assign
MediaReceiver& operator=(MediaReceiver&&) = delete; // Move assign
static std::string getVersion();
static std::string getLibraryVersions();
private:
class Impl;
std::unique_ptr<Impl> pImpl;
};
} // namespace Acl