Re: [GnomeMeeting-devel-list] Gnome-vfs support for the static image loading
- From: Miguel Rodríguez Pérez <migrax terra es>
- To: gnomemeeting-devel-list gnome org
- Subject: Re: [GnomeMeeting-devel-list] Gnome-vfs support for the static image loading
- Date: Thu, 08 Apr 2004 17:32:54 +0200
Here it goes the latest version of the patch. I have corrected some
minor coding style issues (loader_area_updated should be called
loader_area_updated_cb) and tried to follow GM's doc style (hope I did
get it right this time).
I have also made the compilation optional depending on the macro
DISABLE_GNOME. For this I created two new files vfakeio-vfs.cpp and
vfakeio-vfs.h that replace vfakeio.cpp and vfakeio.h when DISABLE_GNOME
is undefined.
Do I commit?
PS: Damien, I'm missing some mails from the list (mails I sent and the
last mail from Craig). Can you check everything is ok? Thanks.
El jue, 08-04-2004 a las 13:20, +0200, Damien Sandras escribió:
> Mmmh, why do you need to modify vfakeio.cpp so much just to load an
> image one time?
>
> Isn't it possible to minimize the class variables?
>
> Ps: your new functions do not follow GM's doc style. (see endpoint.h)
>
>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnomemeeting/ChangeLog,v
retrieving revision 1.1223
diff -d -u -r1.1223 ChangeLog
--- ChangeLog 7 Apr 2004 08:25:04 -0000 1.1223
+++ ChangeLog 8 Apr 2004 15:26:17 -0000
@@ -1,3 +1,15 @@
+2004-04-08 Miguel Rodríguez Pérez <migrax terra es>
+
+ * src/Makefile.am (gnomemeeting_SOURCES): Compile the gnome-vfs
+ based version of the image loader only if DISABLE_GNOME is not defined.
+
+ * configure.in: Add explicit detection of gnome-vfs.
+
+ * src/pref_window.cpp (browse_button_clicked_cb): Accept non local files.
+
+ * src/vfakeio-vfs.cpp:
+ * src/vfakeio-vfs.h: Implement async loading of gnome-vfs uris.
+
2004-04-07 Kilian Krause <kk verfaction de>
* configure.in, lib/about/gnome-about.c, lib/about/gnome-about.h,
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnomemeeting/configure.in,v
retrieving revision 1.266
diff -d -u -r1.266 configure.in
--- configure.in 7 Apr 2004 08:25:04 -0000 1.266
+++ configure.in 8 Apr 2004 15:26:18 -0000
@@ -79,7 +79,7 @@
PKG_CHECK_MODULES(GNOMEMEETING, gtk+-2.0 >= 2.0.6 gthread-2.0 >= 2.0.6 esound >= 0.2.28 libxml-2.0 >= 2.5.0)
GNOMEMEETING_CFLAGS="$GNOMEMEETING_CFLAGS -DDISABLE_GNOME"
else
-PKG_CHECK_MODULES(GNOMEMEETING, gtk+-2.0 >= 2.0.6 gthread-2.0 >= 2.0.6 esound >= 0.2.28 gconf-2.0 >= 1.2.1 libxml-2.0 >= 2.5.0 libgnome-2.0 >= 2.0.0 libgnomeui-2.0 >= 2.0.0)
+PKG_CHECK_MODULES(GNOMEMEETING, gtk+-2.0 >= 2.0.6 gthread-2.0 >= 2.0.6 esound >= 0.2.28 gconf-2.0 >= 1.2.1 libxml-2.0 >= 2.5.0 libgnome-2.0 >= 2.0.0 libgnomeui-2.0 >= 2.0.0 gnome-vfs-2.0 >= 2.2.0)
fi
OPENH323_REC_VERSION="1.13.4"
Index: src/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnomemeeting/src/Makefile.am,v
retrieving revision 1.49
diff -d -u -r1.49 Makefile.am
--- src/Makefile.am 6 Apr 2004 23:54:26 -0000 1.49
+++ src/Makefile.am 8 Apr 2004 15:26:18 -0000
@@ -44,8 +44,6 @@
chat_window.h \
urlhandler.cpp \
urlhandler.h \
- vfakeio.cpp \
- vfakeio.h \
tray.h \
tray.cpp \
tools.cpp \
@@ -54,6 +52,13 @@
lid.h \
codec_info.cpp \
codec_info.h
+
+
+if DISABLE_GNOME
+gnomemeeting_SOURCES += vfakeio.cpp vfakeio.h
+else
+gnomemeeting_SOURCES += vfakeio-vfs.cpp vfakeio-vfs.h
+endif
gnomemeeting_SOURCES += druid.cpp druid.h
Index: src/pref_window.cpp
===================================================================
RCS file: /cvs/gnome/gnomemeeting/src/pref_window.cpp,v
retrieving revision 1.216
diff -d -u -r1.216 pref_window.cpp
--- src/pref_window.cpp 29 Mar 2004 18:41:40 -0000 1.216
+++ src/pref_window.cpp 8 Apr 2004 15:26:20 -0000
@@ -416,12 +416,13 @@
GTK_STOCK_OPEN,
GTK_RESPONSE_ACCEPT,
NULL);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (selector), FALSE);
if (gtk_dialog_run (GTK_DIALOG (selector)) == GTK_RESPONSE_ACCEPT)
{
char *filename;
- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (selector));
+ filename = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (selector));
gtk_entry_set_text (GTK_ENTRY (data), filename);
g_free (filename);
Index: src/vfakeio-vfs.cpp
===================================================================
RCS file: src/vfakeio-vfs.cpp
diff -N src/vfakeio-vfs.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/vfakeio-vfs.cpp 8 Apr 2004 15:26:20 -0000
@@ -0,0 +1,477 @@
+
+/* GnomeMeeting -- A Video-Conferencing application
+ * Copyright (C) 2000-2004 Damien Sandras
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * GnomeMeting is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OpenH323 and Pwlib, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OpenH323 program, as long
+ * as you do follow the requirements of the GNU GPL for all the rest of the
+ * software thus combined.
+ */
+
+
+/*
+ * vfakeio.cpp - description
+ * ---------------------------
+ * begin : Tue Jul 30 2003
+ * copyright : (C) 2000-2004 by Damien Sandras
+ * description : This file contains a descendant of a Fake Input
+ * Device that display the GM logo when connected to
+ * a remote party without using a camera.
+ * Additional code : Miguel RodrÃguez Pérez <migrax terra es>
+ *
+ */
+
+
+#include "../config.h"
+
+#include "vfakeio-vfs.h"
+#include <ptlib/vconvert.h>
+
+#include "misc.h"
+#include "gm_conf.h"
+
+#include "../pixmaps/text_logo.xpm"
+#include <libgnomevfs/gnome-vfs.h>
+
+const size_t GMH323FakeVideoInputDevice::buffer_size = 4096;
+
+GMH323FakeVideoInputDevice::GMH323FakeVideoInputDevice ()
+{
+ orig_pix = NULL;
+ cached_pix = NULL;
+ loader_pix = NULL;
+ filehandle = NULL;
+
+ pos = 0;
+ increment = 1;
+
+ moving = false;
+
+ buffer = new guchar [buffer_size];
+}
+
+
+GMH323FakeVideoInputDevice::~GMH323FakeVideoInputDevice ()
+{
+ Close ();
+
+ delete[] buffer;
+}
+
+void GMH323FakeVideoInputDevice::loader_area_updated_cb (GdkPixbufLoader *loader,
+ gint x, gint y, gint width,
+ gint height,
+ gpointer thisclass)
+{
+ GMH323FakeVideoInputDevice *thisc = static_cast<GMH323FakeVideoInputDevice *> (thisclass);
+
+ if (thisc->orig_pix)
+ g_object_unref (G_OBJECT (thisc->orig_pix));
+ if (thisc->cached_pix != NULL) {
+ g_object_unref (G_OBJECT (thisc->cached_pix));
+ thisc->cached_pix = NULL;
+ }
+
+ thisc->orig_pix = gdk_pixbuf_loader_get_pixbuf (loader);
+ g_object_ref (G_OBJECT (thisc->orig_pix));
+}
+
+void GMH323FakeVideoInputDevice::async_close_cb (GnomeVFSAsyncHandle *fp,
+ GnomeVFSResult result,
+ gpointer thisclass)
+{
+ GMH323FakeVideoInputDevice *thisc = static_cast<GMH323FakeVideoInputDevice *> (thisclass);
+
+ if (thisc->loader_pix != NULL) {
+ gdk_pixbuf_loader_close (thisc->loader_pix, NULL);
+ g_object_unref (G_OBJECT (thisc->loader_pix));
+ thisc->loader_pix = NULL;
+ }
+}
+
+void GMH323FakeVideoInputDevice::async_read_cb (GnomeVFSAsyncHandle *fp,
+ GnomeVFSResult result,
+ gpointer buffer,
+ GnomeVFSFileSize requested,
+ GnomeVFSFileSize bytes_read,
+ gpointer thisclass)
+{
+ GMH323FakeVideoInputDevice *thisc = static_cast<GMH323FakeVideoInputDevice *> (thisclass);
+
+
+ if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) {
+ gnome_vfs_async_close (fp, async_close_cb, thisclass);
+ return;
+ }
+
+ if (thisc->loader_pix != NULL)
+ gdk_pixbuf_loader_write (thisc->loader_pix,
+ thisc->buffer, thisc->buffer_size, NULL);
+
+ if (result == GNOME_VFS_ERROR_EOF) {
+ gnome_vfs_async_close (fp, async_close_cb, thisclass);
+ } else {
+ gnome_vfs_async_read (fp, thisc->buffer, thisc->buffer_size,
+ async_read_cb, thisclass);
+ }
+}
+
+void GMH323FakeVideoInputDevice::async_open_cb (GnomeVFSAsyncHandle *fp,
+ GnomeVFSResult result,
+ gpointer thisclass)
+{
+ GMH323FakeVideoInputDevice *thisc = static_cast<GMH323FakeVideoInputDevice *> (thisclass);
+
+
+ if (result != GNOME_VFS_OK) {
+ gnome_vfs_async_close (fp, async_close_cb, thisclass);
+ return;
+ }
+
+ gnome_vfs_async_read (fp, thisc->buffer, 4096,
+ async_read_cb, thisclass);
+}
+
+gboolean GMH323FakeVideoInputDevice::async_cancel (gpointer data)
+{
+ gnome_vfs_async_cancel ((GnomeVFSAsyncHandle *)data);
+
+ return FALSE;
+}
+
+BOOL
+GMH323FakeVideoInputDevice::Open (const PString &name,
+ BOOL start_immediate)
+{
+ gchar *image_name = NULL;
+
+ if (IsOpen ())
+ return FALSE;
+
+ if (name == "MovingLogo") {
+
+ moving = true;
+ orig_pix = gdk_pixbuf_new_from_xpm_data ((const char **) text_logo_xpm);
+
+ return TRUE;
+ }
+
+ /* from there on, we're in the static picture case! */
+ moving = false;
+
+ image_name = gm_conf_get_string (VIDEO_DEVICES_KEY "image");
+ loader_pix = gdk_pixbuf_loader_new ();
+ g_signal_connect (G_OBJECT (loader_pix), "area-updated",
+ G_CALLBACK (loader_area_updated_cb), this);
+
+ if (orig_pix != NULL) {
+ g_object_unref (G_OBJECT (orig_pix));
+ orig_pix = NULL;
+ }
+
+ gnome_vfs_async_open (&filehandle, image_name, GNOME_VFS_OPEN_READ,
+ GNOME_VFS_PRIORITY_DEFAULT,
+ async_open_cb,
+ this);
+
+ g_free (image_name);
+
+ return TRUE;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::IsOpen ()
+{
+ if (orig_pix)
+ return TRUE;
+
+ return FALSE;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::Close ()
+{
+ gnomemeeting_threads_enter ();
+ if (filehandle != NULL) {
+ g_idle_add (async_cancel, filehandle);
+ filehandle = NULL;
+ }
+ if (loader_pix != NULL) {
+ gdk_pixbuf_loader_close (loader_pix, NULL);
+ g_object_unref (G_OBJECT (loader_pix));
+ loader_pix = NULL;
+ }
+ if (orig_pix != NULL) {
+ g_object_unref (G_OBJECT (orig_pix));
+ orig_pix = NULL;
+ }
+ if (cached_pix != NULL) {
+ g_object_unref (G_OBJECT (cached_pix));
+ cached_pix = NULL;
+ }
+ gnomemeeting_threads_leave ();
+
+ return TRUE;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::Start ()
+{
+ return TRUE;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::Stop ()
+{
+ return TRUE;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::IsCapturing ()
+{
+ return IsCapturing ();
+}
+
+
+PStringList
+GMH323FakeVideoInputDevice::GetInputDeviceNames ()
+{
+ PStringList l;
+
+ l.AppendString ("MovingLogo");
+ l.AppendString ("StaticPicture");
+
+ return l;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::SetFrameSize (unsigned int width,
+ unsigned int height)
+{
+ if (!PVideoDevice::SetFrameSize (width, height))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::GetFrame (PBYTEArray &a)
+{
+ PINDEX returned;
+
+ if (!GetFrameData (a.GetPointer (), &returned))
+ return FALSE;
+
+ a.SetSize (returned);
+
+ return TRUE;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::GetFrameData (BYTE *a, PINDEX *i)
+{
+ WaitFinishPreviousFrame ();
+
+ GetFrameDataNoDelay (a, i);
+
+ *i = CalculateFrameBytes (frameWidth, frameHeight, colourFormat);
+
+ return TRUE;
+}
+
+
+BOOL GMH323FakeVideoInputDevice::GetFrameDataNoDelay (BYTE *frame, PINDEX *i)
+{
+ guchar *data = NULL;
+
+ unsigned width = 0;
+ unsigned height = 0;
+
+ int orig_width = 0;
+ int orig_height = 0;
+
+ GetFrameSize (width, height);
+
+ if (orig_pix == NULL)
+ return FALSE;
+
+ gnomemeeting_threads_enter ();
+
+ if (!cached_pix) {
+
+ cached_pix = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
+ width, height);
+ gdk_pixbuf_fill (cached_pix, 0x000000FF); /* Opaque black */
+
+ if (!moving) { // create the ever-displayed picture
+
+ orig_width = gdk_pixbuf_get_width (orig_pix);
+ orig_height = gdk_pixbuf_get_height (orig_pix);
+
+ if ((unsigned)orig_width <= width && (unsigned)orig_height <= height)
+ /* the picture fits in the target space: center it */
+ gdk_pixbuf_copy_area (orig_pix, 0, 0, orig_width, orig_height,
+ cached_pix,
+ (width - orig_width) / 2,
+ (height - orig_height) / 2);
+ else { /* the picture doesn't fit: scale 1:1, and center */
+ double scale_w, scale_h, scale;
+
+ scale_w = (double)width / orig_width;
+ scale_h = (double)height / orig_height;
+
+ if (scale_w < scale_h) // one of them is known to be < 1
+ scale = scale_w;
+ else
+ scale = scale_h;
+
+ GdkPixbuf *scaled_pix = gdk_pixbuf_scale_simple (orig_pix, (int)(scale*orig_width),(int)(scale*orig_height), GDK_INTERP_BILINEAR);
+ gdk_pixbuf_copy_area (scaled_pix, 0, 0, (int)(scale*orig_width), (int)(scale*orig_height), cached_pix,
+ (width - (int)(scale*orig_width)) / 2, (height - (int)(scale*orig_height)) / 2);
+ g_object_unref (G_OBJECT (scaled_pix));
+ }
+ }
+ }
+
+ if (moving) { // recompute the cache pix
+
+ orig_width = gdk_pixbuf_get_width (orig_pix);
+ orig_height = gdk_pixbuf_get_height (orig_pix);
+
+ gdk_pixbuf_fill (cached_pix, 0x000000FF); /* Opaque black */
+ gdk_pixbuf_copy_area (orig_pix, 0, 0, orig_width, orig_height,
+ cached_pix, (width - orig_width) / 2, pos);
+
+ pos = pos + increment;
+
+ if ((int) pos > (int) height - orig_height - 10) increment = -1;
+ if (pos < 10) increment = +1;
+ }
+
+ data = gdk_pixbuf_get_pixels (cached_pix);
+ rgb_increment = gdk_pixbuf_get_n_channels (cached_pix);
+
+ if (converter)
+ converter->Convert (data, frame);
+
+ gnomemeeting_threads_leave ();
+
+
+ return TRUE;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::TestAllFormats ()
+{
+ return TRUE;
+}
+
+
+PINDEX
+GMH323FakeVideoInputDevice::GetMaxFrameBytes ()
+{
+ return CalculateFrameBytes (frameWidth, frameHeight, colourFormat);
+}
+
+
+void
+GMH323FakeVideoInputDevice::WaitFinishPreviousFrame ()
+{
+ frameTimeError += msBetweenFrames;
+
+ PTime now;
+ PTimeInterval delay = now - previousFrameTime;
+ frameTimeError -= (int)delay.GetMilliSeconds();
+ frameTimeError += 1000 / frameRate;
+ previousFrameTime = now;
+
+ if (frameTimeError > 0) {
+ PTRACE(6, "FakeVideo\t Sleep for " << frameTimeError << " milli seconds");
+#ifdef P_LINUX
+ usleep(frameTimeError * 1000);
+#else
+ PThread::Current()->Sleep(frameTimeError);
+#endif
+ }
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::SetVideoFormat (VideoFormat newFormat)
+{
+ return PVideoDevice::SetVideoFormat (newFormat);
+}
+
+
+int
+GMH323FakeVideoInputDevice::GetNumChannels()
+{
+ return 1;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::SetChannel (int newChannel)
+{
+ return PVideoDevice::SetChannel (newChannel);
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::SetColourFormat (const PString &newFormat)
+{
+ if (newFormat == "BGR32")
+ return PVideoDevice::SetColourFormat (newFormat);
+
+ return FALSE;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::SetFrameRate (unsigned rate)
+{
+ PVideoDevice::SetFrameRate (12);
+
+ return TRUE;
+}
+
+
+BOOL
+GMH323FakeVideoInputDevice::GetFrameSizeLimits (unsigned & minWidth,
+ unsigned & minHeight,
+ unsigned & maxWidth,
+ unsigned & maxHeight)
+{
+ minWidth = 10;
+ minHeight = 10;
+ maxWidth = 1000;
+ maxHeight = 800;
+
+ return TRUE;
+}
Index: src/vfakeio-vfs.h
===================================================================
RCS file: src/vfakeio-vfs.h
diff -N src/vfakeio-vfs.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/vfakeio-vfs.h 8 Apr 2004 15:26:20 -0000
@@ -0,0 +1,243 @@
+
+/* GnomeMeeting -- A Video-Conferencing application
+ * Copyright (C) 2000-2004 Damien Sandras
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * GnomeMeting is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OpenH323 and Pwlib, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OpenH323 program, as long
+ * as you do follow the requirements of the GNU GPL for all the rest of the
+ * software thus combined.
+ */
+
+
+/*
+ * vfakeio.h - description
+ * -------------------------
+ * begin : Tue Jul 30 2003
+ * copyright : (C) 2000-2004 by Damien Sandras
+ * description : This file contains a descendant of a Fake Input
+ * Device that display the GM logo when connected to
+ * a remote party without using a camera.
+ * Additional code : Miguel RodrÃguez Pérez <migrax terra es>
+ *
+ */
+
+
+#ifndef _VFAKEIO_H_
+#define _VFAKEIO_H_
+
+#define P_FORCE_STATIC_PLUGIN
+
+#include "common.h"
+#include <libgnomevfs/gnome-vfs.h>
+
+
+class GMH323FakeVideoInputDevice : public PVideoInputDevice
+{
+ PCLASSINFO(GMH323FakeVideoInputDevice, PVideoInputDevice);
+ guchar *buffer;
+ static const size_t buffer_size;
+ GdkPixbuf *cached_pix;
+ GdkPixbuf *orig_pix;
+ GdkPixbufLoader *loader_pix;
+ GnomeVFSAsyncHandle *filehandle;
+
+ /* DESCRIPTION : Callback called when the loading pixbuf is updated.
+ * BEHAVIOR : Recreates orig_pix and cached_pix
+ * PRE : thisclass is a pointer to the pointer class/
+ */
+ static void loader_area_updated_cb (GdkPixbufLoader *loader,
+ gint x, gint y, gint width,
+ gint height, gpointer thisclass);
+
+ /* DESCRIPTION : Callback called to confirm close of the async operation
+ * BEHAVIOR : Frees all resouurces associated with pixbuf loading
+ * PRE : thisclass is a pointer to the pointer class/
+ */
+ static void async_close_cb (GnomeVFSAsyncHandle *fp,
+ GnomeVFSResult result, gpointer thisclass);
+
+ /* DESCRIPTION : Callback called when there is data ready to be used
+ * BEHAVIOR : Passes the read data to the pixbuf loader
+ * PRE : thisclass is a pointer to the pointer class/
+ */
+ static void async_read_cb (GnomeVFSAsyncHandle *fp,
+ GnomeVFSResult result,
+ gpointer buffer,
+ GnomeVFSFileSize requested,
+ GnomeVFSFileSize bytes_read,
+ gpointer thisclass);
+
+ /* DESCRIPTION : Callback called to confirm uri opening
+ * BEHAVIOR : Prepares the reading of data from the uri
+ * PRE : thisclass is a pointer to the pointer class/
+ */
+ static void async_open_cb (GnomeVFSAsyncHandle *fp,
+ GnomeVFSResult result, gpointer thisclass);
+
+ /* DESCRIPTION : Called from the main loop to cancel a pending gnome-async request.
+ * It seems gnome-vfs doesn't support this operation being
+ * done from a thread.
+ * BEHAVIOR : Calls gnome_vfs_async_cancel
+ * PRE : Data is the handler of the gnome-vfs operation/
+ */
+ static gboolean async_cancel (gpointer data);
+
+ public:
+
+ /* DESCRIPTION : The constructor.
+ * BEHAVIOR : Creates the Fake Input Device.
+ * PRE : /
+ */
+ GMH323FakeVideoInputDevice ();
+
+
+ /* DESCRIPTION : The destructor
+ * BEHAVIOR : /
+ * PRE : /
+ */
+ ~GMH323FakeVideoInputDevice ();
+
+
+ BOOL Open (const PString &,
+ BOOL = TRUE);
+
+
+ /**Determine of the device is currently open.
+ */
+ BOOL IsOpen() ;
+
+
+ /**Close the device.
+ */
+ BOOL Close();
+
+
+ /**Start the video device I/O.
+ */
+ BOOL Start();
+
+
+ /**Stop the video device I/O capture.
+ */
+ BOOL Stop();
+
+
+ /**Determine if the video device I/O capture is in progress.
+ */
+ BOOL IsCapturing();
+
+
+ /**Get a list of all of the drivers available.
+ */
+ static PStringList GetInputDeviceNames();
+
+
+ BOOL SetFrameSize (unsigned int,
+ unsigned int);
+
+
+ /* DESCRIPTION : The destructor
+ * BEHAVIOR : /
+ * PRE : /
+ */
+ BOOL GetFrameData (BYTE *, PINDEX * = NULL);
+
+
+ /* DESCRIPTION : The destructor
+ * BEHAVIOR : /
+ * PRE : /
+ */
+ BOOL GetFrameDataNoDelay (BYTE *, PINDEX * = NULL);
+
+
+ BOOL GetFrame (PBYTEArray &);
+
+
+ BOOL TestAllFormats ();
+
+
+ /**Get the maximum frame size in bytes.
+ */
+ PINDEX GetMaxFrameBytes();
+
+
+ /** Given a preset interval of n milliseconds, this function
+ returns n msecs after the previous frame capture was initiated.
+ */
+ void WaitFinishPreviousFrame();
+
+
+ /**Set the video format to be used.
+
+ Default behaviour sets the value of the videoFormat variable and then
+ returns the IsOpen() status.
+ */
+ BOOL SetVideoFormat (VideoFormat);
+
+
+ /**Get the number of video channels available on the device.
+
+ Default behaviour returns 1.
+ */
+ int GetNumChannels() ;
+
+
+ /**Set the video channel to be used on the device.
+
+ Default behaviour sets the value of the channelNumber variable and then
+ returns the IsOpen() status.
+ */
+ BOOL SetChannel (int);
+
+
+ /**Set the colour format to be used.
+
+ Default behaviour sets the value of the colourFormat variable and then
+ returns the IsOpen() status.
+ */
+ BOOL SetColourFormat (const PString &);
+
+
+ /**Set the video frame rate to be used on the device.
+
+ Default behaviour sets the value of the frameRate variable and then
+ return the IsOpen() status.
+ */
+ BOOL SetFrameRate (unsigned);
+
+
+ BOOL GetFrameSizeLimits (unsigned &,
+ unsigned &,
+ unsigned &,
+ unsigned &);
+
+
+ PBYTEArray data;
+ bool moving;
+ int rgb_increment;
+ int pos;
+ int increment;
+ PStringList GetDeviceNames() const
+ { return GetInputDeviceNames(); }
+};
+
+PCREATE_VIDINPUT_PLUGIN (Picture, GMH323FakeVideoInputDevice);
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]