Skip to content

Commit

Permalink
GStreamer: allow newer versions
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Dec 3, 2024
1 parent 5f949c7 commit e5891aa
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions ExtLibs/Utilities/GStreamer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,37 @@ public static BackendEnum Backend
{
get
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
return BackendEnum.Windows;
if (Environment.OSVersion.Platform == PlatformID.Unix)
if (Environment.OSVersion.Platform == PlatformID.Unix)
{
var doc = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
if (doc.StartsWith("/data/user/"))
return BackendEnum.Android;
return BackendEnum.Linux;
return BackendEnum.Linux;
}

return BackendEnum.Windows;
}
}

public static void gst_init(IntPtr argc, IntPtr argv)
{
switch (Backend)
{
default:
case BackendEnum.Windows:
WinNativeMethods.gst_init(argc, argv);
break;
case BackendEnum.Linux:
LinuxNativeMethods.gst_init(argc, argv);
break;
case BackendEnum.Android:
AndroidNativeMethods.gst_init(argc, argv);
break;
}
}

public static void gst_init(ref int argc, string[] argv)
{
switch (Backend)
Expand Down Expand Up @@ -918,7 +935,7 @@ public static class WinNativeMethods
[DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
public static extern void gst_init(IntPtr argc, IntPtr argv);

[DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern void gst_init(ref int argc, string[] argv);

[DllImport(lib, CallingConvention = CallingConvention.Cdecl)]
Expand Down Expand Up @@ -1244,17 +1261,15 @@ public static Thread StartA(string stringpipeline)
static void ThreadStart(object datao)
{
string stringpipeline = (string)datao;
int argc = 1;
string[] argv = new string[] { "-vvv" };

Environment.SetEnvironmentVariable("GST_DEBUG", "*:4");

try
{


//https://github.com/GStreamer/gstreamer/blob/master/tools/gst-launch.c#L1125
NativeMethods.gst_init(ref argc, argv);
NativeMethods.gst_init(IntPtr.Zero, IntPtr.Zero);
}
catch (DllNotFoundException ex)
{
Expand Down

0 comments on commit e5891aa

Please sign in to comment.