summaryrefslogtreecommitdiff
path: root/media-video/camorama/files/camorama-0.19-libv4l.patch
blob: ada58fe7dd2fac96fd3c5383261caf9f606364c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
http://cvs.fedoraproject.org/viewvc/rpms/camorama/devel/

--- camorama-0.19/src/Makefile.am	2007-09-16 14:48:05.000000000 +0200
+++ camorama-0.19.new/src/Makefile.am	2009-06-24 15:01:37.000000000 +0200
@@ -36,7 +36,7 @@
 	filter.h	\
 	$(BUILT_SOURCES)\
 	$(NULL)
-camorama_LDADD = $(PACKAGE_LIBS)
+camorama_LDADD = $(PACKAGE_LIBS) -lv4l1
 
 DISTCLEANFILES=$(BUILT_SOURCES)
 
--- camorama-0.19/src/Makefile.in	2007-10-06 21:06:28.000000000 +0200
+++ camorama-0.19.new/src/Makefile.in	2009-06-24 15:01:50.000000000 +0200
@@ -248,7 +248,7 @@
 	$(BUILT_SOURCES)\
 	$(NULL)
 
-camorama_LDADD = $(PACKAGE_LIBS)
+camorama_LDADD = $(PACKAGE_LIBS) -lv4l1
 DISTCLEANFILES = $(BUILT_SOURCES)
 all: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) all-am
--- camorama-0.19/src/callbacks.c	2009-06-24 15:01:55.000000000 +0200
+++ camorama-0.19.new/src/callbacks.c	2009-06-24 14:55:42.000000000 +0200
@@ -9,6 +9,7 @@
 #include <libgnomeui/gnome-propertybox.h>
 #include <libgnomeui/gnome-window-icon.h>
 #include <pthread.h>
+#include <libv4l1.h>
 
 extern GtkWidget *main_window, *prefswindow;
 //extern state func_state;
@@ -390,7 +391,7 @@
 
     /*
      * if(cam->read == FALSE) {
-     *  cam->pic = mmap(0, cam->vid_buf.size, PROT_READ | PROT_WRITE, MAP_SHARED, cam->dev, 0);
+     *  cam->pic = v4l1_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) {
@@ -401,7 +402,7 @@
      *  }
      *  }else{
      *   cam->pic_buf = malloc(cam->x * cam->y * cam->depth);
-     *   read(cam->dev,cam->pic,(cam->x * cam->y * 3));
+     *   v4l1_read(cam->dev,cam->pic,(cam->x * cam->y * 3));
      *  } 
      */
 
@@ -427,7 +428,7 @@
      * if(cam->read == FALSE) {
      * * for(frame = 0; frame < cam->vid_buf.frames; frame++) {
      * * cam->vid_map.frame = frame;
-     * * if(ioctl(cam->dev, VIDIOCMCAPTURE, &cam->vid_map) < 0) {
+     * * if(v4l1_ioctl(cam->dev, VIDIOCMCAPTURE, &cam->vid_map) < 0) {
      * * if(cam->debug == TRUE) {
      * * fprintf(stderr, "Unable to capture image (VIDIOCMCAPTURE) during resize.\n");
      * * }
@@ -547,7 +548,7 @@
     int i, count = 0;
     GdkGC *gc;
 
-    read (cam->dev, cam->pic, (cam->x * cam->y * 3));
+    v4l1_read (cam->dev, cam->pic, (cam->x * cam->y * 3));
     frames2++;
     /*
      * update_rec.x = 0;
@@ -588,7 +589,7 @@
 
     i = -1;
     while (i < 0) {
-        i = ioctl (cam->dev, VIDIOCSYNC, &frame);
+        i = v4l1_ioctl (cam->dev, VIDIOCSYNC, &frame);
 
         if (i < 0 && errno == EINTR) {
             if (cam->debug == TRUE) {
@@ -630,7 +631,7 @@
                                 0, cam->x, cam->y);
 
     cam->vid_map.frame = frame;
-    if (ioctl (cam->dev, VIDIOCMCAPTURE, &cam->vid_map) < 0) {
+    if (v4l1_ioctl (cam->dev, VIDIOCMCAPTURE, &cam->vid_map) < 0) {
         if (cam->debug == TRUE) {
             fprintf (stderr, "Unable to capture image (VIDIOCMCAPTURE)\n");
         }
@@ -677,7 +678,7 @@
 void init_cam (GtkWidget * capture, cam * cam)
 {
     cam->pic =
-        mmap (0, cam->vid_buf.size, PROT_READ | PROT_WRITE,
+        v4l1_mmap (0, cam->vid_buf.size, PROT_READ | PROT_WRITE,
               MAP_SHARED, cam->dev, 0);
 
     if ((unsigned char *) -1 == (unsigned char *) cam->pic) {
@@ -692,7 +693,7 @@
     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 (v4l1_ioctl (cam->dev, VIDIOCMCAPTURE, &cam->vid_map) < 0) {
             if (cam->debug == TRUE) {
                 fprintf (stderr,
                          "Unable to capture image (VIDIOCMCAPTURE).\n");
--- camorama-0.19/src/main.c	2009-06-24 15:01:55.000000000 +0200
+++ camorama-0.19.new/src/main.c	2009-06-24 14:59:35.000000000 +0200
@@ -9,6 +9,7 @@
 #include <gdk-pixbuf-xlib/gdk-pixbuf-xlib.h>
 #include <gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.h>
 #include <locale.h>
+#include <libv4l1.h>
 
 #include "camorama-display.h"
 #include "camorama-stock-items.h"
@@ -206,7 +207,7 @@
     gdk_pixbuf_xlib_init (display, 0);
     cam->desk_depth = xlib_rgb_get_depth ();
 
-    cam->dev = open (cam->video_dev, O_RDWR);
+    cam->dev = v4l1_open (cam->video_dev, O_RDWR);
 
     camera_cap (cam);
     get_win_info (cam);
@@ -284,5 +285,8 @@
 
     gtk_timeout_add (2000, (GSourceFunc) fps, cam->status);
     gtk_main ();
+    v4l1_munmap(cam->pic, cam->vid_buf.size);
+    v4l1_close(cam->dev);
+    
     return 0;
 }
--- camorama-0.19/src/v4l.c	2009-06-24 15:01:55.000000000 +0200
+++ camorama-0.19.new/src/v4l.c	2009-06-24 14:54:09.000000000 +0200
@@ -2,6 +2,7 @@
 #include<time.h>
 #include<errno.h>
 #include<gnome.h>
+#include <libv4l1.h>
 #include "support.h"
 
 extern int frame_number;
@@ -87,7 +88,7 @@
 void camera_cap(cam * cam)
 {
    char *msg;
-   if(ioctl(cam->dev, VIDIOCGCAP, &cam->vid_cap) == -1) {
+   if(v4l1_ioctl(cam->dev, VIDIOCGCAP, &cam->vid_cap) == -1) {
       if(cam->debug == TRUE) {
          fprintf(stderr, "VIDIOCGCAP  --  could not get camera capabilities, exiting.....\n");
       }
@@ -161,7 +162,7 @@
 	cam->vid_pic.palette = VIDEO_PALETTE_RGB24;
 	cam->vid_pic.depth = 24;
 	//cam->vid_pic.palette = VIDEO_PALETTE_YUV420P;
-	if(ioctl(cam->dev, VIDIOCSPICT, &cam->vid_pic) == -1) {
+	if(v4l1_ioctl(cam->dev, VIDIOCSPICT, &cam->vid_pic) == -1) {
 		if(cam->debug) {
 			g_message("VIDIOCSPICT  --  could not set picture info, exiting....");
 		}
@@ -176,7 +177,7 @@
 //set_pic_info(cam);
    char *msg;
 	
-   if(ioctl(cam->dev, VIDIOCGPICT, &cam->vid_pic) == -1) {
+   if(v4l1_ioctl(cam->dev, VIDIOCGPICT, &cam->vid_pic) == -1) {
       msg = g_strdup_printf(_("Could not connect to video device (%s).\nPlease check connection."), cam->video_dev);
       error_dialog(msg);
       if(cam->debug == TRUE) {
@@ -201,7 +202,7 @@
 void get_win_info(cam * cam)
 {
    gchar *msg;
-   if(ioctl(cam->dev, VIDIOCGWIN, &cam->vid_win) == -1) {
+   if(v4l1_ioctl(cam->dev, VIDIOCGWIN, &cam->vid_win) == -1) {
       msg = g_strdup_printf(_("Could not connect to video device (%s).\nPlease check connection."), cam->video_dev);
       error_dialog(msg);
       if(cam->debug == TRUE) {
@@ -222,7 +223,7 @@
 void set_win_info(cam * cam)
 {
    gchar *msg;
-   if(ioctl(cam->dev, VIDIOCSWIN, &cam->vid_win) == -1) {
+   if(v4l1_ioctl(cam->dev, VIDIOCSWIN, &cam->vid_win) == -1) {
       msg = g_strdup_printf(_("Could not connect to video device (%s).\nPlease check connection."), cam->video_dev);
       error_dialog(msg);
       if(cam->debug == TRUE) {
@@ -239,7 +240,7 @@
 void set_buffer(cam * cam)
 {
    char *msg;
-   if(ioctl(cam->dev, VIDIOCGMBUF, &cam->vid_buf) == -1) {
+   if(v4l1_ioctl(cam->dev, VIDIOCGMBUF, &cam->vid_buf) == -1) {
       msg = g_strdup_printf(_("Could not connect to video device (%s).\nPlease check connection."), cam->video_dev);
       error_dialog(msg);
       if(cam->debug == TRUE) {