[pinpoint] cairo: Give absolute paths to gst_video_thumbnailer_get_shot()



commit 719837eb3150062bc8d82e466218348cfd467f18
Author: Damien Lespiau <damien lespiau intel com>
Date:   Wed Aug 17 14:55:40 2011 +0100

    cairo: Give absolute paths to gst_video_thumbnailer_get_shot()
    
    As it will construct an URI from it. To do that we add a new basedir
    variable representing the directory to resolve all the relative paths
    against and use it to retrieve the absolute path of video files.

 pinpoint.c |   12 ++++++++++++
 pinpoint.h |    1 +
 pp-cairo.c |   11 +++++++++--
 3 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/pinpoint.c b/pinpoint.c
index 8f69f82..fa98b9b 100644
--- a/pinpoint.c
+++ b/pinpoint.c
@@ -35,8 +35,11 @@
 #include <clutter-gst/clutter-gst.h>
 #endif
 
+/* Probably time to create a PinPointPresentation type */
+
 GList *pp_slides      = NULL; /* list of slide text */
 GList *pp_slidep      = NULL; /* current slide */
+GFile *pp_basedir     = NULL; /* basedir to resolve relative paths against */
 
 typedef struct
 {
@@ -228,6 +231,15 @@ main (int    argc,
   if (!pinfile)
     pp_rehearse = FALSE;
 
+  if (pinfile)
+    {
+      GFile *file;
+
+      file = g_file_new_for_commandline_arg (pinfile);
+      pp_basedir = g_file_get_parent (file);
+      g_object_unref (file);
+    }
+
   renderer->init (renderer, pinfile);
   pp_parse_slides (renderer, text);
   g_free (text);
diff --git a/pinpoint.h b/pinpoint.h
index 5f93b29..3f26630 100644
--- a/pinpoint.h
+++ b/pinpoint.h
@@ -123,6 +123,7 @@ extern char     *pp_camera_device;
 
 extern GList         *pp_slides;  /* list of slide text */
 extern GList         *pp_slidep;  /* current slide */
+extern GFile         *pp_basedir;
 extern PinPointPoint *point_defaults;
 
 void     pp_parse_slides  (PinPointRenderer *renderer,
diff --git a/pp-cairo.c b/pp-cairo.c
index 79ece8c..a673674 100644
--- a/pp-cairo.c
+++ b/pp-cairo.c
@@ -368,11 +368,18 @@ _cairo_render_background (CairoRenderer *renderer,
         cairo_surface_t *surface;
         float bg_x, bg_y, bg_width, bg_height, bg_scale_x, bg_scale_y;
         GCancellable* cancellable = g_cancellable_new ();
+        GFile *abs_file;
+        gchar *abs_path;
 
-        pixbuf = gst_video_thumbnailer_get_shot (file, cancellable);
+        abs_file = g_file_resolve_relative_path (pp_basedir, point->bg);
+        abs_path = g_file_get_path (abs_file);
+        g_object_unref (abs_file);
+
+        pixbuf = gst_video_thumbnailer_get_shot (abs_path, cancellable);
+        g_free (abs_path);
         if (pixbuf == NULL)
           {
-            g_warning ("Could not create video thumbmail for %s", file);
+            g_warning ("Could not create video thumbmail for %s", point->bg);
             break;
           }
 



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