Files
2026-05-19 15:02:22 +03:00

85 lines
2.1 KiB
C++

#pragma once
#include "IVideoFeed.hpp"
#include <cstdint>
#include <string>
#include <vector>
struct MxlInstanceHandle;
#if MXL_MULTIVIEWER_ENABLE_MXL_SDK
#include <mxl/flow.h>
#include <mxl/mxl.h>
#include <mxl/rational.h>
#include <mxl/time.h>
#endif
class MxlSdkFeed : public IVideoFeed
{
public:
MxlSdkFeed(
const std::string& domain,
const std::string& flowId,
uint32_t outputWidth,
uint32_t outputHeight,
bool verbose = false);
~MxlSdkFeed() override;
MxlSdkFeed(const MxlSdkFeed&) = delete;
MxlSdkFeed& operator=(const MxlSdkFeed&) = delete;
const VideoFrame& getFrame(uint32_t frameCounter) override;
FeedRuntimeStatus status() const override;
std::string displayName() const override;
std::string sourceInfo() const override;
uint64_t frameVersion() const override;
bool hasGrainIndex() const override;
uint64_t grainIndex() const override;
bool hasFrameRate() const override;
double frameRate() const override;
float srcAspectRatio() const override;
bool hasV210() const override;
const uint8_t* v210Data() const override;
bool supportsDirectV210Read() const override;
bool readV210FrameInto(
uint32_t frameCounter,
void* destination,
size_t destinationSize,
V210ReadTiming* timing = nullptr) override;
uint32_t v210Width() const override;
uint32_t v210Height() const override;
uint32_t v210Stride() const override;
private:
bool openFlow();
void closeFlow();
std::string mDomain;
std::string mFlowId;
std::string mFlowName;
VideoFrame mFrame;
#if MXL_MULTIVIEWER_ENABLE_MXL_SDK
MxlInstanceHandle* mInstanceHandle = nullptr;
mxlFlowReader mReader = nullptr;
mxlRational mGrainRate{};
uint64_t mLastDisplayedIndex = 0;
uint32_t mSourceWidth = 0;
uint32_t mSourceHeight = 0;
uint32_t mSourceStride = 0;
uint64_t mFrameVersion = 0;
int mOpenRetryCount = 0;
bool mVerbose = false;
bool mFlowOpened = false;
bool mFlowInvalid = false;
std::vector<uint8_t> mV210Payload;
#endif
};