[Pkg-maemo-commits] r32 ./hildon-thumbnail/debian: * Merge with trunk branch.

Jonny Lamb jonnylamb at jonnylamb.com
Fri Dec 28 19:20:46 UTC 2007


------------------------------------------------------------
revno: 32
committer: Jonny Lamb <jonnylamb at jonnylamb.com>
branch nick: hildon-thumbnail
timestamp: Fri 2007-09-21 18:37:46 +0100
message:
  * Merge with trunk branch.
modified:
  ChangeLog
  configure
  configure.ac
  debian/changelog
  debian/control
  thumbs/thumber-common.c
  thumbs/thumber-gdk-pixbuf.c
    ------------------------------------------------------------
    revno: 4.1.2
    committer: kihamala
    timestamp: Mon 2007-08-13 10:04:13 +0000
    message:
      fixes from 0.13-1
    modified:
      ChangeLog
      debian/changelog
      debian/control
      debian/copyright
      thumbs/thumber-common.c
      thumbs/thumber-gdk-pixbuf.c
    ------------------------------------------------------------
    revno: 4.1.3
    committer: marivoll
    timestamp: Mon 2007-08-13 14:30:31 +0000
    message:
      Bumped version to reflect reality.
    modified:
      configure.ac
    ------------------------------------------------------------
    revno: 4.1.4
    committer: marivoll
    timestamp: Mon 2007-08-13 14:32:20 +0000
    message:
        * Make hildon-thumbnail again depend on libhildon-thumbnail0 (=
          ${Source-Version}) since hildon-thumber-register uses thumbs-private.h
    modified:
      debian/changelog
      debian/control
    ------------------------------------------------------------
    revno: 4.1.5
    committer: marivoll
    timestamp: Mon 2007-08-13 14:36:38 +0000
    message:
      Recreated.
    modified:
      configure
    ------------------------------------------------------------
    revno: 4.1.6
    committer: marivoll
    timestamp: Thu 2007-08-30 16:45:30 +0000
    message:
      	* thumbs/thumber-gdk-pixbuf.c (thumbnailer_oom_func): Do not
      	output debugging message.  Doing so might call malloc which would
      	result in a loop (N63712).  Thanks Leonid!
    modified:
      thumbs/thumber-gdk-pixbuf.c
    ------------------------------------------------------------
    revno: 4.1.7
    committer: marivoll
    timestamp: Thu 2007-08-30 16:46:02 +0000
    message:
      	Released 0.14
    modified:
      ChangeLog
      configure
      configure.ac
      debian/changelog
-------------- next part --------------
=== modified file 'ChangeLog'
--- a/ChangeLog	2007-07-22 21:37:12 +0000
+++ b/ChangeLog	2007-09-21 17:37:46 +0000
@@ -1,7 +1,19 @@
-2007-06-12  Tommi Komulainen  <tommi.komulainen at nokia.com>
-
-	* thumbs/thumber-common.c (hildon_thumber_main): Call g_thread_init()
-	before g_type_init() or gnome_vfs_init() to avoid GSlice problems.
+2007-08-30  Marius Vollmer  <marius.vollmer at nokia.com>
+
+	Released 0.14
+	
+	* thumbs/thumber-gdk-pixbuf.c (thumbnailer_oom_func): Do not
+	output debugging message.  Doing so might call malloc which would
+	result in a loop (N63712).  Thanks Leonid!
+
+2007-08-10  Kimmo H?m?l?inen  <kimmo.hamalainen at nokia.com>
+
+	Applied a modified patch from Daniil Ivanov:
+	* thumbs/thumber-gdk-pixbuf.c (create_thumb): Read four bytes at a
+	time instead of one.
+	(thumbnailer_oom_func): New.
+	(main): Register thumbnailer_oom_func as the OOM callback. Add Glib
+	thread initialisation. Fixes: NB#63712
 
 2007-05-21  Adilson Oliveira  <adilson at canonical.com>
 
@@ -31,9 +43,9 @@
 	
 2005-10-12  Luc Pionchon  <luc.pionchon at nokia.com>
 
-        N#20238 - Thumbnailer causes system crashes on large images
+	N#20238 - Thumbnailer causes system crashes on large images
 	
-        * thumbs/thumber-gdk-pixbuf.c
+	* thumbs/thumber-gdk-pixbuf.c
 
 	(can_crop_file): Removed artificial resolution restriction, since
 	                 more precice memory monitoring can be used now.

=== modified file 'configure'
--- a/configure	2007-06-06 17:11:19 +0000
+++ b/configure	2007-09-21 17:37:46 +0000
@@ -2279,7 +2279,7 @@
 
 # Define the identity of the package.
  PACKAGE=hildon-thumbnail
- VERSION=0.11
+ VERSION=0.14
 
 
 cat >>confdefs.h <<_ACEOF

=== modified file 'configure.ac'
--- a/configure.ac	2007-06-06 17:11:19 +0000
+++ b/configure.ac	2007-09-21 17:37:46 +0000
@@ -1,6 +1,6 @@
 AC_INIT(Makefile.am)
 AC_CONFIG_AUX_DIR(config)
-AM_INIT_AUTOMAKE(hildon-thumbnail, 0.11)
+AM_INIT_AUTOMAKE(hildon-thumbnail, 0.14)
 AM_CONFIG_HEADER(config.h)
 AM_MAINTAINER_MODE
 

=== modified file 'debian/changelog'
--- a/debian/changelog	2007-07-23 13:50:12 +0000
+++ b/debian/changelog	2007-09-21 17:37:46 +0000
@@ -1,4 +1,4 @@
-hildon-thumbnail (0.11-1) UNRELEASED; urgency=low
+hildon-thumbnail (0.14-1) UNRELEASED; urgency=low
 
   [ Loic Minier ]
   * Set Maintainer to Debian Maemo Maintainers; add myself to Uploaders.
@@ -19,8 +19,43 @@
   * Updated description in control.
   * Merge with trunk branch.
   * Add myself to Uploaders.
-
- -- Jonny Lamb <jonnylamb at jonnylamb.com>  Mon, 23 Jul 2007 14:49:29 +0100
+  * Merge with trunk branch.
+
+ -- Jonny Lamb <jonnylamb at jonnylamb.com>  Fri, 21 Sep 2007 18:36:21 +0100
+
+hildon-thumbnail (0.14) unstable; urgency=low
+
+  * Fixes: NB#63712.
+
+ -- Marius Vollmer <marius.vollmer at nokia.com>  Thu, 30 Aug 2007 19:40:02 +0300
+
+hildon-thumbnail (0.13-2) unstable; urgency=low
+
+  * Make hildon-thumbnail again depend on libhildon-thumbnail0 (=
+    ${Source-Version}) since hildon-thumber-register uses thumbs-private.h
+
+ -- Marius Vollmer <marius.vollmer at nokia.com>  Mon, 13 Aug 2007 17:28:43 +0300
+
+hildon-thumbnail (0.13-1) unstable; urgency=low
+
+  * Fixed some lintian warnings. Fixes: NB#44044
+
+ -- Kimmo H?m?l?inen <kimmo.hamalainen at nokia.com>  Fri, 10 Aug 2007 16:19:45 +0300
+
+hildon-thumbnail (0.13) unstable; urgency=low
+
+  * Added Glib thread initialisation. Fixes: NB#62806
+  * Now OOM handler simply exits because the thumbnailer was still jamming
+    sometimes with Daniil's patch. Fixes: NB#63712
+
+ -- Kimmo H?m?l?inen <kimmo.hamalainen at nokia.com>  Fri, 10 Aug 2007 15:13:11 +0300
+
+hildon-thumbnail (0.12) unstable; urgency=low
+
+  * Applied patch to use Libosso saw functions.
+  * Read four bytes at a time, instead of one byte, in thumber-gdk-pixbuf.
+
+ -- Kimmo H?m?l?inen <kimmo.hamalainen at nokia.com>  Fri, 10 Aug 2007 14:28:59 +0300
 
 hildon-thumbnail (0.11ubuntu2) UNRELEASED; urgency=low
 

=== modified file 'debian/control'
--- a/debian/control	2007-07-23 13:50:12 +0000
+++ b/debian/control	2007-09-21 17:37:46 +0000
@@ -30,6 +30,19 @@
  This package contains the hildon-thumb-gdk-pixbuf and
  hildon-thumber-register programs.
 
+Package: osso-thumbnail
+Section: libs
+Architecture: any
+Depends: hildon-thumbnail
+Description: Transitional package for hildon-thumbnail
+ hildon-thumbnail is a thumbnail-generating and managing helper
+ library for the hildon desktop. It includes an API for getting 
+ thumbnails for files. It is designed for devices with low performance
+ and little memory. Also included is a thumbnailer plugin for files
+ supported by GdkPixbuf.
+ .
+ This package contains a transitional package for hildon-thumbnail.
+
 Package: libhildon-thumbnail0
 Section: libs
 Architecture: any

=== modified file 'thumbs/thumber-common.c'
--- a/thumbs/thumber-common.c	2007-06-12 19:02:20 +0000
+++ b/thumbs/thumber-common.c	2007-08-13 10:04:13 +0000
@@ -53,7 +53,6 @@
     guint width, height;
     HildonThumbnailFlags flags;
     gchar *uri, *file, *mime_type, *local_file;
-    //gchar *fail_file, *final_file;
 
     time_t mtime = 0;
     GdkPixbuf *pixbuf;
@@ -61,7 +60,6 @@
     GError *error = NULL;
     int status = 0;
 
-    //const char *meta;
     gchar **keys = NULL, **values = NULL;
 
     argc = *argc_p;
@@ -82,8 +80,6 @@
     width = atoi(argv[5]);
     height = atoi(argv[6]);
 
-    if (!g_thread_supported ())
-      g_thread_init (NULL);
     g_type_init();
 
     gnome_vfs_init();
@@ -96,14 +92,7 @@
 
     local_file = gnome_vfs_get_local_path_from_uri(uri);
 
-    //if(gnome_vfs_uri_is_local(vfs_uri)) {
     if(local_file && strlen(local_file)) {
-        /*
-        if(!local_file || strlen(local_file) == 0) {
-            g_warning("Failed to get local file for uri: %s", uri);
-            return 4;
-        }
-        */
         mtime = get_file_mtime(local_file);
     } else {
         gchar *file_uri;
@@ -130,8 +119,6 @@
 
     gnome_vfs_uri_unref(vfs_uri);
 
-    //g_message("thumber from %s to %s", local_file, file);
-
     pixbuf = create_thumb(local_file, mime_type,
         width, height, flags, &keys, &values, &error);
 
@@ -151,8 +138,6 @@
     if(keys) g_strfreev(keys);
     if(values) g_strfreev(values);
 
-    //g_message("Saved %s to %s", uri, final_file);
-
     gdk_pixbuf_unref(pixbuf);
 
     g_free(local_file);

=== modified file 'thumbs/thumber-gdk-pixbuf.c'
--- a/thumbs/thumber-gdk-pixbuf.c	2007-04-24 17:59:32 +0000
+++ b/thumbs/thumber-gdk-pixbuf.c	2007-08-30 16:45:30 +0000
@@ -1,7 +1,7 @@
  /*
   * This file is part of osso-thumbnail package
   *
-  * Copyright (C) 2005, 2006 Nokia Corporation.  All rights reserved.
+  * Copyright (C) 2005-2007 Nokia Corporation.  All rights reserved.
   *
   * Contact: Marius Vollmer <marius.vollmer at nokia.com>
   *
@@ -28,6 +28,7 @@
 #include <osso-mem.h>
 #include <osso-log.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <sys/resource.h>
 #include <stdio.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
@@ -72,8 +73,6 @@
             v = b;
         }
 
-        //printf("na=%f, nb=%f, nx=%d, ny=%d, u=%d, v=%d\n", na, nb, nx, ny, u, v);
-
         if(a * y < b * x) {
             nb = (double)a * v / u;
             // Center
@@ -91,13 +90,6 @@
     offx = -offx * scax;
     offy = -offy * scay;
 
-    /*
-    printf("(%d, %d) -> (%d, %d) => (%f, %f) -> (%d, %d)\n",
-        a, b, x, y, na, nb, nx, ny);
-    printf("offx=%f, offy=%f, scax=%f, scay=%f\n",
-        offx, offy, scax, scay);
-    */
-
     dest = gdk_pixbuf_new(gdk_pixbuf_get_colorspace(src),
         gdk_pixbuf_get_has_alpha(src), gdk_pixbuf_get_bits_per_sample(src),
         nx, ny);
@@ -141,6 +133,8 @@
   }
 }
 
+#define BLK 4
+
 GdkPixbuf *create_thumb(const gchar *local_file, const gchar *mime_type,
     guint width, guint height, HildonThumbnailFlags flags,
     gchar ***opt_keys, gchar ***opt_values, GError **error)
@@ -148,36 +142,59 @@
     if((flags & HILDON_THUMBNAIL_FLAG_CROP)) {
        GdkPixbuf *pixbuf, *result = NULL;
        GdkPixbufLoader *loader;
-       guchar buffer[2048];
+       guchar buffer[2048]; /* size must be dividable by BLK */
        FILE *f; 
-       size_t bytes_read;
+       size_t items_read = sizeof(buffer) / BLK;
        size_t desired_max_area;
 
        f = fopen(local_file, "r");
        if (!f) return NULL;
-     
+
        desired_max_area = (width * height * 4) - 1;
        loader = gdk_pixbuf_loader_new ();
        g_signal_connect(loader, "size-prepared", G_CALLBACK(size_prepared),
                         GINT_TO_POINTER(desired_max_area));
 
-       do
+       while (items_read >= sizeof(buffer) / BLK)
        {
-         bytes_read = fread(buffer, 1, sizeof(buffer), f);
-         if (!gdk_pixbuf_loader_write(loader, buffer, bytes_read, error))
+         long pos;
+         int nbytes;
+
+         /* read BLK bytes at a time as much as possible */
+         if ((pos = ftell(f)) == -1)
+         {
+           gdk_pixbuf_loader_close(loader, NULL);
+           goto cleanup;
+         }
+         items_read = fread(buffer, BLK, sizeof(buffer) / BLK, f);
+
+         if (items_read < sizeof(buffer) / BLK)
+         {
+           /* read again one byte at a time */
+           if (fseek(f, pos, SEEK_SET) == -1)
+           {
+             gdk_pixbuf_loader_close(loader, NULL);
+             goto cleanup;
+           }
+           nbytes = fread(buffer, 1, sizeof(buffer), f);
+         }
+         else
+           nbytes = items_read * BLK;
+
+         if (!gdk_pixbuf_loader_write(loader, buffer, nbytes, error))
          { /* We have to call close before unreffing */
            gdk_pixbuf_loader_close(loader, NULL);
            goto cleanup;
          }
-       } while (bytes_read >= sizeof(buffer));
+       }
 
        if (!gdk_pixbuf_loader_close(loader, error))
          goto cleanup;
-       
+
        /* Loader owns reference to this pixbuf */
        pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
 
-       if(pixbuf)
+       if (pixbuf)
          result = crop_resize(pixbuf, width, height);
 cleanup:
        fclose(f);
@@ -191,23 +208,34 @@
        pixbuf = gdk_pixbuf_new_from_file_at_size (local_file, width, height, 
 	 					  &error);
        if (error) {
- 	   ULOG_ERR ("can't create thumb: %s", error->message);
+ 	   ULOG_ERR_F("can't create thumb: %s", error->message);
 	   g_error_free (error);
        }
        return pixbuf;
     }
-    
+
     return NULL;
 }
 
+static void
+thumbnailer_oom_func (size_t cur, size_t max, void *data)
+{
+  /* We can't do much here other than exit.  Even printing might
+     allocate memory which would put us into a loop.
+  */
+
+  exit(1);
+}
+
 int main(int argc, char **argv)
 {
     int result;
 
     setpriority(PRIO_PROCESS, getpid(), 10);
-    result = osso_mem_saw_enable(4 << 20, 64, NULL, NULL);
+    g_thread_init(NULL);
+    result = osso_mem_saw_enable(4 << 20, 64, thumbnailer_oom_func, NULL);
     if (result != 0)
-      ULOG_ERR ("can't install memory watchdog: code %d\n", result);
+      ULOG_ERR_F("osso_mem_saw_enable failed with error %d", result);
     else
       {
 	result = hildon_thumber_main(&argc, &argv, create_thumb);



More information about the Pkg-maemo-commits mailing list