Added ndi receiver and sdi outputs

This commit is contained in:
mchara40
2025-08-25 13:16:29 +03:00
parent 11b8be19f6
commit d046828313
125 changed files with 14757 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
/*
Copyright (C) 2024 Vizrt NDI AB. All rights reserved.
This file and its use within a Product is bound by the terms of NDI SDK license that was provided
as part of the NDI SDK. For more information, please review the license and the NDI SDK documentation.
*/
#pragma once
#include <CoreMinimal.h>
#include <Misc/FrameRate.h>
#include "NDIBroadcastConfiguration.generated.h"
/**
Describes essential properties used for modifying the broadcast configuration of an Sender object
*/
USTRUCT(BlueprintType, Blueprintable, Category = "NDI IO", META = (DisplayName = "NDI Broadcast Configuration"))
struct NDIIO_API FNDIBroadcastConfiguration
{
GENERATED_USTRUCT_BODY()
public:
/** Describes the output frame size while sending video frame over NDI */
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Broadcast Settings", META = (DisplayName = "Frame Size"))
FIntPoint FrameSize = FIntPoint(1920, 1080);
/** Represents the desired number of frames (per second) for video to be sent over NDI */
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Broadcast Settings", META = (DisplayName = "Frame Rate"))
FFrameRate FrameRate = FFrameRate(60, 1);
public:
/** Constructs a new instance of this object */
FNDIBroadcastConfiguration() = default;
/** Copies an existing instance to this object */
FNDIBroadcastConfiguration(const FNDIBroadcastConfiguration& other);
/** Copies existing instance properties to this object */
FNDIBroadcastConfiguration& operator=(const FNDIBroadcastConfiguration& other);
/** Destructs this object */
virtual ~FNDIBroadcastConfiguration() = default;
/** Compares this object to 'other' and returns a determination of whether they are equal */
bool operator==(const FNDIBroadcastConfiguration& other) const;
/** Compares this object to 'other" and returns a determination of whether they are NOT equal */
bool operator!=(const FNDIBroadcastConfiguration& other) const;
protected:
/** Attempts to serialize this object using an Archive object */
virtual FArchive& Serialize(FArchive& Ar);
private:
/** Operator override for serializing this object to an Archive object */
friend class FArchive& operator<<(FArchive& Ar, FNDIBroadcastConfiguration& Input)
{
return Input.Serialize(Ar);
}
};

View File

@@ -0,0 +1,92 @@
/*
Copyright (C) 2024 Vizrt NDI AB. All rights reserved.
This file and its use within a Product is bound by the terms of NDI SDK license that was provided
as part of the NDI SDK. For more information, please review the license and the NDI SDK documentation.
*/
#pragma once
#include <NDIIOPluginAPI.h>
#include <Enumerations/NDISourceBandwidth.h>
#include <Serialization/Archive.h>
#include "NDIConnectionInformation.generated.h"
/**
Describes essential properties used for connection objects over NDI
*/
USTRUCT(BlueprintType, Blueprintable, Category = "NDI IO", META = (DisplayName = "NDI Connection Information"))
struct NDIIO_API FNDIConnectionInformation
{
GENERATED_USTRUCT_BODY()
public:
/** A user-friendly name of the source */
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Properties", META = (DisplayName = "Source Name"))
FString SourceName = FString("");
/** The machine name of the source */
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Properties", META = (DisplayName = "Machine Name"))
FString MachineName = FString("");
/** The stream name of the source */
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Properties", META = (DisplayName = "Stream Name"))
FString StreamName = FString("");
/** A location on the network for which this source exists */
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Properties", META = (DisplayName = "Url"))
FString Url = FString("");
/** Indicates the current bandwidth mode used for this connection */
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Properties", META = (DisplayName = "Bandwidth"))
ENDISourceBandwidth Bandwidth = ENDISourceBandwidth::Highest;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Properties", META = (DisplayName = "Mute Audio"))
bool bMuteAudio = false;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Properties", META = (DisplayName = "Mute Video"))
bool bMuteVideo = false;
public:
/** Constructs a new instance of this object */
FNDIConnectionInformation() = default;
/** Copies an existing instance to this object */
FNDIConnectionInformation(const FNDIConnectionInformation& other);
/** Copies existing instance properties to this object */
FNDIConnectionInformation& operator=(const FNDIConnectionInformation& other);
/** Destructs this object */
virtual ~FNDIConnectionInformation() = default;
/** Implicit conversion to a base NDI bandwidth value */
operator NDIlib_recv_bandwidth_e() const;
/** Compares this object to 'other' and returns a determination of whether they are equal */
bool operator==(const FNDIConnectionInformation& other) const;
/** Compares this object to 'other" and returns a determination of whether they are NOT equal */
bool operator!=(const FNDIConnectionInformation& other) const;
public:
/** Resets the current parameters to the default property values */
void Reset();
/** Determines whether this object is valid connection information */
bool IsValid() const;
FString GetNDIName() const;
protected:
/** Attempts to serialize this object using an Archive object */
virtual FArchive& Serialize(FArchive& Ar);
private:
/** Operator override for serializing this object to an Archive object */
friend class FArchive& operator<<(FArchive& Ar, FNDIConnectionInformation& Input)
{
return Input.Serialize(Ar);
}
};

View File

@@ -0,0 +1,97 @@
/*
Copyright (C) 2024 Vizrt NDI AB. All rights reserved.
This file and its use within a Product is bound by the terms of NDI SDK license that was provided
as part of the NDI SDK. For more information, please review the license and the NDI SDK documentation.
*/
#pragma once
#include <NDIIOPluginAPI.h>
#include <Serialization/Archive.h>
#include "NDIReceiverPerformanceData.generated.h"
/**
A structure holding data allowing you to determine the current performance levels of the receiver with the
ability to detect whether frames has been dropped
*/
USTRUCT(BlueprintType, Blueprintable, Category = "NDI IO", META = (DisplayName = "NDI Receiver Performance Data"))
struct NDIIO_API FNDIReceiverPerformanceData
{
GENERATED_USTRUCT_BODY()
public:
/**
The number of audio frames received from the NDI sender
*/
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Information", META = (DisplayName = "Audio Frames"))
int64 AudioFrames = 0;
/**
The number of video frames dropped in transit from an NDI sender
*/
UPROPERTY(BlueprintReadonly, VisibleAnywhere, Category = "Information",
META = (DisplayName = "Dropped Video Frames"))
int64 DroppedVideoFrames = 0;
/**
The number of audio frames dropped in transit from the NDI sender
*/
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Information",
META = (DisplayName = "Dropped Audio Frames"))
int64 DroppedAudioFrames = 0;
/**
The number of metadata frames dropped in transit from the NDI sender
*/
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Information",
META = (DisplayName = "Dropped Metadata Frames"))
int64 DroppedMetadataFrames = 0;
/**
The number of metadata frames received from the NDI sender
*/
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Information", META = (DisplayName = "Metadata Frames"))
int64 MetadataFrames = 0;
/**
The number of video frames received from the NDI sender
*/
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Information", META = (DisplayName = "Video Frames"))
int64 VideoFrames = 0;
public:
/** Constructs a new instance of this object */
FNDIReceiverPerformanceData() = default;
/** Copies an existing instance to this object */
FNDIReceiverPerformanceData(const FNDIReceiverPerformanceData& other);
/** Copies existing instance properties to this object */
FNDIReceiverPerformanceData& operator=(const FNDIReceiverPerformanceData& other);
/** Destructs this object */
virtual ~FNDIReceiverPerformanceData() = default;
/** Compares this object to 'other' and returns a determination of whether they are equal */
bool operator==(const FNDIReceiverPerformanceData& other) const;
/** Compares this object to 'other" and returns a determination of whether they are NOT equal */
bool operator!=(const FNDIReceiverPerformanceData& other) const;
public:
/** Resets the current parameters to the default property values */
void Reset();
protected:
/** Attempts to serialize this object using an Archive object */
virtual FArchive& Serialize(FArchive& Ar);
private:
/** Operator override for serializing this object to an Archive object */
friend class FArchive& operator<<(FArchive& Ar, FNDIReceiverPerformanceData& Input)
{
return Input.Serialize(Ar);
}
};

View File

@@ -0,0 +1,131 @@
/*
Copyright (C) 2024 Vizrt NDI AB. All rights reserved.
This file and its use within a Product is bound by the terms of NDI SDK license that was provided
as part of the NDI SDK. For more information, please review the license and the NDI SDK documentation.
*/
#pragma once
#include <CoreMinimal.h>
#include <FastXml.h>
class NDIXmlElementParser
{
public:
virtual ~NDIXmlElementParser()
{}
// Start parsing this element
virtual bool ProcessOpen(const TCHAR* ElementName, const TCHAR* ElementData)
{
return true;
}
// Parse an attribute of this element
virtual bool ProcessAttribute(const TCHAR* AttributeName, const TCHAR* AttributeValue)
{
return true;
}
// Start parsing a sub-element
virtual TSharedRef<NDIXmlElementParser>* ProcessElement(const TCHAR* ElementName, const TCHAR* ElementData)
{
return nullptr;
}
// Finish parsing this element
virtual bool ProcessClose(const TCHAR* ElementName)
{
return true;
}
};
class NDIXmlElementParser_null : public NDIXmlElementParser
{
public:
};
class NDIXmlParser : public IFastXmlCallback
{
public:
virtual ~NDIXmlParser()
{}
void AddElementParser(FName ElementName, TSharedRef<NDIXmlElementParser> ElementParser)
{
ElementParsers.Add(ElementName, ElementParser);
}
virtual bool ProcessXmlDeclaration(const TCHAR* ElementData, int32 XmlFileLineNumber) override
{
return true;
}
virtual bool ProcessElement(const TCHAR* ElementName, const TCHAR* ElementData, int32 XmlFileLineNumber) override
{
if(ElementParserStack.Num() == 0)
{
TSharedRef<NDIXmlElementParser>* ParserPtr = ElementParsers.Find(ElementName);
if(ParserPtr == nullptr)
ParserPtr = &NullParser;
ElementParserStack.Push(*ParserPtr);
return (*ParserPtr)->ProcessOpen(ElementName, ElementData);
}
else
{
TSharedRef<NDIXmlElementParser>* ParserPtr = ElementParserStack.Last()->ProcessElement(ElementName, ElementData);
if(ParserPtr == nullptr)
ParserPtr = &NullParser;
ElementParserStack.Push(*ParserPtr);
return (*ParserPtr)->ProcessOpen(ElementName, ElementData);
}
//return false;
}
virtual bool ProcessAttribute(const TCHAR* AttributeName, const TCHAR* AttributeValue) override
{
if(ElementParserStack.Num() == 0)
{
return true;
}
else
{
return ElementParserStack.Last()->ProcessAttribute(AttributeName, AttributeValue);
}
//return false;
}
virtual bool ProcessClose(const TCHAR* ElementName) override
{
if(ElementParserStack.Num() == 0)
{
return true;
}
else
{
auto Parser = ElementParserStack.Pop();
return Parser->ProcessClose(ElementName);
}
//return false;
}
virtual bool ProcessComment(const TCHAR* Comment) override
{
return true;
}
protected:
TMap<FName, TSharedRef<NDIXmlElementParser> > ElementParsers;
TArray<TSharedRef<NDIXmlElementParser> > ElementParserStack;
TSharedRef<NDIXmlElementParser> NullParser { MakeShareable(new NDIXmlElementParser_null()) };
};