Skip to content

Commit

Permalink
Merge pull request #151 from AgoraIO-Extensions/dev/4.5.0
Browse files Browse the repository at this point in the history
[Plugin 450] Blueprint API update
  • Loading branch information
WinterPu authored Nov 18, 2024
2 parents 607564e + 4fa0a3f commit 4ccb233
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2155,13 +2155,16 @@ int UAgoraBPuRtcEngine::ConfigRhythmPlayer(const FUABT_AgoraRhythmPlayerConfig&
config.FreeRawData(agoraRhythmPlayerConfig);
return ret;
}
int UAgoraBPuRtcEngine::TakeSnapshot(int64 uid, const FString& filePath)
{
std::string Filepath = TCHAR_TO_UTF8(*filePath);

auto ret = AgoraUERtcEngine::Get()->takeSnapshot(uid, Filepath.c_str());

int UAgoraBPuRtcEngine::TakeSnapshot(int64 uid, const FUABT_SnapshotConfig& config)
{
agora::media::SnapshotConfig snapshotConfig = config.CreateRawData();
auto ret = AgoraUERtcEngine::Get()->takeSnapshot(UABT::ToUID(uid), snapshotConfig);
config.FreeRawData(snapshotConfig);
return ret;
}

int UAgoraBPuRtcEngine::EnableContentInspect(bool enabled, const FUABT_ContentInspectConfig& config)
{
agora::media::ContentInspectConfig contentInspectConfig = config.CreateRawData();
Expand Down Expand Up @@ -2739,17 +2742,16 @@ int UAgoraBPuRtcEngine::SetHighPriorityUserListEx(TArray<int64> uidList, EUABT_S
return ret;
}


int UAgoraBPuRtcEngine::TakeSnapshotEx(const FUABT_RtcConnection& connection, int64 uid, const FString& filePath)
int UAgoraBPuRtcEngine::TakeSnapshotEx(const FUABT_RtcConnection& connection, int64 uid, const FUABT_SnapshotConfig& config)
{
agora::rtc::RtcConnection rtcConnection = connection.CreateRawData();
std::string FilePath = TCHAR_TO_UTF8(*filePath);
auto ret = AgoraUERtcEngine::Get()->takeSnapshotEx(rtcConnection, uid, FilePath.c_str());
agora::media::SnapshotConfig snapshotConfig = config.CreateRawData();
auto ret = AgoraUERtcEngine::Get()->takeSnapshotEx(rtcConnection, UABT::ToUID(uid), snapshotConfig);
config.FreeRawData(snapshotConfig);
connection.FreeRawData(rtcConnection);
return ret;
}


int UAgoraBPuRtcEngine::EnableContentInspectEx(bool enabled, const FUABT_ContentInspectConfig& config, const FUABT_RtcConnection& connection)
{
agora::media::ContentInspectConfig contentInspectConfig = config.CreateRawData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4881,4 +4881,58 @@ struct FUABT_LocalAudioMixerConfiguration {
void FreeRawData(agora::rtc::LocalAudioMixerConfiguration& AgoraData) const {
UABT::Free_RawDataArray<agora::rtc::MixedAudioStream, FUABT_MixedAudioStream>(AgoraData.sourceStreams, AgoraData.streamCount);
}
};




/** Definition of SnapshotConfig.
*/

USTRUCT(BlueprintType)
struct FUABT_SnapshotConfig {

GENERATED_BODY()

public:

/**
* The local path (including filename extensions) of the snapshot. For example:
* - Windows: `C:\Users\<user_name>\AppData\Local\Agora\<process_name>\example.jpg`
* - iOS: `/App Sandbox/Library/Caches/example.jpg`
* - macOS: `¡«/Library/Logs/example.jpg`
* - Android: `/storage/emulated/0/Android/data/<package name>/files/example.jpg`
*/
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
FString filePath;

/**
* The position of the video observation. See VIDEO_MODULE_POSITION.
*
* Allowed values vary depending on the `uid` parameter passed in `takeSnapshot` or `takeSnapshotEx`:
* - uid = 0: Position 2, 4 and 8 are allowed.
* - uid != 0: Only position 2 is allowed.
*
*/
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
EUABT_VIDEO_MODULE_POSITION position = EUABT_VIDEO_MODULE_POSITION::POSITION_PRE_ENCODER;


FUABT_SnapshotConfig() {}
FUABT_SnapshotConfig(const agora::media::SnapshotConfig& AgoraData) {
filePath = UTF8_TO_TCHAR(AgoraData.filePath);
position = UABTEnum::WrapWithUE(AgoraData.position);
}

agora::media::SnapshotConfig CreateRawData() const {
agora::media::SnapshotConfig AgoraData;
AgoraData.filePath = UABT::New_CharPtr(filePath);
AgoraData.position = UABTEnum::ToRawValue(position);
return AgoraData;
}

void FreeRawData(agora::media::SnapshotConfig& AgoraData) const {
UABT::Free_CharPtr(AgoraData.filePath);
}

};
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,11 @@ class AGORAPLUGIN_API UAgoraBPuRtcEngine : public UObject
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int ConfigRhythmPlayer(const FUABT_AgoraRhythmPlayerConfig& config);

UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int TakeSnapshot(int64 uid, const FString& filePath);
//UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
//int TakeSnapshot(int64 uid, const FString& filePath);

// virtual int takeSnapshot(uid_t uid, const media::SnapshotConfig& config) override;
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int TakeSnapshot(int64 uid, const FUABT_SnapshotConfig& config);

UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableContentInspect(bool enabled, const FUABT_ContentInspectConfig& config);
Expand Down Expand Up @@ -915,10 +916,11 @@ UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetHighPriorityUserListEx(TArray<int64> uidList, EUABT_STREAM_FALLBACK_OPTIONS option, const FUABT_RtcConnection& connection);

UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int TakeSnapshotEx(const FUABT_RtcConnection& connection, int64 uid, const FString& filePath);
//UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
//int TakeSnapshotEx(const FUABT_RtcConnection& connection, int64 uid, const FString& filePath);

//virtual int takeSnapshotEx(const RtcConnection& connection, uid_t uid, const media::SnapshotConfig& config) override;
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int TakeSnapshotEx(const FUABT_RtcConnection& connection, int64 uid, const FUABT_SnapshotConfig& config);

UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableContentInspectEx(bool enabled, const FUABT_ContentInspectConfig& config, const FUABT_RtcConnection& connection);
Expand Down

0 comments on commit 4ccb233

Please sign in to comment.