[gnome-subtitles] Switched to gstreamer-sharp and GLibSharp/GtkSharp



commit 77af7ccb41844f769cea2d9a4284abd3cbd22687
Author: Pedro Castro <pedro gnomesubtitles org>
Date:   Thu Feb 3 23:55:26 2022 +0000

    Switched to gstreamer-sharp and GLibSharp/GtkSharp
    
    The gstreamer backend now uses gstreamer-sharp instead of the custom C
    bindings. This fixes #184 and #189.
    Additionally, Gnome Subtitles now uses GLibSharp/GtkSharp instead of the
    original gtk-sharp binding which haven't been updated in a while. The
    new bindings will be bundled inside the Gnome Subtitles source tree. For
    now, to build Gnome Subtitles, gstreamer-sharp (and its gtk-sharp
    subproject) must be built and all dll files places in GS's build dir.

 INSTALL                                            |   6 +-
 Makefile.am                                        |  16 -
 configure.ac                                       |   4 +-
 gnome-subtitles.csproj                             |  36 +-
 src/External/GStreamer/GstBackend.cs               | 361 ++++++++++++++++++
 .../{GstBackend => GStreamer}/GstMediaInfo.cs      |  53 +--
 src/External/GstBackend/.vscode/settings.json      |   4 -
 src/External/GstBackend/GstBackend.cs              | 217 -----------
 src/External/GstBackend/gst-backend.c              | 421 ---------------------
 src/GnomeSubtitles/Core/Base.cs                    |  14 +-
 src/GnomeSubtitles/Execution/ExecutionContext.cs   |   6 +-
 src/GnomeSubtitles/Ui/VideoPreview/Player.cs       |   2 +-
 src/Makefile.am                                    |  22 +-
 13 files changed, 412 insertions(+), 750 deletions(-)
---
diff --git a/INSTALL b/INSTALL
index 8865734..e82fd21 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,8 +1,8 @@
 Installation Instructions
 *************************
 
-   Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
-Foundation, Inc.
+   Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free
+Software Foundation, Inc.
 
    Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
@@ -225,7 +225,7 @@ order to use an ANSI C compiler:
 
 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
 
-   HP-UX 'make' updates targets which have the same time stamps as their
+   HP-UX 'make' updates targets which have the same timestamps as their
 prerequisites, which makes it generally unusable when shipped generated
 files such as 'configure' are involved.  Use GNU 'make' instead.
 
diff --git a/Makefile.am b/Makefile.am
index 6c36925..9c4b40b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,22 +2,6 @@ SUBDIRS = src data po help
 
 ACLOCAL_AMFLAGS = -I m4
 
-gstpbdir = $(pkglibdir)
-
-#dist-hook:
-#      @if test -d "$(srcdir)/.git"; \
-#      then \
-#              echo Creating ChangeLog && \
-#              ( cd "$(top_srcdir)" && \
-#                      echo '# Generated by Makefile. Do not edit.'; echo; \
-#                      $(top_srcdir)/missing --run git log --stat ) > ChangeLog.tmp \
-#              && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
-#              || ( rm -f ChangeLog.tmp ; \
-#                      echo Failed to generate ChangeLog >&2 ); \
-#      else \
-#              echo A git clone is required to generate a ChangeLog >&2; \
-#      fi
-
 EXTRA_DIST =                   \
        autogen.sh                      \
        gnome-subtitles.csproj \
diff --git a/configure.ac b/configure.ac
index 5ebc5a4..480e718 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,12 +67,12 @@ fi
 
 #Dependencies
 MONO_REQUIRED_VERSION=4.0
-GTKSHARP_REQUIRED_VERSION=2.99.3
+#GTKSHARP_REQUIRED_VERSION=2.99.3
 GTK_REQUIRED_VERSION=3.12
 GSTREAMER_REQUIRED_VERSION=1.0
 
 PKG_CHECK_MODULES(MONO, [mono >= $MONO_REQUIRED_VERSION])
-PKG_CHECK_MODULES(GTKSHARP, [gtk-sharp-3.0 >= $GTKSHARP_REQUIRED_VERSION])
+#PKG_CHECK_MODULES(GTKSHARP, [gtk-sharp-3.0 >= $GTKSHARP_REQUIRED_VERSION])
 PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= $GTK_REQUIRED_VERSION])
 PKG_CHECK_MODULES(gstreamer, [
        gstreamer-1.0 >= $GSTREAMER_REQUIRED_VERSION
diff --git a/gnome-subtitles.csproj b/gnome-subtitles.csproj
index 4d55860..a609c83 100644
--- a/gnome-subtitles.csproj
+++ b/gnome-subtitles.csproj
@@ -33,26 +33,29 @@
     <Reference Include="System" />
     <Reference Include="Mono.Posix" />
     <Reference Include="System.Web" />
-    <Reference Include="gtk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
-      <Package>gtk-sharp-3.0</Package>
+    <Reference Include="atk-sharp">
+      <HintPath>build\atk-sharp.dll</HintPath>
     </Reference>
-    <Reference Include="atk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
-      <Package>gtk-sharp-3.0</Package>
+    <Reference Include="gdk-sharp">
+      <HintPath>build\gdk-sharp.dll</HintPath>
     </Reference>
-    <Reference Include="pango-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
-      <Package>gtk-sharp-3.0</Package>
+    <Reference Include="gio-sharp">
+      <HintPath>build\gio-sharp.dll</HintPath>
     </Reference>
-    <Reference Include="gdk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
-      <Package>gdk-sharp-3.0</Package>
+    <Reference Include="glib-sharp">
+      <HintPath>build\glib-sharp.dll</HintPath>
     </Reference>
-    <Reference Include="cairo-sharp, Version=1.10.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
-      <Package>gtk-sharp-3.0</Package>
+    <Reference Include="gstreamer-sharp">
+      <HintPath>build\gstreamer-sharp.dll</HintPath>
     </Reference>
-    <Reference Include="gio-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
-      <Package>gio-sharp-3.0</Package>
+    <Reference Include="gtk-sharp">
+      <HintPath>build\gtk-sharp.dll</HintPath>
     </Reference>
-    <Reference Include="glib-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
-      <Package>glib-sharp-3.0</Package>
+    <Reference Include="pango-sharp">
+      <HintPath>build\pango-sharp.dll</HintPath>
+    </Reference>
+    <Reference Include="cairo-sharp">
+      <HintPath>build\cairo-sharp.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>
@@ -275,10 +278,10 @@
     <Compile Include="src\GnomeSubtitles\Ui\WindowState.cs" />
     <Compile Include="src\External\Enchant\Enchant.cs" />
     <Compile Include="src\External\Interop\Interop.cs" />
-    <Compile Include="src\External\GstBackend\GstBackend.cs" />
-    <Compile Include="src\External\GstBackend\GstMediaInfo.cs" />
     <Compile Include="src\GnomeSubtitles\Ui\VideoPreview\MediaBackend.cs" />
     <Compile Include="src\GnomeSubtitles\Dialog\Message\DialogUtil.cs" />
+    <Compile Include="src\External\GStreamer\GstBackend.cs" />
+    <Compile Include="src\External\GStreamer\GstMediaInfo.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>
@@ -287,6 +290,7 @@
     <Folder Include="src\External\GtkSpell\" />
     <Folder Include="src\External\Enchant\" />
     <Folder Include="src\External\Interop\" />
+    <Folder Include="src\External\GStreamer\" />
   </ItemGroup>
   <ItemGroup>
     <None Include="data\gnome-subtitles.svg">
diff --git a/src/External/GStreamer/GstBackend.cs b/src/External/GStreamer/GstBackend.cs
new file mode 100644
index 0000000..ccdf649
--- /dev/null
+++ b/src/External/GStreamer/GstBackend.cs
@@ -0,0 +1,361 @@
+/*
+ * This file is part of Gnome Subtitles.
+ * Copyright (C) 2022 Pedro Castro
+ *
+ * Gnome Subtitles is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Gnome Subtitles is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+using GnomeSubtitles.Ui.VideoPreview;
+using Gst;
+using Gst.PbUtils;
+using Mono.Unix;
+using SubLib.Util;
+using System;
+
+namespace External.GStreamer {
+
+       public class GstBackend : MediaBackend {
+
+               private Element playbin = null;
+               private Element gtkSink = null;
+               private GstMediaInfo mediaInfo = null;
+               private float speed = 1f; //Keeping it here as we need to pass it to every 'seek' call
+
+               public override string Name {
+                       get { return "GStreamer"; }
+               }
+               
+               public override long CurrentPosition {
+                       get { return GetCurrentPosition(); }
+               }
+               
+               public override long Duration {
+                       get { return mediaInfo.Duration; }
+               }
+               
+               public override bool HasVideo {
+                       get { return mediaInfo.HasVideo; }
+               }
+               
+               public override float AspectRatio {
+                       get { return mediaInfo.AspectRatio; }
+               }
+
+               public override float FrameRate {
+                       get { return mediaInfo.FrameRate; }
+               }
+
+               public override bool HasAudio {
+                       get { return mediaInfo.HasAudio; }
+               }
+
+               public override Gtk.Widget CreateVideoWidget () {
+                       return gtkSink["widget"] as Gtk.Widget;
+               }
+               
+               
+               /* Public methods */
+
+               public override void Dispose () {
+                       //Do nothing
+               }
+
+               public override void Initialize () {
+                       //Disable LIBVA by default as it's causing lots of problems. This is done by setting 
an invalid driver name.
+                       if (!"FALSE".Equals(Environment.GetEnvironmentVariable("GS_DISABLE_LIBVA"))) {
+                               Logger.Info("[GstBackend] Disabling libva");
+                               Environment.SetEnvironmentVariable("LIBVA_DRIVER_NAME", "GNOME_SUBTITLES");
+                       }
+
+                       Gst.Application.Init();
+
+                       playbin = ElementFactory.Make("playbin", "playbin");
+                       gtkSink = ElementFactory.Make("gtksink", "gtksink");
+
+                       playbin["video-sink"] = gtkSink;
+
+                       playbin.Bus.AddSignalWatch();
+                       playbin.Bus.Message += OnGstMessage;
+               }
+
+               public override bool Load (string uri) {
+                       SetStatus(MediaStatus.Loading);
+                       
+                       playbin["uri"]  = uri;
+                       return playbin.SetState(State.Paused) != StateChangeReturn.Failure;
+               }
+
+               public override void Pause () {
+                       playbin.SetState(State.Paused);
+                       SetStatus(MediaStatus.Paused);
+               }
+
+               public override void Play () {
+                       playbin.SetState(State.Playing);
+                       SetStatus(MediaStatus.Playing);
+               }
+
+               public override void Seek (long time, bool isAbsolute) {
+                       if ((Status == MediaStatus.Unloaded) || (Status == MediaStatus.Loading)) {
+                               return;
+                       }
+                       
+                       long newPosition = isAbsolute ? time : GetCurrentPosition() + time;
+
+                       /* Note: gst_element_seek_simple can't be used here because it always resets speed to 
1, 
+                        * and we need to keep the current speed.
+                        */
+                       playbin.Seek(speed, Format.Time, SeekFlags.Flush, SeekType.Set, newPosition * 
Gst.Constants.MSECOND, SeekType.None, 0);
+               }
+
+               public override void SetSpeed (float speed) {
+                       if ((Status == MediaStatus.Unloaded) || (Status == MediaStatus.Loading)) {
+                               return;
+                       }
+                       
+                       this.speed = speed;
+                       playbin.Seek(speed, Format.Time, SeekFlags.Flush, SeekType.Set, GetCurrentPosition() 
* Gst.Constants.MSECOND, SeekType.None, 0);
+               }
+
+               public override void Unload () {
+                       if (playbin != null) {
+                               playbin.SetState(State.Null);
+                               playbin.Unref();
+                               playbin = null;
+                       }
+
+                       SetStatus(MediaStatus.Unloaded);
+                                               
+                       mediaInfo = null;
+                       speed = 1f;
+               }
+                               
+
+               /* Private members */
+
+               private void OnGstMessage (object o, MessageArgs args) {
+
+                       switch (args.Message.Type) {
+
+                               /* ASYNC_DONE can be emitted many times (example: when returning back from
+                                * pause to play). If the info is already loaded, don't do anything.
+                                */
+                               case MessageType.AsyncDone:
+                                       if (mediaInfo == null) {
+                                               LoadMediaInfo();
+                                       }
+                                       break;
+
+                               /*case GST_MESSAGE_STATE_CHANGED: {
+                                       GstState old_state, new_state, pending_state;
+                                       gst_message_parse_state_changed(message, &old_state, &new_state, 
&pending_state);
+                                       g_print("on_gst_message: STATE CHANGED: old=%s, new(current)=%s, 
pending(target)=%s\n",
+                                               gst_element_state_get_name(old_state), 
gst_element_state_get_name(new_state), gst_element_state_get_name(pending_state));
+                                       break;
+                               }*/
+
+                               case MessageType.Error:
+                                       GLib.GException gerror;
+                                       string debug;
+                                       args.Message.ParseError(out gerror, out debug);
+
+                                       Logger.Error("[GstBackend] Gst error: '{0}'; debug message: '{1}'", 
gerror.Message, debug);
+                                       TriggerErrorFound(gerror.Message);
+                                       break;
+
+                               // Playback finished
+                               case MessageType.Eos:
+                                       TriggerEndOfStreamReached();
+                                       break;
+                       }
+               }
+
+               private void LoadMediaInfo () {
+                       mediaInfo = new GstMediaInfo();
+
+                       /* Check for video and audio */
+                       mediaInfo.HasVideo = CheckIfMediaHasVideo();
+                       mediaInfo.HasAudio = CheckIfMediaHasAudio();
+
+                       if (!mediaInfo.HasVideo && !mediaInfo.HasAudio) {
+                               TriggerErrorFound(Catalog.GetString("The file contains no video or audio."));
+                               return;
+                       }
+
+                       if (mediaInfo.HasVideo) {
+                               if (!LoadVideoInfo(mediaInfo)) {
+                                       TriggerNoMediaInfoError();
+                                       return;
+                               }
+                       }
+
+                       LoadMediaDuration();
+               }
+               
+               private bool CheckIfMediaHasVideo() {
+                       return (int)playbin["current-video"] != -1;
+               }
+               
+               private bool CheckIfMediaHasAudio() {
+                       return (int)playbin["current-audio"] != -1;
+               }
+               
+               private bool LoadVideoInfo(GstMediaInfo info) {
+                       Pad videoPad = gtkSink.GetStaticPad("sink");
+                       if (videoPad == null) {
+                               Logger.Error("[GstBackend] Unable to obtain the video pad");
+                               return false;
+                       }
+                       
+                       Caps caps = videoPad.CurrentCaps;
+                       if (caps == null) {
+                               Logger.Error("[GstBackend] Unable to obtain the video caps");
+                               return false;
+                       }
+                       
+                       bool gotWidth = false, gotHeight = false, gotFrameRate = false;
+                       foreach (Structure structure in caps) {
+                               string name = structure.Name;
+                               if (String.IsNullOrEmpty(name) || !name.StartsWith("video", 
StringComparison.Ordinal)) {
+                                       continue;
+                               }
+                               
+                               /* Get the values */
+                               
+                               if (!gotWidth) {
+                                       int width = -1;
+                                       if (structure.GetInt("width", out width)) {
+                                               info.Width = width;
+                                               gotWidth = true;
+                                       }
+                               }
+                               
+                               if (!gotHeight) {
+                                       int height = -1;
+                                       if (structure.GetInt("height", out height)) {
+                                               info.Height = height;
+                                               gotHeight = true;
+                                       }
+                               }
+                               
+                               if (!gotFrameRate) {
+                                       int numerator = -1, denominator = -1;
+                                       if (structure.GetFraction("framerate", out numerator, out 
denominator)) {
+                                               info.FrameRate = (float)numerator / (float)denominator;
+                                               gotFrameRate = true;
+                                       }
+                               }
+                               
+                               if (gotWidth && gotHeight && gotFrameRate) {
+                                       break;
+                               }
+                       }
+
+
+                       /* Check if we got everything we needed */
+                       
+                       if (!gotWidth || !gotHeight || !gotFrameRate) {
+                               Logger.Error("[GstBackend] Unable to obtain the video width, height or frame 
rate. GotWidth={0}, GotHeight={1}, GotFrameRate={2}", gotWidth, gotHeight, gotFrameRate);
+                               return false;
+                       }
+                       
+                       info.AspectRatio = (float)mediaInfo.Width / (float)mediaInfo.Height;
+                       
+                       return true;
+               }
+               
+               /**
+                * Performs an async query when the default method for obtaining the duration fails.
+                */
+               private void LoadMediaDuration() {
+                       long duration = -1;     
+                       if (playbin.QueryDuration(Format.Time, out duration)) {
+                               mediaInfo.Duration = duration / Gst.Constants.MSECOND;
+                               TriggerLoadComplete();
+                               return;
+                       }
+       
+                       /* Usually we can query the duration above. However, there are
+                        * some files where this doesn't happen (for example, some audio files
+                        * where the duration is only computed when starting to play the file).
+                        * In those cases, the GstDiscoverer is used below.
+                        */
+                       Logger.Info("[GstBackend] Unable to query the media duration. Using the discoverer.");
+                       
+                       
+                       string uri = playbin["current-uri"] as String;
+                       Discoverer discoverer = new Discoverer(Gst.Constants.SECOND);
+                       if (discoverer == null) {
+                               Logger.Error("[GstBackend] Unable to get the gstreamer discoverer");
+                               TriggerNoMediaInfoError();
+                               return;
+                       }
+
+                       discoverer.Discovered += OnDiscovered;
+                       discoverer.Start();
+                       
+                       if (!discoverer.DiscoverUriAsync(uri)) {
+                               Logger.Error("[GstBackend] Failed to start the discoverer");
+                               TriggerNoMediaInfoError();
+                               return;
+                       }
+               }
+               
+               private long GetCurrentPosition() {
+                       long position = -1;
+                       
+                       /* Try to query the position */
+                       if (playbin.QueryPosition(Format.Time, out position)) {
+                               return position / Gst.Constants.MSECOND;
+                       }
+                       
+                       /* Query position wasn't successful. This is usually due to a pending state change,
+                        * which happens for example after seeking, so we wait for the state change to 
complete
+                        * and try again.
+                        */
+                       WaitForStateChangeToComplete();
+                       if (playbin.QueryPosition(Format.Time, out position)) {
+                               return position / Gst.Constants.MSECOND;
+                       }
+                       
+                       /* If we're here, we're still unable to return the position after waiting for the 
state
+                        * change to complete. Return -1. */
+                       Logger.Error("[GstBackend] Unable to query the current position");
+                       return -1;
+               }
+
+               private void WaitForStateChangeToComplete () {
+                       State state;
+                       State pending;
+                       playbin.GetState(out state, out pending, Gst.Constants.CLOCK_TIME_NONE);
+               }
+
+               private void TriggerLoadComplete () {
+                       SetStatus(MediaStatus.Loaded);
+               }
+               
+               private void OnDiscovered (object o, DiscoveredArgs args) {
+                       mediaInfo.Duration = (long)args.Info.Duration / Gst.Constants.MSECOND;
+                       TriggerLoadComplete();                  
+               }
+
+               private void TriggerNoMediaInfoError() {
+                       TriggerErrorFound(Catalog.GetString("Unable to obtain the complete media 
information."));
+               }
+               
+
+       }
+
+}
\ No newline at end of file
diff --git a/src/External/GstBackend/GstMediaInfo.cs b/src/External/GStreamer/GstMediaInfo.cs
similarity index 55%
rename from src/External/GstBackend/GstMediaInfo.cs
rename to src/External/GStreamer/GstMediaInfo.cs
index e7022a1..7225a3e 100644
--- a/src/External/GstBackend/GstMediaInfo.cs
+++ b/src/External/GStreamer/GstMediaInfo.cs
@@ -1,6 +1,6 @@
 /*
  * This file is part of Gnome Subtitles.
- * Copyright (C) 2021 Pedro Castro
+ * Copyright (C) 2022 Pedro Castro
  *
  * Gnome Subtitles is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,54 +22,17 @@ using System.Runtime.InteropServices;
 
 namespace External.GStreamer {
 
-[StructLayout(LayoutKind.Sequential)]
 public class GstMediaInfo {
-       long duration;
        
-       bool has_video;
-       int width;
-       int height;
-       float aspect_ratio;
-       float frame_rate;
+       public long Duration { get; set; }
        
-       bool has_audio;
+       public bool HasVideo { get; set; }
+       public int Width { get; set; }
+       public int Height { get; set; }
+       public float AspectRatio { get; set; }
+       public float FrameRate { get; set; }
 
-       public GstMediaInfo(IntPtr ptr) {
-               if (ptr != IntPtr.Zero) {
-                       Marshal.PtrToStructure(ptr, this);
-               }
-       }
-       
-       
-       /* Public properties */
-       
-       public long Duration {
-               get { return duration; }
-       }
-       
-       public bool HasVideo {
-               get { return has_video; }
-       }
-       
-       public int Width {
-               get { return width; }
-       }
-       
-       public int Height
-               { get { return height; }
-       }
-       
-       public float AspectRatio {
-               get { return aspect_ratio; }
-       }
-       
-       public float FrameRate {
-               get { return frame_rate; }
-       }
-       
-       public bool HasAudio {
-               get { return has_audio; }
-       }
+       public bool HasAudio { get; set; }
 
 }
 
diff --git a/src/GnomeSubtitles/Core/Base.cs b/src/GnomeSubtitles/Core/Base.cs
index 5277bf8..6ecfd2f 100644
--- a/src/GnomeSubtitles/Core/Base.cs
+++ b/src/GnomeSubtitles/Core/Base.cs
@@ -1,6 +1,6 @@
 /*
  * This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2019 Pedro Castro
+ * Copyright (C) 2006-2022 Pedro Castro
  *
  * Gnome Subtitles is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -224,19 +224,9 @@ public static class Base {
 
        public static void Open (string path, Encoding encoding, Uri videoUri) {
                OpenDocument(path, encoding);
-               
-               //OpenVideo(videoUri); //FIXME
-               videoUriToOpenWithTimeout = videoUri; //FIXME
-               GLib.Timeout.Add(1000, OpenVideoWithTimeout); //FIXME
+               OpenVideo(videoUri);
        }
        
-       /* Nasty hack while there isn't a proper fix for #184 */
-       private static Uri videoUriToOpenWithTimeout = null;
-       private static bool OpenVideoWithTimeout() {
-               OpenVideo(videoUriToOpenWithTimeout);
-               return false;
-       }
-
        public static void OpenTranslation (string path, Encoding encoding) {
                if (document.IsTranslationLoaded)
                        CloseTranslation();
diff --git a/src/GnomeSubtitles/Execution/ExecutionContext.cs 
b/src/GnomeSubtitles/Execution/ExecutionContext.cs
index f199ab6..eab5aff 100644
--- a/src/GnomeSubtitles/Execution/ExecutionContext.cs
+++ b/src/GnomeSubtitles/Execution/ExecutionContext.cs
@@ -1,6 +1,6 @@
 /*
  * This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2019 Pedro Castro
+ * Copyright (C) 2006-2022 Pedro Castro
  *
  * Gnome Subtitles is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -96,8 +96,8 @@ public class ExecutionContext {
                app.Activated += (sender, e) => {
                        methodToExecute();
                };
-
-               app.Run(0, "");
+               
+               app.Run(applicationID, new string[]{ });
        }
        
 
diff --git a/src/GnomeSubtitles/Ui/VideoPreview/Player.cs b/src/GnomeSubtitles/Ui/VideoPreview/Player.cs
index 08d3e29..37270ff 100644
--- a/src/GnomeSubtitles/Ui/VideoPreview/Player.cs
+++ b/src/GnomeSubtitles/Ui/VideoPreview/Player.cs
@@ -1,6 +1,6 @@
 /*
  * This file is part of Gnome Subtitles.
- * Copyright (C) 2007-2021 Pedro Castro
+ * Copyright (C) 2007-2022 Pedro Castro
  *
  * Gnome Subtitles is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/Makefile.am b/src/Makefile.am
index 77e37e7..5c3fac2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,17 +11,10 @@ ASSEMBLY = $(GS_BUILDDIR)/gnome-subtitles.exe
 ASSEMBLY_CONFIG = $(ASSEMBLY).config
 ASSEMBLY_CONFIG_SRC = $(srcdir)/GnomeSubtitles/Execution/gnome-subtitles.exe.config
 
-AM_CFLAGS = $(gstreamer_CFLAGS) -Wall -g -fPIC
-gnomesubtitles_LTLIBRARIES = libgst_backend.la
-libgst_backend_la_SOURCES = External/GstBackend/gst-backend.c
-libgst_backend_la_LIBADD = $(gstreamer_LIBS)
-libgst_backend_la_LDFLAGS = -module -avoid-version
-libgst_backend_la_LIBTOOLFLAGS = --tag=disable-static 
-
 GSSOURCES = \
        $(srcdir)/External/Enchant/*.cs \
        $(srcdir)/External/GtkSpell/*.cs \
-       $(srcdir)/External/GstBackend/*.cs \
+       $(srcdir)/External/GStreamer/*.cs \
        $(srcdir)/External/Interop/*.cs \
        $(srcdir)/External/NCharDet/*.cs \
        $(srcdir)/GnomeSubtitles/Core/*.cs \
@@ -54,12 +47,21 @@ GS_SYSTEM_REFERENCES = \
        Mono.Posix.dll \
        System.Web.dll
 
+GS_LOCAL_REFERENCES = \
+       $(GS_BUILDDIR)/atk-sharp.dll \
+       $(GS_BUILDDIR)/cairo-sharp.dll \
+       $(GS_BUILDDIR)/gdk-sharp.dll \
+       $(GS_BUILDDIR)/gio-sharp.dll \
+       $(GS_BUILDDIR)/glib-sharp.dll \
+       $(GS_BUILDDIR)/gtk-sharp.dll \
+       $(GS_BUILDDIR)/pango-sharp.dll \
+       $(GS_BUILDDIR)/gstreamer-sharp.dll
+
 $(ASSEMBLY): $(GSSOURCES) $(GS_RESOURCES)
-       $(MCS) $(MCS_FLAGS) -target:winexe -out:$(ASSEMBLY) $(GS_SYSTEM_REFERENCES:%=-r:%) $(GTKSHARP_LIBS) 
$(SUBLIB_LIBS) $(GS_RESOURCES:%=-resource:%) $(GSSOURCES)
+       $(MCS) $(MCS_FLAGS) -target:winexe -out:$(ASSEMBLY) $(GS_SYSTEM_REFERENCES:%=-r:%) 
$(GS_LOCAL_REFERENCES:%=-r:%) $(GS_RESOURCES:%=-resource:%) $(GSSOURCES)
 
 $(ASSEMBLY_CONFIG): $(gnomesubtitles_LTLIBRARIES)
        cp -f $(ASSEMBLY_CONFIG_SRC) $(GS_BUILDDIR)
-       cp -f $(srcdir)/.libs/libgst_backend.so $(GS_BUILDDIR)
 
 bin_SCRIPTS = $(srcdir)/GnomeSubtitles/Execution/gnome-subtitles
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]