Skip to content

Commit

Permalink
Initial push of AJAMedia plugin for 4.23. SDK ntv2sdkwin_15.2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Boutot committed Aug 16, 2019
1 parent 49796cf commit 9febb69
Show file tree
Hide file tree
Showing 56 changed files with 6,133 additions and 0 deletions.
56 changes: 56 additions & 0 deletions AjaMedia.uplugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"FileVersion" : 3,

"FriendlyName" : "AJA Media Player",
"Version" : 2,
"VersionName" : "2.0",
"CreatedBy" : "Epic Games Inc",
"CreatedByURL" : "http://epicgames.com",
"MarketplaceURL" : "com.epicgames.launcher://ue/marketplace/content/91088fb17fb04b6b9eda41aaf8fda21e",
"Description" : "Implements input and output using AJA Capture cards.",
"Category" : "Media Players",
"CanContainContent" : true,
"EnabledByDefault" : false,
"IsBetaVersion": false,

"Modules" :
[
{
"Name" : "AjaMedia",
"Type" : "Runtime",
"LoadingPhase" : "Default",
"WhitelistPlatforms" : [ "Win64" ]
},
{
"Name": "AjaMediaOutput",
"Type" : "Runtime",
"LoadingPhase" : "Default",
"WhitelistPlatforms" : [ "Win64" ]
},
{
"Name" : "AjaMediaFactory",
"Type" : "Editor",
"LoadingPhase" : "PostEngineInit",
"WhitelistPlatforms" : [ "Win64" ]
},
{
"Name" : "AjaMediaFactory",
"Type": "RuntimeNoCommandlet",
"LoadingPhase" : "PostEngineInit",
"WhitelistPlatforms" : [ "Win64" ]
},
{
"Name" : "AjaMediaEditor",
"Type" : "Editor",
"LoadingPhase" : "PostEngineInit",
"WhitelistPlatforms" : [ "Win64" ]
}
],
"Plugins" :
[
{
"Name" : "MediaIOFramework",
"Enabled" : true
}
]
}
Binary file added Binaries/ThirdParty/Win64/AJA.dll
Binary file not shown.
Binary file added Binaries/ThirdParty/Win64/AJA.lib
Binary file not shown.
6 changes: 6 additions & 0 deletions Config/BaseAjaMedia.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[CoreRedirects]

; 4.22
+EnumRedirects=(OldName="EAjaMediaOutputPixelFormat", ValueChanges=(("PF_8BIT_ARGB", "PF_8BIT_YUV"), ("PF_10BIT_RGB", "PF_10BIT_YUV")))
+EnumRedirects=(OldName="EAjaMediaSourceColorFormat", ValueChanges=(("BGRA", "YUV2_8bit"), ("BGR10", "YUV_10bit")))

Binary file added Content/Editor/Icons/AjaMediaOutput_20x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Content/Editor/Icons/AjaMediaOutput_64x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Content/Editor/Icons/AjaMediaSource_20x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Content/Editor/Icons/AjaMediaSource_64x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Epic Games

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file added Resources/Icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions Source/AjaMedia/AjaMedia.Build.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.

using System.IO;

namespace UnrealBuildTool.Rules
{
using System.IO;

public class AjaMedia : ModuleRules
{
public AjaMedia(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

DynamicallyLoadedModuleNames.AddRange(
new string[] {
"Media",
});

PrivateDependencyModuleNames.AddRange(
new string[] {
"AJA",
"Core",
"CoreUObject",
"Engine",
"MediaIOCore",
"MediaUtils",
"Projects",
"TimeManagement",
"UtilityShaders"
});

PrivateIncludePathModuleNames.AddRange(
new string[] {
"Media",
});

PrivateIncludePaths.AddRange(
new string[] {
"AjaMedia/Private",
"AjaMedia/Private/Aja",
"AjaMedia/Private/Assets",
"AjaMedia/Private/Player",
"AjaMedia/Private/Shared",
});

PublicDependencyModuleNames.AddRange(
new string[] {
"MediaAssets",
});
}
}
}
132 changes: 132 additions & 0 deletions Source/AjaMedia/Private/Aja/Aja.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.

#include "Aja.h"
#include "AjaMediaPrivate.h"

#include "Misc/FrameRate.h"
#include "Interfaces/IPluginManager.h"
#include "HAL/PlatformProcess.h"
#include "Misc/Paths.h"

//~ Static initialization
//--------------------------------------------------------------------
void* FAja::LibHandle = nullptr;
bool FAja::bCanForceAJAUsage = false;

//~ Initialization functions implementation
//--------------------------------------------------------------------
bool FAja::Initialize()
{
#if AJAMEDIA_DLL_PLATFORM
check(LibHandle == nullptr);

#if AJAMEDIA_DLL_DEBUG
const FString AjaDll = TEXT("AJAd.dll");
#else
const FString AjaDll = TEXT("AJA.dll");
#endif //AJAMEDIA_DLL_DEBUG

// determine directory paths
FString AjaDllPath = FPaths::Combine(IPluginManager::Get().FindPlugin(TEXT("AjaMedia"))->GetBaseDir(), TEXT("/Binaries/ThirdParty/Win64"));
FPlatformProcess::PushDllDirectory(*AjaDllPath);
AjaDllPath = FPaths::Combine(AjaDllPath, AjaDll);

if (!FPaths::FileExists(AjaDllPath))
{
UE_LOG(LogAjaMedia, Error, TEXT("Failed to find the binary folder for the AJA dll. Plug-in will not be functional."));
return false;
}

LibHandle = FPlatformProcess::GetDllHandle(*AjaDllPath);

if (LibHandle == nullptr)
{
UE_LOG(LogAjaMedia, Error, TEXT("Failed to load required library %s. Plug-in will not be functional."), *AjaDllPath);
return false;
}

//Check if command line argument to force AJA card usage is there
bCanForceAJAUsage = FParse::Param(FCommandLine::Get(), TEXT("forceajausage"));

#if !NO_LOGGING
AJA::SetLoggingCallbacks(&LogInfo, &LogWarning, &LogError);
#endif // !NO_LOGGING
return true;
#else
return false;
#endif // AJAMEDIA_DLL_PLATFORM
}

bool FAja::IsInitialized()
{
return (LibHandle != nullptr);
}

void FAja::Shutdown()
{
#if AJAMEDIA_DLL_PLATFORM
if (LibHandle != nullptr)
{
#if !NO_LOGGING
AJA::SetLoggingCallbacks(nullptr, nullptr, nullptr);
#endif // !NO_LOGGING
FPlatformProcess::FreeDllHandle(LibHandle);
LibHandle = nullptr;
}
#endif // AJAMEDIA_DLL_PLATFORM
}

//~ Conversion functions implementation
//--------------------------------------------------------------------

FTimecode FAja::ConvertAJATimecode2Timecode(const AJA::FTimecode& InTimecode, const FFrameRate& InFPS)
{
return FTimecode(InTimecode.Hours, InTimecode.Minutes, InTimecode.Seconds, InTimecode.Frames, FTimecode::IsDropFormatTimecodeSupported(InFPS));
}

//~ Log functions implementation
//--------------------------------------------------------------------
void FAja::LogInfo(const TCHAR* InFormat, ...)
{
#if !NO_LOGGING
TCHAR TempString[1024];
va_list Args;

va_start(Args, InFormat );
FCString::GetVarArgs(TempString, ARRAY_COUNT(TempString), InFormat, Args);
va_end(Args);

UE_LOG(LogAjaMedia, Log, TempString);
#endif // !NO_LOGGING
}

void FAja::LogWarning(const TCHAR* InFormat, ...)
{
#if !NO_LOGGING
TCHAR TempString[1024];
va_list Args;

va_start(Args, InFormat );
FCString::GetVarArgs(TempString, ARRAY_COUNT(TempString), InFormat, Args);
va_end(Args);

UE_LOG(LogAjaMedia, Warning, TempString);
#endif // !NO_LOGGING
}

void FAja::LogError(const TCHAR* InFormat, ...)
{
#if !NO_LOGGING
TCHAR TempString[1024];
va_list Args;

va_start(Args, InFormat );
FCString::GetVarArgs(TempString, ARRAY_COUNT(TempString), InFormat, Args);
va_end(Args);

UE_LOG(LogAjaMedia, Error, TempString);
#endif // !NO_LOGGING
}



36 changes: 36 additions & 0 deletions Source/AjaMedia/Private/Aja/Aja.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.

#pragma once

#include "CoreTypes.h"
#include "Misc/App.h"
#include "Misc/Timecode.h"
#include "Misc/Timespan.h"

namespace AJA
{
struct FTimecode;
}
struct FFrameRate;

class FAja
{
public:
static bool Initialize();
static bool IsInitialized();
static void Shutdown();

// Helpers
static FTimecode ConvertAJATimecode2Timecode(const AJA::FTimecode& InTimecode, const FFrameRate& InFPS);

static bool CanUseAJACard() { return (FApp::CanEverRender() || bCanForceAJAUsage); }

private:
static void LogInfo(const TCHAR* InFormat, ...);
static void LogWarning(const TCHAR* InFormat, ...);
static void LogError(const TCHAR* InFormat, ...);

private:
static void* LibHandle;
static bool bCanForceAJAUsage;
};
Loading

0 comments on commit 9febb69

Please sign in to comment.