camorama r357 - in trunk: . src
- From: herzi svn gnome org
- To: svn-commits-list gnome org
- Subject: camorama r357 - in trunk: . src
- Date: Wed, 28 May 2008 14:20:13 +0000 (UTC)
Author: herzi
Date: Wed May 28 14:20:13 2008
New Revision: 357
URL: http://svn.gnome.org/viewvc/camorama?rev=357&view=rev
Log:
2008-05-28 Sven Herzberg <sven imendio com>
moved the read timeout
* src/callbacks.c: (on_change_size_activate), (apply_filters): deleted
the read timeout; export apply_filters()
* src/callbacks.h: export apply_filters()
* src/capture-strategy-read.c: (read_timeout_func): added the read
timeout
* src/fileio.c: (local_save): dropped unused code
* src/main.c: (main): small code cleanup
Modified:
trunk/ChangeLog
trunk/src/callbacks.c
trunk/src/callbacks.h
trunk/src/capture-strategy-read.c
trunk/src/fileio.c
trunk/src/main.c
Modified: trunk/src/callbacks.c
==============================================================================
--- trunk/src/callbacks.c (original)
+++ trunk/src/callbacks.c Wed May 28 14:20:13 2008
@@ -391,23 +391,6 @@
gtk_widget_set_size_request (glade_xml_get_widget (cam->xml, "da"),
cam->x, cam->y);
- /*
- * if(cam->read == FALSE) {
- * 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);
- * }
- * }else{
- * cam->pic_buf = malloc(cam->x * cam->y * cam->depth);
- * read(cam->dev,cam->pic,(cam->x * cam->y * 3));
- * }
- */
-
cam->vid_win.x = 0;
cam->vid_win.y = 0;
cam->vid_win.width = cam->x;
@@ -426,20 +409,6 @@
*/
cam->vid_map.format = cam->vid_pic.palette;
// get_win_info(cam);
- /*
- * 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(cam->debug == TRUE) {
- * * fprintf(stderr, "Unable to capture image (VIDIOCMCAPTURE) during resize.\n");
- * * }
- * * //error_dialog(_("Unable to capture image."));
- * * //exit(-1);
- * * }
- * * }
- * * }
- */
get_win_info (cam);
frame = 0;
gtk_window_resize (GTK_WINDOW
@@ -520,8 +489,9 @@
gtk_widget_show (about);
}
-static void
-apply_filters(cam* cam) {
+void
+apply_filters (cam* cam)
+{
camorama_filter_chain_apply(cam->filter_chain, cam->pic_buf, cam->x, cam->y, cam->depth);
#warning "FIXME: enable the threshold channel filter"
// if((effect_mask & CAMORAMA_FILTER_THRESHOLD_CHANNEL) != 0)
@@ -531,47 +501,6 @@
// threshold (cam->pic_buf, cam->x, cam->y, cam->dither);
}
-/*
- * get image from cam - does all the work ;)
- */
-gboolean
-read_timeout_func(cam* cam) {
- int i, count = 0;
- GdkGC *gc;
-
- read (cam->dev, cam->pic, (cam->x * cam->y * 3));
- frames2++;
- /*
- * update_rec.x = 0;
- * update_rec.y = 0;
- * update_rec.width = cam->x;
- * update_rec.height = cam->y;
- */
- count++;
- /*
- * refer the frame
- */
- cam->pic_buf = cam->pic; // + cam->vid_buf.offsets[frame];
-
- if (cam->vid_pic.palette == VIDEO_PALETTE_YUV420P) {
- yuv420p_to_rgb (cam->pic_buf, cam->tmp, cam->x, cam->y, cam->depth);
- cam->pic_buf = cam->tmp;
- }
-
- apply_filters(cam);
-
- gc = gdk_gc_new (cam->pixmap);
- gdk_draw_rgb_image (cam->pixmap,
- gc, 0, 0,
- cam->vid_win.width, cam->vid_win.height,
- GDK_RGB_DITHER_NORMAL, cam->pic_buf,
- cam->vid_win.width * cam->depth);
-
- gtk_widget_queue_draw_area (glade_xml_get_widget (cam->xml, "da"), 0,
- 0, cam->x, cam->y);
- return TRUE; /* call this function again */
-}
-
gint
timeout_func (cam * cam)
{
Modified: trunk/src/callbacks.h
==============================================================================
--- trunk/src/callbacks.h (original)
+++ trunk/src/callbacks.h Wed May 28 14:20:13 2008
@@ -7,6 +7,8 @@
G_BEGIN_DECLS
+void apply_filters (cam* cam);
+
void on_change_size_activate (GtkWidget * widget, cam * cam);
void on_quit_activate (GtkMenuItem * menuitem, gpointer user_data);
void gconf_notify_func (GConfClient * client, guint cnxn_id,
@@ -46,7 +48,6 @@
gint timeout_capture_func (cam *);
gint fps (GtkWidget *);
gboolean timeout_func (cam * application);
-gboolean read_timeout_func (cam * application);
void edge_func1 (GtkToggleButton *, gpointer);
void sobel_func (GtkToggleButton *, gpointer);
void fix_colour_func (GtkToggleButton *, char *);
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:13 2008
@@ -23,7 +23,7 @@
#include "capture-strategy-read.h"
-#include "callbacks.h"
+#include "camorama-globals.h"
/* GType Implementation */
@@ -51,6 +51,48 @@
/* Capture Strategy Implementation */
+/*
+ * get image from cam - does all the work ;)
+ */
+static
+gboolean
+read_timeout_func(cam* cam) {
+ int i, count = 0;
+ GdkGC *gc;
+
+ read (cam->dev, cam->pic, (cam->x * cam->y * 3));
+ frames2++;
+ /*
+ * update_rec.x = 0;
+ * update_rec.y = 0;
+ * update_rec.width = cam->x;
+ * update_rec.height = cam->y;
+ */
+ count++;
+ /*
+ * refer the frame
+ */
+ cam->pic_buf = cam->pic; // + cam->vid_buf.offsets[frame];
+
+ if (cam->vid_pic.palette == VIDEO_PALETTE_YUV420P) {
+ yuv420p_to_rgb (cam->pic_buf, cam->tmp, cam->x, cam->y, cam->depth);
+ cam->pic_buf = cam->tmp;
+ }
+
+ apply_filters(cam);
+
+ gc = gdk_gc_new (cam->pixmap);
+ gdk_draw_rgb_image (cam->pixmap,
+ gc, 0, 0,
+ cam->vid_win.width, cam->vid_win.height,
+ GDK_RGB_DITHER_NORMAL, cam->pic_buf,
+ cam->vid_win.width * cam->depth);
+
+ gtk_widget_queue_draw_area (glade_xml_get_widget (cam->xml, "da"), 0,
+ 0, cam->x, cam->y);
+ return TRUE; /* call this function again */
+}
+
static void
implement_capture_strategy (CaptureStrategyIface* iface)
{
Modified: trunk/src/fileio.c
==============================================================================
--- trunk/src/fileio.c (original)
+++ trunk/src/fileio.c Wed May 28 14:20:13 2008
@@ -366,8 +366,6 @@
default:
ext = g_strdup ((gchar *) "jpeg");
}
- //cam->tmp = NULL;
- //memcpy (cam->tmp, cam->pic_buf, cam->x * cam->y * cam->depth);
if (cam->timestamp == TRUE) {
add_rgb_text (cam->tmp, cam->x, cam->y, cam->ts_string,
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Wed May 28 14:20:13 2008
@@ -242,9 +242,8 @@
if (cam->read == FALSE) {
set_buffer (cam);
}
- //cam->read = FALSE;
- /* initialize cam and create the window */
+ /* initialize cam and create the window */
if (cam->read == FALSE) {
cam->capture = capture_strategy_mmap_new ();
init_cam (cam);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]