From b6694eb48519a6949f8894c6de8cb4b7935e457f Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Wed, 7 Sep 2016 16:18:20 +0200 Subject: [PATCH] Mod: prefer shipped gstreamer over an installed version (closes #199) --- .../GstreamerSharp/CGstreamerSharpAudio.cs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudio.cs b/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudio.cs index 73c624f8..28f47f49 100644 --- a/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudio.cs +++ b/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudio.cs @@ -35,26 +35,29 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp #if ARCH_X64 const string varName = "GSTREAMER_1_0_ROOT_X86_64"; #endif - string gstreamerEnvVar = Environment.GetEnvironmentVariable(varName, EnvironmentVariableTarget.User); string dllDirectory; - if (gstreamerEnvVar == null || !Directory.Exists(gstreamerEnvVar)) - { + #if ARCH_X86 - dllDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libs\\unmanaged\\gstreamer86\\bin\\"); + dllDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libs\\unmanaged\\gstreamer86\\bin\\"); #endif #if ARCH_X64 - dllDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libs\\unmanaged\\gstreamer64\\bin\\"); + dllDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libs\\unmanaged\\gstreamer64\\bin\\"); #endif - if (!Directory.Exists(dllDirectory)) + if (!Directory.Exists(dllDirectory)) + { + string gstreamerEnvVar = Environment.GetEnvironmentVariable(varName, EnvironmentVariableTarget.User); + + if (gstreamerEnvVar == null || !Directory.Exists(gstreamerEnvVar)) { CLog.LogError("Gstreamer not found! Make sure you installed it correctly and if it set the environment variable '" + varName + "'!", true); return false; } + else + { + dllDirectory = gstreamerEnvVar + "bin\\"; + } } - else - { - dllDirectory = gstreamerEnvVar + "bin\\"; - } + COSFunctions.AddEnvironmentPath(dllDirectory); #endif