Mod: prefer shipped gstreamer over an installed version (closes #199)

This commit is contained in:
lukeIam committed 2016-09-07 16:18:20 +02:00
1 parent d01ac27c5d
commit b6694eb485
1 file changed
+13 -10
@@ -35,26 +35,29 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
#if ARCH_X64 #if ARCH_X64
const string varName = "GSTREAMER_1_0_ROOT_X86_64"; const string varName = "GSTREAMER_1_0_ROOT_X86_64";
#endif #endif
string gstreamerEnvVar = Environment.GetEnvironmentVariable(varName, EnvironmentVariableTarget.User);
string dllDirectory; string dllDirectory;
if (gstreamerEnvVar == null || !Directory.Exists(gstreamerEnvVar))
{
#if ARCH_X86 #if ARCH_X86
dllDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libs\\unmanaged\\gstreamer86\\bin\\"); dllDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libs\\unmanaged\\gstreamer86\\bin\\");
#endif #endif
#if ARCH_X64 #if ARCH_X64
dllDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libs\\unmanaged\\gstreamer64\\bin\\"); dllDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libs\\unmanaged\\gstreamer64\\bin\\");
#endif #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); CLog.LogError("Gstreamer not found! Make sure you installed it correctly and if it set the environment variable '" + varName + "'!", true);
return false; return false;
} }
else
{
dllDirectory = gstreamerEnvVar + "bin\\";
}
} }
else
{
dllDirectory = gstreamerEnvVar + "bin\\";
}
COSFunctions.AddEnvironmentPath(dllDirectory); COSFunctions.AddEnvironmentPath(dllDirectory);
#endif #endif