camorama r363 - in trunk: . src
- From: herzi svn gnome org
- To: svn-commits-list gnome org
- Subject: camorama r363 - in trunk: . src
- Date: Wed, 28 May 2008 14:20:47 +0000 (UTC)
Author: herzi
Date: Wed May 28 14:20:47 2008
New Revision: 363
URL: http://svn.gnome.org/viewvc/camorama?rev=363&view=rev
Log:
2008-05-28 Sven Herzberg <sven imendio com>
added a cam property to the read strategy; we're going to need this
property so we can properly initialize the "pic" buffer of it
* src/capture-strategy-read.c: (read_constructed), (read_finalize),
(read_set_property), (capture_strategy_read_class_init),
(capture_strategy_read_new): added the new property
* src/capture-strategy-read.h: added a cam parameter to new()
* src/main.c: (main): pass the cam parameter to new() for read
Modified:
trunk/ChangeLog
trunk/src/capture-strategy-read.c
trunk/src/capture-strategy-read.h
trunk/src/main.c
Modified: trunk/src/capture-strategy-read.c
==============================================================================
--- trunk/src/capture-strategy-read.c (original)
+++ trunk/src/capture-strategy-read.c Wed May 28 14:20:47 2008
@@ -29,6 +29,11 @@
cam* cam;
};
+enum {
+ PROP_0,
+ PROP_CAMORAMA
+};
+
#define PRIV(i) (CAPTURE_STRATEGY_READ (i)->_private)
/* GType Implementation */
@@ -47,17 +52,63 @@
}
static void
+read_constructed (GObject* object)
+{
+ if (G_OBJECT_CLASS (capture_strategy_read_parent_class)->constructed) {
+ G_OBJECT_CLASS (capture_strategy_read_parent_class)->constructed (object);
+ }
+
+ g_return_if_fail (PRIV (object)->cam);
+}
+
+static void
+read_finalize (GObject* object)
+{
+ PRIV(object)->cam = NULL;
+
+ G_OBJECT_CLASS (capture_strategy_read_parent_class)->finalize (object);
+}
+
+static void
+read_set_property (GObject * object,
+ guint prop_id,
+ GValue const* value,
+ GParamSpec * pspec)
+{
+ switch (prop_id) {
+ case PROP_CAMORAMA:
+ PRIV (object)->cam = g_value_get_pointer (value);
+ g_object_notify (object, "cam");
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
capture_strategy_read_class_init (CaptureStrategyReadClass* self_class)
{
+ GObjectClass* object_class = G_OBJECT_CLASS (self_class);
+
+ object_class->constructed = read_constructed;
+ object_class->finalize = read_finalize;
+ object_class->set_property = read_set_property;
+
+ g_object_class_install_property (object_class, PROP_CAMORAMA,
+ g_param_spec_pointer ("cam", "", "",
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+
g_type_class_add_private (self_class, sizeof (CaptureStrategyReadPrivate));
}
/* Public API */
CaptureStrategy*
-capture_strategy_read_new (void)
+capture_strategy_read_new (cam* cam)
{
return g_object_new (CAMORAMA_TYPE_CAPTURE_STRATEGY_READ,
+ "cam", cam,
NULL);
}
Modified: trunk/src/capture-strategy-read.h
==============================================================================
--- trunk/src/capture-strategy-read.h (original)
+++ trunk/src/capture-strategy-read.h Wed May 28 14:20:47 2008
@@ -35,7 +35,7 @@
#define CAMORAMA_TYPE_CAPTURE_STRATEGY_READ (capture_strategy_read_get_type ())
#define CAPTURE_STRATEGY_READ(i) (G_TYPE_CHECK_INSTANCE_CAST ((i), CAMORAMA_TYPE_CAPTURE_STRATEGY_READ, CaptureStrategyRead))
-CaptureStrategy* capture_strategy_read_new (void);
+CaptureStrategy* capture_strategy_read_new (cam* cam);
struct _CaptureStrategyRead {
GObject base_instance;
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Wed May 28 14:20:47 2008
@@ -247,7 +247,7 @@
if (cam->read == FALSE) {
cam->capture = capture_strategy_mmap_new (cam);
} else {
- cam->capture = capture_strategy_read_new ();
+ cam->capture = capture_strategy_read_new (cam);
printf ("using read()\n");
cam->pic =
realloc (cam->pic,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]