[Ekiga-list] first patch for firewire
- From: "jamesmikedupont googlemail com" <jamesmikedupont googlemail com>
- To: Ekiga mailing list <ekiga-list gnome org>
- Subject: [Ekiga-list] first patch for firewire
- Date: Mon, 30 Mar 2009 09:26:35 +0200
I have done some work for the firewire,
still in testing
comments appreciated
Index: vidinput_avc.h
===================================================================
--- vidinput_avc.h (Revision 22314)
+++ vidinput_avc.h (Arbeitskopie)
@@ -44,12 +44,17 @@
#include <libraw1394/csr.h>
#include <libdv/dv.h>
+
+#ifdef HAVE_LIBIEC61883
+#include <libiec61883/iec61883.h>
+#endif
+
#include <ptlib.h>
#include <ptlib/videoio.h>
#include <ptlib/vconvert.h>
#include <ptlib/file.h>
#if !P_USE_INLINES
-#include <ptlib/contain.inl>
+//#include <ptlib/contain.inl>
#endif
#include <ptclib/delaychan.h>
@@ -214,6 +219,14 @@
protected:
raw1394handle_t handle;
+
+ int nChannel;
+ // stolen from gstreamer
+#ifdef HAVE_LIBIEC61883
+ iec61883_dv_fb_t iec61883dv;
+#endif
+
+
PBoolean is_capturing;
PBoolean UseDMA;
dv_decoder_t * dv_decoder;
Index: vidinput_avc.cxx
===================================================================
--- vidinput_avc.cxx (Revision 22314)
+++ vidinput_avc.cxx (Arbeitskopie)
@@ -2,6 +2,7 @@
* This file is essentially a rewrite of video4dc1394.cxx
* Check that one for more explanations
*
+ *
* A lot of code "borrowed" from
* - dvgrab.c from libdv (http://libdv.sf.net/)
* - kino (http://kino.schirmacher.de/)
@@ -57,9 +58,16 @@
* libdv 0.98
*
* Author: Georgi Georgiev <chutz gg3 net>
- *
+ * Hacked by : H4ck3rm1k3 <h4ck3rm1k3 fossk org>
*/
+#ifdef HAVE_LIBIEC61883
+#include <libiec61883/iec61883.h>
+#endif
+
+#define DEFAULT_CHANNEL 63
+
+
#pragma implementation "vidinput_avc.h"
#include "vidinput_avc.h"
@@ -78,6 +86,7 @@
// PVideoInput1394AVC
PVideoInputDevice_1394AVC::PVideoInputDevice_1394AVC()
+ : nChannel(DEFAULT_CHANNEL) // used to be 63 everywhere
{
handle = NULL;
is_capturing = PFalse;
@@ -158,15 +167,69 @@
return PFalse;
}
+#ifdef HAVE_LIBIEC61883
+/*
+lifted off :
+http://kino.sourcearchive.com/documentation/1.3.0-2ubuntu1/ieee1394io_8cc-source.html
+
+*/
+static int HandlerProxy
+( unsigned char *data,
+ int length,
+ int complete, // not used
+ void *callback_data // not used
+ )
+{
+ PTRACE(3, "HandlerProxy called for raw1394handle");
+
+ //PVideoInputDevice_1394AVC *self = static_cast< PVideoInputDevice_1394AVC* >( callback_data );
+ // return self->Handler( length, complete, data );
+
+ // int RawISOHandler (raw1394handle_t handle, int channel, size_t
+ // length, u_int32_t * data)
+ if (length < RAW_BUFFER_SIZE) {
+ *(u_int32_t *) raw_buffer = length;
+ memcpy (raw_buffer + 4, data, length);
+ }
+ else
+ {
+ /**
+ overflow!
+ */
+ PTRACE(3, "buffer overflow in RawISOHandler");
+ }
+ return 0;
+}
+#endif
+
+
PBoolean PVideoInputDevice_1394AVC::Start()
{
if (!IsOpen()) return PFalse;
if (IsCapturing()) return PTrue;
- if (raw1394_set_iso_handler(handle, 63, &RawISOHandler)!= NULL) {
+
+ /*
+ lifted off of gstreamer
+ http://gst-plugins-good0.10.sourcearchive.com/documentation/0.10.11/gstdv1394src_8c-source.html
+ */
+ #ifdef HAVE_LIBIEC61883
+ if ((iec61883dv =
+ iec61883_dv_fb_init (handle,
+ &HandlerProxy,
+ 0
+ )
+ ) == NULL)
+
+ #else
+ // raw1394_set_iso_handler (handle, src->channel, gst_dv1394src_iso_receive);
+ //old code
+ if (raw1394_set_iso_handler(handle, DEFAULT_CHANNEL, &RawISOHandler)!= NULL)
+ {
PTRACE (3, "Cannot set_iso_handler");
return PFalse;
}
+ #endif
is_capturing = PTrue;
return PTrue;
@@ -370,11 +433,24 @@
BYTE capture_buffer[150000];
BYTE * capture_buffer_end = capture_buffer;
+
+#ifdef HAVE_LIBIEC61883
+ if (iec61883_dv_fb_start (iec61883dv, nChannel) != 0)
+ {
+ PTRACE(3, "Cannot start receive data on channel " << nChannel);
+ return PFalse;
+ }
+#else
+
// this starts the bytes' rain
- if (raw1394_start_iso_rcv(handle, 63) < 0) {
- PTRACE(3, "Cannot receive data on channel 63");
+ if (raw1394_start_iso_rcv(handle, nChannel) < 0) {
+ PTRACE(3, "Cannot receive data on channel " << nChannel);
return PFalse;
}
+
+
+#endif
+
// calling the raw1394 event manager, to get a frame:
while(!frame_complete) {
raw1394_loop_iterate(handle);
@@ -414,8 +490,16 @@
}
}
}
+
+#ifdef HAVE_LIBIEC61883
+ iec61883_dv_fb_close (iec61883dv);
+ iec61883dv=0;
+#else
// stops the bytes from coming at us!
- raw1394_stop_iso_rcv(handle, 63);
+ raw1394_stop_iso_rcv(handle, nChannel);
+
+#endif
+
dv_decoder_t *dv;
dv = dv_decoder_new(PTrue, PFalse, PFalse);
@@ -506,6 +590,13 @@
*(u_int32_t *) raw_buffer = length;
memcpy (raw_buffer + 4, data, length);
}
+ else
+ {
+ /**
+ overflow!
+ */
+ PTRACE(3, "buffer overflow in RawISOHandler on channel " << channel);
+ }
return 0;
}
// End Of File ///////////////////////////////////////////////////////////////
Index: Makefile
===================================================================
--- Makefile (Revision 22314)
+++ Makefile (Arbeitskopie)
@@ -1,7 +1,21 @@
PLUGIN_NAME = avc
PLUGIN_FAMILY = device/videoinput
-PLUGIN_LIBS = $(LDFLAGS) -lraw1394 -ldv -lrom1394
+PLUGIN_LIBS = $(LDFLAGS) -lraw1394 -ldv -lrom1394 -lpt_d_s -liec61883
PLUGIN_SOURCES = vidinput_avc.cxx
+CFLAGS = -DHAVE_LIBIEC61883
+CXXFLAGS = -DHAVE_LIBIEC61883=1
include ../../make/plugins.mak
+
+
+staticlink:
+ g++ -DPTRACING=1 -D_REENTRANT \
+ -fno-exceptions -Wall -fPIC \
+ -DPIC -DNDEBUG -Os \
+ -I../../../../ekiga/ptlib/include \
+ -DHAVE_LIBIEC61883 \
+ -L../../../../ekiga/ptlib/lib_linux_x86 \
+ -I. -shared vidinput_avc.cxx \
+ -L../../../../ekiga/ptlib/lib_linux_x86 -lraw1394 -ldv -lrom1394 \
+ -o ../../../../ekiga/ptlib/lib_linux_x86/device/videoinput/avc_pwplugin_s.o
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]