[cheese] Move CheeseCameraDevice into its own files



commit 247970fcf3421d53800453dc99bb7d000a35f1ff
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 2 16:37:48 2009 +0000

    Move CheeseCameraDevice into its own files

 libcheese/Makefile.am            |    2 +
 libcheese/cheese-camera-device.c |   44 ++++++++++++++++++++++++++
 libcheese/cheese-camera-device.h |   63 ++++++++++++++++++++++++++++++++++++++
 libcheese/cheese-camera.c        |   18 -----------
 libcheese/cheese-camera.h        |   30 +-----------------
 5 files changed, 110 insertions(+), 47 deletions(-)
---
diff --git a/libcheese/Makefile.am b/libcheese/Makefile.am
index 5ccfc15..94a3ab8 100644
--- a/libcheese/Makefile.am
+++ b/libcheese/Makefile.am
@@ -21,6 +21,8 @@ libcheesecommon_la_SOURCES = \
 	cheese-fileutil.h \
 	cheese-camera.c \
 	cheese-camera.h \
+	cheese-camera-device.c \
+	cheese-camera-device.h \
 	cheese-flash.h \
 	cheese-flash.c \
 	cheese-countdown.c \
diff --git a/libcheese/cheese-camera-device.c b/libcheese/cheese-camera-device.c
new file mode 100644
index 0000000..0fa308f
--- /dev/null
+++ b/libcheese/cheese-camera-device.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright © 2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright © 2007-2009 daniel g. siegel <dgsiegel gnome org>
+ * Copyright © 2008 Ryan Zeigler <zeiglerr gmail com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifdef HAVE_CONFIG_H
+  #include <cheese-config.h>
+#endif
+
+#include "cheese-camera-device.h"
+
+void
+cheese_camera_device_free (CheeseCameraDevice *device)
+{
+  guint j;
+
+  for (j = 0; j < device->num_video_formats; j++)
+  {
+    g_free (g_array_index (device->video_formats, CheeseVideoFormat, j).framerates);
+    g_free (g_array_index (device->video_formats, CheeseVideoFormat, j).mimetype);
+  }
+  g_free (device->video_device);
+  g_free (device->hal_udi);
+  g_free (device->gstreamer_src);
+  g_free (device->product_name);
+  g_array_free (device->video_formats, TRUE);
+  g_hash_table_destroy (device->supported_resolutions);
+}
+
diff --git a/libcheese/cheese-camera-device.h b/libcheese/cheese-camera-device.h
new file mode 100644
index 0000000..36baadc
--- /dev/null
+++ b/libcheese/cheese-camera-device.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright © 2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright © 2007-2009 daniel g. siegel <dgsiegel gnome org>
+ * Copyright © 2008 Ryan zeigler <zeiglerr gmail com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __CHEESE_CAMERA_DEVICE_H__
+#define __CHEESE_CAMERA_DEVICE_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct
+{
+  int numerator;
+  int denominator;
+} CheeseFramerate;
+
+typedef struct
+{
+  char *mimetype;
+  int   width;
+  int   height;
+  int   num_framerates;
+  CheeseFramerate *framerates;
+  CheeseFramerate  highest_framerate;
+} CheeseVideoFormat;
+
+typedef struct
+{
+  char *video_device;
+  char *hal_udi;
+  char *gstreamer_src;
+  char *product_name;
+  int   num_video_formats;
+  GArray *video_formats;
+
+  /* Hash table for resolution based lookup of video_formats */
+  GHashTable *supported_resolutions;
+} CheeseCameraDevice;
+
+void cheese_camera_device_free (CheeseCameraDevice *device);
+
+G_END_DECLS
+
+#endif /* __CHEESE_CAMERA_DEVICE_H__ */
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index c240696..25046be 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -287,24 +287,6 @@ cheese_camera_bus_message_cb (GstBus *bus, GstMessage *message, CheeseCamera *ca
 }
 
 static void
-cheese_camera_device_free (CheeseCameraDevice *device)
-{
-  guint j;
-
-  for (j = 0; j < device->num_video_formats; j++)
-  {
-    g_free (g_array_index (device->video_formats, CheeseVideoFormat, j).framerates);
-    g_free (g_array_index (device->video_formats, CheeseVideoFormat, j).mimetype);
-  }
-  g_free (device->video_device);
-  g_free (device->hal_udi);
-  g_free (device->gstreamer_src);
-  g_free (device->product_name);
-  g_array_free (device->video_formats, TRUE);
-  g_hash_table_destroy (device->supported_resolutions);
-}
-
-static void
 cheese_camera_get_video_devices_from_hal (CheeseCamera *camera)
 {
   CheeseCameraPrivate *priv = CHEESE_CAMERA_GET_PRIVATE (camera);
diff --git a/libcheese/cheese-camera.h b/libcheese/cheese-camera.h
index 1e2233c..049edb5 100644
--- a/libcheese/cheese-camera.h
+++ b/libcheese/cheese-camera.h
@@ -26,6 +26,7 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 #include <gst/interfaces/xoverlay.h>
+#include <cheese-camera-device.h>
 
 G_BEGIN_DECLS
 
@@ -36,35 +37,6 @@ G_BEGIN_DECLS
 #define CHEESE_IS_CAMERA_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), CHEESE_TYPE_CAMERA))
 #define CHEESE_CAMERA_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CHEESE_TYPE_CAMERA, CheeseCameraClass))
 
-typedef struct
-{
-  int numerator;
-  int denominator;
-} CheeseFramerate;
-
-typedef struct
-{
-  char *mimetype;
-  int   width;
-  int   height;
-  int   num_framerates;
-  CheeseFramerate *framerates;
-  CheeseFramerate  highest_framerate;
-} CheeseVideoFormat;
-
-typedef struct
-{
-  char *video_device;
-  char *hal_udi;
-  char *gstreamer_src;
-  char *product_name;
-  int   num_video_formats;
-  GArray *video_formats;
-
-  /* Hash table for resolution based lookup of video_formats */
-  GHashTable *supported_resolutions;
-} CheeseCameraDevice;
-
 typedef enum
 {
   CHEESE_CAMERA_EFFECT_NO_EFFECT       = (0),



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