[frogr] Made gstreamer-ffmpeg an optional dependency (recommended)



commit 4fc189e51a0c62bb412589bc8804559bba6a5d1c
Author: Mario Sanchez Prada <msanchez gnome org>
Date:   Fri Nov 30 13:12:44 2012 +0100

    Made gstreamer-ffmpeg an optional dependency (recommended)

 NEWS                    |    3 +--
 debian/control          |    3 ++-
 frogr.spec              |    4 ----
 src/frogr-file-loader.c |   47 +++++++++++++++++++++++++++++++++++------------
 4 files changed, 38 insertions(+), 19 deletions(-)
---
diff --git a/NEWS b/NEWS
index 647865f..19eada3 100644
--- a/NEWS
+++ b/NEWS
@@ -15,9 +15,8 @@
   * Updated menu item accelerators and shortcuts.
   * Raised glib minimum version up to 2.32.
   * Raised gtk+ minimum version up to 3.4.
-  * New build dependency: json-glib (> 0.12) (for the 'projects' feature).
   * New build dependency: gstreamer 0.10 (for video upload support).
-  * New run-time dependency: gstreamer-ffmpeg 0.10 (for video upload support).
+  * New build dependency: json-glib (> 0.12) (for the 'projects' feature).
   * Stop using gtk-mac-integration, now we have migrated to GMenu.
   * As usual, other minor improvements, bug fixes and cleanups.
 
diff --git a/debian/control b/debian/control
index ad110a9..e0d06ec 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,8 @@ Homepage: http://live.gnome.org/Frogr
 
 Package: frogr
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, desktop-file-utils, gstreamer0.10-ffmpeg, gvfs
+Depends: ${shlibs:Depends}, ${misc:Depends}, desktop-file-utils, gvfs
+Recommends: gstreamer0.10-ffmpeg
 Description: Flickr Remote Organizer for GNOME
  Frogr is a small application for the GNOME desktop that allows users
  to manage their accounts in the Flickr image hosting website.
diff --git a/frogr.spec b/frogr.spec
index 95d9538..b5b2f0a 100644
--- a/frogr.spec
+++ b/frogr.spec
@@ -21,10 +21,6 @@ BuildRequires:	libexif-devel > 0.6.14
 BuildRequires:	libgcrypt-devel
 BuildRequires:	desktop-file-utils
 
-#Frogr needs the gstreamer-ffmpeg plugin to generate thumbnails for
-#video files that might be loaded into the UI's icon view.
-Requires:       gstreamer-ffmpeg > 0.10
-
 #Explicitly Requires: gvfs since we need to be able to open a web
 #browser when associating frogr with a flickr account (this is how
 #application/flickr pairing works, through flickr.com)
diff --git a/src/frogr-file-loader.c b/src/frogr-file-loader.c
index 5bbab07..27ca357 100644
--- a/src/frogr-file-loader.c
+++ b/src/frogr-file-loader.c
@@ -242,8 +242,8 @@ _load_current_file (FrogrFileLoader *self)
 
 static void
 _load_current_file_cb (GObject *object,
-                    GAsyncResult *res,
-                    gpointer data)
+                       GAsyncResult *res,
+                       gpointer data)
 {
   FrogrFileLoader *self = NULL;
   FrogrFileLoaderPrivate *priv = NULL;
@@ -266,11 +266,29 @@ _load_current_file_cb (GObject *object,
       /* Load the pixbuf for the video or the image */
       is_video = _is_video_file (file);
       if (is_video)
-        pixbuf = frogr_util_get_pixbuf_for_video_file (file, IV_THUMB_WIDTH, IV_THUMB_HEIGHT, &error);
+        {
+          pixbuf = frogr_util_get_pixbuf_for_video_file (file, IV_THUMB_WIDTH, IV_THUMB_HEIGHT, &error);
+          if (!pixbuf)
+            {
+              /* FIXME: We should integrate with gstreamer's codec
+                 installer instead of just showing an error message to
+                 the user, but this is "good enough" for now. */
+              gchar *file_name = NULL;
+              gchar *msg = NULL;
+
+              file_name = g_file_get_basename (file);
+              msg = g_strdup_printf (_("Unable to load video %s\n"
+                                       "Please check that you have the right codec installed"), file_name);
+              g_free (file_name);
+
+              frogr_util_show_error_dialog (GTK_WINDOW (priv->mainview), msg);
+              g_free (msg);
+            }
+        }
       else
         pixbuf = frogr_util_get_pixbuf_from_image_contents ((const guchar *)contents, length,
                                                             IV_THUMB_WIDTH, IV_THUMB_HEIGHT, &error);
-      if (!error)
+      if (pixbuf)
         {
           if (priv->loading_mode == LOADING_MODE_FROM_PICTURES)
             {
@@ -286,7 +304,7 @@ _load_current_file_cb (GObject *object,
 
           g_object_unref (pixbuf);
         }
-      else
+      else if (error)
         {
           g_warning ("Not able to read pixbuf: %s", error->message);
           g_error_free (error);
@@ -311,14 +329,19 @@ _load_current_file_cb (GObject *object,
 
   /* Update status and progress */
   _update_status_and_progress (self);
-  g_signal_emit (self, signals[FILE_LOADED], 0, picture);
-
-  /* Check if we must interrupt the process */
-  keep_going = _check_filesize_limits (self, picture);
 
-  /* We only unref the picture if it was created here */
-  if (picture != NULL && priv->loading_mode != LOADING_MODE_FROM_PICTURES)
-    g_object_unref (picture);
+  /* We might not have a file loaded (e.g. unsupported format) */
+  if (picture)
+    {
+      /* Check if we must interrupt the process */
+      keep_going = _check_filesize_limits (self, picture);
+      if (keep_going)
+        g_signal_emit (self, signals[FILE_LOADED], 0, picture);
+
+      /* We only unref the picture if it was created here */
+      if (priv->loading_mode != LOADING_MODE_FROM_PICTURES)
+        g_object_unref (picture);
+    }
 
   /* Go for the next file, if needed */
   if (keep_going)



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