2013-07-25 22:55:08 +00:00
|
|
|
// Copyright (C) 2013 Stephan Sundermann <stephansundermann@gmail.com>
|
|
|
|
//
|
2014-05-28 11:29:36 +00:00
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2.1 of the License, or (at your option) any later version.
|
2013-07-25 22:55:08 +00:00
|
|
|
//
|
2014-05-28 11:29:36 +00:00
|
|
|
// This library is distributed in the hope that it will be useful,
|
2013-07-25 22:55:08 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2014-05-28 11:29:36 +00:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
2013-07-25 22:55:08 +00:00
|
|
|
//
|
2014-05-28 11:29:36 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
// 02110-1301 USA
|
2013-07-25 22:55:08 +00:00
|
|
|
|
|
|
|
namespace Gst {
|
|
|
|
using System;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
partial class Application
|
|
|
|
{
|
2014-08-05 21:05:20 +00:00
|
|
|
static Application () {
|
|
|
|
GLib.GType.Register (List.GType, typeof(List));
|
|
|
|
GLib.GType.Register (Fraction.GType, typeof(Fraction));
|
|
|
|
GLib.GType.Register (DoubleRange.GType, typeof(DoubleRange));
|
|
|
|
GLib.GType.Register (IntRange.GType, typeof(IntRange));
|
|
|
|
GLib.GType.Register (FractionRange.GType, typeof(FractionRange));
|
|
|
|
GLib.GType.Register (DateTime.GType, typeof(DateTime));
|
|
|
|
GLib.GType.Register (Gst.Array.GType, typeof(Gst.Array));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-10-23 22:53:37 +00:00
|
|
|
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
static extern void gst_init(ref int argc, ref IntPtr[] argv);
|
|
|
|
|
|
|
|
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
static extern void gst_init(IntPtr argc, IntPtr argv);
|
|
|
|
|
|
|
|
|
2013-07-25 22:55:08 +00:00
|
|
|
public static void Init() {
|
2014-10-23 22:53:37 +00:00
|
|
|
gst_init (IntPtr.Zero, IntPtr.Zero);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Init(ref string[] argv) {
|
|
|
|
int cnt_argv = argv == null ? 0 : argv.Length;
|
2018-01-25 13:47:52 +00:00
|
|
|
System.Collections.Generic.List<IntPtr> native_arg_list = new System.Collections.Generic.List<IntPtr>();
|
2014-10-23 22:53:37 +00:00
|
|
|
for (int i = 0; i < cnt_argv; i++)
|
2018-01-25 13:47:52 +00:00
|
|
|
native_arg_list.Add (GLib.Marshaller.StringToPtrGStrdup(argv[i]));
|
|
|
|
IntPtr[] native_argv = native_arg_list.ToArray();
|
2014-10-23 22:53:37 +00:00
|
|
|
gst_init(ref cnt_argv, ref native_argv);
|
2018-01-25 13:47:52 +00:00
|
|
|
foreach (var native_arg in native_arg_list)
|
|
|
|
GLib.Marshaller.Free (native_arg);
|
2014-10-23 22:53:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
static extern bool gst_init_check(ref int argc, ref IntPtr[] argv, out IntPtr error);
|
|
|
|
|
|
|
|
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
static extern bool gst_init_check(IntPtr argc, IntPtr argv, out IntPtr error);
|
|
|
|
|
|
|
|
public static bool InitCheck() {
|
|
|
|
IntPtr error = IntPtr.Zero;
|
|
|
|
bool ret = gst_init_check (IntPtr.Zero, IntPtr.Zero, out error);
|
|
|
|
if (error != IntPtr.Zero) throw new GLib.GException (error);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool InitCheck(ref string[] argv) {
|
|
|
|
int cnt_argv = argv == null ? 0 : argv.Length;
|
2018-01-25 13:47:52 +00:00
|
|
|
System.Collections.Generic.List<IntPtr> native_arg_list = new System.Collections.Generic.List<IntPtr>();
|
2014-10-23 22:53:37 +00:00
|
|
|
for (int i = 0; i < cnt_argv; i++)
|
2018-01-25 13:47:52 +00:00
|
|
|
native_arg_list.Add (GLib.Marshaller.StringToPtrGStrdup(argv[i]));
|
|
|
|
IntPtr[] native_argv = native_arg_list.ToArray();
|
2014-10-23 22:53:37 +00:00
|
|
|
IntPtr error = IntPtr.Zero;
|
|
|
|
bool ret = gst_init_check(ref cnt_argv, ref native_argv, out error);
|
2018-01-25 13:47:52 +00:00
|
|
|
foreach (var native_arg in native_arg_list)
|
|
|
|
GLib.Marshaller.Free (native_arg);
|
2014-10-23 22:53:37 +00:00
|
|
|
if (error != IntPtr.Zero) throw new GLib.GException (error);
|
|
|
|
return ret;
|
2013-07-25 22:55:08 +00:00
|
|
|
}
|
|
|
|
}
|
2014-05-28 11:29:36 +00:00
|
|
|
}
|