Author: post
Date: 2010-04-02 23:17:20 +0200 (Fri, 02 Apr 2010)
New Revision: 3320

Modified:
   trunk/librawstudio/rs-filetypes.c
   trunk/librawstudio/rs-filetypes.h
   trunk/plugins/input-file/input-file.c
   trunk/plugins/input-image16/input-image16.c
   trunk/plugins/load-dcraw/dcrawloader.c
   trunk/plugins/load-gdk/load-gdk.c
   trunk/plugins/load-rawspeed/rawstudio-plugin-api.cpp
   trunk/plugins/load-rawspeed/rawstudio-plugin-api.h
   trunk/src/application.c
   trunk/src/application.h
   trunk/src/rs-batch.c
   trunk/src/rs-photo.c
   trunk/src/rs-save-dialog.c
Log:
API Change: Make load-plugins return RSFilterRespone instead of RS_IMAGE16.

Modified: trunk/librawstudio/rs-filetypes.c
===================================================================
--- trunk/librawstudio/rs-filetypes.c   2010-04-02 20:13:28 UTC (rev 3319)
+++ trunk/librawstudio/rs-filetypes.c   2010-04-02 21:17:20 UTC (rev 3320)
@@ -208,10 +208,10 @@
  * @param filename The file to load
  * @return A new RS_IMAGE16 or NULL if the loading failed
  */
-RS_IMAGE16 *
+RSFilterResponse *
 rs_filetype_load(const gchar *filename)
 {
-       RS_IMAGE16 *image = NULL;
+       RSFilterResponse* image = NULL;
        gint priority = 0;
        RSFileLoaderFunc loader;
 

Modified: trunk/librawstudio/rs-filetypes.h
===================================================================
--- trunk/librawstudio/rs-filetypes.h   2010-04-02 20:13:28 UTC (rev 3319)
+++ trunk/librawstudio/rs-filetypes.h   2010-04-02 21:17:20 UTC (rev 3320)
@@ -20,6 +20,7 @@
 #define RS_FILETYPES_H
 
 #include "rs-types.h"
+#include "rs-filter-response.h"
 
 typedef enum {
        RS_LOADER_FLAGS_RAW  = (1<<0),
@@ -27,7 +28,7 @@
        RS_LOADER_FLAGS_ALL = 0xffffff,
 } RSLoaderFlags;
 
-typedef RS_IMAGE16 *(*RSFileLoaderFunc)(const gchar *filename);
+typedef RSFilterResponse *(*RSFileLoaderFunc)(const gchar *filename);
 typedef void (*RSFileMetaLoaderFunc)(const gchar *service, RAWFILE *rawfile, 
guint offset, RSMetadata *meta);
 
 /**
@@ -67,7 +68,7 @@
  * @param filename The file to load
  * @return A new RS_IMAGE16 or NULL if the loading failed
  */
-extern RS_IMAGE16 *rs_filetype_load(const gchar *filename);
+extern RSFilterResponse *rs_filetype_load(const gchar *filename);
 
 /**
  * Load metadata from a specified file

Modified: trunk/plugins/input-file/input-file.c
===================================================================
--- trunk/plugins/input-file/input-file.c       2010-04-02 20:13:28 UTC (rev 
3319)
+++ trunk/plugins/input-file/input-file.c       2010-04-02 21:17:20 UTC (rev 
3320)
@@ -126,7 +126,11 @@
                        input->filename = g_value_dup_string (value);
                        if (input->image)
                                g_object_unref(input->image);
-                       input->image = rs_filetype_load(input->filename);
+                       input->image = NULL;
+                       RSFilterResponse *response = 
rs_filetype_load(input->filename);
+                       if (rs_filter_response_has_image(response))
+                               input->image = 
rs_filter_response_get_image(response);
+                       g_object_unref(response);
                        rs_filter_changed(RS_FILTER(input), 
RS_FILTER_CHANGED_DIMENSION);
                        break;
                case PROP_COLOR_SPACE:

Modified: trunk/plugins/input-image16/input-image16.c
===================================================================
--- trunk/plugins/input-image16/input-image16.c 2010-04-02 20:13:28 UTC (rev 
3319)
+++ trunk/plugins/input-image16/input-image16.c 2010-04-02 21:17:20 UTC (rev 
3320)
@@ -32,10 +32,10 @@
 struct _RSInputImage16 {
        RSFilter parent;
 
+       RSFilterResponse *image_response;
        RS_IMAGE16 *image;
        gchar *filename;
        RSColorSpace *colorspace;
-       gulong signal;
 };
 
 struct _RSInputImage16Class {
@@ -57,7 +57,6 @@
 static void dispose (GObject *object);
 static gint get_width(RSFilter *filter);
 static gint get_height(RSFilter *filter);
-static void image_changed(RS_IMAGE16 *image, RSInputImage16 *input_image16);
 
 static RSFilterClass *rs_input_image16_parent_class = NULL;
 
@@ -84,8 +83,8 @@
                PROP_IMAGE, g_param_spec_object (
                        "image",
                        "image",
-                       "RS_IMAGE16 to import",
-                       RS_TYPE_IMAGE16,
+                       "RSFilterResponse to use as input",
+                       RS_TYPE_FILTER_RESPONSE,
                        G_PARAM_READWRITE)
        );
        g_object_class_install_property(object_class,
@@ -107,7 +106,7 @@
 rs_input_image16_init (RSInputImage16 *input_image16)
 {
        input_image16->image = NULL;
-       input_image16->signal = 0;
+       input_image16->image_response = NULL;
 }
 
 static void
@@ -117,7 +116,7 @@
        switch (property_id)
        {
                case PROP_IMAGE:
-                       g_value_set_object(value, input_image16->image);
+                       g_value_set_object(value, 
input_image16->image_response);
                        break;
                case PROP_FILENAME:
                        g_value_set_string(value, input_image16->filename);
@@ -137,13 +136,15 @@
        switch (property_id)
        {
                case PROP_IMAGE:
-                       if (input_image16->signal)
-                               
g_signal_handler_disconnect(input_image16->image, input_image16->signal);
+                       /* Clean up */
                        if (input_image16->image)
                                g_object_unref(input_image16->image);
-                       input_image16->image = 
g_object_ref(g_value_get_object(value));
-                       input_image16->signal = 
g_signal_connect(G_OBJECT(input_image16->image), "pixeldata-changed", 
G_CALLBACK(image_changed), input_image16);
-                       /* Only emit RS_FILTER_CHANGED_PIXELDATA if dimensions 
didn't change */
+                       input_image16->image = NULL;
+                       if (input_image16->image_response)
+                               g_object_unref(input_image16->image_response);
+                       
+                       input_image16->image_response = 
g_object_ref(g_value_get_object(value));
+                       input_image16->image = 
rs_filter_response_get_image(input_image16->image_response);
                        rs_filter_changed(RS_FILTER(input_image16), 
RS_FILTER_CHANGED_DIMENSION);
                        break;
                case PROP_FILENAME:
@@ -166,6 +167,8 @@
 {
        RSInputImage16 *input_image16 = RS_INPUT_IMAGE16(object);
 
+       if (input_image16->image_response)
+               g_object_unref(input_image16->image_response);
        if (input_image16->image)
                g_object_unref(input_image16->image);
 
@@ -176,16 +179,20 @@
 static RSFilterResponse *
 get_image(RSFilter *filter, const RSFilterRequest *request)
 {
-       RSFilterResponse *response = rs_filter_response_new();
        RSInputImage16 *input_image16 = RS_INPUT_IMAGE16(filter);
+       if (RS_IS_FILTER_RESPONSE(input_image16->image_response))
+       {
+               RSFilterResponse *response;
+               response = 
rs_filter_response_clone(RS_FILTER_RESPONSE(input_image16->image_response));
+               rs_filter_response_set_image(response, input_image16->image);
 
-       if (RS_IS_COLOR_SPACE(input_image16->colorspace))
-               rs_filter_param_set_object(RS_FILTER_PARAM(response), 
"colorspace", input_image16->colorspace);
+               if (RS_IS_COLOR_SPACE(input_image16->colorspace))
+                       rs_filter_param_set_object(RS_FILTER_PARAM(response), 
"colorspace", input_image16->colorspace);
 
-       if (RS_IS_IMAGE16(input_image16->image))
-               rs_filter_response_set_image(response, input_image16->image);
+               return response;
+       }
 
-       return response;
+       return rs_filter_response_new();
 }
 
 static gint
@@ -210,8 +217,3 @@
        return input_image16->image->h;
 }
 
-static void
-image_changed(RS_IMAGE16 *image, RSInputImage16 *input_image16)
-{
-       rs_filter_changed(RS_FILTER(input_image16), 
RS_FILTER_CHANGED_PIXELDATA);
-}

Modified: trunk/plugins/load-dcraw/dcrawloader.c
===================================================================
--- trunk/plugins/load-dcraw/dcrawloader.c      2010-04-02 20:13:28 UTC (rev 
3319)
+++ trunk/plugins/load-dcraw/dcrawloader.c      2010-04-02 21:17:20 UTC (rev 
3320)
@@ -171,7 +171,7 @@
        return image;
 }
 
-static RS_IMAGE16 *
+static RSFilterResponse *
 open_dcraw(const gchar *filename)
 {
        dcraw_data *raw = g_new0(dcraw_data, 1);
@@ -189,7 +189,10 @@
                rs_io_unlock();
        g_free(raw);
 
-       return image;
+       RSFilterResponse* response = rs_filter_response_new();
+       rs_filter_response_set_image(response, image);
+       g_object_unref(image);
+       return response;
 }
 
 G_MODULE_EXPORT void

Modified: trunk/plugins/load-gdk/load-gdk.c
===================================================================
--- trunk/plugins/load-gdk/load-gdk.c   2010-04-02 20:13:28 UTC (rev 3319)
+++ trunk/plugins/load-gdk/load-gdk.c   2010-04-02 21:17:20 UTC (rev 3320)
@@ -27,7 +27,7 @@
  * @param filename The filename to open
  * @return The newly created RS_IMAGE16 or NULL on error
  */
-static RS_IMAGE16 *
+static RSFilterResponse*
 load_gdk(const gchar *filename)
 {
        RS_IMAGE16 *image = NULL;
@@ -62,7 +62,10 @@
                g_object_unref(pixbuf);
        }
 
-       return image;
+       RSFilterResponse* response = rs_filter_response_new();
+       rs_filter_response_set_image(response, image);
+       g_object_unref(image);
+       return response;
 }
 
 static void

Modified: trunk/plugins/load-rawspeed/rawstudio-plugin-api.cpp
===================================================================
--- trunk/plugins/load-rawspeed/rawstudio-plugin-api.cpp        2010-04-02 
20:13:28 UTC (rev 3319)
+++ trunk/plugins/load-rawspeed/rawstudio-plugin-api.cpp        2010-04-02 
21:17:20 UTC (rev 3320)
@@ -30,7 +30,7 @@
 
 extern "C" {
 
-RS_IMAGE16 *
+RSFilterResponse*
 load_rawspeed(const gchar *filename)
 {
        static CameraMetaData *c = NULL;
@@ -65,7 +65,7 @@
                } catch (FileIOException e) {
                        printf("RawSpeed: IO Error occured:%s\n", e.what());
                        g_timer_destroy(gt);
-                       return image;
+                       return rs_filter_response_new();
                }
 
 #ifdef TIME_LOAD
@@ -147,7 +147,10 @@
        if (d) delete d;
        if (m) delete m;
 
-       return image;
+       RSFilterResponse* response = rs_filter_response_new();
+       rs_filter_response_set_image(response, image);
+       g_object_unref(image);
+       return response;
 }
 
 } /* extern "C" */

Modified: trunk/plugins/load-rawspeed/rawstudio-plugin-api.h
===================================================================
--- trunk/plugins/load-rawspeed/rawstudio-plugin-api.h  2010-04-02 20:13:28 UTC 
(rev 3319)
+++ trunk/plugins/load-rawspeed/rawstudio-plugin-api.h  2010-04-02 21:17:20 UTC 
(rev 3320)
@@ -20,7 +20,7 @@
 
 G_BEGIN_DECLS
 
-RS_IMAGE16 *
+RSFilterResponse *
 load_rawspeed(const gchar *filename);
 
 G_END_DECLS

Modified: trunk/src/application.c
===================================================================
--- trunk/src/application.c     2010-04-02 20:13:28 UTC (rev 3319)
+++ trunk/src/application.c     2010-04-02 21:17:20 UTC (rev 3320)
@@ -105,7 +105,7 @@
                g_object_unref(meta);
 
                rs_filter_set_recursive(rs->filter_end,
-                       "image", rs->photo->input,
+                       "image", rs->photo->input_response,
                        "filename", rs->photo->filename,
                        "rectangle", rs_photo_get_crop(photo),
                        "angle", rs_photo_get_angle(photo),
@@ -178,7 +178,7 @@
        RSFilter *fend = ftransform_display;
 
        rs_filter_set_recursive(fend,
-               "image", photo->input,
+               "image", photo->input_response,
                "filename", photo->filename,
                "angle", photo->angle,
                "orientation", photo->orientation,
@@ -746,6 +746,7 @@
        gtk_link_button_set_uri_hook(runuri,NULL,NULL);
 #endif
 
+//     g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR | 
G_LOG_LEVEL_WARNING);
        if (do_test)
                test();
        else

Modified: trunk/src/application.h
===================================================================
--- trunk/src/application.h     2010-04-02 20:13:28 UTC (rev 3319)
+++ trunk/src/application.h     2010-04-02 21:17:20 UTC (rev 3320)
@@ -39,6 +39,7 @@
        GObject parent;
        gchar *filename;
        RS_IMAGE16 *input;
+       RSFilterResponse *input_response;
        RSSettings *settings[3];
        gulong settings_signal[3];
        gint priority;

Modified: trunk/src/rs-batch.c
===================================================================
--- trunk/src/rs-batch.c        2010-04-02 20:13:28 UTC (rev 3319)
+++ trunk/src/rs-batch.c        2010-04-02 21:17:20 UTC (rev 3320)
@@ -536,7 +536,7 @@
                        }
 
                        rs_filter_set_recursive(fend,
-                               "image", photo->input,
+                               "image", photo->input_response,
                                "filename", photo->filename,
                                "settings", photo->settings[setting_id],
                                "angle", photo->angle,

Modified: trunk/src/rs-photo.c
===================================================================
--- trunk/src/rs-photo.c        2010-04-02 20:13:28 UTC (rev 3319)
+++ trunk/src/rs-photo.c        2010-04-02 21:17:20 UTC (rev 3320)
@@ -66,6 +66,9 @@
        if (photo->input)
                g_object_unref(photo->input);
 
+       if (photo->input_response)
+               g_object_unref(photo->input_response);
+
        for(c=0;c<3;c++)
        {
                g_signal_handler_disconnect(photo->settings[c], 
photo->settings_signal[c]);
@@ -121,6 +124,7 @@
 
        photo->filename = NULL;
        photo->input = NULL;
+       photo->input_response = NULL;
        ORIENTATION_RESET(photo->orientation);
        photo->priority = PRIO_U;
        photo->metadata = rs_metadata_new();
@@ -587,12 +591,12 @@
 rs_photo_load_from_file(const gchar *filename)
 {
        RS_PHOTO *photo = NULL;
-       RS_IMAGE16 *image;
+       RSFilterResponse *response;
        RSSettingsMask mask;
        gint i;
 
-       image = rs_filetype_load(filename);
-       if (image)
+       response = rs_filetype_load(filename);
+       if (rs_filter_response_has_image(response))
        {
                photo = rs_photo_new();
 
@@ -600,7 +604,8 @@
                photo->filename = g_strdup(filename);
 
                /* Set input image */
-               photo->input = image;
+               photo->input = rs_filter_response_get_image(response);
+               photo->input_response = response;
        }
 
        /* If photo available, read & process metadata */

Modified: trunk/src/rs-save-dialog.c
===================================================================
--- trunk/src/rs-save-dialog.c  2010-04-02 20:13:28 UTC (rev 3319)
+++ trunk/src/rs-save-dialog.c  2010-04-02 21:17:20 UTC (rev 3320)
@@ -186,7 +186,7 @@
 
        /* This should be enough to calculate "original" size */
        rs_filter_set_recursive(dialog->fend, 
-               "image", photo->input,
+               "image", photo->input_response,
                "angle", photo->angle,
                "orientation", photo->orientation,
                "rectangle", photo->crop,


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to