camorama r361 - in trunk: . src



Author: herzi
Date: Wed May 28 14:20:37 2008
New Revision: 361
URL: http://svn.gnome.org/viewvc/camorama?rev=361&view=rev

Log:
2008-05-28  Sven Herzberg  <sven imendio com>

	Moved init_cam() into the mmap() related code

	* src/callbacks.c,
	* src/callbacks.h: dropped init_cam()
	* src/capture-strategy-mmap.c: (init_cam): moved init_cam() here


Modified:
   trunk/ChangeLog
   trunk/src/callbacks.c
   trunk/src/callbacks.h
   trunk/src/capture-strategy-mmap.c

Modified: trunk/src/callbacks.c
==============================================================================
--- trunk/src/callbacks.c	(original)
+++ trunk/src/callbacks.c	Wed May 28 14:20:37 2008
@@ -520,36 +520,6 @@
     cam->status = sb;
 }
 
-void init_cam (cam * cam)
-{
-    cam->pic =
-        mmap (0, cam->vid_buf.size, PROT_READ | PROT_WRITE,
-              MAP_SHARED, cam->dev, 0);
-
-    if ((unsigned char *) -1 == (unsigned char *) cam->pic) {
-        if (cam->debug == TRUE) {
-            fprintf (stderr, "Unable to capture image (mmap).\n");
-        }
-        error_dialog (_("Unable to capture image."));
-        exit (-1);
-    }
-    cam->vid_map.height = cam->y;
-    cam->vid_map.width = cam->x;
-    cam->vid_map.format = cam->vid_pic.palette;
-    for (frame = 0; frame < cam->vid_buf.frames; frame++) {
-        cam->vid_map.frame = frame;
-        if (ioctl (cam->dev, VIDIOCMCAPTURE, &cam->vid_map) < 0) {
-            if (cam->debug == TRUE) {
-                fprintf (stderr,
-                         "Unable to capture image (VIDIOCMCAPTURE).\n");
-            }
-            error_dialog (_("Unable to capture image."));
-            exit (-1);
-        }
-    }
-    frame = 0;
-}
-
 void capture_func (GtkWidget * widget, cam * cam)
 {
     if (cam->debug == TRUE) {

Modified: trunk/src/callbacks.h
==============================================================================
--- trunk/src/callbacks.h	(original)
+++ trunk/src/callbacks.h	Wed May 28 14:20:37 2008
@@ -44,7 +44,6 @@
 gint io_func (cam *, gint, GdkInputCondition);
 void capture_func2 (GtkWidget *, cam *);
 void capture_func (GtkWidget *, cam *);
-void init_cam (cam * cam);
 gint timeout_capture_func (cam *);
 gint fps (GtkWidget *);
 void edge_func1 (GtkToggleButton *, gpointer);

Modified: trunk/src/capture-strategy-mmap.c
==============================================================================
--- trunk/src/capture-strategy-mmap.c	(original)
+++ trunk/src/capture-strategy-mmap.c	Wed May 28 14:20:37 2008
@@ -54,6 +54,37 @@
 						  CaptureStrategyMmapPrivate);
 }
 
+static
+void init_cam (cam * cam)
+{
+    cam->pic =
+        mmap (0, cam->vid_buf.size, PROT_READ | PROT_WRITE,
+              MAP_SHARED, cam->dev, 0);
+
+    if ((unsigned char *) -1 == (unsigned char *) cam->pic) {
+        if (cam->debug == TRUE) {
+            fprintf (stderr, "Unable to capture image (mmap).\n");
+        }
+        error_dialog (_("Unable to capture image."));
+        exit (-1);
+    }
+    cam->vid_map.height = cam->y;
+    cam->vid_map.width = cam->x;
+    cam->vid_map.format = cam->vid_pic.palette;
+    for (frame = 0; frame < cam->vid_buf.frames; frame++) {
+        cam->vid_map.frame = frame;
+        if (ioctl (cam->dev, VIDIOCMCAPTURE, &cam->vid_map) < 0) {
+            if (cam->debug == TRUE) {
+                fprintf (stderr,
+                         "Unable to capture image (VIDIOCMCAPTURE).\n");
+            }
+            error_dialog (_("Unable to capture image."));
+            exit (-1);
+        }
+    }
+    frame = 0;
+}
+
 static void
 mmap_constructed (GObject* object)
 {



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