Make sure GStreamer is at least 1.14
authorThibault Saunier <tsaunier@igalia.com>
Wed, 9 May 2018 11:31:35 +0000 (08:31 -0300)
committerThibault Saunier <tsaunier@igalia.com>
Fri, 1 Jun 2018 13:15:48 +0000 (09:15 -0400)
Since we broke ABI with https://bugzilla.gnome.org/show_bug.cgi?id=743062#c30
it is the safest way to do handle.

Update the README accordingly

README.md
sources/custom/Application.cs

index fd730f2..04dbfe2 100644 (file)
--- a/README.md
+++ b/README.md
@@ -10,9 +10,9 @@ the core and base gstreamer libraries.
 
 Prerequisites
 ----
-These libraries are needed for clutter-sharp to compile:
-* gstreamer core, base and good 1.4 or higher
-* [gtk-sharp] 3.22.6 or higher - *NOTE: This can be built as a meson subproject if using the meson build system.*
+These libraries are needed for gstreamer-sharp to compile:
+* gstreamer core, base and good 1.14 or higher
+* [gtk-sharp] 3.22.0 or higher - *NOTE: This can be built as a meson subproject.*
 
 You will also need various .NET/mono bits (mcs and al). On debian-based distros
 you can install these with:
@@ -70,5 +70,5 @@ License
 gstreamer-sharp is licensed under the [LGPL 2.1](https://www.gnu.org/licenses/lgpl-2.1.html)
 
 [bindinator]:https://github.com/GLibSharp/bindinator
-[gtk-sharp]:https://github.com/GLibSharp/GtlSharp
+[gtk-sharp]:https://github.com/GLibSharp/GtkSharp
 [gstreamer]: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/
index 27ef4c5..4ac9abb 100644 (file)
@@ -21,6 +21,9 @@ namespace Gst {
 
        partial class Application 
        {
+               // Because of: https://bugzilla.gnome.org/show_bug.cgi?id=743062#c30
+               private static uint MIN_GSTREAMER_MINOR = 14;
+
                static Application () {
                        GLib.GType.Register (List.GType, typeof(List));
                        GLib.GType.Register (Fraction.GType, typeof(Fraction));
@@ -38,9 +41,15 @@ namespace Gst {
                [DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
                static extern void gst_init(IntPtr argc, IntPtr argv);
 
+               private static void CheckVersion() {
+                       if (Gst.Version.Minor < MIN_GSTREAMER_MINOR)
+                               throw new Exception(Gst.Version.Description + " found but GStreamer 1." +
+                                       MIN_GSTREAMER_MINOR + " required.");
+               }
 
                public static void Init() {
                        gst_init (IntPtr.Zero, IntPtr.Zero);
+                       CheckVersion();
                }
                        
                public static void Init(ref string[] argv) {
@@ -52,6 +61,8 @@ namespace Gst {
                        gst_init(ref cnt_argv, ref native_argv);
                        foreach (var native_arg in native_arg_list)
                                GLib.Marshaller.Free (native_arg);
+
+                       CheckVersion();
                }
 
                [DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -63,6 +74,8 @@ namespace Gst {
                public static bool InitCheck() {
                        IntPtr error = IntPtr.Zero;
                        bool ret = gst_init_check (IntPtr.Zero, IntPtr.Zero, out error);
+
+                       CheckVersion();
                        if (error != IntPtr.Zero) throw new GLib.GException (error);
                        return ret;
                }
@@ -78,6 +91,8 @@ namespace Gst {
                        foreach (var native_arg in native_arg_list)
                                GLib.Marshaller.Free (native_arg);
                        if (error != IntPtr.Zero) throw new GLib.GException (error);
+
+                       CheckVersion();
                        return ret;
                }
        }