This repository has been archived by the owner on Jul 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
2,181 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Binaries/ | ||
Build/ | ||
Debug/ | ||
Intermediate/ | ||
Saved/ | ||
|
||
Content/Collections/ | ||
Content/Developers/ | ||
|
||
Plugins/GStreamerLoader/Binaries/ | ||
Plugins/GStreamerLoader/Intermediate/ | ||
Plugins/GStreamer/Binaries/ | ||
Plugins/GStreamer/Intermediate/ | ||
|
||
.vs/ | ||
|
||
*.sln | ||
*.suo | ||
*.sdf | ||
*.opensdf | ||
*.db | ||
*.opendb | ||
*.exe | ||
*.pdb |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
[URL] | ||
|
||
[ConsoleVariables] | ||
t.MaxFPS=144 | ||
|
||
[/Script/HardwareTargeting.HardwareTargetingSettings] | ||
TargetedHardwareClass=Desktop | ||
AppliedTargetedHardwareClass=Desktop | ||
DefaultGraphicsPerformance=Maximum | ||
AppliedDefaultGraphicsPerformance=Maximum | ||
|
||
[/Script/EngineSettings.GameMapsSettings] | ||
EditorStartupMap=/Game/TestLevel.TestLevel | ||
GameDefaultMap=/Game/TestLevel.TestLevel | ||
|
||
[/Script/Engine.PhysicsSettings] | ||
DefaultGravityZ=-980.000000 | ||
DefaultTerminalVelocity=4000.000000 | ||
DefaultFluidFriction=0.300000 | ||
SimulateScratchMemorySize=262144 | ||
RagdollAggregateThreshold=4 | ||
TriangleMeshTriangleMinAreaThreshold=5.000000 | ||
bEnableAsyncScene=False | ||
bEnableShapeSharing=False | ||
bEnablePCM=True | ||
bEnableStabilization=False | ||
bWarnMissingLocks=True | ||
bEnable2DPhysics=False | ||
PhysicErrorCorrection=(PingExtrapolation=0.100000,ErrorPerLinearDifference=1.000000,ErrorPerAngularDifference=1.000000,MaxRestoredStateError=1.000000,PositionLerp=0.000000,AngleLerp=0.400000,LinearVelocityCoefficient=100.000000,AngularVelocityCoefficient=10.000000,ErrorAccumulationSeconds=0.500000,ErrorAccumulationDistanceSq=15.000000,ErrorAccumulationSimilarity=100.000000) | ||
LockedAxis=Invalid | ||
DefaultDegreesOfFreedom=Full3D | ||
BounceThresholdVelocity=200.000000 | ||
FrictionCombineMode=Average | ||
RestitutionCombineMode=Average | ||
MaxAngularVelocity=3600.000000 | ||
MaxDepenetrationVelocity=0.000000 | ||
ContactOffsetMultiplier=0.020000 | ||
MinContactOffset=2.000000 | ||
MaxContactOffset=8.000000 | ||
bSimulateSkeletalMeshOnDedicatedServer=True | ||
DefaultShapeComplexity=CTF_UseSimpleAndComplex | ||
bDefaultHasComplexCollision=True | ||
bSuppressFaceRemapTable=False | ||
bSupportUVFromHitResults=False | ||
bDisableActiveActors=False | ||
bDisableKinematicStaticPairs=False | ||
bDisableKinematicKinematicPairs=False | ||
bDisableCCD=False | ||
bEnableEnhancedDeterminism=False | ||
MaxPhysicsDeltaTime=0.033333 | ||
bSubstepping=False | ||
bSubsteppingAsync=False | ||
MaxSubstepDeltaTime=0.016667 | ||
MaxSubsteps=6 | ||
SyncSceneSmoothingFactor=0.000000 | ||
AsyncSceneSmoothingFactor=0.990000 | ||
InitialAverageFrameRate=0.016667 | ||
PhysXTreeRebuildRate=10 | ||
DefaultBroadphaseSettings=(bUseMBPOnClient=False,bUseMBPOnServer=False,MBPBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPNumSubdivs=2) | ||
|
||
[/Script/Engine.RendererSettings] | ||
r.VSync=0 | ||
r.DefaultFeature.AutoExposure=False | ||
r.DefaultFeature.Bloom=False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[/Script/EngineSettings.GeneralProjectSettings] | ||
ProjectID=263F641B48D36F5F49C5B4AE014F2924 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"FileVersion": 3, | ||
"EngineAssociation": "4.20", | ||
"Category": "", | ||
"Description": "", | ||
"Modules": [ | ||
{ | ||
"Name": "GStreamerDemo", | ||
"Type": "Runtime", | ||
"LoadingPhase": "Default", | ||
"AdditionalDependencies": [ | ||
"Engine" | ||
] | ||
} | ||
], | ||
"Plugins": [{ | ||
"Name": "GStreamer", | ||
"Enabled": true | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"FileVersion": 3, | ||
"Version": 1, | ||
"VersionName": "0.0.1", | ||
"FriendlyName": "GStreamer", | ||
"Description": "", | ||
"CreatedBy": "", | ||
"CreatedByURL": "", | ||
"DocsURL": "", | ||
"Category": "Media", | ||
"CanContainContent": true, | ||
"Modules": [ | ||
{ | ||
"Name": "GStreamer", | ||
"Type": "Runtime", | ||
"LoadingPhase": "PostEngineInit", | ||
"WhitelistPlatforms": [ "Win64" ] | ||
} | ||
], | ||
"Plugins": [ | ||
{ | ||
"Name": "GStreamerLoader", | ||
"Enabled": true | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using UnrealBuildTool; | ||
using System.IO; | ||
|
||
public class GStreamer : ModuleRules | ||
{ | ||
public GStreamer(ReadOnlyTargetRules Target) : base(Target) | ||
{ | ||
const string GStreamerRoot = @"d:\dev\gstreamer1.14.4\1.0\x86_64"; | ||
|
||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; | ||
bEnableUndefinedIdentifierWarnings = false; | ||
|
||
PublicDependencyModuleNames.AddRange( | ||
new string[] { | ||
"Core", | ||
"CoreUObject", | ||
"Engine", | ||
"InputCore", | ||
"RHI", | ||
"RenderCore", | ||
"Slate", | ||
"SlateCore", | ||
"GStreamerLoader" | ||
} | ||
); | ||
|
||
PublicIncludePaths.Add(Path.Combine(GStreamerRoot, "include")); | ||
PublicIncludePaths.Add(Path.Combine(GStreamerRoot, "include", "gstreamer-1.0")); | ||
PublicIncludePaths.Add(Path.Combine(GStreamerRoot, "include", "glib-2.0")); | ||
PublicIncludePaths.Add(Path.Combine(GStreamerRoot, "lib", "glib-2.0", "include")); | ||
PublicLibraryPaths.Add(Path.Combine(GStreamerRoot, "lib")); | ||
PublicAdditionalLibraries.Add("glib-2.0.lib"); | ||
PublicAdditionalLibraries.Add("gobject-2.0.lib"); | ||
PublicAdditionalLibraries.Add("gstreamer-1.0.lib"); | ||
PublicAdditionalLibraries.Add("gstvideo-1.0.lib"); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
Plugins/GStreamer/Source/GStreamer/Private/GStreamerModule.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "GStreamerModule.h" | ||
#include "GstCoreImpl.h" | ||
#include "SharedUnreal.h" | ||
#include "Runtime/Core/Public/Misc/Paths.h" | ||
|
||
class FGStreamerModule : public IGStreamerModule | ||
{ | ||
public: | ||
|
||
virtual void StartupModule() override; | ||
virtual void ShutdownModule() override; | ||
}; | ||
|
||
DEFINE_LOG_CATEGORY(LogGStreamer); | ||
|
||
static FString GetGstRoot() | ||
{ | ||
const int32 BufSize = 2048; | ||
TCHAR RootPath[BufSize] = {0}; | ||
|
||
FPlatformMisc::GetEnvironmentVariable(TEXT("GSTREAMER_ROOT_X86_64"), RootPath, BufSize); | ||
if (!RootPath[0]) | ||
{ | ||
FPlatformMisc::GetEnvironmentVariable(TEXT("GSTREAMER_ROOT"), RootPath, BufSize); | ||
} | ||
|
||
return FString(RootPath); | ||
} | ||
|
||
void FGStreamerModule::StartupModule() | ||
{ | ||
GST_LOG_DBG(TEXT("StartupModule")); | ||
|
||
INIT_PROFILER; | ||
|
||
FString RootPath = GetGstRoot(); | ||
FString BinPath = FPaths::Combine(RootPath, TEXT("bin")); | ||
FString PluginPath = FPaths::Combine(RootPath, TEXT("lib"), TEXT("gstreamer-1.0")); | ||
GST_LOG_DBG(TEXT("GStreamer: GSTREAMER_ROOT=\"%s\""), *RootPath); | ||
|
||
if (FGstCoreImpl::Init(TCHAR_TO_ANSI(*BinPath), TCHAR_TO_ANSI(*PluginPath))) | ||
{ | ||
GST_LOG_DBG(TEXT("GStreamer: Init SUCCESS")); | ||
} | ||
else | ||
{ | ||
GST_LOG_ERR(TEXT("GStreamer: Init FAILED")); | ||
} | ||
} | ||
|
||
void FGStreamerModule::ShutdownModule() | ||
{ | ||
GST_LOG_DBG(TEXT("ShutdownModule")); | ||
|
||
FGstCoreImpl::Deinit(); | ||
|
||
SHUT_PROFILER; | ||
} | ||
|
||
IMPLEMENT_MODULE(FGStreamerModule, GStreamer) |
66 changes: 66 additions & 0 deletions
66
Plugins/GStreamer/Source/GStreamer/Private/GstAppSinkComponent.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#include "GstAppSinkComponent.h" | ||
#include "GstPipelineImpl.h" | ||
#include "GstSampleImpl.h" | ||
#include "Runtime/Core/Public/Async/Async.h" | ||
|
||
UGstAppSinkComponent::UGstAppSinkComponent() | ||
{ | ||
PrimaryComponentTick.bCanEverTick = true; | ||
} | ||
|
||
void UGstAppSinkComponent::UninitializeComponent() | ||
{ | ||
ResetState(); | ||
} | ||
|
||
void UGstAppSinkComponent::ResetState() | ||
{ | ||
if (AppSink) AppSink->Disconnect(); | ||
SafeDestroy(Texture); | ||
SafeDestroy(AppSink); | ||
} | ||
|
||
void UGstAppSinkComponent::CbPipelineStart(IGstPipeline* Pipeline) | ||
{ | ||
ResetState(); | ||
|
||
if (AppSinkEnabled && !AppSinkName.IsEmpty()) | ||
{ | ||
AppSink = IGstAppSink::CreateInstance(); | ||
Texture = new FGstTexture(AppSinkName, AppSink, this); | ||
AppSink->Connect(Pipeline, TCHAR_TO_ANSI(*AppSinkName), this); | ||
} | ||
} | ||
|
||
void UGstAppSinkComponent::CbPipelineStop() | ||
{ | ||
ResetState(); | ||
} | ||
|
||
void UGstAppSinkComponent::CbGstSampleReceived(IGstSample* Sample) | ||
{ | ||
Texture->SubmitSample(Sample); | ||
} | ||
|
||
void UGstAppSinkComponent::CbGstTextureCreated() | ||
{ | ||
if (OnGstTextureCreated.IsBound()) | ||
{ | ||
auto This = this; | ||
AsyncTask(ENamedThreads::GameThread, [This]() | ||
{ | ||
auto Tex = This->Texture; | ||
This->OnGstTextureCreated.Broadcast(This, Tex->GetTextureObject(), Tex->GetGstFormat(), Tex->GetWidth(), Tex->GetHeight()); | ||
}); | ||
} | ||
} | ||
|
||
void UGstAppSinkComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) | ||
{ | ||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction); | ||
|
||
if (Texture) | ||
{ | ||
Texture->TickGameThread(); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
Plugins/GStreamer/Source/GStreamer/Private/GstAppSinkComponent.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
|
||
#include "GstElementComponent.h" | ||
#include "GstAppSinkImpl.h" | ||
#include "GstTexture.h" | ||
#include "GstVideoFormat.h" | ||
#include "GstAppSinkComponent.generated.h" | ||
|
||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FGstTextureCreatedSignature, UGstAppSinkComponent*, AppSink, UTexture2D*, NewTexture, EGstVideoFormat, Format, int, Width, int, Height); | ||
|
||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) | ||
class GSTREAMER_API UGstAppSinkComponent : public UGstElementComponent, public IGstAppSinkCallback, public IGstTextureCallback | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
|
||
UGstAppSinkComponent(); | ||
|
||
virtual void UninitializeComponent() override; | ||
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; | ||
|
||
virtual void CbPipelineStart(class IGstPipeline* Pipeline); | ||
virtual void CbPipelineStop(); | ||
virtual void CbGstSampleReceived(class IGstSample* Sample); | ||
virtual void CbGstTextureCreated(); | ||
|
||
UPROPERTY(Category="GstAppSink", EditAnywhere, BlueprintReadWrite) | ||
FString PipelineName; | ||
|
||
UPROPERTY(Category="GstAppSink", EditAnywhere, BlueprintReadWrite) | ||
FString AppSinkName; | ||
|
||
UPROPERTY(Category="GstAppSink", EditAnywhere, BlueprintReadWrite) | ||
bool AppSinkEnabled; | ||
|
||
UFUNCTION(Category="GstAppSink", BlueprintCallable) | ||
UTexture2D* GetTexture() { return Texture->GetTextureObject(); } | ||
|
||
UPROPERTY(Category="GstAppSink", BlueprintAssignable) | ||
FGstTextureCreatedSignature OnGstTextureCreated; | ||
|
||
protected: | ||
|
||
void ResetState(); | ||
|
||
IGstAppSink* AppSink = nullptr; | ||
FGstTexture* Texture = nullptr; | ||
}; |
Oops, something went wrong.