diff --git a/externals/pd-l2ork-TODO.txt b/externals/pd-l2ork-TODO.txt
index 2e47f1715f32b699c5c73be6c457ace3e7a8860d..523bf3416b0ad267c0374a005e040d6d6c0c8c71 100644
--- a/externals/pd-l2ork-TODO.txt
+++ b/externals/pd-l2ork-TODO.txt
@@ -1,10 +1,13 @@
 Diff status between pd-l2ork externals source tree and main community pd svn
-AS OF 11/22/2012
+AS OF Feb. 06, 2012
 
 DONE:
 creb
 gem2pdp
 mrpeach
+pdp
+pidip
+sigpack
 
 MERGE:
 miXed
diff --git a/externals/pdp/Makefile b/externals/pdp/Makefile
index 260f46a9cfd7017c97cb7e6c53e7b5689885eddd..445a2a553ad0396f91414f4fed776eae9894dfcd 100644
--- a/externals/pdp/Makefile
+++ b/externals/pdp/Makefile
@@ -26,11 +26,11 @@ darwin:	pdp_all
 
 linux: pdp_all
 	rm -f pdp.pd_linux
-	$(CC) -Wl,--export-dynamic -shared -o pdp.pd_linux modules/*/*.o system/pdp.o system/*/*.o puredata/*.o $(PDP_LIBS)
+	$(CC) -rdynamic -shared -o pdp.pd_linux modules/*/*.o system/pdp.o system/*/*.o puredata/*.o $(PDP_LIBS)
 
 linux_mmx: pdp_all
 	rm -f pdp.pd_linux
-	$(CC) -Wl,--export-dynamic -shared -o pdp.pd_linux modules/*/*.o system/pdp.o system/*/*.o puredata/*.o $(PDP_LIBS)
+	$(CC) -rdynamic -shared -o pdp.pd_linux modules/*/*.o system/pdp.o system/*/*.o puredata/*.o $(PDP_LIBS)
 
 buildclean:
 	make -C include clean
diff --git a/externals/pdp/README b/externals/pdp/README
index a9251ab5b4b62ec2624471f213ab80749246d64f..1225c11b3d3a17a8534aece8abf46c3a1309c7a8 100644
--- a/externals/pdp/README
+++ b/externals/pdp/README
@@ -1,4 +1,4 @@
-PDP - Pure Data Packet v0.12.6
+PDP - Pure Data Packet v0.12.7
 a packet processing library for pure data
 
 Copyright (c) by Tom Schouten <tom@zwizwa.be>
diff --git a/externals/pdp/bin/pdp-config b/externals/pdp/bin/pdp-config
index 0be670f9d4c85483af72266628e203ee858323b7..b04ac184523c8e558ca55a105e7311a12ec10c52 100644
--- a/externals/pdp/bin/pdp-config
+++ b/externals/pdp/bin/pdp-config
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-prefix=/usr/local
-version=0.12.7-svn
+prefix=/usr
+version=0.12.7
 
 usage="\
 Usage: pdp-config [--version] [--cflags] [--libdir]"
diff --git a/externals/pdp/configure.ac b/externals/pdp/configure.ac
index edeff2e1e437af8ae35078f1795fa833a969746f..15d686ad2d345823e217ac28d36df55a41ea3240 100644
--- a/externals/pdp/configure.ac
+++ b/externals/pdp/configure.ac
@@ -7,7 +7,7 @@ AC_HEADER_STDC
 dnl TAG REPO WHEN RELEASE VERSION CHANGES !!!
 dnl After changing version, do "make mrproper ; sh bootstrap"
 
-PDP_VERSION=0.12.7-svn
+PDP_VERSION=0.12.7
 
 
 
@@ -96,6 +96,12 @@ then
 elif test -f $PWD/../src/m_pd.h;
 then
 	PD_CPPFLAGS="-I$PWD/../src"
+elif test -f /usr/local/include/pd/m_pd.h;
+then
+	PD_CPPFLAGS="-I/usr/local/include/pd"
+elif test -f /usr/include/pd/m_pd.h;
+then
+	PD_CPPFLAGS="-I/usr/include/pd"
 fi
 
 
@@ -139,28 +145,64 @@ then
 
 dnl if not darwin, assume target is linux
 else
-	AC_CHECK_HEADER(linux/videodev.h,
+  have_v4l="no"
+  have_libv4l="no"
+  AC_CHECK_HEADERS([libv4l1-videodev.h], have_v4l="yes")
+  AC_CHECK_HEADERS([linux/videodev.h], have_libv4l="yes")
+
+  if test "x$have_libv4l" = "xyes"
+  then
+    have_v4l="yes"
+  fi
+
+  if test "x$enable_v4l" = "xno"
+  then
+   have_v4l="no"
+  fi
+
+  if test "x$have_v4l" = "xyes"
+  then
 		PDP_OPTMOD="$PDP_OPTMOD pdp_v4l.o"
-		AC_DEFINE(HAVE_PDP_V4L, 1, build pdp_v4l),
-		echo "   linux/videodev.h not found: not building pdp_v4l")
-
-
+		AC_DEFINE(HAVE_PDP_V4L, 1, [build pdp_v4l])
+
+    if test "x$have_libv4l" = "xyes"
+    then
+  		AC_DEFINE(HAVE_PDP_LIBV4L, 1, [build pdp_v4l with libv4l])
+      PDP_V4L_CFLAGS="`pkg-config --cflags libv4l 2>/dev/null || pkg-config --cflags libv4l2`"
+      PDP_V4L_LIBS="`pkg-config --libs libv4l 2>/dev/null || pkg-config --libs libv4l2`"
+    else
+      PDP_V4L_CFLAGS=""
+      PDP_V4L_LIBS=""
+    fi
+    PDP_CFLAGS="$PDP_CFLAGS $PDP_V4L_CFLAGS"
+    LIBS="$LIBS $PDP_V4L_LIBS"
+  else
+    AC_MSG_RESULT([not building pdp_v4l])
+  fi
 fi
 
 dnl optional gsl support
 if test $enable_gsl == yes;
 then
-	AC_CHECK_LIB(gsl,main,
-		PDP_OPTTYPES="$PDP_OPTTYPES pdp_matrix.o"
-		PDP_MATRIX_BASIC="$PDP_MATRIX_BASIC pdp_mat_mul.o pdp_mat_lu.o pdp_mat_vec.o"
-		PDP_IMAGE_BASIC="$PDP_IMAGE_BASIC pdp_cheby.o"
-		PDP_IMAGE_SPECIAL="$PDP_IMAGE_SPECIAL pdp_histo.o"
-		AC_DEFINE(HAVE_PDP_GSL, 1, gsl support)
-		LIBS="$LIBS -lgsl",
-		echo "   libgsl not found: not building matrix type support")
-	AC_CHECK_LIB(gslcblas,main,
-		LIBS="$LIBS -lgslcblas", echo "   libgslcblas not found")
-
+  AC_CHECK_LIB(gslcblas,main)
+  AC_CHECK_LIB(gsl,main,
+    PDP_OPTTYPES="$PDP_OPTTYPES pdp_matrix.o"
+    PDP_MATRIX_BASIC="$PDP_MATRIX_BASIC pdp_mat_mul.o pdp_mat_lu.o pdp_mat_vec.o"
+    PDP_IMAGE_BASIC="$PDP_IMAGE_BASIC pdp_cheby.o"
+    PDP_IMAGE_SPECIAL="$PDP_IMAGE_SPECIAL pdp_histo.o"
+    AC_DEFINE(HAVE_PDP_GSL, 1, gsl support)
+    PDP_GSL_FOUND=1,
+    echo "   libgsl not found: not building matrix type support")
+
+  if test -n "$PDP_GSL_FOUND"; then
+    if test $ARCH == Darwin
+    then
+      LIBS="$LIBS -lgslcblas -lgsl"
+    else
+      dnl if not darwin, assume target is linux
+      LIBS="$LIBS `pkg-config --libs gsl`"
+    fi
+  fi
 fi
 
 
diff --git a/externals/pdp/include/pdp_config.h b/externals/pdp/include/pdp_config.h
index 5d6ecd71aa3992b20ed9c24732109499312c238b..08ac30d1314c9ba7ea47e73922edbc64339f8a35 100644
--- a/externals/pdp/include/pdp_config.h
+++ b/externals/pdp/include/pdp_config.h
@@ -5,11 +5,17 @@
 #define HAVE_INTTYPES_H 1
 
 /* Define to 1 if you have the `gslcblas' library (-lgslcblas). */
-/* #undef HAVE_LIBGSLCBLAS */
+#define HAVE_LIBGSLCBLAS 1
 
 /* Define to 1 if you have the `m' library (-lm). */
 #define HAVE_LIBM 1
 
+/* Define to 1 if you have the <libv4l1-videodev.h> header file. */
+#define HAVE_LIBV4L1_VIDEODEV_H 1
+
+/* Define to 1 if you have the <linux/videodev.h> header file. */
+/* #undef HAVE_LINUX_VIDEODEV_H */
+
 /* Define to 1 if you have the <memory.h> header file. */
 #define HAVE_MEMORY_H 1
 
@@ -19,29 +25,26 @@
 /* gsl support */
 #define HAVE_PDP_GSL 1
 
+/* build pdp_v4l with libv4l */
+/* #undef HAVE_PDP_LIBV4L */
+
 /* build png support */
 #define HAVE_PDP_PNG 1
 
 /* build pdp_qt */
 #define HAVE_PDP_QT 1
 
-/* readline needed for console support */
-/* #undef HAVE_PDP_READLINE */
-
 /* build pdp_sdl */
 #define HAVE_PDP_SDL 1
 
 /* build pdp_v4l */
-/* #undef HAVE_PDP_V4L */
-
-/* experimental vforth dsp engine */
-/* #undef HAVE_PDP_VFORTH */
+#define HAVE_PDP_V4L 1
 
 /* build X11 support */
 #define HAVE_PDP_X 1
 
 /* build pdp_xv */
-/* #undef HAVE_PDP_XV */
+#define HAVE_PDP_XV 1
 
 /* enable forced pwc v4l support */
 /* #undef HAVE_PWCV4L */
@@ -79,6 +82,9 @@
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME ""
 
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
 /* Define to the version of this package. */
 #define PACKAGE_VERSION ""
 
diff --git a/externals/pdp/include/pdp_config.h.in b/externals/pdp/include/pdp_config.h.in
index 1ecfb3ab3da802b03f1a12133d87e9bffdfbb774..cc37277ff377a3f5401da703d1e080eb171ad53d 100644
--- a/externals/pdp/include/pdp_config.h.in
+++ b/externals/pdp/include/pdp_config.h.in
@@ -9,6 +9,12 @@
 /* Define to 1 if you have the `m' library (-lm). */
 #undef HAVE_LIBM
 
+/* Define to 1 if you have the <libv4l1-videodev.h> header file. */
+#undef HAVE_LIBV4L1_VIDEODEV_H
+
+/* Define to 1 if you have the <linux/videodev.h> header file. */
+#undef HAVE_LINUX_VIDEODEV_H
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
@@ -18,24 +24,21 @@
 /* gsl support */
 #undef HAVE_PDP_GSL
 
+/* build pdp_v4l with libv4l */
+#undef HAVE_PDP_LIBV4L
+
 /* build png support */
 #undef HAVE_PDP_PNG
 
 /* build pdp_qt */
 #undef HAVE_PDP_QT
 
-/* readline needed for console support */
-#undef HAVE_PDP_READLINE
-
 /* build pdp_sdl */
 #undef HAVE_PDP_SDL
 
 /* build pdp_v4l */
 #undef HAVE_PDP_V4L
 
-/* experimental vforth dsp engine */
-#undef HAVE_PDP_VFORTH
-
 /* build X11 support */
 #undef HAVE_PDP_X
 
@@ -78,6 +81,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
diff --git a/externals/pdp/include/pdp_types.h b/externals/pdp/include/pdp_types.h
index 3842a664fa58d5117c05c336f6de97976478b4b2..5b4bbfc35f39df51b502f7a400755e3386f1c0db 100644
--- a/externals/pdp/include/pdp_types.h
+++ b/externals/pdp/include/pdp_types.h
@@ -48,6 +48,9 @@ typedef unsigned short     u16;
 typedef unsigned int       u32;
 typedef unsigned long long u64;
 
+typedef unsigned long      uptr;  /* An unsigned int the size of a pointer. */
+typedef signed   long      sptr;
+
 typedef struct _pdp t_pdp;
 typedef void (*t_pdp_packet_method1)(t_pdp *);              /* dst */
 typedef void (*t_pdp_packet_method2)(t_pdp *, t_pdp *);     /* dst, src */
diff --git a/externals/pdp/modules/generic/pdp_rawout.c b/externals/pdp/modules/generic/pdp_rawout.c
index e001b37784aab4687188402b352f4278c3d7b1d5..1163a28ceb501dcfc3fc4ac879ad66bc94ceda7d 100644
--- a/externals/pdp/modules/generic/pdp_rawout.c
+++ b/externals/pdp/modules/generic/pdp_rawout.c
@@ -242,8 +242,8 @@ static t_int *rawout_perform(t_int *w);
 static void rawout_dsp(t_rawout *x, t_signal **sp){
     int nargs = 2 + x->x_chans;
     t_int args[nargs];
-    args[0] = (int)x;
-    args[1] = (int)sp[0]->s_n;
+    args[0] = (t_int)x;
+    args[1] = (t_int)sp[0]->s_n;
     float **in = (float **)(args+2);
     int i;
     for (i=0; i<x->x_chans; i++) in[i] = sp[i]->s_vec;
diff --git a/externals/pdp/modules/image_basic/pdp_constant.c b/externals/pdp/modules/image_basic/pdp_constant.c
index ffd8db1938bf6d4e3700102ca190e8e0eb9f856b..7b482bb40b5e65737cda0d8be6cbeba1e1b92549 100644
--- a/externals/pdp/modules/image_basic/pdp_constant.c
+++ b/externals/pdp/modules/image_basic/pdp_constant.c
@@ -54,7 +54,7 @@ void pdp_constant_value(t_pdp_constant *x, t_floatarg f)
     if (f>1.0f) f = 1.0f;
     if (f<-1.0f) f = -1.0f;
 
-    x->x_constant = (void *)((s32)(0x7fff * f));
+    x->x_constant = (void *)((sptr)(0x7fff * f));
 }
 
 
diff --git a/externals/pdp/modules/image_basic/pdp_logic.c b/externals/pdp/modules/image_basic/pdp_logic.c
index 78b74d67aa5e586cc99d725190f313875b138635..39d47c8eeb05ac6c9fa818a0bead88dbd2a66e8a 100644
--- a/externals/pdp/modules/image_basic/pdp_logic.c
+++ b/externals/pdp/modules/image_basic/pdp_logic.c
@@ -89,7 +89,7 @@ static void pdp_logic_process_hardthresh(t_pdp_logic *x)
 static void pdp_logic_set_mask(t_pdp_logic *x, t_floatarg f)
 {
     /* using a pointer as a variable hmm? */
-    u32 mask = ((u32)f) & 0xffff;
+    sptr mask = ((sptr)f) & 0xffff;
     x->x_mask = ((void * )mask);
 }
 
@@ -98,12 +98,12 @@ static void pdp_logic_set_threshold(t_pdp_logic *x, t_floatarg f)
     /* using a pointer as a variable hmm? */
     if (f<0.0f) f = 0.0f;
     if (f>1.0f) f = 1.0f;
-    x->x_mask = (void *)((u32)(((float)0x7fff) * f));
+    x->x_mask = (void *)((sptr)(((float)0x7fff) * f));
 }
 
 static void pdp_logic_set_depth(t_pdp_logic *x, t_floatarg f)
 {
-    u32 mask;
+    sptr mask;
     int shift = (16 - ((int)f));
     if (shift < 0) shift = 0;
     if (shift > 16) shift = 16;
diff --git a/externals/pdp/modules/image_io/pdp_qt.c b/externals/pdp/modules/image_io/pdp_qt.c
index a46bf45dd600693dde09110a77b3eb432bf2da79..58023033d53c8e18445ee7aaca6155a905a3f885 100644
--- a/externals/pdp/modules/image_io/pdp_qt.c
+++ b/externals/pdp/modules/image_io/pdp_qt.c
@@ -26,9 +26,12 @@
 
 #include "pdp.h"
 #include "pdp_llconv.h"
-#include "s_stuff.h" // need to get sys_libdir for libquicktime plugins
 
 
+#if PD_MAJOR_VERSION==0 && PD_MINOR_VERSION>=43
+#include "s_stuff.h" // need to get sys_libdir for libquicktime plugins
+#endif
+
 #define min(x,y) ((x<y)?(x):(y))
 
 
diff --git a/externals/pdp/modules/image_io/pdp_v4l.c b/externals/pdp/modules/image_io/pdp_v4l.c
index d54ee766f59c03a4a459213c6873415e2f15cb31..c0e4a729a457228c82e189c161361a39d0ad3821 100644
--- a/externals/pdp/modules/image_io/pdp_v4l.c
+++ b/externals/pdp/modules/image_io/pdp_v4l.c
@@ -35,7 +35,14 @@
 #include <sys/types.h>
 #include <sys/time.h>
 #include <linux/types.h>
-#include <linux/videodev.h>
+
+#ifdef HAVE_LIBV4L1_VIDEODEV_H
+# include <libv4l1-videodev.h>
+#else
+# warning trying to use deprecated V4L-1 API
+# include <linux/videodev.h>
+#endif
+
 #include <sys/mman.h>
 #include <sched.h>
 #include <pthread.h>
diff --git a/externals/pdp/opengl/Makefile b/externals/pdp/opengl/Makefile
index 5ddaa1c30280d8d71c3609f0b36316ca1ad349ad..9021c2943850eb00f737e566fbad436237b934da 100644
--- a/externals/pdp/opengl/Makefile
+++ b/externals/pdp/opengl/Makefile
@@ -20,7 +20,7 @@ clean:
 
 pdp_opengl.pd_linux: subdirs
 	rm -f pdp_opengl.pd_linux
-	$(CC) --export-dynamic -shared -o pdp_opengl.pd_linux modules/*.o system/*.o $(LDFLAGS) -g
+	$(CC) -rdynamic -shared -o pdp_opengl.pd_linux modules/*.o system/*.o $(LDFLAGS) -g
 
 pdp_opengl.pd_darwin: subdirs
 	rm -f pdp_opengl.pd_linux
diff --git a/externals/pdp/opengl/Makefile.config b/externals/pdp/opengl/Makefile.config
index 1e0fd61c385d1533b3dca0ef8bbc4ebebcab00d1..b3dbb6f42604511c442429a2b54aa400d24f3edf 100644
--- a/externals/pdp/opengl/Makefile.config
+++ b/externals/pdp/opengl/Makefile.config
@@ -1,7 +1,7 @@
 
 prefix = /usr/local
 
-PDP_VERSION=0.12.6
+PDP_VERSION=0.12.7
 PDP_DIR = ../../include
 PDP_OGL_DIR = ../include
 
@@ -23,7 +23,7 @@ endif
 ifeq ($(UNAME),Darwin)
   TARGET = darwin
   CPPFLAGS += -I/sw/include
-  PD_EXECUTABLE=../../../pd/bin/pd
+  PD_EXECUTABLE=../../../pd/src/pd
   LDFLAGS = -lgsl -lGL -lGLU -lglut -lX11 -L/sw/lib -L/usr/X11R6/lib
 endif
 
diff --git a/externals/pdp/scaf/Makefile b/externals/pdp/scaf/Makefile
index 075a0b443326bdd25a0b9aae3d24eb83fc8707ca..dd0b822145f2e8ad8d074540f85d30d16814da7f 100644
--- a/externals/pdp/scaf/Makefile
+++ b/externals/pdp/scaf/Makefile
@@ -26,7 +26,7 @@ mrproper: clean
 
 pdp_scaf.pd_linux: pdp_scaf_all
 	rm -f pdp_scaf.pd_linux
-	gcc --export-dynamic -shared -o pdp_scaf.pd_linux pdp/*.o $(PDP_CA_LIBS)
+	gcc -rdynamic -shared -o pdp_scaf.pd_linux pdp/*.o $(PDP_CA_LIBS)
 
 install: all
 	install -d $(prefix)/lib/scaf
diff --git a/externals/pdp/system/image/pdp_imageproc_common.c b/externals/pdp/system/image/pdp_imageproc_common.c
index dc6f4e1df3b69a2bd63e3c0b3472cd847af9f990..1175e7d2d4875b29d8b88656f316f84642985e7b 100644
--- a/externals/pdp/system/image/pdp_imageproc_common.c
+++ b/externals/pdp/system/image/pdp_imageproc_common.c
@@ -136,7 +136,7 @@ void pdp_imageproc_not_process(void *x, u32 width, u32 height, s16 *image)
 
 void pdp_imageproc_mask_process(void *x, u32 width, u32 height, s16 *image)
 {
-    u32 mask = (u32)x;
+    uptr mask = (uptr)x;
     u32 *plane = (u32 *)image;
     int count = (width * height) >> 1;
     int i;
@@ -279,7 +279,7 @@ void pdp_imageproc_zero_process(void *x, u32 width, u32 height, s16 *image)
 void pdp_imageproc_constant_process(void *x, u32 width, u32 height, s16 *image)
 {
     int i;
-    u32 value = (u32)x;
+    uptr value = (uptr)x;
     u32 *plane = (u32 *)image;
     int wordsize = (width * height) >> 1;
     value = (value & 0xffff) | (value << 16);
@@ -346,7 +346,7 @@ void pdp_imageproc_zthresh_process(void *x, u32 width, u32 height, s16 *image)
 void pdp_imageproc_hardthresh_process(void *x, u32 width, u32 height, s16 *image)
 {
     int i;
-    s32 thresh = (s32)x;
+    uptr thresh = (uptr)x;
     s32 sign1, isign2, a;
     s32 *wimage = (s32 *)image;
     int wsize = (width * height) >> 1;
@@ -370,7 +370,7 @@ void pdp_imageproc_hardthresh_process(void *x, u32 width, u32 height, s16 *image
 void pdp_imageproc_softthresh_process(void *x, u32 width, u32 height, s16 *image)
 {
     int i;
-    s32 thresh = (s32)x;
+    sptr thresh = (sptr)x;
     s32 sign1, sign2, a;
     s32 *wimage = (s32 *)image;
     int wsize = (width * height) >> 1;
diff --git a/externals/pdp/system/image/pdp_llconv.c b/externals/pdp/system/image/pdp_llconv.c
index 7826cfab273a9847302d449f46a1f93c235ff8c1..e6381fc2b2a9838cb6f46e407b8d820d1e04c02a 100644
--- a/externals/pdp/system/image/pdp_llconv.c
+++ b/externals/pdp/system/image/pdp_llconv.c
@@ -69,7 +69,7 @@ static inline int rgb2u(int r, int g, int b)
 /* swap top to bottom */
 static inline void _exchange_row(char *row1, char *row2, int size)
 {
-    int mask = ~(sizeof(int)-1);
+    int mask = ~((unsigned int)sizeof(int)-1);
     int *irow1 = (int *)row1;
     int *irow2 = (int *)row2;
 
diff --git a/externals/pdp/system/pdp.c b/externals/pdp/system/pdp.c
index 0d03854593321a422a2f7813c7f8743f0914d1c0..96870d06205a5b580c0da67c3ca99ca2db2c4d6a 100644
--- a/externals/pdp/system/pdp.c
+++ b/externals/pdp/system/pdp.c
@@ -110,8 +110,12 @@ void pdp_setup(void){
     if (initialized) return;
 
     /* babble */
-#ifdef PDP_VERSION	
+#ifdef PDP_VERSION
+# if PD_MAJOR_VERSION==0 && PD_MINOR_VERSION<43
     pdp_post("PDP: pure data packet version " PDP_VERSION );
+# else
+    logpost(NULL, 3, "PDP: pure data packet version " PDP_VERSION );
+# endif
 #else
     pdp_post ("PDP: pure data packet");
 #endif
diff --git a/externals/pdp/www/index.html b/externals/pdp/www/index.html
index a0d84ccf41be04f01cc288570803bec5a13270a3..b4444dec18db44b1db01fc16cc14fd73cbe4cef0 100644
--- a/externals/pdp/www/index.html
+++ b/externals/pdp/www/index.html
@@ -17,14 +17,6 @@ functionality, have a look at Yves
 Degoyon's <a href="http://ydegoyon.free.fr/pidip.html">PiDiP</a>
 library.
 
-<p> PDP is currently in maintenance only mode.  After version 0.12 I
-  got ambitious and started writing 
-<a href="http://zwizwa.be/packetforth">Packet Forth (PF)</a>
-and <a href="http://zwizwa.be/staapl">Staapl</a>.  These projects
-address problems in the design of PDP, but are not in a state to be
-included back into PDP.  However, Packet Forth can be used as a
-Pure Data external.
-
 <p> For documentation, have a look at the 'pdp' subdirectory in pd's 'Pure
 Documentation'.  Most objects are documented with pd style help
 patches accessible by right clicking on an object. The place to send
@@ -33,29 +25,31 @@ questions is the Pure Data mailing list.
 <a name="darcs">
 <h2>Download</h2></a>
 
-The latest stable PDP tarball release
-is <a href="http://zwizwa.be/pd/pdp/pdp-0.12.5.tar.gz">0.12.5</a>.
-For older releases see <a href="http://zwizwa.be/pd/pdp">here</a>.
-During this maintenance only phase, the main distribution and code
-contribution channel is the Pure Data SVN.  I do try to keep
-my <a href="http://zwizwa.be/darcs/pdp-12">darcs</a> archive up to
-date.  
-PDP is written by Tom Schouten and released under the GPL v2.
+The latest stable PDP tarball release can be found in the
+<a href="http://sourceforge.net/projects/pure-data/files/libraries/pdp/">PDP</a>
+section of the Pure
+Data <a href="http://sourceforge.net/projects/pure-data"> SourceForge
+project</a>.  The <code>pd-pdp</code> package is currently maintained
+by Paul Brossier.  PDP is written by <a href="http://zwizwa.be">Tom
+Schouten</a> and released under the GPL v2.
+
 
 <a name="links">
 <h2>Links</h2></a>
 
-<li><a href="http://pure-data.iem.at/about/">Pure Data at IEM</a>
+<li><a href="http://pure-data.info/">Pure Data portal</a>
 <li><a href="http://ydegoyon.free.fr/pidip.html">PiDiP Is Definitely In Pieces</a>
 <li><a href="http://www.hackitectura.net/aljwarizmi/">al-Jwarizmi</a>
-<li><a href="http://www.artefacte.org/modules.php?op=modload&name=PD&file=index">PidipVJ</a>
 <li><a href="http://rama.xicnet.com/appz.php">Videoflow / Cruzados BGN</a>
 <li><a href="http://attacksyour.net/pi/pd/index.html">Eth0</a>
 <li><a href="http://footils.org/cms">RRADical</a>
 
-<li><a href="http://veejay.sourceforge.net/">Veejay</a> / <a href="http://zwizwa.fartit.com/pd/sendVIMS/">SendVIMS</a>
+<li><a href="http://veejay.sourceforge.net/">Veejay</a> / <a href="http://zwizwa.be/pd/sendVIMS/">SendVIMS</a>
 <li><a href="http://freej.dyne.org/">FreeJ</a>
 <li><a href="http://effectv.sourceforge.net/">EffecTV</a>
+<li><a href="http://zwizwa.be/packetforth/">Packet Forth</a>, the
+direct descendant of PDP.
+<li><a href="http://zwizwa.be/-/libprim/">libprim</a>, a descendant of Packet Forth.
 
 
 
diff --git a/externals/pidip/CHANGES.LOG b/externals/pidip/CHANGES.LOG
old mode 100644
new mode 100755
index 7eec7ceedae6df1da5336fd18fd1cf86f0a0ab2f..5b18f6efa84a056e5c06650e901d21107d0b4f35
--- a/externals/pidip/CHANGES.LOG
+++ b/externals/pidip/CHANGES.LOG
@@ -1,7 +1,42 @@
+0.12.30 ( codename Great Blobs Of Fire )
+   added pdp_cluster : clusterization of colors for later color blob detection.
+   added pdp_ycfilter : YUV color filter using luminosity or not.
+   added pdp_shapes : a more general pdp_shape object detecting all blobs of a given color (using luminosity or not).
+   note : if you want to work with black and white, you need to activate the luminosity,
+   otherwise it's not necessary... it is off by default.
+
+0.12.29 ( codename Moving Targets )
+   added pdp_skeleton : skeletonization object.
+   ( feed it with a binary blob image  )
+
+   added pdp_joint : calculate ending, inflection and junction points in a skeleton.
+   ( feed it with the output of pdp_skeleton of course, , otherwise the output will be all red  )
+   although the algorithm was written from scratch,
+   it requires some utilities from opencv ( install libcv-dev ).
+
+0.12.28 ( codename Prevolution )
+   added pdp_freenect : module to get video and data from a kinect device
+   ( it's fun to hack mainstream devices )
+   based on libfreenect from Hector Martin & http://openkinect.org
+   dedicated to t.b.b., he would have liked it :
+   http://ydegoyon.free.fr/basiony-ak47.jpg
+   and thanks to Francisco Sanmartin for his pre-release tests and support.
+
+0.12.27 ( codename Freed From Mainstream )
+   added pdp_artkp : binding to ARToolKitPlus
+   it offers a 6 Degrees Of Freedom tracking in theory (3D tracking) using 2D markers.
+   ( requires ARToolKitPlus sources and to compile pidip with --with-artkp=/path/to/ARToolKitPlus,
+   see help-pacth )
+   this object comes from the investigations of llgib on augmented reality toolkits.
+
+0.12.26 ( codename I will not work until 67 )
+   pdp_theonice~ : fixed number of audio samples to send ( no more audio x-run)
+   pdp_theonice~ : flush packets it seems necessary now
+
 0.12.25 ( codename Dangerous Modules )
    added pdp_vloopback : some say it's dangerous, but it works smooth
 
-0.12.25 ( codename CrunchyBits )
+0.12.25 ( codename Crunchy Bits )
    fixed default font for pdp_text, pdp_qtext
    fixed crash in pdp_theonice~
 
diff --git a/externals/pidip/INSTALL b/externals/pidip/INSTALL
old mode 100644
new mode 100755
index 3e51fcfdb26df261b1af69b1ccba052e4f2f4426..13edd8c9f15fe2c2177afa2ffe4356726328e5eb
--- a/externals/pidip/INSTALL
+++ b/externals/pidip/INSTALL
@@ -2,32 +2,36 @@ a/ first, install  :
 
 MANDATORY ::
 ============
-***** PD sources 	: http://www-crca.ucsd.edu/~msp/software.html
-***** PDP and its deps  : http://zwizwa.fartit.com/pd/pdp/
-***** imlib2 		: http://sourceforge.net/project/showfiles.php?group_id=2
-***** theora 		: http://www.theora.org/files/
-                          ---->  watchout !! you will need the static libs ( theora.a, ogg.a, vorbis.a )
-***** Image Magick 	: http://www.imagemagick.org
-                          ---->  watchout !! configure with --enable-shared 
-
-OPTIONALLY ::
-=============
-***** ffmpeg		: http://ffmpeg.sourceforge.net/cvs 
-( --with-ffmpeg=PATH )    ----> watchout, it requires the cvs snapshot !
-                          + don't forget to activate mp3 and vorbis support in ffmpeg : 
-                          ./configure --enable-mp3lame --enable-vorbis
-OR
-
-***** mpeg4ip		: http://mpeg4ip.sourceforge.net/ ( download mpeg4ip v1.0 )
-( --with-mpeg4ip=PATH )    
-
-b/ ./configure --with-pd=PATH --with-pdp=PATH [--with-ffmpeg=PATH] OR [--with-mpeg4ip=PATH] ( not both )
+***** PD sources 	: svn co https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/pd pd 
+***** PDP sources       : svn co https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/externals/pdp pdp 
+( make a ./configure in pdp )
+
+DEPENDENCIES ::
+============
+
+on a ubuntu system :
+
+apt-get install libbz2-dev libc6-dev libdc1394-22-dev libfreetype6-dev libgcc1 libimlib2-dev libmp3lame-dev libogg-dev libraw1394-dev libtheora-dev libvorbis-dev libvorbisenc2 zlib1g-dev tcllib libcv-dev
+
+OPTIONAL ::
+============
+
+ARToolKitPlus sources : 
+http://studierstube.icg.tu-graz.ac.at/handheld_ar/artoolkitplus.php
+
+libfreenect if you want to build pdp_freenect from :
+git clone https://github.com/OpenKinect/libfreenect.git
+( build it and put it off the stove for the moment )
+
+b/ ./configure --with-pd=PATH --with-pdp=PATH [--with-artkp=PATH]
 
 c/ make clean 
 
 d/ make
 
-e/ as root, make install
+e/ copy the pidip.pd_linux in place where pd can find it.
+if you use pd-extended :
+cp pidip.pd_linux /usr/lib/pd-extended/extra/pidip/pidip.pd_linux 
 
 f/ modify your pd start-up script :
 
@@ -39,5 +43,5 @@ loading of PDP library ( option "-lib <path>/pdp" )
 Enjoy!!
 
 Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
+sevy
+comments and bugs @ tffobject@gmail.com
diff --git a/externals/pidip/KNOWN.BUGS b/externals/pidip/KNOWN.BUGS
old mode 100644
new mode 100755
diff --git a/externals/pidip/LICENSE.txt b/externals/pidip/LICENSE.txt
old mode 100644
new mode 100755
index d89652e025c08cfdfaf31612f9764d5cdde47572..b805ad9591f0fbb0f2cd1e021301beaf0627f847
--- a/externals/pidip/LICENSE.txt
+++ b/externals/pidip/LICENSE.txt
@@ -1,33 +1,20 @@
-NOT FOR MILITARY OR REPRESSIVE USE !!!
 
+to cut with all legal blah-blah,
+this license will be made short.
 
-This software is copyrighted by Yves Degoyon and others.  The following
-terms (the "Standard Improved BSD License") apply to all files associated with
-the software unless explicitly disclaimed in individual files:
+the code published here can be studied,
+modified, used by anyone that
+provides all the original credits
+and sources in derivative projects.
 
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
+there are restrictions on its use,
+it cannot be used for :
 
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above  
-   copyright notice, this list of conditions and the following 
-   disclaimer in the documentation and/or other materials provided
-   with the distribution.
-3. The name of the author may not be used to endorse or promote
-   products derived from this software without specific prior 
-   written permission.
+* military and/or repressive use
+* commercial installations and products
+* any project that promotes : racism, nationalism, xenophobia, sexism, 
+homophobia, religious hatred or missionarism .. ( expandable list)
 
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,   
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
+this is not a standard license.
+
+sevy & authors.
diff --git a/externals/pidip/Makefile.in b/externals/pidip/Makefile.in
old mode 100644
new mode 100755
index df125d301cca7686cc789402eaddac053dd09c27..157e11217cf5c17579baa6f50c2e9482664d931d
--- a/externals/pidip/Makefile.in
+++ b/externals/pidip/Makefile.in
@@ -1,28 +1,30 @@
 PD_DIR = @PD_DIR@
 PDP_DIR = @PDP_DIR@
-FFMPEG_SOURCE_DIR = @FFMPEG_SOURCE_DIR@
 
 PDP_PIDIP_LIBS = @PDP_PIDIP_LIBS@
 IMLIB_CFLAGS = @IMLIB_CFLAGS@
+ARTKP_CPPFLAGS = @ARTKP_CPPFLAGS@
 IMLIB_LIBS = @IMLIB_LIBS@
 THEORA_LIBS = @THEORA_LIBS@
 DC1394_LIBS = @DC1394_LIBS@
+FREENECT_LIBS = @FREENECT_LIBS@
+OPENCV_LIBS = @OPENCV_LIBS@
+ARTKP_LIBS = @ARTKP_LIBS@
 PDP_PIDIP_INCLUDES =  @PDP_PIDIP_INCLUDES@
 PDP_PIDIP_VERSION = @PDP_PIDIP_VERSION@
-MPEG4IP_CFLAGS = @MPEG4IP_CFLAGS@
 
 PDP_PIDIP_DISTRO = /mnt/c/ydegoyon.free.fr/pidip-$(PDP_PIDIP_VERSION)
 PDP_PIDIP_TARBALL = $(PDP_PIDIP_DISTRO).tar.gz
 
-PDP_PIDIP_CFLAGS  = $(MPEG4IP_CFLAGS) $(IMLIB_CFLAGS) \
+PDP_PIDIP_CFLAGS  = $(IMLIB_CFLAGS) $(ARTKP_CPPFLAGS) \
     -DPD -DX_DISPLAY_MISSING -O2 -funroll-loops -fomit-frame-pointer  -ffast-math \
     -fPIC -Wall -W -Wstrict-prototypes \
     -Wno-unused -Wno-parentheses -Wno-switch \
     -DPDP_PIDIP_VERSION=\"$(PDP_PIDIP_VERSION)\" -g
 
-PDP_PIDIP_CPPFLAGS  = $(MPEG4IP_CFLAGS) $(IMLIB_CFLAGS) \
+PDP_PIDIP_CPPFLAGS  = $(IMLIB_CFLAGS) $(ARTKP_CPPFLAGS) \
     -DPD -DX_DISPLAY_MISSING -O2 -funroll-loops -fomit-frame-pointer  -ffast-math \
-    -Wall -W -Wstrict-prototypes \
+    -Wall -W \
     -Wno-unused -Wno-parentheses -Wno-switch \
     -DPDP_PIDIP_VERSION=\"$(PDP_PIDIP_VERSION)\" -g
 
@@ -42,12 +44,12 @@ pdp_pidip_all:
 
 pidip.pd_darwin: pdp_pidip_all
 	rm -f pidip.pd_darwin
-	g++ -bundle -undefined dynamic_lookup -headerpad_max_install_names -o pidip.pd_darwin modules/*.o system/*.o -L/sw/lib $(THEORA_LIBS) $(DC1394_LIBS) $(PDP_PIDIP_LIBS) $(IMLIB_LIBS)
+	g++ -bundle -undefined dynamic_lookup -headerpad_max_install_names -o pidip.pd_darwin modules/*.o system/*.o -L/sw/lib $(THEORA_LIBS) $(DC1394_LIBS) $(FREENECT_LIBS) $(OPENCV_LIBS) $(PDP_PIDIP_LIBS) $(IMLIB_LIBS) $(ARTKP_LIBS)
 	strip -x pidip.pd_darwin
 
 pidip.pd_linux: pdp_pidip_all
 	rm -f pidip.pd_linux
-	g++ -Wl,--export-dynamic -shared -o pidip.pd_linux modules/*.o system/*.o $(THEORA_LIBS) $(PDP_PIDIP_LIBS) $(IMLIB_LIBS) $(DC1394_LIBS)
+	g++ -Wl,--export-dynamic -shared -o pidip.pd_linux modules/*.o system/*.o $(THEORA_LIBS) $(PDP_PIDIP_LIBS) $(IMLIB_LIBS) $(DC1394_LIBS) $(FREENECT_LIBS) $(OPENCV_LIBS) $(ARTKP_LIBS)
 	strip --strip-unneeded pidip.pd_linux
 
 clean:
@@ -55,9 +57,11 @@ clean:
 	rm -f pidip.pd_linux
 
 install:
-	if test ! -d /usr/X11R6/lib/X11/fonts/TTF; then mkdir /usr/X11R6/lib/X11/fonts/TTF; fi
-	cp fonts/* /usr/X11R6/lib/X11/fonts/TTF
-	cp -f --remove-destination doc/* $(PD_DIR)/doc/5.reference
+	#if test ! -d /usr/X11R6/lib/X11/fonts/TTF; then mkdir /usr/X11R6/lib/X11/fonts/TTF; fi
+	#cp fonts/* /usr/X11R6/lib/X11/fonts/TTF
+	if test ! -d /usr/share/fonts/X11/TTF; then mkdir /usr/share/fonts/X11/TTF; fi
+	cp fonts/* /usr/share/fonts/X11/TTF	
+	#cp -f --remove-destination doc/* $(PD_DIR)/doc/5.reference
 
 distro: clean all
 	rm -f */*.o
diff --git a/externals/pidip/README b/externals/pidip/README
old mode 100644
new mode 100755
index 7a204e89a1fc4160c8ed7fbaf3833158a1029f6a..4ca65b4f1b50164772e8efb199363011014cd29b
--- a/externals/pidip/README
+++ b/externals/pidip/README
@@ -15,8 +15,6 @@ or other source mentionned
 
 To install pidip, follow the steps from INSTALL
 
-This software is published under GPL terms.
-
 This is software with ABSOLUTELY NO WARRANTY.
 Use it at your OWN RISK. It's possible to damage e.g. hardware or your hearing
 due to a bug or for other reasons. 
diff --git a/externals/pidip/TODO b/externals/pidip/TODO
old mode 100644
new mode 100755
diff --git a/externals/pidip/acinclude.m4 b/externals/pidip/acinclude.m4
old mode 100644
new mode 100755
index 7e6bcb47405f5961e48fe63cfc5bd02696ef51db..177abb488e1cea218de3feb1f96b5c2fb28ccb18
--- a/externals/pidip/acinclude.m4
+++ b/externals/pidip/acinclude.m4
@@ -24,7 +24,7 @@ dnl At present there is no support for additional "MODULES" (see AM_PATH_GTK)
 dnl (shamelessly stolen from gtk.m4 and then hacked around a fair amount)
 dnl
 dnl @author Angus Lees <gusl@cse.unsw.edu.au>
-dnl @version $Id: acinclude.m4,v 1.12 2006-12-11 22:53:24 sevyves Exp $
+dnl @version $Id: acinclude.m4,v 1.1.1.1 2010-12-06 05:31:57 giss Exp $
 
 AC_DEFUN(AC_PATH_GENERIC,
 [dnl
diff --git a/externals/pidip/charmaps/acuadrosypuntos.map b/externals/pidip/charmaps/acuadrosypuntos.map
old mode 100644
new mode 100755
diff --git a/externals/pidip/charmaps/allone.map b/externals/pidip/charmaps/allone.map
old mode 100644
new mode 100755
diff --git a/externals/pidip/charmaps/arabic.map b/externals/pidip/charmaps/arabic.map
old mode 100644
new mode 100755
diff --git a/externals/pidip/charmaps/cuadros-basic.map b/externals/pidip/charmaps/cuadros-basic.map
old mode 100644
new mode 100755
diff --git a/externals/pidip/charmaps/default.map b/externals/pidip/charmaps/default.map
old mode 100644
new mode 100755
diff --git a/externals/pidip/charmaps/tati.map b/externals/pidip/charmaps/tati.map
old mode 100644
new mode 100755
diff --git a/externals/pidip/configure.ac b/externals/pidip/configure.ac
old mode 100644
new mode 100755
index f9cec5afbea3dcfae7feb708046ccf3dd7b06e3d..7f4d105c2d169c4936b3670a61d71cd55f2249a4
--- a/externals/pidip/configure.ac
+++ b/externals/pidip/configure.ac
@@ -2,25 +2,28 @@ dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT
 AC_CANONICAL_HOST
+AC_DISABLE_OPTION_CHECKING
 AC_CONFIG_HEADER(include/pidip_config.h)
 
-PDP_PIDIP_VERSION="0.12.26"
+PDP_PIDIP_VERSION="0.12.30"
 PD_DIR=/usr/local/pd
+ARTKP_DIR=/usr/src/ARToolKitPlus
 PDP_DIR=/usr/local/pd/pdp
-FFMPEG_SOURCE_DIR=/SOURCES/ffmpeg
-MPEG4IP_SOURCE_DIR=/SOURCES/mpeg4ip
-PDP_STREAMING_OBJECTS=
 PDP_CAPTURE_OBJECT=
 PDP_DC1394_OBJECT=
+PDP_FREENECT_OBJECT=
+PDP_OPENCV_OBJECT=
+PDP_ARTKP_OBJECT=
 IMLIB_LIBS=
 IMLIB_CFLAGS=
 MAGIC_LIBS=
 MAGIC_CFLAGS=
 THEORA_LIBS=
 DC1394_LIBS=
-enable_ffmpeg=no
-enable_mpeg4ip=no
-enable_lcapture=no
+FREENECT_LIBS=
+OPENCV_LIBS=
+ARTKP_CPPFLAGS=
+ARTKP_LIBS=
 
 echo $host
 # Check for DarwinPorts and/or Fink on Mac OS X/Darwin
@@ -69,38 +72,16 @@ then
   fi
 fi
 
-AC_ARG_WITH(enable-capture, [  --enable-capture        capture optional object ( only works with Image Magick <= 6.0.7 )])
-if ! test -z "${enable_capture}"
+AC_ARG_WITH(artkpsources, [  --with-artkp=PATH       ARToolKitPlus source tree])
+if ! test -z "${with_artkp}"
 then
-  enable_lcapture=yes
-fi
-
-AC_ARG_WITH(ffmpeg, [  --with-ffmpeg=PATH      ffmpeg source tree])
-if ! test -z "${with_ffmpeg}"
-then
-  ffmpeg_tree="`cd ${with_ffmpeg} 2>/dev/null && pwd`"
-  if test -z "${ffmpeg_tree}"
+  artkp_tree="`cd ${with_artkp} 2>/dev/null && pwd`"
+  if test -z "${artkp_tree}"
   then
    dnl  The given directory can't be found
-   AC_MSG_ERROR([ffmpeg sources not found in ${with_ffmpeg}])
+   AC_MSG_ERROR([ARToolKitPlus sources not found in ${with_artkp}])
   else
-   FFMPEG_SOURCE_DIR=${ffmpeg_tree}
-   enable_ffmpeg=yes
-  fi
-fi
-
-AC_ARG_WITH(mpeg4ip, [  --with-mpeg4ip=PATH     mpeg4ip source tree])
-if ! test -z "${with_mpeg4ip}"
-then
-  mpeg4ip_tree="`cd ${with_mpeg4ip} 2>/dev/null && pwd`"
-  if test -z "${mpeg4ip_tree}"
-  then
-   dnl  The given directory can't be found
-   AC_MSG_RESULT(no)
-   AC_MSG_ERROR([mpeg4ip sources not found in ${with_mpeg4ip}])
-  else
-   MPEG4IP_SOURCE_DIR=${mpeg4ip_tree}
-   enable_mpeg4ip=yes
+   ARTKP_DIR=${artkp_tree}
   fi
 fi
 
@@ -125,19 +106,52 @@ AC_PATH_GENERIC(imlib2, 1.0.0,
   IMLIB_CFLAGS=`imlib2-config --cflags` ],
   AC_MSG_ERROR(Cannot find imlib2: Is imlib2-config in the path?) )
 
-AC_CHECK_LIB(Magick, XWindowByProperty, 
-              [ PDP_CAPTURE_OBJECT="$PDP_CAPTURE_OBJECT"
-              MAGICK_LIBS="-L/usr/X11R6/lib -lMagick `Magick-config --libs` `Magick-config --ldflags`"
-              MAGICK_CFLAGS="-I/usr/X11R6/include `Magick-config --cflags` " ],
-              echo "Image Magick not found : not building pdp_capture", 
-              -I/usr/X11R6/include -L/usr/X11R6/lib )
-
 AC_CHECK_LIB(dc1394, dc1394_camera_enumerate, 
               [ PDP_DC1394_OBJECT="pdp_dc1394.o"
               AC_DEFINE(HAVE_DC1394, 1, dc1394 cameras interface)
               DC1394_LIBS="-ldc1394 -lraw1394"],
               echo "dc1394 not found : not building pdp_dc1394", )
 
+AC_CHECK_LIB(freenect, freenect_init, 
+              [ PDP_FREENECT_OBJECT="pdp_freenect.o"
+              AC_DEFINE(HAVE_FREENECT, 1, M$ kinect usb capture utility)
+              PDP_PIDIP_INCLUDES="`pkg-config --cflags libfreenect` $PDP_PIDIP_INCLUDES"
+              FREENECT_LIBS="`pkg-config --libs libfreenect` -lfreenect"],
+              echo "freenect not found : not building pdp_freenect", )
+
+AC_CHECK_LIB([cv], [cvSobel], [AC_DEFINE(HAVE_OPENCV, 1, OpenCV useful library)
+  OPENCV_FOUND="1"
+], [
+  # try another lib name used in other versions of OpenCV
+  AC_CHECK_LIB([opencv_imgproc], [cvSobel], [AC_DEFINE(HAVE_OPENCV, 1, OpenCV useful library)
+  OPENCV_FOUND="1"
+  ],
+    [AC_MSG_WARN([[missing a library from opencv, not building pdp_joint - try installing libcv]])
+  ])
+])
+
+if test -n "$OPENCV_FOUND"; then
+   echo "OpenCV found, yes! ====================="
+   PDP_OPENCV_OBJECT="pdp_joint.o pdp_shapes.o"
+   OPENCV_LIBS="`pkg-config --libs opencv`"
+fi
+
+AC_LANG(C++)
+AC_LANG(C++)
+SAVED_LDFLAGS=$LDFLAGS
+CXXFLAGS="-I$ARTKP_DIR $CXXFLAGS  -fPIC"
+LDFLAGS="$LDFLAGS -lARToolKitPlus"
+AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM([#include <ARToolKitPlus/TrackerMultiMarker.h>],
+          [ARToolKitPlus::TrackerMultiMarker *dummy])],
+        [AC_MSG_RESULT([libARToolKitPlus found ... building pdp_artkp.])
+        PDP_ARTKP_OBJECT="pdp_artkp.o" 
+        ARTKP_LIBS="-lARToolKitPlus"
+        ARTKP_CPPFLAGS="-I$ARTKP_DIR -fPIC"
+        AC_DEFINE(HAVE_ARTKP, 1, augmented reality toolkit plus)],
+        [AC_MSG_WARN([libARToolKitPlus is not installed.])])
+LDFLAGS=$SAVED_LDFLAGS
+
 AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, , AC_MSG_ERROR(streaming requires bz2 library!!))
 AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR(streaming requires compress library!!))
 AC_CHECK_LIB(dl, dlopen, , AC_MSG_ERROR(streaming requires dynamic loader library!!))
@@ -148,33 +162,7 @@ AC_CHECK_LIB(vorbisenc, vorbis_encode_setup_init, , AC_MSG_ERROR(streaming requi
 AC_CHECK_LIB(theora, theora_encode_init, , AC_MSG_ERROR(theora library needed! sorry...), -lm)
 AC_CHECK_LIB(quicktime, lqt_decode_video, , AC_MSG_ERROR(libquicktime not found) )
 
-qt_minor_version="`lqt-config --version | cut -f3 -d'.'`"
-qt_major_version="`lqt-config --version | cut -f1 -d'.'`"
-echo "qt version minor : ${qt_minor_version} major : ${qt_major_version}"
-if test ${qt_minor_version} == "8";
-then
-  IMLIB_CFLAGS="$CFLAGS -DQUICKTIME_NEWER=1"
-fi
-if test ${qt_minor_version} == "9";
-then
-  IMLIB_CFLAGS="$CFLAGS -DQUICKTIME_NEWER=1"
-fi
-if test ${qt_minor_version} == "10";
-then
-  IMLIB_CFLAGS="$CFLAGS -DQUICKTIME_NEWER=1"
-fi
-if test ${qt_minor_version} == "11";
-then
-  IMLIB_CFLAGS="$CFLAGS -DQUICKTIME_NEWER=1"
-fi
-if test ${qt_minor_version} == "12";
-then
-  IMLIB_CFLAGS="$CFLAGS -DQUICKTIME_NEWER=1"
-fi
-if test ${qt_major_version} == "1";
-then
-  IMLIB_CFLAGS="$CFLAGS -DQUICKTIME_NEWER=1"
-fi
+IMLIB_CFLAGS="$CFLAGS -DQUICKTIME_NEWER=1"
 
 THEORA_LIBS="-ltheora -logg -lvorbis -lvorbisenc"
 if test -f /usr/lib/libtheora.a
@@ -230,19 +218,15 @@ else
   exit -1
 fi
 
-if test $enable_lcapture == yes;
-then
-    PDP_CAPTURE_OBJECT="$PDP_CAPTURE_OBJECT pdp_capture.o"
-    AC_DEFINE(HAVE_IMAGE_MAGICK, 1, image magick capture capability)
-    PDP_PIDIP_LIBS="$MAGICK_LIBS $PDP_PIDIP_LIBS"
-    PDP_PIDIP_INCLUDES="$MAGICK_CFLAGS $PDP_PIDIP_INCLUDES"
-    echo "building pdp_capture."
-fi
+AC_CHECK_HEADER(libv4l1-videodev.h,
+                PDP_CAPTURE_OBJECT="$PDP_CAPTURE_OBJECT pdp_vloopback.o"
+                AC_DEFINE(HAVE_V4L, 1, build pdp_vloopback),
+                echo "   libv4l1-videodev.h not found: not building pdp_vloopback")
 
 AC_CHECK_HEADER(linux/videodev2.h,
-                PDP_CAPTURE_OBJECT="$PDP_CAPTURE_OBJECT pdp_v4l2.o pdp_vloopback.o"
-                AC_DEFINE(HAVE_V4L2, 1, build pdp_v4l2 and pdp_vloopback),
-                echo "   linux/videodev2.h not found: not building pdp_v4l2 and pdp_vloopback")
+                PDP_CAPTURE_OBJECT="$PDP_CAPTURE_OBJECT pdp_v4l2.o"
+                AC_DEFINE(HAVE_V4L2, 1, build pdp_v4l2),
+                echo "   linux/videodev2.h not found: not building pdp_v4l2")
 
 case "$host" in
   *-linux* )
@@ -254,50 +238,20 @@ case "$host" in
   ;;
 esac
 
-if test $enable_ffmpeg == yes;
-then
-  echo -n "looking for ffmpeg sources (required) ... "
-  if test -f $FFMPEG_SOURCE_DIR/libavformat/avformat.h
-  then
-    AC_SUBST(FFMPEG_SOURCE_DIR)
-    PDP_STREAMING_OBJECTS="pdp_live~.o pdp_ffmpeg~.o"
-    AC_DEFINE(HAVE_PIDIP_FFMPEG, 1, build pdp_live~/pdp_ffmpeg~)
-    PDP_PIDIP_LIBS="$PDP_PIDIP_LIBS $FFMPEG_SOURCE_DIR/libavformat/libavformat.a $FFMPEG_SOURCE_DIR/libavcodec/libavcodec.a"
-    PDP_PIDIP_INCLUDES="$PDP_PIDIP_INCLUDES  -I$FFMPEG_SOURCE_DIR/libavcodec -I$FFMPEG_SOURCE_DIR/libavformat"
-    echo "ok." 
-  else
-    echo "ffmpeg source tree not found... install it and use the --with-ffmpeg=<path> configuration option."
-    exit -1
-  fi
-fi
-
-if test $enable_mpeg4ip == yes;
-then
-   echo -n "looking for mpeg4ip sources (required) ... "
-   if test -f $MPEG4IP_SOURCE_DIR/server/mp4live/mp4live_common.h
-   then
-    AC_SUBST(MPEG4IP_SOURCE_DIR)
-    PDP_STREAMING_OBJECTS="pdp_mp4config.o pdp_mp4videosource.o pdp_mp4audiosource.o pdp_mp4live~.o pdp_mp4player~.o pdp_mp4audiosync.o pdp_mp4videosync.o pdp_mp4playermedia.o pdp_mp4playersession.o"
-    AC_DEFINE(HAVE_PIDIP_MPEG4IP, 1, build pdp_mp4live~/pdp_mp4player~)
-    PDP_PIDIP_LIBS="$PDP_PIDIP_LIBS $MPEG4IP_SOURCE_DIR/player/src/our_bytestream_file.o $MPEG4IP_SOURCE_DIR/player/src/our_config_file.o $MPEG4IP_SOURCE_DIR/player/src/qtime_file.o $MPEG4IP_SOURCE_DIR/player/src/mp4_file.o $MPEG4IP_SOURCE_DIR/player/src/mpeg3_file.o $MPEG4IP_SOURCE_DIR/player/src/avi_file.o $MPEG4IP_SOURCE_DIR/player/src/ip_port.o $MPEG4IP_SOURCE_DIR/player/src/media_utils.o $MPEG4IP_SOURCE_DIR/player/src/mpeg2t_thread.o $MPEG4IP_SOURCE_DIR/player/src/mpeg2t_thread_nx.o $MPEG4IP_SOURCE_DIR/player/src/*bytestream.o $MPEG4IP_SOURCE_DIR/player/src/*plugin.o $MPEG4IP_SOURCE_DIR/player/src/player_sdp.o $MPEG4IP_SOURCE_DIR/player/src/player_util.o $MPEG4IP_SOURCE_DIR/player/src/audio.o $MPEG4IP_SOURCE_DIR/player/src/video.o $MPEG4IP_SOURCE_DIR/server/mp4live/video_util_mpeg4.o $MPEG4IP_SOURCE_DIR/server/mp4live/sdp_file.o $MPEG4IP_SOURCE_DIR/server/mp4live/util.o $MPEG4IP_SOURCE_DIR/server/mp4live/video_encoder.o $MPEG4IP_SOURCE_DIR/server/mp4live/video_xvid.o $MPEG4IP_SOURCE_DIR/server/mp4live/media_source.o $MPEG4IP_SOURCE_DIR/server/mp4live/video_util_rgb.o $MPEG4IP_SOURCE_DIR/server/mp4live/video_util_resize.o $MPEG4IP_SOURCE_DIR/server/mp4live/resample.o $MPEG4IP_SOURCE_DIR/server/mp4live/video_encoder_base.o $MPEG4IP_SOURCE_DIR/server/mp4live/audio_encoder.o $MPEG4IP_SOURCE_DIR/server/mp4live/audio_encoder_base.o $MPEG4IP_SOURCE_DIR/server/mp4live/audio_encoder_tables.o $MPEG4IP_SOURCE_DIR/server/mp4live/audio_lame.o $MPEG4IP_SOURCE_DIR/server/mp4live/audio_faac.o $MPEG4IP_SOURCE_DIR/server/mp4live/rtp_transmitter.o $MPEG4IP_SOURCE_DIR/server/mp4live/h261/.libs/*.a $MPEG4IP_SOURCE_DIR/lib/sdp/.libs/libsdp.so $MPEG4IP_SOURCE_DIR/player/lib/mp4util/.libs/libmp4util.so $MPEG4IP_SOURCE_DIR/player/lib/libhttp/.libs/libhttp.a $MPEG4IP_SOURCE_DIR/lib/config_file/.libs/libconfig_file.so $MPEG4IP_SOURCE_DIR/lib/msg_queue/.libs/libmsg_queue.so $MPEG4IP_SOURCE_DIR/lib/mp4av/.libs/libmp4av.so $MPEG4IP_SOURCE_DIR/lib/mp4/.libs/libmp4.so $MPEG4IP_SOURCE_DIR/lib/mp4v2/.libs/libmp4v2.so $MPEG4IP_SOURCE_DIR/lib/SDL/src/.libs/libSDL.so $MPEG4IP_SOURCE_DIR/lib/rtp/*.o $MPEG4IP_SOURCE_DIR/player/lib/rtsp/.libs/librtsp.a $MPEG4IP_SOURCE_DIR/common/video/libmpeg32/.libs/*.a $MPEG4IP_SOURCE_DIR/lib/avi/.libs/libavi.al $MPEG4IP_SOURCE_DIR/lib/mpeg2t/.libs/libmpeg2_transport.al $MPEG4IP_SOURCE_DIR/player/lib/audio/mp3util/.libs/libmp3utils.al -lm -L/usr/X11R6/lib -lX11 -lXext -lpthread $MPEG4IP_SOURCE_DIR/lib/SDL/src/main/libSDLmain.a -ldl -Wl,--rpath -Wl,/usr/local/lib -lfaac -lmpeg4ip_xvid"
-    PDP_PIDIP_INCLUDES="$PDP_PIDIP_INCLUDES -I/usr/include/SDL -I/usr/local/include/SDL -I$MPEG4IP_SOURCE_DIR/server/mp4live -I$MPEG4IP_SOURCE_DIR/player/src -I$MPEG4IP_SOURCE_DIR/player/lib -I$MPEG4IP_SOURCE_DIR/lib/msg_queue -I$MPEG4IP_SOURCE_DIR/lib"
-    MPEG4IP_CFLAGS="-D_REENTRANT -DNOCONTROLS -fexceptions -Wno-char-subscripts -Wno-unknown-pragmas -Wno-deprecated -DPLAYER_PLUGIN_DIR=\"/usr/local/lib/mp4player_plugin\" -g -O2 -DUSE_MMX -DMPEG4IP"
-    AC_SUBST(MPEG4IP_CFLAGS)
-    echo "ok." 
-  else
-    echo "mpeg4ip source tree not found... install it and use the --with-mpeg4ip=<path> configuration option."
-    exit -1
-  fi
-fi
-
 AC_SUBST(PDP_PIDIP_VERSION)
 AC_SUBST(IMLIB_LIBS)
 AC_SUBST(IMLIB_CFLAGS)
 AC_SUBST(THEORA_LIBS)
 AC_SUBST(DC1394_LIBS)
-AC_SUBST(PDP_STREAMING_OBJECTS)
+AC_SUBST(FREENECT_LIBS)
+AC_SUBST(OPENCV_LIBS)
+AC_SUBST(ARTKP_CPPFLAGS)
+AC_SUBST(ARTKP_LIBS)
 AC_SUBST(PDP_CAPTURE_OBJECT)
 AC_SUBST(PDP_DC1394_OBJECT)
+AC_SUBST(PDP_FREENECT_OBJECT)
+AC_SUBST(PDP_OPENCV_OBJECT)
+AC_SUBST(PDP_ARTKP_OBJECT)
 AC_SUBST(PDP_PIDIP_LIBS)
 AC_SUBST(PDP_PIDIP_INCLUDES)
 
@@ -307,7 +261,3 @@ system/Makefile
 modules/Makefile
 ])
 AC_OUTPUT
-
-echo "used configure options:"
-echo "  --enable_ffmpeg=$enable_ffmpeg"
-echo "  --enable_mpeg4ip=$enable_mpeg4ip"
diff --git a/externals/pidip/doc/handle-clicks.pd b/externals/pidip/doc/handle-clicks.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_aa-help.pd b/externals/pidip/doc/pdp_aa-help.pd
deleted file mode 100644
index b6cfe740851d8fc9668d6cac8d2d986e65edda1e..0000000000000000000000000000000000000000
--- a/externals/pidip/doc/pdp_aa-help.pd
+++ /dev/null
@@ -1,72 +0,0 @@
-#N canvas 84 12 763 664 10;
-#X obj 191 444 pdp_glx;
-#X obj 268 64 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X msg 123 136 loop \$1;
-#X obj 124 114 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1
-1;
-#X msg 370 44 open \$1;
-#X obj 369 20 openpanel;
-#X obj 354 3 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X floatatom 316 99 5 0 0;
-#X msg 225 65 stop;
-#X obj 323 68 hsl 300 15 0 1000 0 0 empty empty empty -2 -6 0 8 -262144
--1 -1 0 1;
-#X obj 257 135 metro 70;
-#X obj 346 203 pdp_v4l;
-#X obj 355 172 metro 70;
-#X obj 400 138 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X msg 357 139 stop;
-#X msg 442 170 open /dev/video;
-#X obj 252 167 pdp_yqt;
-#X obj 606 530 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 606 582 pdp_control;
-#X msg 606 555 thread \$1;
-#X floatatom 606 643 5 0 0;
-#X obj 606 614 route pdp_drop;
-#X text 224 632 written by Yves Degoyon (ydegoyon@free.fr);
-#X msg 445 203 dim 800 600;
-#X text 223 618 ( http://aa-project.sourceforge.net/aalib );
-#X text 224 603 it makes use of aalib;
-#X obj 191 411 pdp_aa -----------------;
-#X msg 318 287 driver X11;
-#X msg 420 287 driver slang;
-#X msg 419 309 driver stdout;
-#X msg 318 309 driver stderr;
-#X text 523 285 Set the driver;
-#X msg 319 356 render \$1;
-#X obj 396 356 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X text 418 356 Activate/Deactivate rendering;
-#X text 225 589 pdp_aa : output images in ASCII art;
-#X connect 1 0 10 0;
-#X connect 2 0 16 0;
-#X connect 3 0 2 0;
-#X connect 4 0 16 0;
-#X connect 5 0 4 0;
-#X connect 6 0 5 0;
-#X connect 7 0 10 1;
-#X connect 8 0 10 0;
-#X connect 9 0 7 0;
-#X connect 10 0 16 0;
-#X connect 11 0 26 0;
-#X connect 12 0 11 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 0;
-#X connect 15 0 11 0;
-#X connect 16 0 26 0;
-#X connect 17 0 19 0;
-#X connect 18 0 21 0;
-#X connect 19 0 18 0;
-#X connect 21 0 20 0;
-#X connect 23 0 11 0;
-#X connect 26 0 0 0;
-#X connect 27 0 26 0;
-#X connect 28 0 26 0;
-#X connect 29 0 26 0;
-#X connect 30 0 26 0;
-#X connect 32 0 26 0;
-#X connect 33 0 32 0;
diff --git a/externals/pidip/doc/pdp_affine.pd b/externals/pidip/doc/pdp_affine.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_aging-help.pd b/externals/pidip/doc/pdp_aging-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_ascii-help.pd b/externals/pidip/doc/pdp_ascii-help.pd
old mode 100644
new mode 100755
index 5cf62cd935ab651031f9f2057156e875630b31f6..e25490617522c8394094ea738d4e53467b074b0b
--- a/externals/pidip/doc/pdp_ascii-help.pd
+++ b/externals/pidip/doc/pdp_ascii-help.pd
@@ -1,4 +1,4 @@
-#N canvas 368 56 763 664 10;
+#N canvas 261 56 763 664 10;
 #X obj 268 64 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
 #X msg 123 136 loop \$1;
@@ -43,9 +43,9 @@
 #X text 452 374 Increase brightness ( default 25 );
 #X text 393 347 Activate/suppress colors;
 #X text 462 300 Load a characters map;
-#X obj 346 203 pdp_v4l;
 #X obj 95 307 pdp_scale 600 480;
 #X obj 191 444 pdp_glx;
+#X obj 346 203 pdp_v4l2;
 #X connect 0 0 9 0;
 #X connect 1 0 14 0;
 #X connect 2 0 1 0;
@@ -56,11 +56,11 @@
 #X connect 7 0 9 0;
 #X connect 8 0 6 0;
 #X connect 9 0 14 0;
-#X connect 10 0 36 0;
+#X connect 10 0 38 0;
 #X connect 11 0 10 0;
 #X connect 12 0 10 0;
-#X connect 13 0 36 0;
-#X connect 14 0 37 0;
+#X connect 13 0 38 0;
+#X connect 14 0 36 0;
 #X connect 15 0 17 0;
 #X connect 16 0 19 0;
 #X connect 17 0 16 0;
@@ -73,6 +73,6 @@
 #X connect 27 0 29 0;
 #X connect 28 0 27 0;
 #X connect 29 0 31 0;
-#X connect 31 0 38 0;
-#X connect 36 0 37 0;
-#X connect 37 0 31 0;
+#X connect 31 0 37 0;
+#X connect 36 0 31 0;
+#X connect 38 0 36 0;
diff --git a/externals/pidip/doc/pdp_background-help.pd b/externals/pidip/doc/pdp_background-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_baltan-help.pd b/externals/pidip/doc/pdp_baltan-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_binary-help.pd b/externals/pidip/doc/pdp_binary-help.pd
old mode 100644
new mode 100755
index 58b062d1db9e14c5fffe8d09e76b34950674ec16..319aed183f6fc161baaa29cd43a8671cfb9c17a1
--- a/externals/pidip/doc/pdp_binary-help.pd
+++ b/externals/pidip/doc/pdp_binary-help.pd
@@ -1,8 +1,8 @@
-#N canvas 76 103 922 722 10;
+#N canvas 80 116 922 722 10;
 #X obj 342 90 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
 #X msg 197 162 loop \$1;
-#X obj 198 140 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1
+#X obj 198 140 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0
 1;
 #X msg 444 70 open \$1;
 #X obj 443 46 openpanel;
@@ -14,7 +14,6 @@
 -1 -1 0 1;
 #X obj 331 161 metro 70;
 #X obj 326 193 pdp_yqt;
-#X obj 55 105 pdp_v4l;
 #X obj 64 74 metro 70;
 #X obj 109 40 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
@@ -188,6 +187,7 @@
 #X floatatom 239 658 5 0 0 0 - - -;
 #X obj 79 505 pdp_glx;
 #X obj 312 264 pdp_glx;
+#X obj 55 105 pdp_v4l2;
 #X connect 0 0 9 0;
 #X connect 1 0 10 0;
 #X connect 2 0 1 0;
@@ -198,60 +198,60 @@
 #X connect 7 0 9 0;
 #X connect 8 0 6 0;
 #X connect 9 0 10 0;
-#X connect 10 0 41 0;
-#X connect 10 0 43 0;
-#X connect 10 0 76 0;
-#X connect 11 0 41 0;
+#X connect 10 0 40 0;
+#X connect 10 0 42 0;
+#X connect 10 0 75 0;
 #X connect 11 0 76 0;
 #X connect 12 0 11 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 0;
-#X connect 15 0 11 0;
-#X connect 16 0 41 1;
-#X connect 17 0 41 2;
-#X connect 18 0 41 3;
-#X connect 19 0 41 4;
-#X connect 21 0 41 5;
-#X connect 22 0 41 0;
-#X connect 24 0 41 6;
-#X connect 25 0 27 0;
-#X connect 26 0 29 0;
-#X connect 27 0 26 0;
-#X connect 29 0 28 0;
-#X connect 31 0 70 0;
-#X connect 32 0 69 0;
-#X connect 33 0 68 0;
-#X connect 41 0 75 0;
-#X connect 41 1 31 0;
-#X connect 41 2 32 0;
-#X connect 41 3 33 0;
-#X connect 42 0 55 0;
-#X connect 43 0 76 0;
-#X connect 44 0 48 0;
-#X connect 44 1 66 0;
-#X connect 44 2 65 0;
+#X connect 13 0 11 0;
+#X connect 14 0 76 0;
+#X connect 15 0 40 1;
+#X connect 16 0 40 2;
+#X connect 17 0 40 3;
+#X connect 18 0 40 4;
+#X connect 20 0 40 5;
+#X connect 21 0 40 0;
+#X connect 23 0 40 6;
+#X connect 24 0 26 0;
+#X connect 25 0 28 0;
+#X connect 26 0 25 0;
+#X connect 28 0 27 0;
+#X connect 30 0 69 0;
+#X connect 31 0 68 0;
+#X connect 32 0 67 0;
+#X connect 40 0 74 0;
+#X connect 40 1 30 0;
+#X connect 40 2 31 0;
+#X connect 40 3 32 0;
+#X connect 41 0 54 0;
+#X connect 42 0 75 0;
+#X connect 43 0 47 0;
+#X connect 43 1 65 0;
+#X connect 43 2 64 0;
+#X connect 44 0 15 0;
 #X connect 45 0 16 0;
 #X connect 46 0 17 0;
-#X connect 47 0 18 0;
-#X connect 51 0 52 0;
-#X connect 51 0 62 0;
-#X connect 51 1 52 1;
-#X connect 51 1 63 0;
-#X connect 51 2 52 2;
-#X connect 51 2 64 0;
-#X connect 52 0 60 0;
-#X connect 53 0 22 0;
+#X connect 50 0 51 0;
+#X connect 50 0 61 0;
+#X connect 50 1 51 1;
+#X connect 50 1 62 0;
+#X connect 50 2 51 2;
+#X connect 50 2 63 0;
+#X connect 51 0 59 0;
+#X connect 52 0 21 0;
+#X connect 53 0 52 0;
+#X connect 54 0 40 0;
 #X connect 54 0 53 0;
-#X connect 55 0 41 0;
-#X connect 55 0 54 0;
-#X connect 60 0 44 0;
-#X connect 65 0 50 0;
-#X connect 66 0 49 0;
-#X connect 67 0 71 0;
-#X connect 68 0 70 2;
-#X connect 69 0 70 1;
-#X connect 70 0 67 0;
-#X connect 71 0 72 0;
-#X connect 71 1 73 0;
-#X connect 71 2 74 0;
-#X connect 76 0 42 0;
+#X connect 59 0 43 0;
+#X connect 64 0 49 0;
+#X connect 65 0 48 0;
+#X connect 66 0 70 0;
+#X connect 67 0 69 2;
+#X connect 68 0 69 1;
+#X connect 69 0 66 0;
+#X connect 70 0 71 0;
+#X connect 70 1 72 0;
+#X connect 70 2 73 0;
+#X connect 75 0 41 0;
+#X connect 76 0 40 0;
+#X connect 76 0 75 0;
diff --git a/externals/pidip/doc/pdp_cache-help.pd b/externals/pidip/doc/pdp_cache-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_canvas-help.pd b/externals/pidip/doc/pdp_canvas-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_capture-help.pd b/externals/pidip/doc/pdp_capture-help.pd
deleted file mode 100644
index 1b000083619b5ce81f95dab49f12ea104908f2fb..0000000000000000000000000000000000000000
--- a/externals/pidip/doc/pdp_capture-help.pd
+++ /dev/null
@@ -1,44 +0,0 @@
-#N canvas 237 21 712 664 10;
-#X obj 131 353 pdp_glx;
-#X obj 494 427 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 494 479 pdp_control;
-#X msg 494 452 thread \$1;
-#X floatatom 494 540 5 0 0 0 - - -;
-#X obj 494 511 route pdp_drop;
-#X text 44 481 written by Yves Degoyon ( ydegoyon@free.fr );
-#X text 43 466 pdp_capture : capture a portion of the screen;
-#X floatatom 237 156 5 0 0 0 - - -;
-#X floatatom 248 179 5 0 0 0 - - -;
-#X floatatom 265 202 5 0 0 0 - - -;
-#X floatatom 279 227 5 0 0 0 - - -;
-#X msg 72 90 bang;
-#X msg 125 89 stop;
-#X msg 229 125 screen 0;
-#X text 392 101 Sets the display;
-#X text 296 125 Sets the screen number;
-#X obj 183 300 pdp_scale 320 240;
-#X obj 89 135 metro 200;
-#X obj 183 264 pdp_capture;
-#X text 318 201 Width ( default : 320 );
-#X text 301 178 Upper left Y position ( default : 0 );
-#X text 290 155 Upper left X position ( default : 0 );
-#X text 332 226 Height ( default : 240 );
-#X floatatom 174 109 5 0 0 0 - - -;
-#X msg 218 101 display 192.168.0.225:0;
-#X connect 1 0 3 0;
-#X connect 2 0 5 0;
-#X connect 3 0 2 0;
-#X connect 5 0 4 0;
-#X connect 8 0 19 1;
-#X connect 9 0 19 2;
-#X connect 10 0 19 3;
-#X connect 11 0 19 4;
-#X connect 12 0 18 0;
-#X connect 13 0 18 0;
-#X connect 14 0 19 0;
-#X connect 17 0 0 0;
-#X connect 18 0 19 0;
-#X connect 19 0 17 0;
-#X connect 24 0 18 1;
-#X connect 25 0 19 0;
diff --git a/externals/pidip/doc/pdp_cmap-help.pd b/externals/pidip/doc/pdp_cmap-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_colorgrid-help.pd b/externals/pidip/doc/pdp_colorgrid-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_compose-help.pd b/externals/pidip/doc/pdp_compose-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_cropper-help.pd b/externals/pidip/doc/pdp_cropper-help.pd
old mode 100644
new mode 100755
index 07e784c9285735ef40be658854989c80aae20f17..85735dbaf7bde8ef3c6b1d7c77e92842a6f7df27
--- a/externals/pidip/doc/pdp_cropper-help.pd
+++ b/externals/pidip/doc/pdp_cropper-help.pd
@@ -1,9 +1,9 @@
-#N canvas 237 21 712 664 10;
+#N canvas 416 43 712 664 10;
 #X obj 217 367 pdp_glx;
 #X obj 268 64 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
 #X msg 123 136 loop \$1;
-#X obj 124 114 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1
+#X obj 124 114 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0
 1;
 #X msg 150 62 open \$1;
 #X obj 149 38 openpanel;
@@ -13,7 +13,6 @@
 #X msg 225 65 stop;
 #X obj 257 135 metro 70;
 #X obj 252 167 pdp_yqt;
-#X obj 369 162 pdp_v4l;
 #X obj 378 131 metro 70;
 #X obj 423 97 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
@@ -38,6 +37,7 @@ patch );
 #X text 315 239 Y1;
 #X floatatom 338 259 5 0 0 0 - - -;
 #X text 316 259 Y2;
+#X obj 369 162 pdp_v4l2;
 #X connect 1 0 9 0;
 #X connect 2 0 10 0;
 #X connect 3 0 2 0;
@@ -47,18 +47,18 @@ patch );
 #X connect 7 0 9 1;
 #X connect 8 0 9 0;
 #X connect 9 0 10 0;
-#X connect 10 0 21 0;
-#X connect 11 0 21 0;
+#X connect 10 0 20 0;
+#X connect 11 0 32 0;
 #X connect 12 0 11 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 0;
-#X connect 15 0 11 0;
-#X connect 16 0 18 0;
-#X connect 17 0 20 0;
-#X connect 18 0 17 0;
-#X connect 20 0 19 0;
-#X connect 21 0 0 0;
-#X connect 25 0 21 1;
-#X connect 27 0 21 2;
-#X connect 29 0 21 3;
-#X connect 31 0 21 4;
+#X connect 13 0 11 0;
+#X connect 14 0 32 0;
+#X connect 15 0 17 0;
+#X connect 16 0 19 0;
+#X connect 17 0 16 0;
+#X connect 19 0 18 0;
+#X connect 20 0 0 0;
+#X connect 24 0 20 1;
+#X connect 26 0 20 2;
+#X connect 28 0 20 3;
+#X connect 30 0 20 4;
+#X connect 32 0 20 0;
diff --git a/externals/pidip/doc/pdp_ctrack-help.pd b/externals/pidip/doc/pdp_ctrack-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_cycle-help.pd b/externals/pidip/doc/pdp_cycle-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_dc1394-help.pd b/externals/pidip/doc/pdp_dc1394-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_dice-help.pd b/externals/pidip/doc/pdp_dice-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_dilate-help.pd b/externals/pidip/doc/pdp_dilate-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_disintegration-help.pd b/externals/pidip/doc/pdp_disintegration-help.pd
old mode 100644
new mode 100755
index c773f37bb0a10e5009267f51d161cc78d7f7b1b7..393e6fc0f6509fa352eda8e0d7dfb9cb00245ced
--- a/externals/pidip/doc/pdp_disintegration-help.pd
+++ b/externals/pidip/doc/pdp_disintegration-help.pd
@@ -2,7 +2,7 @@
 #X obj 341 20 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
 #X msg 196 92 loop \$1;
-#X obj 197 70 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 1
+#X obj 197 70 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1
 ;
 #X msg 453 93 open \$1;
 #X obj 452 69 openpanel;
@@ -14,12 +14,10 @@
 -1 -1 0 1;
 #X obj 330 91 metro 70;
 #X obj 325 123 pdp_yqt;
-#X obj 25 193 pdp_v4l;
 #X obj 34 162 metro 70;
 #X obj 79 128 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
 #X msg 36 129 stop;
-#X msg 121 160 open /dev/video;
 #X text 296 540 written by Yves Degoyon ( ydegoyon@free.fr );
 #X obj 594 197 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
 1;
@@ -36,6 +34,8 @@
 #X text 333 310 Reduction factor ( default = 5 );
 #X text 281 282 ( disintegration is here );
 #X obj 137 376 pdp_glx;
+#X obj 25 193 pdp_v4l2;
+#X msg 121 160 open /dev/video0;
 #X connect 0 0 9 0;
 #X connect 1 0 10 0;
 #X connect 2 0 1 0;
@@ -46,16 +46,16 @@
 #X connect 7 0 9 0;
 #X connect 8 0 6 0;
 #X connect 9 0 10 0;
-#X connect 10 0 25 0;
-#X connect 11 0 25 0;
+#X connect 10 0 23 0;
+#X connect 11 0 28 0;
 #X connect 12 0 11 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 0;
-#X connect 15 0 11 0;
-#X connect 17 0 19 0;
-#X connect 18 0 21 0;
+#X connect 13 0 11 0;
+#X connect 15 0 17 0;
+#X connect 16 0 19 0;
+#X connect 17 0 16 0;
 #X connect 19 0 18 0;
-#X connect 21 0 20 0;
-#X connect 22 0 25 1;
-#X connect 23 0 25 2;
-#X connect 25 0 29 0;
+#X connect 20 0 23 1;
+#X connect 21 0 23 2;
+#X connect 23 0 27 0;
+#X connect 28 0 23 0;
+#X connect 29 0 28 0;
diff --git a/externals/pidip/doc/pdp_distance-help.pd b/externals/pidip/doc/pdp_distance-help.pd
old mode 100644
new mode 100755
index cad3668e04b3fb12bd7b393854ac838cf83923d6..2ff8f79ee909399d06b3b2a5723d48bb945d153d
--- a/externals/pidip/doc/pdp_distance-help.pd
+++ b/externals/pidip/doc/pdp_distance-help.pd
@@ -1,4 +1,4 @@
-#N canvas 375 16 781 666 10;
+#N canvas 360 24 781 666 10;
 #X obj 341 20 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
 #X msg 196 92 loop \$1;
@@ -14,12 +14,10 @@
 -1 -1 0 1;
 #X obj 330 91 metro 70;
 #X obj 325 123 pdp_yqt;
-#X obj 25 193 pdp_v4l;
 #X obj 34 162 metro 70;
 #X obj 79 128 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
 #X msg 36 129 stop;
-#X msg 121 160 open /dev/video;
 #X obj 594 197 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
 1;
 #X obj 594 249 pdp_control;
@@ -43,6 +41,10 @@
 #X text 324 380 Coefficient 4;
 #X obj 108 441 pdp_glx;
 #X obj 113 289 pdp_grey ----;
+#X obj 25 194 pdp_v4l2;
+#X msg 111 129 format 1;
+#X msg 128 189 close;
+#X msg 121 160 open /dev/video0;
 #X connect 0 0 9 0;
 #X connect 1 0 10 0;
 #X connect 2 0 1 0;
@@ -53,20 +55,22 @@
 #X connect 7 0 9 0;
 #X connect 8 0 6 0;
 #X connect 9 0 10 0;
-#X connect 10 0 36 0;
-#X connect 11 0 36 0;
+#X connect 10 0 34 0;
+#X connect 11 0 35 0;
 #X connect 12 0 11 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 0;
-#X connect 15 0 11 0;
-#X connect 16 0 18 0;
-#X connect 17 0 20 0;
+#X connect 13 0 11 0;
+#X connect 14 0 16 0;
+#X connect 15 0 18 0;
+#X connect 16 0 15 0;
 #X connect 18 0 17 0;
-#X connect 20 0 19 0;
-#X connect 25 0 35 0;
-#X connect 27 0 25 1;
-#X connect 29 0 25 2;
-#X connect 30 0 25 3;
-#X connect 31 0 25 4;
-#X connect 36 0 25 0;
-#X connect 36 0 26 0;
+#X connect 23 0 33 0;
+#X connect 25 0 23 1;
+#X connect 27 0 23 2;
+#X connect 28 0 23 3;
+#X connect 29 0 23 4;
+#X connect 34 0 23 0;
+#X connect 34 0 24 0;
+#X connect 35 0 34 0;
+#X connect 36 0 35 0;
+#X connect 37 0 35 0;
+#X connect 38 0 35 0;
diff --git a/externals/pidip/doc/pdp_edge-help.pd b/externals/pidip/doc/pdp_edge-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_erode-help.pd b/externals/pidip/doc/pdp_erode-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_fcqt-help.pd b/externals/pidip/doc/pdp_fcqt-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_fdiff-help.pd b/externals/pidip/doc/pdp_fdiff-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_ffmpeg~-help.pd b/externals/pidip/doc/pdp_ffmpeg~-help.pd
deleted file mode 100644
index 824f681bf9584bd4428c1234ce2c0969a36b96ad..0000000000000000000000000000000000000000
--- a/externals/pidip/doc/pdp_ffmpeg~-help.pd
+++ /dev/null
@@ -1,110 +0,0 @@
-#N canvas 84 12 763 664 10;
-#X obj 268 64 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X msg 123 136 loop \$1;
-#X obj 124 114 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1
-1;
-#X msg 370 44 open \$1;
-#X obj 369 20 openpanel;
-#X obj 354 3 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X floatatom 316 99 5 0 0 0 - - -;
-#X msg 225 65 stop;
-#X obj 323 68 hsl 300 15 0 1000 0 0 empty empty empty -2 -6 0 8 -262144
--1 -1 0 1;
-#X obj 257 134 metro 70;
-#X obj 454 170 pdp_v4l;
-#X obj 463 139 metro 70;
-#X obj 508 105 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X msg 465 106 stop;
-#X msg 550 137 open /dev/video;
-#X obj 606 530 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 606 582 pdp_control;
-#X msg 606 555 thread \$1;
-#X floatatom 606 643 5 0 0 0 - - -;
-#X obj 606 614 route pdp_drop;
-#X text 82 562 written by Yves Degoyon (ydegoyon@free.fr);
-#X text 657 358 Set and open the feed;
-#X floatatom 193 439 5 0 0 0 - - -;
-#X text 241 440 Streaming status;
-#X floatatom 229 462 5 0 0 0 - - -;
-#X text 272 462 Number of video frames emitted;
-#X text 319 320 BEWARE : All the stream parameters must be set in ffserver
-configuration file.;
-#X msg 318 387 starve;
-#X text 377 389 Close the current feed;
-#X floatatom 267 482 5 0 0 0 - - -;
-#X text 311 483 Number of video frames dropped;
-#X text 79 624 PDP cannot guarantee that the audio will be sent on
-time;
-#X text 78 598 NOTE : although there is an experimental audio support
-here \,;
-#X text 78 611 you'd better stream with mp3cast~ because;
-#X text 81 547 pdp_ffmeg~ : streams video & audio towards an ffmpeg
-server;
-#X obj 620 284 pdp_glx;
-#X obj 619 251 pdp_spigot;
-#X obj 684 223 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 171 309 adc~;
-#X obj 504 284 dac~;
-#X obj 684 223 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 548 223 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X msg 674 285 close;
-#X obj 193 413 pdp_ffmpeg~;
-#X floatatom 306 505 5 0 0 0 - - -;
-#X text 352 505 Emission framerate;
-#X obj 282 199 pdp_yqt;
-#X obj 501 251 spigot~;
-#X floatatom 128 194 5 0 0 0 - - -;
-#X obj 122 273 pdp_affine;
-#X msg 318 415 feed http://localhost:8090/feed1.ffm;
-#X msg 320 357 feed http://www.xicnet.com:8000/sin1.ffm;
-#X connect 0 0 9 0;
-#X connect 1 0 46 0;
-#X connect 2 0 1 0;
-#X connect 3 0 46 0;
-#X connect 4 0 3 0;
-#X connect 5 0 4 0;
-#X connect 6 0 9 1;
-#X connect 7 0 9 0;
-#X connect 8 0 6 0;
-#X connect 9 0 46 0;
-#X connect 10 0 36 0;
-#X connect 10 0 49 0;
-#X connect 11 0 10 0;
-#X connect 12 0 11 0;
-#X connect 13 0 11 0;
-#X connect 14 0 10 0;
-#X connect 15 0 17 0;
-#X connect 16 0 19 0;
-#X connect 17 0 16 0;
-#X connect 19 0 18 0;
-#X connect 27 0 43 0;
-#X connect 36 1 35 0;
-#X connect 37 0 36 1;
-#X connect 38 0 43 0;
-#X connect 38 1 43 1;
-#X connect 41 0 47 1;
-#X connect 42 0 35 0;
-#X connect 43 0 22 0;
-#X connect 43 1 24 0;
-#X connect 43 2 29 0;
-#X connect 43 3 44 0;
-#X connect 46 0 36 0;
-#X connect 46 0 43 0;
-#X connect 46 4 43 0;
-#X connect 46 4 47 0;
-#X connect 46 5 43 1;
-#X connect 46 5 47 0;
-#X connect 47 1 39 1;
-#X connect 47 1 39 0;
-#X connect 48 0 49 1;
-#X connect 49 0 43 0;
-#X connect 49 0 35 0;
-#X connect 50 0 43 0;
-#X connect 51 0 43 0;
diff --git a/externals/pidip/doc/pdp_form-help.pd b/externals/pidip/doc/pdp_form-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_fqt-help.pd b/externals/pidip/doc/pdp_fqt-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_hitandmiss-help.pd b/externals/pidip/doc/pdp_hitandmiss-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_hue-help.pd b/externals/pidip/doc/pdp_hue-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_icedthe~-help.pd b/externals/pidip/doc/pdp_icedthe~-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_ieee1394-help.pd b/externals/pidip/doc/pdp_ieee1394-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_imgloader-help.pd b/externals/pidip/doc/pdp_imgloader-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_imgsaver-help.pd b/externals/pidip/doc/pdp_imgsaver-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_intrusion-help.pd b/externals/pidip/doc/pdp_intrusion-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_juxta-help.pd b/externals/pidip/doc/pdp_juxta-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_lens-help.pd b/externals/pidip/doc/pdp_lens-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_live~-help.pd b/externals/pidip/doc/pdp_live~-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_lumafilt-help.pd b/externals/pidip/doc/pdp_lumafilt-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_mapper-help.pd b/externals/pidip/doc/pdp_mapper-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_mgrid-help.pd b/externals/pidip/doc/pdp_mgrid-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_mosaic-help.pd b/externals/pidip/doc/pdp_mosaic-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_mp4live~-help.pd b/externals/pidip/doc/pdp_mp4live~-help.pd
deleted file mode 100644
index ab1dc628d3751b7e71afb2d22587f613b1936673..0000000000000000000000000000000000000000
--- a/externals/pidip/doc/pdp_mp4live~-help.pd
+++ /dev/null
@@ -1,135 +0,0 @@
-#N canvas 84 12 807 665 10;
-#X obj 268 64 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X msg 93 136 loop \$1;
-#X obj 94 114 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1
-;
-#X msg 123 92 open \$1;
-#X obj 122 68 openpanel;
-#X obj 107 51 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X floatatom 316 99 5 0 0 0 - - -;
-#X msg 225 65 stop;
-#X obj 323 68 hsl 300 15 0 1000 0 0 empty empty empty -2 -6 0 8 -262144
--1 -1 0 1;
-#X obj 257 134 metro 70;
-#X obj 365 156 pdp_v4l;
-#X obj 419 91 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X msg 376 92 stop;
-#X obj 207 160 pdp_yqt;
-#X obj 606 530 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 606 582 pdp_control;
-#X msg 606 555 thread \$1;
-#X floatatom 606 643 5 0 0 0 - - -;
-#X obj 606 614 route pdp_drop;
-#X floatatom 220 496 5 0 0 0 - - -;
-#X text 268 497 Streaming status;
-#X floatatom 256 519 5 0 0 0 - - -;
-#X text 299 519 Number of video frames emitted;
-#X floatatom 294 539 5 0 0 0 - - -;
-#X obj 55 315 pdp_glx;
-#X obj 119 254 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 43 244 dac~;
-#X obj 40 211 spigot~;
-#X obj 119 254 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 87 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
-;
-#X msg 109 316 close;
-#X text 32 162 Local echoes;
-#X text 0 390 Start the streaming;
-#X text 1 409 Stop the streaming;
-#X msg 142 411 disconnect;
-#X msg 142 390 connect;
-#X text 368 189 Step 1 : set streaming parameters;
-#X msg 363 229 videoport 47168;
-#X msg 364 250 audioport 47170;
-#X text 516 228 Set video port ( default : 7070 );
-#X text 515 250 Set audio port ( default : 8000 );
-#X text 516 209 Set ip address ( default : 127.0.0.1 );
-#X msg 365 269 ttl 1;
-#X text 515 269 Set ttl ( default : 15 );
-#X text 17 371 Step 3 : on air !!;
-#X text 515 291 Set video width ( default : 320 );
-#X msg 365 310 vheight 240;
-#X text 514 310 Set video height ( default : 240 );
-#X msg 365 330 framerate 15;
-#X text 515 331 Set video framerate ( default : 25 );
-#X text 516 352 Set video bitrate ( default : 128 );
-#X msg 365 351 vbitrate 256;
-#X msg 365 373 samplerate 22050;
-#X text 516 374 Set audio samplerate ( default : 44100 );
-#X text 516 395 Set audio bitrate ( default : 128 );
-#X msg 365 394 abitrate 64;
-#X text 368 420 Step 2 : save sdp file and upload it to your server
-;
-#X text 338 540 Frame Rate;
-#X obj 220 470 pdp_mp4live~;
-#X msg 366 436 sdp /usr/local/movies/pdstream.sdp;
-#X text 81 625 The rest is written by Yves Degoyon (ydegoyon@free.fr)
-;
-#X text 81 611 This object uses some code from mpeg4ip;
-#X msg 362 208 ipaddr 213.56.149.35;
-#X obj 207 200 pdp_scale 320 240;
-#X obj 273 231 adc~;
-#X obj 54 282 pdp_spigot;
-#X obj 123 477 osc~ 440;
-#X text 83 597 ( to a quicktime or darwin server );
-#X text 85 583 pdp_mp4live~ : mpeg4ip stream emitter;
-#X obj 374 125 metro 70;
-#X msg 366 289 vwidth 160;
-#X connect 0 0 9 0;
-#X connect 1 0 13 0;
-#X connect 2 0 1 0;
-#X connect 3 0 13 0;
-#X connect 4 0 3 0;
-#X connect 5 0 4 0;
-#X connect 6 0 9 1;
-#X connect 7 0 9 0;
-#X connect 8 0 6 0;
-#X connect 9 0 13 0;
-#X connect 10 0 58 0;
-#X connect 10 0 65 0;
-#X connect 11 0 69 0;
-#X connect 12 0 69 0;
-#X connect 13 0 63 0;
-#X connect 13 0 65 0;
-#X connect 13 4 27 0;
-#X connect 13 4 58 0;
-#X connect 13 5 27 0;
-#X connect 13 5 58 1;
-#X connect 14 0 16 0;
-#X connect 15 0 18 0;
-#X connect 16 0 15 0;
-#X connect 18 0 17 0;
-#X connect 25 0 65 1;
-#X connect 27 1 26 1;
-#X connect 27 1 26 0;
-#X connect 29 0 27 1;
-#X connect 30 0 24 0;
-#X connect 34 0 58 0;
-#X connect 35 0 58 0;
-#X connect 37 0 58 0;
-#X connect 38 0 58 0;
-#X connect 42 0 58 0;
-#X connect 46 0 58 0;
-#X connect 48 0 58 0;
-#X connect 51 0 58 0;
-#X connect 52 0 58 0;
-#X connect 55 0 58 0;
-#X connect 58 0 19 0;
-#X connect 58 1 21 0;
-#X connect 58 2 23 0;
-#X connect 59 0 58 0;
-#X connect 62 0 58 0;
-#X connect 63 0 58 0;
-#X connect 64 0 58 0;
-#X connect 64 1 58 1;
-#X connect 65 1 24 0;
-#X connect 66 0 58 0;
-#X connect 66 0 58 1;
-#X connect 69 0 10 0;
-#X connect 70 0 58 0;
diff --git a/externals/pidip/doc/pdp_mp4player~-help.pd b/externals/pidip/doc/pdp_mp4player~-help.pd
deleted file mode 100644
index 9b129049793179a5a9d04be68e7cda7c44afdde2..0000000000000000000000000000000000000000
--- a/externals/pidip/doc/pdp_mp4player~-help.pd
+++ /dev/null
@@ -1,17 +0,0 @@
-#N canvas 259 178 509 391 10;
-#X obj 156 158 dac~;
-#X text 250 113 <-- everything is in this box;
-#X text 279 128 where the block size is redefined;
-#X text 279 143 this is necessary for an;
-#X text 280 155 ( acceptable? ) audio decoding;
-#X msg 395 251 \; pd dsp 1;
-#X text 51 295 pdp_mp4player~ : decodes a mpeg4ip video stream;
-#X obj 128 113 rs_pdp_mp4player~;
-#X text 50 333 The rest is written by Yves Degoyon (ydegoyon@free.fr)
-;
-#X text 51 321 This object uses some code from mpeg4ip;
-#X text 51 308 ( from a darwin or quicktime server );
-#X obj 395 221 loadbang;
-#X connect 7 0 0 0;
-#X connect 7 1 0 1;
-#X connect 11 0 5 0;
diff --git a/externals/pidip/doc/pdp_nervous-help.pd b/externals/pidip/doc/pdp_nervous-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_noquark-help.pd b/externals/pidip/doc/pdp_noquark-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_ocanvas-help.pd b/externals/pidip/doc/pdp_ocanvas-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_pen-help.pd b/externals/pidip/doc/pdp_pen-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_puzzle-help.pd b/externals/pidip/doc/pdp_puzzle-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_qtext-help.pd b/externals/pidip/doc/pdp_qtext-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_quark-help.pd b/externals/pidip/doc/pdp_quark-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_radioactiv-help.pd b/externals/pidip/doc/pdp_radioactiv-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_rec~-help.pd b/externals/pidip/doc/pdp_rec~-help.pd
old mode 100644
new mode 100755
index 07e534b9a47ac4d81c1c403fc2c9bd283d5874bb..737c509df13d466b5f54d9912ee5ad702dd6cc97
--- a/externals/pidip/doc/pdp_rec~-help.pd
+++ b/externals/pidip/doc/pdp_rec~-help.pd
@@ -11,7 +11,6 @@
 #X floatatom 303 69 5 0 0 0 - - -;
 #X msg 212 35 stop;
 #X obj 216 84 metro 70;
-#X obj 18 245 pdp_v4l;
 #X obj 27 214 metro 70;
 #X obj 72 180 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
@@ -67,47 +66,50 @@ at the samplerate of PD;
 #X obj 21 385 pdp_affine;
 #X floatatom 52 340 5 0 0 0 - - -;
 #X obj 26 440 pdp_glx;
+#X obj 18 244 pdp_v4l2;
+#X msg 89 258 format 1;
 #X connect 0 0 8 0;
-#X connect 1 0 21 0;
+#X connect 1 0 20 0;
 #X connect 2 0 1 0;
-#X connect 3 0 21 0;
+#X connect 3 0 20 0;
 #X connect 4 0 3 0;
 #X connect 5 0 4 0;
 #X connect 6 0 8 1;
 #X connect 7 0 8 0;
-#X connect 8 0 21 0;
-#X connect 9 0 57 0;
+#X connect 8 0 20 0;
+#X connect 9 0 59 0;
 #X connect 10 0 9 0;
-#X connect 11 0 10 0;
-#X connect 12 0 10 0;
-#X connect 13 0 9 0;
-#X connect 15 0 56 0;
-#X connect 16 0 56 0;
-#X connect 19 0 56 0;
-#X connect 21 0 53 0;
-#X connect 21 0 56 0;
-#X connect 21 4 56 0;
-#X connect 21 5 56 1;
-#X connect 24 0 56 0;
-#X connect 25 0 24 0;
-#X connect 27 0 56 0;
-#X connect 28 0 27 0;
-#X connect 31 0 32 0;
-#X connect 32 0 56 0;
-#X connect 33 0 32 0;
-#X connect 34 0 32 0;
-#X connect 35 0 32 0;
-#X connect 36 0 32 0;
-#X connect 39 0 41 0;
-#X connect 40 0 43 0;
-#X connect 41 0 40 0;
-#X connect 43 0 42 0;
-#X connect 45 0 56 0;
-#X connect 45 1 56 1;
-#X connect 51 0 56 0;
-#X connect 52 0 51 0;
-#X connect 55 0 51 0;
-#X connect 56 0 20 0;
-#X connect 57 0 59 0;
-#X connect 57 0 56 0;
-#X connect 58 0 57 1;
+#X connect 11 0 9 0;
+#X connect 12 0 59 0;
+#X connect 14 0 55 0;
+#X connect 15 0 55 0;
+#X connect 18 0 55 0;
+#X connect 20 0 52 0;
+#X connect 20 0 55 0;
+#X connect 20 4 55 0;
+#X connect 20 5 55 1;
+#X connect 23 0 55 0;
+#X connect 24 0 23 0;
+#X connect 26 0 55 0;
+#X connect 27 0 26 0;
+#X connect 30 0 31 0;
+#X connect 31 0 55 0;
+#X connect 32 0 31 0;
+#X connect 33 0 31 0;
+#X connect 34 0 31 0;
+#X connect 35 0 31 0;
+#X connect 38 0 40 0;
+#X connect 39 0 42 0;
+#X connect 40 0 39 0;
+#X connect 42 0 41 0;
+#X connect 44 0 55 0;
+#X connect 44 1 55 1;
+#X connect 50 0 55 0;
+#X connect 51 0 50 0;
+#X connect 54 0 50 0;
+#X connect 55 0 19 0;
+#X connect 56 0 58 0;
+#X connect 56 0 55 0;
+#X connect 57 0 56 1;
+#X connect 59 0 56 0;
+#X connect 60 0 59 0;
diff --git a/externals/pidip/doc/pdp_rev-help.pd b/externals/pidip/doc/pdp_rev-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_ripple-help.pd b/externals/pidip/doc/pdp_ripple-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_segsnd~-help.pd b/externals/pidip/doc/pdp_segsnd~-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_shagadelic-help.pd b/externals/pidip/doc/pdp_shagadelic-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_shape-help.pd b/externals/pidip/doc/pdp_shape-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_simura-help.pd b/externals/pidip/doc/pdp_simura-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_smuck-help.pd b/externals/pidip/doc/pdp_smuck-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_spigot-help.pd b/externals/pidip/doc/pdp_spigot-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_spiral-help.pd b/externals/pidip/doc/pdp_spiral-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_spotlight-help.pd b/externals/pidip/doc/pdp_spotlight-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_streaming-help.pd b/externals/pidip/doc/pdp_streaming-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_text-help.pd b/externals/pidip/doc/pdp_text-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_theonice~-help.pd b/externals/pidip/doc/pdp_theonice~-help.pd
old mode 100644
new mode 100755
index cec7bf2a027cf9b99721dd27f16222d76029f4a8..b48b00e1ad9cc7d6607ec56f5ae123c51d9d026b
--- a/externals/pidip/doc/pdp_theonice~-help.pd
+++ b/externals/pidip/doc/pdp_theonice~-help.pd
@@ -1,4 +1,4 @@
-#N canvas 131 125 861 556 10;
+#N canvas 135 149 861 556 10;
 #X obj 156 158 dac~;
 #X text 246 113 <-- everything is in this box;
 #X text 275 128 where the block size is redefined;
@@ -13,8 +13,11 @@
 #X text 276 155 ( acceptable? ) theora audio decoding;
 #X obj 395 221 loadbang;
 #X obj 160 55 adc~;
+#X obj 93 56 osc~ 150;
 #X connect 5 0 0 0;
 #X connect 5 1 0 1;
 #X connect 12 0 4 0;
 #X connect 13 0 5 0;
 #X connect 13 1 5 1;
+#X connect 14 0 5 0;
+#X connect 14 0 5 1;
diff --git a/externals/pidip/doc/pdp_theorin~-help.pd b/externals/pidip/doc/pdp_theorin~-help.pd
old mode 100644
new mode 100755
index 19d133a46a908a035e764fadd32bfa5ae0432d01..2b882cd345f1684bb58a2b66dbc7c1a630d81600
--- a/externals/pidip/doc/pdp_theorin~-help.pd
+++ b/externals/pidip/doc/pdp_theorin~-help.pd
@@ -1,4 +1,4 @@
-#N canvas 259 178 509 391 10;
+#N canvas 263 202 509 391 10;
 #X obj 156 158 dac~;
 #X text 51 309 written by Yves Degoyon (ydegoyon@free.fr);
 #X text 236 112 <-- everything is in this box;
diff --git a/externals/pidip/doc/pdp_theorout~-help.pd b/externals/pidip/doc/pdp_theorout~-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_transform-help.pd b/externals/pidip/doc/pdp_transform-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_transition-help.pd b/externals/pidip/doc/pdp_transition-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_underwatch-help.pd b/externals/pidip/doc/pdp_underwatch-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_v4l2-help.pd b/externals/pidip/doc/pdp_v4l2-help.pd
old mode 100644
new mode 100755
index 6b0e5996ea9940d6d4a98d75e5a620f3a2c2faf7..5de0de787d4c02a96f49e76c0bce1380a09f712c
--- a/externals/pidip/doc/pdp_v4l2-help.pd
+++ b/externals/pidip/doc/pdp_v4l2-help.pd
@@ -1,4 +1,4 @@
-#N canvas 508 213 927 686 10;
+#N canvas 600 67 927 686 10;
 #X obj 35 20 metro 40;
 #X msg 87 -19 stop;
 #X msg 35 -19 bang;
@@ -36,12 +36,12 @@ recent cameras \, if it doesn't with yours report bugs to ydegoyon@free.fr
 #X text 297 81 see initialization phase for valid standards;
 #X floatatom 213 71 5 0 0 0 - - -;
 #X msg 213 91 standard \$1;
-#X obj 96 300 pdp_glx;
 #X msg 179 299 cursor 1;
 #X msg 167 271 posdim 0 0 1440 800;
 #X text 324 303 authors : Yves Degoyon and Lluis Gomez i Bigorda;
 #X text 325 317 code was inspired by pdp_v4l by Tom Schouten and xawtv
 by Gerd Knorr;
+#X obj 96 300 pdp_glx;
 #X connect 0 0 18 0;
 #X connect 1 0 0 0;
 #X connect 2 0 0 0;
@@ -55,11 +55,11 @@ by Gerd Knorr;
 #X connect 12 0 18 0;
 #X connect 13 0 14 0;
 #X connect 14 0 18 0;
-#X connect 18 0 31 0;
+#X connect 18 0 35 0;
 #X connect 20 0 21 0;
 #X connect 21 0 18 0;
 #X connect 23 0 18 0;
 #X connect 29 0 30 0;
 #X connect 30 0 18 0;
-#X connect 32 0 31 0;
-#X connect 33 0 31 0;
+#X connect 31 0 35 0;
+#X connect 32 0 35 0;
diff --git a/externals/pidip/doc/pdp_vertigo-help.pd b/externals/pidip/doc/pdp_vertigo-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_warhol-help.pd b/externals/pidip/doc/pdp_warhol-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_warp-help.pd b/externals/pidip/doc/pdp_warp-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_xcanvas-help.pd b/externals/pidip/doc/pdp_xcanvas-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_yqt-help.pd b/externals/pidip/doc/pdp_yqt-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/pdp_yvu2rgb-help.pd b/externals/pidip/doc/pdp_yvu2rgb-help.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/rs_pdp_icedthe~.pd b/externals/pidip/doc/rs_pdp_icedthe~.pd
old mode 100644
new mode 100755
index 5352d58e5f355444b1bbb3a4abf009f1d42a6324..b5140f4a94e7e393e3dcc0673911dcf968cd8ef6
--- a/externals/pidip/doc/rs_pdp_icedthe~.pd
+++ b/externals/pidip/doc/rs_pdp_icedthe~.pd
@@ -1,4 +1,4 @@
-#N canvas 127 47 872 636 10;
+#N canvas 131 71 872 636 10;
 #X text 452 600 written by Yves Degoyon (ydegoyon@free.fr);
 #X floatatom 245 506 7 0 0 0 - - -;
 #X text 301 507 Number of video frames decoded;
@@ -31,7 +31,6 @@
 #X floatatom 232 530 5 0 0 0 - - -;
 #X text 281 531 Connection status;
 #X text 452 586 pdp_icedthe~ : threaded theora stream decoder;
-#X msg 223 217 connect http://localhost:8000/theora.ogg;
 #X floatatom 306 443 20 0 0 0 - - -;
 #X text 458 442 Video/Audio lag;
 #X obj 134 543 outlet~;
@@ -41,9 +40,11 @@
 #X text 439 352 Set the desired receiving framerate;
 #X obj 39 496 pdp_glx;
 #X msg 199 191 connect http://hackitectura.net:8000/vlnc.ogg;
-#X connect 3 0 34 0;
+#X msg 223 217 connect http://giss.tv:8001/piksel10.ogg;
+#X obj 76 453 pdp_convert image/YCrCb/*;
+#X connect 3 0 33 0;
 #X connect 4 0 3 0;
-#X connect 7 0 34 0;
+#X connect 7 0 33 0;
 #X connect 8 0 7 0;
 #X connect 14 0 15 0;
 #X connect 15 0 8 0;
@@ -51,16 +52,17 @@
 #X connect 18 0 21 0;
 #X connect 19 0 18 0;
 #X connect 21 0 20 0;
-#X connect 22 0 34 0;
-#X connect 30 0 34 0;
-#X connect 34 0 38 0;
-#X connect 34 1 11 0;
-#X connect 34 2 33 0;
-#X connect 34 3 27 0;
-#X connect 34 4 1 0;
-#X connect 34 5 9 0;
-#X connect 34 6 10 0;
-#X connect 34 7 31 0;
+#X connect 22 0 33 0;
+#X connect 33 0 40 0;
+#X connect 33 1 11 0;
+#X connect 33 2 32 0;
+#X connect 33 3 27 0;
+#X connect 33 4 1 0;
+#X connect 33 5 9 0;
+#X connect 33 6 10 0;
+#X connect 33 7 30 0;
+#X connect 34 0 33 0;
 #X connect 35 0 34 0;
-#X connect 36 0 35 0;
-#X connect 39 0 34 0;
+#X connect 38 0 33 0;
+#X connect 39 0 33 0;
+#X connect 40 0 37 0;
diff --git a/externals/pidip/doc/rs_pdp_live~.pd b/externals/pidip/doc/rs_pdp_live~.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/rs_pdp_mp4player~.pd b/externals/pidip/doc/rs_pdp_mp4player~.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/rs_pdp_segsnd~.pd b/externals/pidip/doc/rs_pdp_segsnd~.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/doc/rs_pdp_theonice~.pd b/externals/pidip/doc/rs_pdp_theonice~.pd
old mode 100644
new mode 100755
index d7450933233fea4257189a175aa65cee5ac528ef..cc996f9f97f2cd3c1fa79307082851d94c7b13b3
--- a/externals/pidip/doc/rs_pdp_theonice~.pd
+++ b/externals/pidip/doc/rs_pdp_theonice~.pd
@@ -1,4 +1,4 @@
-#N canvas 9 49 986 661 10;
+#N canvas 337 80 986 661 10;
 #X obj 255 34 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
 #X msg 117 65 loop \$1;
@@ -11,11 +11,9 @@
 #X floatatom 293 75 5 0 0 0 - - -;
 #X msg 212 35 stop;
 #X obj 215 91 metro 70;
-#X obj 14 124 metro 70;
 #X obj 59 90 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
 #X msg 16 91 stop;
-#X msg 79 125 open /dev/video;
 #X text 647 79 written by Yves Degoyon ( ydegoyon@free.fr );
 #X obj 215 124 pdp_yqt;
 #X obj 860 516 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
@@ -63,7 +61,7 @@
 #X msg 383 335 description images from infowar;
 #X msg 384 309 url http://www.indymedia.org;
 #X msg 384 285 artist recuerdos de luchas;
-#X obj 356 98 pdp_theorin~;
+#X obj 357 99 pdp_theorin~;
 #X floatatom 41 530 5 0 0 0 - - -;
 #X text 83 531 Streaming status;
 #X floatatom 68 551 7 0 0 0 - - -;
@@ -73,12 +71,10 @@
 #X floatatom 124 594 5 0 0 0 - - -;
 #X text 168 593 Emission framerate;
 #X obj 23 304 pdp_spigot;
-#X obj 94 282 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
+#X obj 94 282 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
 ;
-#X text 556 433 Video quality : [0 \, 63] \, default 2!;
 #X floatatom 502 406 5 0 0 0 - - -;
 #X msg 383 405 framerate \$1;
-#X obj 156 268 pdp_scale 192 160;
 #X floatatom 145 617 7 0 0 0 - - -;
 #X text 201 618 Audio stream time;
 #X floatatom 165 639 7 0 0 0 - - -;
@@ -95,80 +91,84 @@
 #X obj 518 622 block~ 512;
 #X obj 142 366 inlet~;
 #X obj 216 366 inlet~;
-#X text 556 406 Framerate : [1 \, 100] \, default 7;
 #X obj 159 490 pdp_theonice~;
 #X obj 6 155 pdp_v4l2;
-#X msg 384 182 connect giss.tv redirect.ogg 8000;
-#X msg 384 237 passwd *****;
+#X obj 156 268 pdp_scale 320 240;
+#X obj 358 126 pdp_convert image/YCrCb/*;
+#X obj 15 124 metro 40;
+#X text 556 406 Framerate : [1 \, 100] \, default 12;
+#X text 556 431 Video quality : [0 \, 63] \, default 16;
+#X msg 384 182 connect localhost piksel10.ogg 8000;
+#X msg 384 237 passwd hacktv;
 #X connect 0 0 8 0;
-#X connect 1 0 14 0;
+#X connect 1 0 12 0;
 #X connect 2 0 1 0;
-#X connect 3 0 14 0;
+#X connect 3 0 12 0;
 #X connect 4 0 3 0;
 #X connect 5 0 4 0;
 #X connect 6 0 8 1;
 #X connect 7 0 8 0;
-#X connect 8 0 14 0;
-#X connect 9 0 90 0;
-#X connect 10 0 9 0;
-#X connect 11 0 9 0;
-#X connect 12 0 90 0;
-#X connect 14 0 72 0;
-#X connect 14 4 78 0;
-#X connect 14 4 89 0;
-#X connect 14 5 78 0;
-#X connect 14 5 89 1;
-#X connect 15 0 17 0;
-#X connect 16 0 19 0;
+#X connect 8 0 12 0;
+#X connect 9 0 88 0;
+#X connect 10 0 88 0;
+#X connect 12 0 86 0;
+#X connect 12 4 74 0;
+#X connect 12 4 84 0;
+#X connect 12 5 74 0;
+#X connect 12 5 84 1;
+#X connect 13 0 15 0;
+#X connect 14 0 17 0;
+#X connect 15 0 14 0;
 #X connect 17 0 16 0;
-#X connect 19 0 18 0;
-#X connect 25 0 72 0;
-#X connect 26 0 25 1;
-#X connect 27 0 29 0;
-#X connect 28 0 58 0;
-#X connect 29 0 28 0;
-#X connect 29 0 82 1;
-#X connect 31 0 89 0;
-#X connect 32 0 89 0;
-#X connect 35 0 89 0;
-#X connect 36 0 89 0;
-#X connect 40 0 31 0;
-#X connect 41 0 32 0;
-#X connect 42 0 35 0;
-#X connect 43 0 36 0;
-#X connect 49 0 89 0;
-#X connect 53 0 89 0;
-#X connect 54 0 89 0;
-#X connect 55 0 89 0;
-#X connect 56 0 89 0;
-#X connect 57 0 89 0;
-#X connect 58 0 89 0;
-#X connect 58 1 78 0;
-#X connect 58 1 89 0;
-#X connect 58 2 78 0;
-#X connect 58 2 89 1;
-#X connect 58 5 80 0;
-#X connect 67 1 24 0;
-#X connect 68 0 67 1;
-#X connect 70 0 71 0;
-#X connect 71 0 89 0;
-#X connect 72 0 67 0;
-#X connect 72 0 89 0;
-#X connect 77 0 24 0;
-#X connect 78 1 84 0;
-#X connect 78 1 83 0;
-#X connect 79 0 78 1;
-#X connect 80 0 81 0;
-#X connect 81 0 82 0;
-#X connect 82 0 28 0;
-#X connect 86 0 89 0;
-#X connect 87 0 89 1;
-#X connect 89 0 59 0;
-#X connect 89 1 61 0;
-#X connect 89 2 63 0;
-#X connect 89 3 65 0;
-#X connect 89 4 73 0;
-#X connect 89 5 75 0;
-#X connect 90 0 25 0;
-#X connect 91 0 89 0;
-#X connect 92 0 89 0;
+#X connect 23 0 86 0;
+#X connect 24 0 23 1;
+#X connect 25 0 27 0;
+#X connect 26 0 56 0;
+#X connect 27 0 26 0;
+#X connect 27 0 78 1;
+#X connect 29 0 84 0;
+#X connect 30 0 84 0;
+#X connect 33 0 84 0;
+#X connect 34 0 84 0;
+#X connect 38 0 29 0;
+#X connect 39 0 30 0;
+#X connect 40 0 33 0;
+#X connect 41 0 34 0;
+#X connect 47 0 84 0;
+#X connect 51 0 84 0;
+#X connect 52 0 84 0;
+#X connect 53 0 84 0;
+#X connect 54 0 84 0;
+#X connect 55 0 84 0;
+#X connect 56 0 87 0;
+#X connect 56 1 74 0;
+#X connect 56 1 84 0;
+#X connect 56 2 74 0;
+#X connect 56 2 84 1;
+#X connect 56 5 76 0;
+#X connect 65 1 22 0;
+#X connect 66 0 65 1;
+#X connect 67 0 68 0;
+#X connect 68 0 84 0;
+#X connect 73 0 22 0;
+#X connect 74 1 80 0;
+#X connect 74 1 79 0;
+#X connect 75 0 74 1;
+#X connect 76 0 77 0;
+#X connect 77 0 78 0;
+#X connect 78 0 26 0;
+#X connect 82 0 84 0;
+#X connect 83 0 84 1;
+#X connect 84 0 57 0;
+#X connect 84 1 59 0;
+#X connect 84 2 61 0;
+#X connect 84 3 63 0;
+#X connect 84 4 69 0;
+#X connect 84 5 71 0;
+#X connect 85 0 23 0;
+#X connect 86 0 65 0;
+#X connect 86 0 84 0;
+#X connect 87 0 86 0;
+#X connect 88 0 85 0;
+#X connect 91 0 84 0;
+#X connect 92 0 84 0;
diff --git a/externals/pidip/doc/rs_pdp_theorin~.pd b/externals/pidip/doc/rs_pdp_theorin~.pd
old mode 100644
new mode 100755
index bd08e527740ca03c87231ddc751c7cb23d85fabe..be3b107c46a852155f6ced7d71a952259fb488a4
--- a/externals/pidip/doc/rs_pdp_theorin~.pd
+++ b/externals/pidip/doc/rs_pdp_theorin~.pd
@@ -1,4 +1,4 @@
-#N canvas 127 47 872 636 10;
+#N canvas 446 83 872 636 10;
 #X text 452 600 written by Yves Degoyon (ydegoyon@free.fr);
 #X floatatom 240 549 5 0 0 0 - - -;
 #X text 289 550 Number of video frames decoded;
@@ -55,7 +55,7 @@
 #X floatatom 309 455 5 0 0 0 - - -;
 #X text 354 455 File size ( in kbs );
 #X obj 39 496 pdp_glx;
-#X obj 78 259 vsl 15 128 0 510 0 0 empty filesize empty 0 -8 0 8 -262144
+#X obj 78 259 vsl 15 128 0 2524 0 0 empty filesize empty 0 -8 0 8 -262144
 -1 -1 0 1;
 #X msg 310 473 \; filesize range 0 \$1;
 #X floatatom 59 411 5 0 0 0 - - -;
@@ -69,6 +69,7 @@
 #X obj 152 265 symbol;
 #X msg 115 265 bang;
 #X obj 241 582 block~ 512;
+#X obj 39 461 pdp_convert image/YCrCb/*;
 #X connect 3 0 29 0;
 #X connect 4 0 3 0;
 #X connect 8 0 40 0;
@@ -87,7 +88,7 @@
 #X connect 25 0 27 1;
 #X connect 27 0 29 0;
 #X connect 28 0 27 0;
-#X connect 29 0 50 0;
+#X connect 29 0 63 0;
 #X connect 29 1 38 0;
 #X connect 29 2 6 0;
 #X connect 29 3 1 0;
@@ -111,3 +112,4 @@
 #X connect 59 0 61 0;
 #X connect 60 0 33 0;
 #X connect 61 0 60 0;
+#X connect 63 0 50 0;
diff --git a/externals/pidip/fonts/helmetr.ttf b/externals/pidip/fonts/helmetr.ttf
old mode 100644
new mode 100755
diff --git a/externals/pidip/include/g_colorgrid.h b/externals/pidip/include/g_colorgrid.h
old mode 100644
new mode 100755
diff --git a/externals/pidip/include/pdp_mp4audiosource.h b/externals/pidip/include/pdp_mp4audiosource.h
deleted file mode 100644
index ec42c3b1a7deb06df02175f20148a1cc27145866..0000000000000000000000000000000000000000
--- a/externals/pidip/include/pdp_mp4audiosource.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *		Dave Mackie		dmackie@cisco.com
- *		Bill May 		wmay@cisco.com
- *
- * Adapted for PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-#ifndef __PDP_MP4AUDIOSOURCE__
-#define __PDP_MP4AUDIOSOURCE__
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <linux/soundcard.h>
-
-#include "media_source.h"
-#include "audio_encoder.h"
-
-class CPDPAudioSource : public CMediaSource {
- public:
-  CPDPAudioSource(CLiveConfig *pConfig);
-
-  ~CPDPAudioSource() {
-    free(m_pcmFrameBuffer);
-  }
-
-  bool IsDone() {
-    return false;
-  }
-
-  float GetProgress() {
-    return 0.0;	
-  }
-
-  void CPDPAudioSource::DoStart();
-
-  void CPDPAudioSource::DoStop();
-
-  void ProcessAudio(u_int8_t* pcmBuffer, u_int32_t pcmBufferSize);
-
- protected:
-  int ThreadMain();
-
-  bool Init();
-
-
- protected:
-  int           m_maxPasses;
-  Timestamp     m_prevTimestamp;
-  int           m_audioOssMaxBufferSize;
-  int           m_audioOssMaxBufferFrames;
-  Timestamp     *m_timestampOverflowArray;
-  size_t        m_timestampOverflowArrayIndex;
-  u_int8_t*     m_pcmFrameBuffer;
-  u_int32_t     m_pcmFrameSize;
-  uint32_t      m_channelsConfigured;
-};
-
-
-#endif /* __PDP_MP4AUDIOSOURCE__ */
diff --git a/externals/pidip/include/pdp_mp4audiosync.h b/externals/pidip/include/pdp_mp4audiosync.h
deleted file mode 100644
index 92098d9ff071283e3d7658f12fbef915698e0f98..0000000000000000000000000000000000000000
--- a/externals/pidip/include/pdp_mp4audiosync.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *              Bill May        wmay@cisco.com
- *
- * Adapted to PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-/*
- * audio.h - provides a class that interfaces between the codec and
- * the SDL audio application.  Will provide for volume, buffering,
- * syncronization
- */
-
-#ifndef __PDP_MP4AUDIOSYNC__
-#define __PDP_MP4AUDIOSYNC__
-
-#include "audio.h"
-#include "pdp_mp4player~.h"
-
-#define DECODE_BUFFERS_MAX 32
-
-class CPDPAudioSync : public CAudioSync {
- public:
-  CPDPAudioSync(CPlayerSession *psptr, t_pdp_mp4player *pdp_father);
-  ~CPDPAudioSync(void);
-  // APIs from  codec
-  uint8_t *get_audio_buffer(void);
-  void filled_audio_buffer(uint64_t ts, int resync);
-  void set_config(int freq, int channels, int format, uint32_t max_buffer_size);
-  void set_eof(void);
-  void load_audio_buffer(uint8_t *from, 
-			 uint32_t bytes, 
-			 uint64_t ts, 
-			 int resync);
-  
-  // APIs from sync task
-  int initialize_audio(int have_video);
-  int is_audio_ready(uint64_t &disptime);
-  uint64_t check_audio_sync(uint64_t current_time, int &have_eof);
-  void play_audio(void);
-  void audio_callback(Uint8 *stream, int len);
-  void flush_sync_buffers(void);
-  void flush_decode_buffers(void);
-
-  // Initialization, other APIs
-  void set_wait_sem(SDL_sem *p) { }; //m_audio_waiting = p; } ;
-  void set_volume(int volume);
-
- private:
-  void audio_convert_data(void *from, uint32_t len);
-  volatile int m_dont_fill;
-  uint64_t m_buffer_ts;
-  uint32_t m_buffer_offset_on;
-  uint32_t m_buffer_size;
-  uint32_t m_fill_index, m_play_index;
-  volatile int m_buffer_filled[DECODE_BUFFERS_MAX];
-  uint64_t m_buffer_time[DECODE_BUFFERS_MAX];
-  uint64_t m_last_fill_timestamp;
-  uint64_t m_play_time;
-  SDL_AudioSpec m_obtained;
-  uint8_t *m_sample_buffer[DECODE_BUFFERS_MAX];
-  int m_config_set;
-  int m_audio_initialized;
-  int m_freq;
-  int m_channels;
-  int m_format;
-  int m_resync_required;
-  int m_audio_paused;
-  int m_consec_no_buffers;
-  volatile int m_audio_waiting_buffer;
-  int m_use_SDL_delay;
-  uint32_t m_resync_buffer;
-  SDL_sem *m_audio_waiting;
-  uint32_t m_skipped_buffers;
-  uint32_t m_didnt_fill_buffers;
-  int m_first_time;
-  int m_first_filled;
-  uint32_t m_msec_per_frame;
-  uint64_t m_buffer_latency;
-  int m_consec_wrong_latency;
-  int64_t m_wrong_latency_total;
-  int m_volume;
-  int m_do_sync;
-  int m_load_audio_do_next_resync;
-  uint32_t m_sample_size;
-  uint32_t m_play_sample_index;
-  uint32_t m_samples_loaded;
-  uint32_t m_bytes_per_sample;
-  uint64_t m_loaded_next_ts;
-  int m_silence;
-  void *m_convert_buffer;
-  t_pdp_mp4player *m_father;
-};
-
-CPDPAudioSync *pdp_create_audio_sync(CPlayerSession *, t_pdp_mp4player *pdp_father);
-
-#endif
-
-
diff --git a/externals/pidip/include/pdp_mp4config.h b/externals/pidip/include/pdp_mp4config.h
deleted file mode 100644
index aac8b8b6a95c13f80d7b610c887ad309dde681ba..0000000000000000000000000000000000000000
--- a/externals/pidip/include/pdp_mp4config.h
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *		Dave Mackie		dmackie@cisco.com
- *		Bill May 		wmay@cisco.com
- *
- * Adapted for PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-#ifndef __LIVE_CONFIG_H__
-#define __LIVE_CONFIG_H__
-
-#include <sys/types.h>
-#include <linux/videodev.h>
-
-#include "pdp_mp4configset.h"
-
-#include "media_time.h"
-#include "video_util_tv.h"
-
-#define FILE_SOURCE		"FILE"
-#define URL_SOURCE		"URL"
-
-#define AUDIO_SOURCE_OSS	"OSS"
-#define AUDIO_SOURCE_PDP	"PDP"
-
-#define AUDIO_ENCODER_FAAC	"faac"
-#define AUDIO_ENCODER_LAME	"lame"
-#define AUDIO_ENCODING_NONE	"None"
-#define AUDIO_ENCODING_PCM16	"PCM16"
-#define AUDIO_ENCODING_MP3	"MP3"
-#define AUDIO_ENCODING_AAC	"AAC"
-#define AUDIO_ENCODING_AC3	"AC3"
-#define AUDIO_ENCODING_VORBIS	"VORBIS"
-
-#define VIDEO_SOURCE_V4L	"V4L"
-#define VIDEO_SOURCE_PDP	"PDP"
-
-#define VIDEO_ENCODER_FFMPEG	"ffmpeg"
-#define VIDEO_ENCODER_DIVX	"divx"
-#define VIDEO_ENCODER_H26L	"h26l"
-#define VIDEO_ENCODER_XVID	"xvid"
-#define VIDEO_ENCODER_H261      "h261"
-
-#define VIDEO_ENCODING_NONE	"None"
-#define VIDEO_ENCODING_YUV12	"YUV12"
-#define VIDEO_ENCODING_MPEG2	"MPEG2"
-#define VIDEO_ENCODING_MPEG4	"MPEG4"
-#define VIDEO_ENCODING_H26L	"H26L"
-#define VIDEO_ENCODING_H261     "H261"
-
-#define VIDEO_NTSC_FRAME_RATE	((float)29.97)
-#define VIDEO_PAL_FRAME_RATE	((float)25.00)
-
-#define VIDEO_STD_ASPECT_RATIO 	((float)1.33)	// standard 4:3
-#define VIDEO_LB1_ASPECT_RATIO 	((float)2.35)	// typical "widescreen" format
-#define VIDEO_LB2_ASPECT_RATIO 	((float)1.85)	// alternate widescreen format
-#define VIDEO_LB3_ASPECT_RATIO 	((float)1.78)	// hdtv 16:9
-
-#define MP3_MPEG1_SAMPLES_PER_FRAME	1152	// for MPEG-1 bitrates
-#define MP3_MPEG2_SAMPLES_PER_FRAME	576		// for MPEG-2 bitrates
-
-#define VIDEO_SIGNAL_PAL 0
-#define VIDEO_SIGNAL_NTSC 1
-#define VIDEO_SIGNAL_SECAM 2
-
-DECLARE_CONFIG(CONFIG_APP_REAL_TIME);
-DECLARE_CONFIG(CONFIG_APP_REAL_TIME_SCHEDULER);
-DECLARE_CONFIG(CONFIG_APP_DURATION);
-DECLARE_CONFIG(CONFIG_APP_DURATION_UNITS);
-DECLARE_CONFIG(CONFIG_APP_FILE_0);
-DECLARE_CONFIG(CONFIG_APP_FILE_1);
-DECLARE_CONFIG(CONFIG_APP_FILE_2);
-DECLARE_CONFIG(CONFIG_APP_FILE_3);
-DECLARE_CONFIG(CONFIG_APP_FILE_4);
-DECLARE_CONFIG(CONFIG_APP_FILE_5);
-DECLARE_CONFIG(CONFIG_APP_FILE_6);
-DECLARE_CONFIG(CONFIG_APP_FILE_7);
-DECLARE_CONFIG(CONFIG_APP_DEBUG);
-DECLARE_CONFIG(CONFIG_APP_LOGLEVEL);
-DECLARE_CONFIG(CONFIG_APP_SIGNAL_HALT);
-
-DECLARE_CONFIG(CONFIG_AUDIO_ENABLE);
-DECLARE_CONFIG(CONFIG_AUDIO_SOURCE_TYPE);
-DECLARE_CONFIG(CONFIG_AUDIO_SOURCE_NAME);
-DECLARE_CONFIG(CONFIG_AUDIO_MIXER_NAME);
-DECLARE_CONFIG(CONFIG_AUDIO_INPUT_NAME);
-DECLARE_CONFIG(CONFIG_AUDIO_SOURCE_TRACK);
-DECLARE_CONFIG(CONFIG_AUDIO_CHANNELS);
-DECLARE_CONFIG(CONFIG_AUDIO_SAMPLE_RATE);
-DECLARE_CONFIG(CONFIG_AUDIO_BIT_RATE_KBPS);
-DECLARE_CONFIG(CONFIG_AUDIO_BIT_RATE);
-DECLARE_CONFIG(CONFIG_AUDIO_ENCODING);
-DECLARE_CONFIG(CONFIG_AUDIO_ENCODER);
-DECLARE_CONFIG(CONFIG_AUDIO_OSS_USE_SMALL_FRAGS);
-DECLARE_CONFIG(CONFIG_AUDIO_OSS_FRAGMENTS);
-DECLARE_CONFIG(CONFIG_AUDIO_OSS_FRAG_SIZE);
-
-DECLARE_CONFIG(CONFIG_VIDEO_ENABLE);
-DECLARE_CONFIG(CONFIG_VIDEO_SOURCE_TYPE);
-DECLARE_CONFIG(CONFIG_VIDEO_SOURCE_NAME);
-DECLARE_CONFIG(CONFIG_VIDEO_INPUT);
-DECLARE_CONFIG(CONFIG_VIDEO_SIGNAL);
-DECLARE_CONFIG(CONFIG_VIDEO_TUNER);
-DECLARE_CONFIG(CONFIG_VIDEO_CHANNEL_LIST_INDEX);
-DECLARE_CONFIG(CONFIG_VIDEO_CHANNEL_INDEX);
-DECLARE_CONFIG(CONFIG_VIDEO_SOURCE_TRACK);
-DECLARE_CONFIG(CONFIG_VIDEO_PREVIEW);
-DECLARE_CONFIG(CONFIG_VIDEO_RAW_PREVIEW);
-DECLARE_CONFIG(CONFIG_VIDEO_ENCODED_PREVIEW);
-DECLARE_CONFIG(CONFIG_VIDEO_ENCODER);
-DECLARE_CONFIG(CONFIG_VIDEO_ENCODING);
-DECLARE_CONFIG(CONFIG_VIDEO_RAW_WIDTH);
-DECLARE_CONFIG(CONFIG_VIDEO_RAW_HEIGHT);
-DECLARE_CONFIG(CONFIG_VIDEO_ASPECT_RATIO);
-DECLARE_CONFIG(CONFIG_VIDEO_FRAME_RATE);
-DECLARE_CONFIG(CONFIG_VIDEO_KEY_FRAME_INTERVAL);
-DECLARE_CONFIG(CONFIG_VIDEO_BIT_RATE);
-DECLARE_CONFIG(CONFIG_VIDEO_PROFILE_ID);
-DECLARE_CONFIG(CONFIG_VIDEO_BRIGHTNESS);
-DECLARE_CONFIG(CONFIG_VIDEO_HUE);
-DECLARE_CONFIG(CONFIG_VIDEO_COLOR);
-DECLARE_CONFIG(CONFIG_VIDEO_CONTRAST);
-DECLARE_CONFIG(CONFIG_VIDEO_TIMEBITS);
-DECLARE_CONFIG(CONFIG_V4L_CACHE_TIMESTAMP);
-DECLARE_CONFIG(CONFIG_VIDEO_H261_QUALITY);
-DECLARE_CONFIG(CONFIG_VIDEO_H261_QUALITY_ADJ_FRAMES);
-DECLARE_CONFIG(CONFIG_VIDEO_CAP_BUFF_COUNT);
-
-
-DECLARE_CONFIG(CONFIG_RECORD_ENABLE);
-DECLARE_CONFIG(CONFIG_RECORD_RAW_AUDIO);
-DECLARE_CONFIG(CONFIG_RECORD_RAW_VIDEO);
-DECLARE_CONFIG(CONFIG_RECORD_ENCODED_AUDIO);
-DECLARE_CONFIG(CONFIG_RECORD_ENCODED_VIDEO);
-DECLARE_CONFIG(CONFIG_RECORD_MP4_FILE_NAME);
-DECLARE_CONFIG(CONFIG_RECORD_MP4_HINT_TRACKS);
-DECLARE_CONFIG(CONFIG_RECORD_MP4_OVERWRITE);
-DECLARE_CONFIG(CONFIG_RECORD_MP4_OPTIMIZE);
-
-DECLARE_CONFIG(CONFIG_RTP_ENABLE);
-DECLARE_CONFIG(CONFIG_RTP_DEST_ADDRESS); // for video
-DECLARE_CONFIG(CONFIG_RTP_AUDIO_DEST_PORT);
-DECLARE_CONFIG(CONFIG_RTP_VIDEO_DEST_PORT);
-DECLARE_CONFIG(CONFIG_RTP_RECV_BUFFER_TIME);
-DECLARE_CONFIG(CONFIG_RTP_PAYLOAD_SIZE);
-DECLARE_CONFIG(CONFIG_RTP_MCAST_TTL);
-DECLARE_CONFIG(CONFIG_RTP_DISABLE_TS_OFFSET);
-DECLARE_CONFIG(CONFIG_RTP_USE_SSM);
-DECLARE_CONFIG(CONFIG_SDP_FILE_NAME);
-DECLARE_CONFIG(CONFIG_RTP_AUDIO_DEST_ADDRESS);
-DECLARE_CONFIG(CONFIG_RTP_USE_MP3_PAYLOAD_14);
-DECLARE_CONFIG(CONFIG_RTP_NO_B_RR_0);
-DECLARE_CONFIG(CONFIG_RAW_ENABLE);
-DECLARE_CONFIG(CONFIG_RAW_PCM_FILE_NAME);
-DECLARE_CONFIG(CONFIG_RAW_PCM_FIFO);
-DECLARE_CONFIG(CONFIG_RAW_YUV_FILE_NAME);
-DECLARE_CONFIG(CONFIG_RAW_YUV_FIFO);
-
-
-#ifdef DECLARE_CONFIG_VARIABLES
-static SConfigVariable PdpConfigVariables[] = {
-
-  CONFIG_BOOL(CONFIG_APP_REAL_TIME, "isRealTime", true),
-  CONFIG_BOOL(CONFIG_APP_REAL_TIME_SCHEDULER, "useRealTimeScheduler", true),
-  CONFIG_INT(CONFIG_APP_DURATION, "duration", 1),
-  CONFIG_INT(CONFIG_APP_DURATION_UNITS, "durationUnits", 60),
-
-  CONFIG_STRING(CONFIG_APP_FILE_0, "file0", ""),
-  CONFIG_STRING(CONFIG_APP_FILE_1, "file1", ""),
-  CONFIG_STRING(CONFIG_APP_FILE_2, "file2", ""),
-  CONFIG_STRING(CONFIG_APP_FILE_3, "file3", ""),
-  CONFIG_STRING(CONFIG_APP_FILE_4, "file4", ""),
-  CONFIG_STRING(CONFIG_APP_FILE_5, "file5", ""),
-  CONFIG_STRING(CONFIG_APP_FILE_6, "file6", ""),
-  CONFIG_STRING(CONFIG_APP_FILE_7, "file7", ""),
-
-  CONFIG_BOOL(CONFIG_APP_DEBUG, "debug", false),
-  CONFIG_INT(CONFIG_APP_LOGLEVEL, "logLevel", 0),
-  CONFIG_STRING(CONFIG_APP_SIGNAL_HALT, "signalHalt", "sighup"),
-    
-  // AUDIO
-    
-  CONFIG_BOOL(CONFIG_AUDIO_ENABLE, "audioEnable", true),
-  CONFIG_STRING(CONFIG_AUDIO_SOURCE_TYPE, "audioSourceType", AUDIO_SOURCE_PDP),
-  CONFIG_STRING(CONFIG_AUDIO_SOURCE_NAME, "audioDevice", "/dev/dsp"),
-  CONFIG_STRING(CONFIG_AUDIO_MIXER_NAME, "audioMixer", "/dev/mixer"),
-  CONFIG_STRING(CONFIG_AUDIO_INPUT_NAME, "audioInput", "mix"),
-
-  CONFIG_INT(CONFIG_AUDIO_SOURCE_TRACK, "audioSourceTrack", 0),
-  CONFIG_INT(CONFIG_AUDIO_CHANNELS, "audioChannels", 2),
-  CONFIG_INT(CONFIG_AUDIO_SAMPLE_RATE, "audioSampleRate", 44100),
-  CONFIG_INT(CONFIG_AUDIO_BIT_RATE_KBPS, "audioBitRate", 128),
-  CONFIG_INT(CONFIG_AUDIO_BIT_RATE, "audioBitRateBps", 128000),
-  CONFIG_STRING(CONFIG_AUDIO_ENCODING, "audioEncoding", AUDIO_ENCODING_AAC),
-  CONFIG_STRING(CONFIG_AUDIO_ENCODER, "audioEncoder", AUDIO_ENCODER_FAAC),
-
-  CONFIG_BOOL(CONFIG_AUDIO_OSS_USE_SMALL_FRAGS, "audioOssUseSmallFrags", true),
-  CONFIG_INT(CONFIG_AUDIO_OSS_FRAGMENTS, "audioOssFragments", 128),
-  CONFIG_INT(CONFIG_AUDIO_OSS_FRAG_SIZE, "audioOssFragSize", 8),
-
-  // VIDEO 
-    
-  CONFIG_BOOL(CONFIG_VIDEO_ENABLE, "videoEnable", true),
-  CONFIG_STRING(CONFIG_VIDEO_SOURCE_TYPE, "videoSourceType", VIDEO_SOURCE_PDP),
-  CONFIG_STRING(CONFIG_VIDEO_SOURCE_NAME, "videoDevice", "/dev/video0"),
-  CONFIG_INT(CONFIG_VIDEO_INPUT, "videoInput", 1),
-  CONFIG_INT(CONFIG_VIDEO_SIGNAL, "videoSignal", VIDEO_SIGNAL_NTSC),
-
-  CONFIG_INT(CONFIG_VIDEO_TUNER, "videoTuner", -1),
-  CONFIG_INT(CONFIG_VIDEO_CHANNEL_LIST_INDEX, "videoChannelListIndex", 0),
-  CONFIG_INT(CONFIG_VIDEO_CHANNEL_INDEX, "videoChannelIndex", 1),
-
-  CONFIG_INT(CONFIG_VIDEO_SOURCE_TRACK, "videoSourceTrack", 0),
-
-  CONFIG_BOOL(CONFIG_VIDEO_PREVIEW, "videoPreview", true),
-  CONFIG_BOOL(CONFIG_VIDEO_RAW_PREVIEW, "videoRawPreview", false),
-  CONFIG_BOOL(CONFIG_VIDEO_ENCODED_PREVIEW, "videoEncodedPreview", true),
-
-  CONFIG_STRING(CONFIG_VIDEO_ENCODER, "videoEncoder", VIDEO_ENCODER_XVID),
-  CONFIG_STRING(CONFIG_VIDEO_ENCODING, "videoEncoding", VIDEO_ENCODING_MPEG4),
-
-  CONFIG_INT(CONFIG_VIDEO_RAW_WIDTH, "videoRawWidth", 320),
-  CONFIG_INT(CONFIG_VIDEO_RAW_HEIGHT, "videoRawHeight", 240),
-  CONFIG_FLOAT(CONFIG_VIDEO_ASPECT_RATIO, "videoAspectRatio", VIDEO_STD_ASPECT_RATIO),
-  CONFIG_FLOAT(CONFIG_VIDEO_FRAME_RATE, "videoFrameRate", VIDEO_PAL_FRAME_RATE),
-  CONFIG_FLOAT(CONFIG_VIDEO_KEY_FRAME_INTERVAL, "videoKeyFrameInterval", 2.0),
-
-  CONFIG_INT(CONFIG_VIDEO_BIT_RATE, "videoBitRate", 128),
-  CONFIG_INT(CONFIG_VIDEO_PROFILE_ID, "videoProfileId", MPEG4_SP_L3),
-
-  CONFIG_INT(CONFIG_VIDEO_BRIGHTNESS, "videoBrightness", 50),
-  CONFIG_INT(CONFIG_VIDEO_HUE, "videoHue", 50),
-  CONFIG_INT(CONFIG_VIDEO_COLOR, "videoColor", 50),
-  CONFIG_INT(CONFIG_VIDEO_CONTRAST, "videoContrast", 50),
-
-  CONFIG_INT(CONFIG_VIDEO_TIMEBITS, "videoTimebits", 0),
-
-  CONFIG_BOOL(CONFIG_V4L_CACHE_TIMESTAMP, "videoTimestampCache", true),
-  CONFIG_INT(CONFIG_VIDEO_H261_QUALITY, "videoH261Quality", 10),
-  CONFIG_INT(CONFIG_VIDEO_H261_QUALITY_ADJ_FRAMES, "videoH261QualityAdjFrames", 8),
-
-  CONFIG_INT(CONFIG_VIDEO_CAP_BUFF_COUNT, "videoCaptureBuffersCount", 16),
-
-  // RECORD
-  CONFIG_BOOL(CONFIG_RECORD_ENABLE, "recordEnable", true),
-  CONFIG_BOOL(CONFIG_RECORD_RAW_AUDIO, "recordRawAudio", false),
-  CONFIG_BOOL(CONFIG_RECORD_RAW_VIDEO, "recordRawVideo", false),
-  CONFIG_BOOL(CONFIG_RECORD_ENCODED_AUDIO, "recordEncodedAudio", true),
-  CONFIG_BOOL(CONFIG_RECORD_ENCODED_VIDEO, "recordEncodedVideo", true),
-
-  CONFIG_STRING(CONFIG_RECORD_MP4_FILE_NAME, "recordMp4File", "capture.mp4"),
-  CONFIG_BOOL(CONFIG_RECORD_MP4_HINT_TRACKS, "recordMp4HintTracks", true),
-  CONFIG_BOOL(CONFIG_RECORD_MP4_OVERWRITE, "recordMp4Overwrite", true),
-  CONFIG_BOOL(CONFIG_RECORD_MP4_OPTIMIZE, "recordMp4Optimize", false),
-
-  // RTP
-    
-  CONFIG_BOOL(CONFIG_RTP_ENABLE, "rtpEnable", true),
-  CONFIG_STRING(CONFIG_RTP_DEST_ADDRESS, "rtpDestAddress", "127.0.0.1"),
-  CONFIG_STRING(CONFIG_RTP_AUDIO_DEST_ADDRESS, "audioRtpDestAddress", "127.0.0.1"),
-
-  CONFIG_INT(CONFIG_RTP_AUDIO_DEST_PORT, "rtpAudioDestPort", 8000),
-  CONFIG_INT(CONFIG_RTP_VIDEO_DEST_PORT, "rtpVideoDestPort", 7070),
-
-  CONFIG_INT(CONFIG_RTP_PAYLOAD_SIZE, "rtpPayloadSize", 1460),
-  CONFIG_INT(CONFIG_RTP_MCAST_TTL, "rtpMulticastTtl", 15),
-
-  CONFIG_BOOL(CONFIG_RTP_DISABLE_TS_OFFSET, "rtpDisableTimestampOffset", false),
-  CONFIG_BOOL(CONFIG_RTP_USE_SSM, "rtpUseSingleSourceMulticast", false),
-
-  CONFIG_STRING(CONFIG_SDP_FILE_NAME, "sdpFile", "capture.sdp"),
-
-  CONFIG_BOOL(CONFIG_RTP_USE_MP3_PAYLOAD_14, "rtpUseMp4RtpPayload14", false),
-  CONFIG_BOOL(CONFIG_RTP_NO_B_RR_0, "rtpNoBRR0", false),
-
-  // RAW sink
-
-  CONFIG_BOOL(CONFIG_RAW_ENABLE, "rawEnable", false),
-  CONFIG_STRING(CONFIG_RAW_PCM_FILE_NAME, "rawAudioFile", "capture.pcm"),
-  CONFIG_BOOL(CONFIG_RAW_PCM_FIFO, "rawAudioUseFifo", false),
-
-  CONFIG_STRING(CONFIG_RAW_YUV_FILE_NAME, "rawVideoFile", "capture.yuv"),
-  CONFIG_BOOL(CONFIG_RAW_YUV_FIFO, "rawVideoUseFifo", false)
-
-};
-#endif
-
-// forward declarations
-class CVideoCapabilities;
-class CAudioCapabilities;
-class CLiveConfig;
-
-// some configuration utility routines
-void GenerateMpeg4VideoConfig(CLiveConfig* pConfig);
-bool GenerateSdpFile(CLiveConfig* pConfig);
-struct session_desc_t;
-
-session_desc_t *createSdpDescription(CLiveConfig *pConfig, 
-				     char *sAudioDestAddr,
-				     char *sVideoDestAddr,
-				     int ttl,
-				     bool allow_rtcp,
-				     int video_port,
-				     int audio_port);
-
-class CLiveConfig : public CConfigSet {
-public:
-        CLiveConfig(SConfigVariable* variables,
-                config_index_t numVariables, const char* defaultFileName);
-
-        ~CLiveConfig();
-
-        // recalculate derived values
-        void Update();
-        void UpdateFileHistory(const char* fileName);
-        void UpdateVideo();
-        void CalculateVideoFrameSize();
-        void UpdateAudio();
-        void UpdateRecord();
-
-        bool IsOneSource();
-        bool IsCaptureVideoSource();
-        bool IsCaptureAudioSource();
-        bool IsFileVideoSource();
-        bool IsFileAudioSource();
-
-        bool SourceRawVideo() {
-                return false;
-        }
-
-        bool SourceRawAudio() {
-                return false;
-        }
-
-public:
-        // command line configuration
-        bool            m_appAutomatic;
-
-        // derived, shared video configuration
-        CVideoCapabilities* m_videoCapabilities;
-        bool            m_videoEncode;
-        u_int32_t       m_videoPreviewWindowId;
-        u_int16_t       m_videoWidth;
-        u_int16_t       m_videoHeight;
-        u_int16_t       m_videoMaxWidth;
-        u_int16_t       m_videoMaxHeight;
-        u_int32_t       m_ySize;
-        u_int32_t       m_uvSize;
-        u_int32_t       m_yuvSize;
-        bool            m_videoNeedRgbToYuv;
-        u_int16_t       m_videoMpeg4ConfigLength;
-        u_int8_t*       m_videoMpeg4Config;
-        u_int32_t       m_videoMaxVopSize;
-        u_int8_t        m_videoTimeIncrBits;
-
-        // derived, shared audio configuration
-        CAudioCapabilities* m_audioCapabilities;
-        bool            m_audioEncode;
-
-        // derived, shared file configuration
-        u_int64_t       m_recordEstFileSize;
-};
-
-#endif /* __LIVE_CONFIG_H__ */
-
diff --git a/externals/pidip/include/pdp_mp4configset.h b/externals/pidip/include/pdp_mp4configset.h
deleted file mode 100644
index a20d26093717d7b61cac6ce7f2ebeb0fe40a30f9..0000000000000000000000000000000000000000
--- a/externals/pidip/include/pdp_mp4configset.h
+++ /dev/null
@@ -1,532 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *		Dave Mackie		dmackie@cisco.com
- *		Bill May 		wmay@cisco.com
- *
- * Adapted for PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-#ifndef __CONFIG_SET_H__
-#define __CONFIG_SET_H__
-
-#include <mpeg4ip.h>
-
-#ifndef CONFIG_SAFETY
-#define CONFIG_SAFETY 1
-#endif
-
-typedef u_int32_t config_integer_t;
-
-typedef u_int16_t config_index_t;
-
-
-enum ConfigException {
-	CONFIG_ERR_INAME,
-	CONFIG_ERR_TYPE,
-	CONFIG_ERR_MEMORY,
-};
-
-// TBD type specific exception info and printing utility
-class CConfigException {
-public:
-	CConfigException(ConfigException e) {
-	  type = e;
-          fprintf( stderr, "pdp_mp4configset : exception : type : %d\n", e );
-	}
-	ConfigException	type;
-};
-
-#define CONFIG_MAX_STRLEN	255
-
-// TBD weld this in, and throw exception
-inline char* stralloc(const char* src) {
-	char* dst = (char*)malloc(strlen(src)+1);
-	if (dst) {
-		strcpy(dst, src);
-	}
-	return dst;
-}
-
-enum ConfigType {
-	CONFIG_TYPE_UNDEFINED,
-	CONFIG_TYPE_INTEGER,
-	CONFIG_TYPE_BOOL,
-	CONFIG_TYPE_STRING,
-	CONFIG_TYPE_FLOAT
-};
-
-union UConfigValue {
-	UConfigValue(void) {
-		m_svalue = NULL;
-	}
-	UConfigValue(config_integer_t ivalue) {
-		m_ivalue = ivalue;
-	}
-	UConfigValue(bool bvalue) {
-		m_bvalue = bvalue;
-	}
-	UConfigValue(char* svalue) {
-		m_svalue = svalue;
-	}
-	UConfigValue(float fvalue) {
-		m_fvalue = fvalue;
-	}
-
-	config_integer_t	m_ivalue;
-	bool			m_bvalue;
-	char*			m_svalue;
-	float			m_fvalue;
-};
-
-struct SConfigVariable {
-	config_index_t	               *m_iName;
-	const char* 			m_sName;
-	ConfigType				m_type;
-	UConfigValue			m_defaultValue;
-	UConfigValue			m_value;
-
-	const char* ToAscii() {
-		static char sBuf[CONFIG_MAX_STRLEN+3];
-		switch (m_type) {
-		case CONFIG_TYPE_INTEGER:
-			sprintf(sBuf, "%d", m_value.m_ivalue);
-			return sBuf;
-		case CONFIG_TYPE_BOOL:
-			sprintf(sBuf, "%d", m_value.m_bvalue);
-			return sBuf;
-		case CONFIG_TYPE_STRING:
-			if (strchr(m_value.m_svalue, ' ')) {
-				sBuf[0] = '"';
-				strncpy(&sBuf[1], m_value.m_svalue, CONFIG_MAX_STRLEN);
-				strcpy(&sBuf[
-					MIN(strlen(m_value.m_svalue), CONFIG_MAX_STRLEN)+1], "\"");
-			}
-			return m_value.m_svalue;
-		case CONFIG_TYPE_FLOAT:
-			sprintf(sBuf, "%f", m_value.m_fvalue);
-			return sBuf;
-		default:
-			return "";
-		}
-	}
-
-	bool FromAscii(const char* s) {
-		switch (m_type) {
-		case CONFIG_TYPE_INTEGER:
-			return (sscanf(s, " %i ", &m_value.m_ivalue) == 1);
-		case CONFIG_TYPE_BOOL:
-			// OPTION could add "yes/no", "true/false"
-			if (sscanf(s, " %u ", &m_value.m_ivalue) != 1) {
-				return false;
-			}
-			m_value.m_bvalue = m_value.m_ivalue ? true : false;
-			return true;
-		case CONFIG_TYPE_STRING:
-			// N.B. assuming m_svalue has been alloc'ed
-		  {
-		    size_t len = strlen(s);
-		    free(m_value.m_svalue);
-		    if (*s == '"' && s[len] == '"') {
-		      m_value.m_svalue = strdup(s + 1);
-		      m_value.m_svalue[len - 1] = '\0';
-		    } else {
-		      m_value.m_svalue = strdup(s);
-		    }
-		    if (m_value.m_svalue == NULL) {
-		      throw new CConfigException(CONFIG_ERR_MEMORY);
-		    }
-		    return true;
-		  }
-		case CONFIG_TYPE_FLOAT:
-			return (sscanf(s, " %f ", &m_value.m_fvalue) == 1);
-		default:
-			return false;
-		}
-	}
-
-	void SetToDefault(void) {
-		switch (m_type) {
-		case CONFIG_TYPE_INTEGER:
-			m_value.m_ivalue = m_defaultValue.m_ivalue;
-			break;
-		case CONFIG_TYPE_BOOL:
-			m_value.m_bvalue = m_defaultValue.m_bvalue;
-			break;
-		case CONFIG_TYPE_STRING:
-			// free(m_value.m_svalue);
-			m_value.m_svalue = stralloc(m_defaultValue.m_svalue);
-			if (m_value.m_svalue == NULL) {
-				throw new CConfigException(CONFIG_ERR_MEMORY);
-			}
-			break;
-		case CONFIG_TYPE_FLOAT:
-			m_value.m_fvalue = m_defaultValue.m_fvalue;
-			break;
-		default:
-			break;
-		} 
-	}
-
-	bool IsValueDefault(void) {
-		switch (m_type) {
-		case CONFIG_TYPE_INTEGER:
-			return m_value.m_ivalue == m_defaultValue.m_ivalue;
-		case CONFIG_TYPE_BOOL:
-			return m_value.m_bvalue == m_defaultValue.m_bvalue;
-		case CONFIG_TYPE_STRING:
-			return (strcmp(m_value.m_svalue, m_defaultValue.m_svalue) == 0);
-		case CONFIG_TYPE_FLOAT:
-			return m_value.m_fvalue == m_defaultValue.m_fvalue;
-		default:
-			return false;
-		} 
-	}
-        void CleanUpConfig(void) {
-	  if (m_type == CONFIG_TYPE_STRING) {
-	    CHECK_AND_FREE(m_value.m_svalue);
-	  }
-	}
-};
-
-struct SUnknownConfigVariable {
-  struct SUnknownConfigVariable *next;
-  char *value;
-};
-
-class CConfigSet {
-public:
-	CConfigSet(SConfigVariable* variables, 
-	  config_index_t numVariables, 
-	  const char* defaultFileName) {
-	  uint32_t size;
-		m_fileName = NULL;
-		m_debug = false;
-		m_variables = variables;
-		m_numVariables = numVariables;
-		size = sizeof(SConfigVariable) * numVariables;
-		m_variables = 
-		  (SConfigVariable*)malloc(size);
-
-		memcpy(m_variables, variables, size);
-		m_defaultFileName = strdup(defaultFileName);
-		SetToDefaults();
-		m_unknown_head = NULL;
-	};
-
-	~CConfigSet() {
-		free(m_fileName);
-		for (config_index_t i = 0; i < m_numVariables; i++) {
-		  m_variables[i].CleanUpConfig();
-		}
-		free(m_variables);
-		m_variables = NULL;
-		SUnknownConfigVariable *ptr = m_unknown_head;
-		while (ptr != NULL) {
-		  m_unknown_head = ptr->next;
-		  free(ptr->value);
-		  free(ptr);
-		  ptr = m_unknown_head;
-		}
-		CHECK_AND_FREE(m_defaultFileName);
-	}
-
-	void InitializeIndexes(void) {
-	  for (config_index_t ix = 0; ix < m_numVariables; ix++) {
-	      *m_variables[ix].m_iName = ix;
-	    }
-	}
-
-	void AddConfigVariables (SConfigVariable* vars,
-				 config_index_t numVariables) {
-	  config_index_t start = m_numVariables;
-	  uint32_t size = sizeof(SConfigVariable) * 
-	    (m_numVariables + numVariables);
-	  m_variables = (SConfigVariable*)realloc(m_variables, size);
-	  memcpy(&m_variables[m_numVariables], vars, 
-		 numVariables * sizeof(SConfigVariable));
-	  m_numVariables += numVariables;
-	  SetToDefaults(start);
-	}
-
-	const char* GetFileName() {
-		return m_fileName;
-	}
-
-	inline void CheckIName(config_index_t iName) {
-		if (iName >= m_numVariables) {
-			throw new CConfigException(CONFIG_ERR_INAME);
-		}
-		if (*m_variables[iName].m_iName != iName) {
-			throw new CConfigException(CONFIG_ERR_INAME);
-		}
-	}
-
-	inline void CheckIntegerType(config_index_t iName) {
-		if (m_variables[iName].m_type != CONFIG_TYPE_INTEGER) {
-			throw new CConfigException(CONFIG_ERR_TYPE);
-		}
-	}
-
-	inline void CheckBoolType(config_index_t iName) {
-		if (m_variables[iName].m_type != CONFIG_TYPE_BOOL) {
-			throw new CConfigException(CONFIG_ERR_TYPE);
-		}
-	}
-
-	inline void CheckStringType(config_index_t iName) {
-		if (m_variables[iName].m_type != CONFIG_TYPE_STRING) {
-			throw new CConfigException(CONFIG_ERR_TYPE);
-		}
-	}
-
-	inline void CheckFloatType(config_index_t iName) {
-		if (m_variables[iName].m_type != CONFIG_TYPE_FLOAT) {
-			throw new CConfigException(CONFIG_ERR_TYPE);
-		}
-	}
-
-	inline bool IsDefault (const config_index_t iName) {
-#if CONFIG_SAFETY
-	  CheckIName(iName);
-	  CheckIntegerType(iName);
-#endif
-	  return m_variables[iName].IsValueDefault();
-	};
-
-	inline config_integer_t GetIntegerValue(const config_index_t iName) {
-#if CONFIG_SAFETY
-		CheckIName(iName);
-		CheckIntegerType(iName);
-#endif
-		return m_variables[iName].m_value.m_ivalue;
-	}
-
-	inline void SetIntegerValue(const config_index_t iName, 
-	  config_integer_t ivalue) {
-#if CONFIG_SAFETY
-		CheckIName(iName);
-		CheckIntegerType(iName);
-#endif
-		m_variables[iName].m_value.m_ivalue = ivalue;
-	}
-
-	inline bool GetBoolValue(const config_index_t iName) {
-#if CONFIG_SAFETY
-		CheckIName(iName);
-		CheckBoolType(iName);
-#endif
-		return m_variables[iName].m_value.m_bvalue;;
-	}
-
-	inline void SetBoolValue(const config_index_t iName, bool bvalue) {
-#if CONFIG_SAFETY
-		CheckIName(iName);
-		CheckBoolType(iName);
-#endif
-		m_variables[iName].m_value.m_bvalue = bvalue;
-	}
-
-	inline char* GetStringValue(const config_index_t iName) {
-#if CONFIG_SAFETY
-		CheckIName(iName);
-		CheckStringType(iName);
-#endif
-		return m_variables[iName].m_value.m_svalue;
-	}
-
-	inline void SetStringValue(const config_index_t iName, const char* svalue) {
-		printf ( "setting variable : %d to : %s\n", iName, svalue );  
-#if CONFIG_SAFETY
-		CheckIName(iName);
-		CheckStringType(iName);
-#endif
-		if (svalue == m_variables[iName].m_value.m_svalue) {
-			return;
-		}
-		// free(m_variables[iName].m_value.m_svalue);
-		m_variables[iName].m_value.m_svalue = stralloc(svalue);
-		if (m_variables[iName].m_value.m_svalue == NULL) {
-			throw new CConfigException(CONFIG_ERR_MEMORY);
-		}
-	}
-
-	inline float GetFloatValue(const config_index_t iName) {
-#if CONFIG_SAFETY
-		CheckIName(iName);
-		CheckFloatType(iName);
-#endif
-		return m_variables[iName].m_value.m_fvalue;
-	}
-
-	inline void SetFloatValue(const config_index_t iName, float fvalue) {
-#if CONFIG_SAFETY
-		CheckIName(iName);
-		CheckFloatType(iName);
-#endif
-		m_variables[iName].m_value.m_fvalue = fvalue;
-	}
-
-	void SetToDefaults(int start = 0) {
-		for (config_index_t i = start; i < m_numVariables; i++) {
-			m_variables[i].SetToDefault();
-		}
-	}
-
-	void SetToDefault(const config_index_t iName) {
-	  m_variables[iName].SetToDefault();
-	}
-
-	void ProcessLine (char *line) {
-	// comment
-	  if (line[0] == '#') {
-	    return;
-	  }
-	  char* s = line;
-	  while (*s != '\0') s++;
-	  s--;
-	  while (isspace(*s)) {
-	    *s = '\0';
-	    s--;
-	  }
-	  s = line;
-
-	  SConfigVariable* var = FindByName(strsep(&s, "="));
-	  if (var == NULL || s == NULL) {
-	    if (s != NULL) {
-	      *(s - 1) = '='; // restore seperation character
-	      SUnknownConfigVariable *ptr;
-	      ptr = MALLOC_STRUCTURE(SUnknownConfigVariable);
-	      ptr->next = m_unknown_head;
-	      ptr->value = strdup(line);
-	      m_unknown_head = ptr;
-	    }
-	    if (m_debug) {
-	      fprintf(stderr, "bad config line %s\n", s);  
-	    }
-	    return;
-	  }
-	  if (!var->FromAscii(s)) {
-	    if (m_debug) {
-	      fprintf(stderr, "bad config value in line %s\n", s);  
-	    }
-	  }
-	}
-
-	bool ReadFromFile(const char* fileName) {
-		free(m_fileName);
-		m_fileName = stralloc(fileName);
-		FILE* pFile = fopen(fileName, "r");
-		if (pFile == NULL) {
-			if (m_debug) {
-				fprintf(stderr, "couldn't open file %s\n", fileName);
-			}
-			return false;
-		}
-		char line[256];
-		while (fgets(line, sizeof(line), pFile)) {
-		  ProcessLine(line);
-		}
-		fclose(pFile);
-		return true;
-	}
-
-	bool WriteToFile(const char* fileName, bool allValues = false) {
-		FILE* pFile = fopen(fileName, "w");
-		config_index_t i;
-		SConfigVariable *var;
-		SUnknownConfigVariable *ptr;
-
-		if (pFile == NULL) {
-			if (m_debug) {
-				fprintf(stderr, "couldn't open file %s\n", fileName);
-			}
-			return false;
-		}
-		for (i = 0; i < m_numVariables; i++) {
-			var = &m_variables[i];
-			if (allValues || !var->IsValueDefault()) {
-				fprintf(pFile, "%s=%s\n", var->m_sName, var->ToAscii());
-			}
-		}
-		ptr = m_unknown_head;
-		while (ptr != NULL) {
-		  fprintf(pFile, "%s\n", ptr->value);
-		  ptr = ptr->next;
-		}
-		fclose(pFile);
-		return true;
-	}
-
-	bool ReadDefaultFile(void) {
-		return ReadFromFile(m_defaultFileName);
-	}
-	bool WriteDefaultFile(void) {
-		return WriteToFile(m_defaultFileName);
-	}
-
-	void SetDebug(bool debug = true) {
-		m_debug = debug;
-	}
-
-protected:
-	SConfigVariable* FindByName(const char* sName) {
-		for (config_index_t i = 0; i < m_numVariables; i++) {
-			if (!strcasecmp(sName, m_variables[i].m_sName)) {
-				return &m_variables[i];
-			}
-		}
-		return NULL;
-	};
-
-protected:
-	SConfigVariable*	m_variables;
-	config_index_t		m_numVariables;
-	const char*			m_defaultFileName;
-	bool 				m_debug;
-	char*				m_fileName;
-	SUnknownConfigVariable *m_unknown_head;
-};
-
-// To define configuration variables - first DECLARE_CONFIG in a
-// .h file.  Then in either a C++ or h file, define a static array
-// of configuration variables using CONFIG_BOOL, CONFIG_FLOAT, CONFIG_INT
-// or CONFIG_STRING.  You can include the .h anywhere you use the variable - 
-// in a .cpp, you must include the .h file with DECLARE_CONFIG_VARIABLES
-// defined before the .h file.  Note - if you're already including mp4live.h, 
-// you need to #define the DECLARE_CONFIG_VARIABLES after the include.
-//
-// Note - you want to add the config variables BEFORE the ReadFromFile
-// call
-#ifdef DECLARE_CONFIG_VARIABLES
-#define DECLARE_CONFIG(a) config_index_t (a);
-#else
-#define DECLARE_CONFIG(a) extern config_index_t (a);
-#endif
-
-#define CONFIG_BOOL(var, name, defval) \
- { &(var), (name), CONFIG_TYPE_BOOL, (defval), }
-#define CONFIG_FLOAT(var, name, defval) \
- { &(var), (name), CONFIG_TYPE_FLOAT,(float) (defval), }
-#define CONFIG_INT(var, name, defval) \
- { &(var), (name), CONFIG_TYPE_INTEGER,(config_integer_t) (defval), }
-#define CONFIG_STRING(var, name, defval) \
- { &(var), (name), CONFIG_TYPE_STRING, (defval), }
-
-
-#endif /* __CONFIG_SET_H__ */
diff --git a/externals/pidip/include/pdp_mp4playermedia.h b/externals/pidip/include/pdp_mp4playermedia.h
deleted file mode 100644
index 025fb5761cdd5c783fd0df673bae965254fda17f..0000000000000000000000000000000000000000
--- a/externals/pidip/include/pdp_mp4playermedia.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *              Bill May        wmay@cisco.com
- *
- * Adapted to PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-/*
- * player_media.h - provides CPlayerMedia class, which defines the
- * interface to a particular media steam.
- */
-
-#ifndef __PLAYER_MEDIA_H__
-#define __PLAYER_MEDIA_H__
-
-#include <SDL.h>
-#include <SDL_thread.h>
-#include <sdp/sdp.h>
-#include <rtsp/rtsp_client.h>
-#include <rtp/rtp.h>
-#include "our_bytestream.h"
-#include "our_msg_queue.h"
-#include "codec_plugin.h"
-
-class CPlayerSession;
-class CPDPAudioSync;
-class CPDPVideoSync;
-class C2ConsecIpPort;
-class COurInByteStream;
-class CRtpByteStreamBase;
-
-class CPlayerMedia {
- public:
-  CPlayerMedia(CPlayerSession *p);
-  ~CPlayerMedia();
-  /* API routine - create - for RTP stream */
-  int create_streaming(media_desc_t *sdp_media,
-		       char *errmsg,
-		       uint32_t errlen,
-		       int on_demand,
-		       int use_rtsp,
-		       int media_number_in_session);
-  /* API routine - create - where we provide the bytestream */
-  int create(COurInByteStream *b, 
-	     int is_video, 
-	     char *errmsg = NULL, 
-	     uint32_t errlen = 0, 
-	     int streaming = 0);
-  /* API routine - play, pause */
-  int do_play(double start_time_offset, char *errmsg, uint32_t errlen);
-  int do_pause(void);
-  int is_video(void) { return (m_is_video); };
-  double get_max_playtime(void);
-  /* API routine - interface for decoding start/continue */
-  void start_decoding(void);
-  void bytestream_primed(void); 
-  /* API routine - ip port information */
-  uint16_t get_our_port (void) { return m_our_port; };
-  void set_server_port (uint16_t port) { m_server_port = port; };
-  uint16_t get_server_port (void) { return m_server_port; };
-
-  media_desc_t *get_sdp_media_desc (void) { return m_media_info; };
-  void set_source_addr (char *s)
-    {
-      if (m_source_addr != NULL) free(m_source_addr);
-      m_source_addr = s;
-    }
-  const char *get_source_addr(void);
-  CPlayerMedia *get_next (void) { return m_next; };
-  void set_next (CPlayerMedia *newone) { m_next = newone; };
-  int decode_thread(void);
-
-  /* Public RTP routines  - receive thread, callback, and routines to
-   * pass information from rtsp to rtp byte stream
-   */
-  int recv_thread(void);
-  void recv_callback(struct rtp *session, rtp_event *e);
-  void set_rtp_ssrc (uint32_t ssrc)
-    { m_rtp_ssrc = ssrc; m_rtp_ssrc_set = TRUE;};
-  void set_rtp_base_ts(uint32_t time);
-  void set_rtp_base_seq(uint16_t seq);
-  
-  void set_video_sync(CPDPVideoSync *p) {m_video_sync = p;};
-  void set_audio_sync(CPDPAudioSync *p) {m_audio_sync = p;};
-
-  const video_info_t *get_video_info (void) { return m_video_info; };
-  const audio_info_t *get_audio_info (void) { return m_audio_info; };
-
-  int create_video_plugin(const codec_plugin_t *p,
-			  const char *compressor, 
-			  int profile, 
-			  int type, 
-			  format_list_t *sdp_media,
-			  video_info_t *video,
-			  const uint8_t *user_data,
-			  uint32_t userdata_size);
-  int create_audio_plugin(const codec_plugin_t *p,
-			  const char *compressor, 
-			  int profile, 
-			  int type, 
-			  format_list_t *sdp_media,
-			  audio_info_t *audio,
-			  const uint8_t *user_data,
-			  uint32_t userdata_size);
-  void set_plugin_data (const codec_plugin_t *p, 
-			codec_data_t *d, 
-			video_vft_t *v, 
-			audio_vft_t *a);
-  int get_plugin_status(char *buffer, uint32_t buflen);
-  void set_user_data (const uint8_t *udata, int length) {
-    m_user_data = udata;
-    m_user_data_size = length;
-  }
-  rtsp_session_t *get_rtsp_session(void) { return m_rtsp_session; };
-  void rtp_init_tcp(void);
-  void rtp_periodic(void);
-  void rtp_start(void);
-  void rtp_end(void);
-  int rtp_receive_packet(unsigned char interleaved, struct rtp_packet *, int len);
-  int rtcp_send_packet(uint8_t *buffer, int buflen);
-  int get_rtp_media_number (void) { return m_rtp_media_number_in_session; };
-  void syncronize_rtp_bytestreams(rtcp_sync_t *sync);
- private:
-  int create_common(int is_video, char *errmsg, uint32_t errlen);
-  void wait_on_bytestream(void);
-  int m_streaming;
-  int m_is_video;
-  int m_paused;
-  CPlayerMedia *m_next;
-  CPlayerSession *m_parent;
-  media_desc_t *m_media_info;
-  format_list_t *m_media_fmt;        // format currently running.
-  rtsp_session_t *m_rtsp_session;
-  C2ConsecIpPort *m_ports;
-  in_port_t m_our_port;
-  in_port_t m_server_port;
-  char *m_source_addr;
-
-  time_t m_start_time;
-  int m_stream_ondemand;
-  int m_sync_time_set;
-  uint64_t m_sync_time_offset;
-  uint32_t m_rtptime_tickpersec;
-  double m_play_start_time;
-  // Receive thread variables
-  SDL_Thread *m_recv_thread;
-
-  /*************************************************************************
-   * RTP variables - used to pass info to the bytestream
-   *************************************************************************/
-  int m_rtp_ondemand;
-  int m_rtp_use_rtsp;
-  int m_rtp_media_number_in_session;
-  int m_rtp_buffering;
-  struct rtp *m_rtp_session;
-  CRtpByteStreamBase *m_rtp_byte_stream;
-  CMsgQueue m_rtp_msg_queue;
-
-  rtp_packet *m_head, *m_tail; 
-  uint32_t m_rtp_queue_len;
-  
-  // from rtsp...
-  int m_rtp_ssrc_set;
-  uint32_t m_rtp_ssrc;
-  int m_rtsp_base_ts_received;
-  uint32_t m_rtp_base_ts;
-  int m_rtsp_base_seq_received;
-  uint16_t m_rtp_base_seq;
-
-  int determine_payload_type_from_rtp(void);
-  void create_rtp_byte_stream(uint8_t payload, uint64_t tps, format_list_t *fmt);
-  void clear_rtp_packets(void);
-
-  // from rtcp, for broadcast, in case we get an RTCP before we determine
-  // the payload type
-  uint32_t m_rtcp_ntp_frac;
-  uint32_t m_rtcp_ntp_sec;
-  uint32_t m_rtcp_rtp_ts;
-  int m_rtcp_received;
-
-  volatile int m_rtp_inited;
-
-  /*************************************************************************
-   * Decoder thread variables
-   *************************************************************************/
-  SDL_Thread *m_decode_thread;
-  volatile int m_decode_thread_waiting;
-  SDL_sem *m_decode_thread_sem;
-
-  const codec_plugin_t *m_plugin;
-  codec_data_t *m_plugin_data;
-  
-  // State change variable
-  CMsgQueue m_decode_msg_queue;
-  // Private routines
-  int process_rtsp_transport(char *transport);
-  CPDPAudioSync *m_audio_sync;
-  CPDPVideoSync *m_video_sync;
-  void parse_decode_message(int &thread_stop, int &decoding);
-  COurInByteStream *m_byte_stream;
-  video_info_t *m_video_info;
-  audio_info_t *m_audio_info;
-
-  const uint8_t *m_user_data;
-  int m_user_data_size;
-
-};
-
-int pdp_process_rtsp_rtpinfo(char *rtpinfo, CPlayerSession *session, CPlayerMedia *media);
-
-extern audio_vft_t audio_vft;
-extern video_vft_t video_vft;
-
-#define media_message(loglevel, fmt...) message(loglevel, "media", fmt)
-
-#endif
diff --git a/externals/pidip/include/pdp_mp4playersession.h b/externals/pidip/include/pdp_mp4playersession.h
deleted file mode 100644
index 5979aad8c31ddabae0141c518cde2d22d722f7b6..0000000000000000000000000000000000000000
--- a/externals/pidip/include/pdp_mp4playersession.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *              Bill May        wmay@cisco.com
- *              video aspect ratio by:
- *              Peter Maersk-Moller peter @maersk-moller.net
- *              
- * Adapted for PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- *
- */
-
-/*
- * pdp_mp4playersession.h - provides definitions for a CPlayerSession.
- * CPlayerSession is the base class that provides a combination audio/video
- * stream/file playback.
- * This class should be the main interface between any outside functionality
- * and the player window.
- */
-
-
-#ifndef __PDP_MP4PLAYERSESSION_H__
-#define __PDP_MP4PLAYERSESSION_H__
-
-struct rtcp_sync_t;
-typedef struct rtcp_sync_t rtcp_sync_t;
-
-#include <rtsp/rtsp_client.h>
-#include <sdp/sdp.h>
-#include "our_msg_queue.h"
-#include "ip_port.h"
-#include "pdp_mp4player~.h"
-
-class CPlayerMedia;
-class CPDPAudioSync;
-class CPDPVideoSync;
-
-typedef enum {
-  SESSION_PAUSED,
-  SESSION_BUFFERING,
-  SESSION_PLAYING,
-  SESSION_DONE
-} session_state_t;
-
-typedef struct rtcp_sync_t {
-  uint64_t first_pak_ts;
-  uint64_t rtcp_ts;
-  uint32_t first_pak_rtp_ts;
-  uint32_t rtcp_rtp_ts;
-  uint64_t timescale;
-} rtcp_sync_t;
-
-typedef void (*media_close_callback_f)(void *);
-
-class CPlayerSession {
- public:
-  /*
-   * API routine - create player session.
-   */
-  CPlayerSession(CMsgQueue *master_queue,
-		 SDL_sem *master_sem,
-		 const char *name,
-                 t_pdp_mp4player *pdp_father);
-  /*
-   * API routine - destroy session - free all sub-structures, cleans
-   * up rtsp, etc
-   */
-  ~CPlayerSession();
-  /*
-   * API routine - create a rtsp session with the url.  After that, you
-   * need to associate media
-   */
-  int create_streaming_broadcast(session_desc_t *sdp,
-				 char *ermsg,
-				 uint32_t errlen);
-  int create_streaming_ondemand(const char *url,
-				char *errmsg,
-				uint32_t errlen,
-				int use_rtp_tcp);
-  /*
-   * API routine - play at time.  If start_from_begin is FALSE, start_time
-   * and we're paused, it will continue from where it left off.
-   */
-  int play_all_media(int start_from_begin = FALSE, double start_time = 0.0,
-		     char *errmsg = NULL, uint32_t errlen = 0);
-  /*
-   * API routine - pause
-   */
-  int pause_all_media(void);
-  /*
-   * API routine for media set up - associate a created
-   * media with the session.
-   */
-  void add_media(CPlayerMedia *m);
-  /*
-   * API routine - returns sdp info for streamed session
-   */
-  session_desc_t *get_sdp_info (void) { return m_sdp_info;} ;
-  rtsp_client_t *get_rtsp_client (void) { return m_rtsp_client; };
-  /*
-   * API routine - after setting up media, need to set up sync thread
-   */
-  void set_up_sync_thread(void);
-  CPDPVideoSync *set_up_video_sync(void);
-  CPDPAudioSync *set_up_audio_sync(void);
-  /*
-   * API routine - get the current time
-   */
-  uint64_t get_playing_time (void) {
-    if (m_streaming && session_is_seekable() == 0) {
-      return (m_current_time - m_first_time_played);
-    }
-    return (m_current_time);
-  };
-  /*
-   * API routine - get max play time
-   */
-  double get_max_time (void);
-  /*
-   * Other API routines
-   */
-  int session_has_audio(void);
-  int session_has_video(void);
-  void set_audio_volume(int volume);
-  int get_audio_volume(void) { return m_audio_volume; };
-  void session_set_seekable (int seekable) {
-    m_seekable = seekable;
-  };
-  int session_is_seekable (void) {
-    return (m_seekable);
-  };
-  session_state_t get_session_state(void) {
-    return (m_session_state);
-  }
-  void set_media_close_callback (media_close_callback_f mccf,
-				 void *mccd) {
-    m_media_close_callback = mccf;
-    m_media_close_callback_data = mccd;
-  }
-  int session_is_network (int &on_demand, int &rtp_over_rtsp) {
-    if (m_streaming == 0) {
-      return 0;
-    }
-    if (m_seekable) { 
-      on_demand = 1;
-      rtp_over_rtsp = m_rtp_over_rtsp;
-    } else {
-      on_demand = 0;
-      rtp_over_rtsp = 0;
-    }
-	return 1;
-  }
-  /*
-   * Non-API routines - used for c interfaces, for sync task APIs.
-   */
-  void wake_sync_thread (void) {
-    SDL_SemPost(m_sync_sem);
-  }
-  int send_sync_thread_a_message(uint32_t msgval,
-				 unsigned char *msg = NULL,
-				 uint32_t msg_len = 0)
-    {
-      return (m_sync_thread_msg_queue.send_message(msgval, msg, msg_len, m_sync_sem));
-    };
-  int sync_thread(int state);
-  uint64_t get_current_time(void);
-  void audio_is_ready (uint64_t latency, uint64_t time);
-  void adjust_start_time(int64_t delta);
-  int session_control_is_aggregate (void) {
-    return m_session_control_is_aggregate;
-  };
-  void set_session_control (int is_aggregate) {
-    m_session_control_is_aggregate = is_aggregate;
-  }
-  CPlayerMedia *rtsp_url_to_media (const char *url);
-  int set_session_desc(int line, const char *desc);
-  const char *get_session_desc(int line);
-  void streaming_media_set_up(void) { m_streaming_media_set_up = 1; };
-  CIpPort **get_unused_ip_port_ptr(void) { return &m_unused_ports; };
-  void syncronize_rtp_bytestreams(rtcp_sync_t *sync);
- private:
-  int process_msg_queue(int state);
-  int sync_thread_init(void);
-  int sync_thread_wait_sync(void);
-  int sync_thread_wait_audio(void);
-  int sync_thread_playing(void);
-  int sync_thread_paused(void);
-  int sync_thread_done(void);
-  const char *m_session_name;
-  const char *m_content_base;
-  int m_paused;
-  int m_streaming;
-  uint64_t m_current_time; // current time playing
-  uint64_t m_start;
-  uint64_t m_latency;
-  int m_clock_wrapped;
-  uint64_t m_play_start_time;
-  session_desc_t *m_sdp_info;
-  rtsp_client_t *m_rtsp_client;
-  CPlayerMedia *m_my_media;
-  CPDPAudioSync *m_audio_sync;
-  CPDPVideoSync *m_video_sync;
-  SDL_Thread *m_sync_thread;
-  SDL_sem *m_sync_sem;
-  CMsgQueue *m_master_msg_queue;
-  SDL_sem *m_master_msg_queue_sem;
-  CMsgQueue m_sync_thread_msg_queue;
-  range_desc_t *m_range;
-  int m_session_control_is_aggregate;
-  int m_waiting_for_audio;
-  int m_audio_volume;
-  int m_screen_scale;
-  int m_fullscreen;
-  int m_pixel_height;
-  int m_pixel_width;
-  int m_seekable;
-  volatile int m_sync_pause_done;
-  session_state_t m_session_state;
-  int m_hardware_error;
-  #define SESSION_DESC_COUNT 4
-  const char *m_session_desc[SESSION_DESC_COUNT];
-  media_close_callback_f m_media_close_callback;
-  void *m_media_close_callback_data;
-  int m_streaming_media_set_up;
-  CIpPort *m_unused_ports;
-  int m_rtp_over_rtsp;
-  uint64_t m_first_time_played;
-  bool m_have_audio_rtcp_sync;
-  rtcp_sync_t m_audio_rtcp_sync;
-  t_pdp_mp4player *m_father;
-};
-
-int pdp_sync_thread(void *data);
-
-#endif
diff --git a/externals/pidip/include/pdp_mp4player~.h b/externals/pidip/include/pdp_mp4player~.h
deleted file mode 100644
index 412dff5569f0786aa88f63627ef2c6180e42e441..0000000000000000000000000000000000000000
--- a/externals/pidip/include/pdp_mp4player~.h
+++ /dev/null
@@ -1,120 +0,0 @@
-
-#ifndef __PDP_MP4PLAYER__
-#define __PDP_MP4PLAYER__
-
-struct pdp_mp4player_struct;
-typedef struct pdp_mp4player_struct t_pdp_mp4player;
-
-#include "pdp.h"
-#include "yuv.h"
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <math.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include "pdp_mp4playersession.h"
-#include "pdp_mp4playermedia.h"
-#include "pdp_mp4videosync.h"
-#include "pdp_mp4audiosync.h"
-#include "media_utils.h"
-#include "codec_plugin_private.h"
-#include "our_config_file.h"
-#include "player_util.h"
-#include <rtp/debug.h>
-#include <libhttp/http.h>
-
-
-/* mpeg4ip includes taken from the source tree ( not exported ) */
-#include <mp4.h>
-#undef  DECLARE_CONFIG_VARIABLES
-#include "config_set.h"
-
-#undef CONFIG_BOOL
-#define CONFIG_BOOL(var, name, defval) \
- { &(var), (name), CONFIG_TYPE_BOOL, (defval), (defval) }
-#undef CONFIG_FLOAT
-#define CONFIG_FLOAT(var, name, defval) \
-  { &(var), (name), CONFIG_TYPE_FLOAT,(float) (defval), (float) (defval) }
-#undef CONFIG_INT
-#define CONFIG_INT(var, name, defval) \
-   { &(var), (name), CONFIG_TYPE_INTEGER,(config_integer_t) (defval), (config_integer_t)(defval) }
-#undef CONFIG_STRING
-#define CONFIG_STRING(var, name, defval) \
-    { &(var), (name), CONFIG_TYPE_STRING, (defval), (defval) }
-
-#include "pdp_mp4config.h"
-
-#undef   DECLARE_CONFIG_VARIABLES
-#ifndef debug_message
-#define debug_message post
-#endif
-#include "rtp_transmitter.h"
-#include "pdp_mp4videosource.h"
-#include "pdp_mp4audiosource.h"
-
-#define DEFAULT_CHANNELS 2
-#define MIN_PRIORITY -20
-#define DEFAULT_PRIORITY 0
-#define MAX_PRIORITY 20
-
-#define VIDEO_BUFFER_SIZE (1024*1024)
-#define MAX_AUDIO_PACKET_SIZE (128 * 1024)
-#define MIN_AUDIO_SIZE (64 * 1024)
-#define AUDIO_PACKET_SIZE (2*1152)
-
-typedef struct pdp_mp4player_struct
-{
-    t_object x_obj;
-    t_float x_f;
-
-    t_int x_packet;
-    t_int x_dropped;
-
-    t_pdp *x_header;
-    short int *x_data;
-    t_int x_vwidth;
-    t_int x_vheight;
-    t_int x_vsize;
-
-    t_outlet *x_pdp_out;           // output decoded pdp packets
-    t_outlet *x_outlet_left;       // left audio output
-    t_outlet *x_outlet_right;      // right audio output
-    t_outlet *x_outlet_streaming;  // indicates the action of streaming
-    t_outlet *x_outlet_nbframes;   // number of frames emitted
-    t_outlet *x_outlet_framerate;  // real framerate
-
-    char  *x_url;
-    t_int x_rtpovertcp;     // flag to bypass certain firewalls (tcp mode)
-    t_int x_streaming;      // streaming flag
-    t_int x_nbframes;       // number of frames emitted
-    t_int x_framerate;      // framerate
-    t_int x_samplerate;     // audio sample rate
-    t_int x_audiochannels;  // audio channels
-    t_int x_audioon;        // enough audio data to start playing
-    t_int x_blocksize;      // audio block size
-    struct timeval x_starttime; // streaming starting time
-    t_int x_cursec;         // current second
-    t_int x_secondcount;    // number of frames received in the current second
-    pthread_t x_decodechild;// stream decoding thread
-    t_int x_priority;       // priority of decoding thread
-    t_int x_newpicture;     // flag indicating a new picture
-
-    short int *x_datav;     // video data from mpeg4hippies
-
-      /* audio structures */
-    t_int x_audio;           // flag to activate the decoding of audio
-    short x_audio_in[4*MAX_AUDIO_PACKET_SIZE]; /* buffer for resampled PCM audio */
-    t_int x_audioin_position; // writing position for incoming audio
-
-      /* mpeg4hippies structures */
-    CPlayerSession      *x_psession;
-    CMsgQueue           x_queue;
-    SDL_sem             *x_psem;
-    t_int x_decodingstate;    // internal decoding state
-
-} t_pdp_mp4player;
-
-#endif
-
diff --git a/externals/pidip/include/pdp_mp4rtpbytestream.h b/externals/pidip/include/pdp_mp4rtpbytestream.h
deleted file mode 100644
index bc087eab26ae47dac7f2dc5bfba9cea74d7ecdf9..0000000000000000000000000000000000000000
--- a/externals/pidip/include/pdp_mp4rtpbytestream.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *              Bill May        wmay@cisco.com
- */
-/*
- * player_rtp_bytestream.h - provides an RTP bytestream for the codecs
- * to access
- */
-
-#ifndef __RTP_BYTESTREAM_H__
-#define __RTP_BYTESTREAM_H__ 1
-#include "our_bytestream.h"
-#include "player_util.h"
-#include "rtp/rtp.h"
-#include <SDL.h>
-#include <SDL_thread.h>
-#include <sdp/sdp.h>
-
-class CRtpByteStreamBase : public COurInByteStream
-{
- public:
-  CRtpByteStreamBase(const char *name,
-		     format_list_t *fmt,
-		     unsigned int rtp_pt,
-		     int ondemand,
-		     uint64_t tickpersec,
-		     rtp_packet **head, 
-		     rtp_packet **tail,
-		     int rtp_seq_set,
-		     uint16_t rtp_base_seq,
-		     int rtp_ts_set,
-		     uint32_t rtp_base_ts,
-		     int rtcp_received,
-		     uint32_t ntp_frac,
-		     uint32_t ntp_sec,
-		     uint32_t rtp_ts);
-
-  ~CRtpByteStreamBase();
-  int eof (void) { return m_eof; };
-  virtual void reset(void) {
-    player_debug_message("rtp bytestream reset");
-    init();
-    m_buffering = 0;
-    m_base_ts_set = 0;
-    m_rtp_base_seq_set = 0;
-
-  };
-  void set_skip_on_advance (uint32_t bytes_to_skip) {
-    m_skip_on_advance_bytes = bytes_to_skip;
-  };
-  double get_max_playtime (void) { 
-    if (m_fmt->media->media_range.have_range) {
-      return m_fmt->media->media_range.range_end;
-    } else if (m_fmt->media->parent->session_range.have_range) {
-      return m_fmt->media->parent->session_range.range_end;
-    }
-    return 0.0; 
-  };
-
-  // various routines for RTP interface.
-  void set_rtp_base_ts(uint32_t t, uint64_t value = 0) { 
-    m_base_ts_set = true; 
-    m_base_rtp_ts = t;
-    m_base_ts = value;
-  };
-  void set_rtp_base_seq(uint16_t s) { 
-    m_rtp_base_seq_set = true;
-    m_rtp_base_seq = s;
-  };
-  int can_skip_frame (void) { return 1; } ;
-  void set_wallclock_offset (uint64_t wclock, uint32_t rtp_ts);
-  int rtp_ready (void) {
-    return true;
-  };
-  void recv_callback(struct rtp *session, rtp_event *e);
-  virtual void flush_rtp_packets(void);
-  int recv_task(int waiting);
-  uint32_t get_last_rtp_timestamp (void) {return m_rtptime_last; };
-  void remove_packet_rtp_queue(rtp_packet *pak, int free);
-  void pause(void);
-  void set_sync(CPlayerSession *psptr);
-
-  void syncronize(rtcp_sync_t *sync);
- protected:
-  bool check_seq (uint16_t seq);
-  void set_last_seq(uint16_t seq);
-  void init(void);
-  // Make sure all classes call this to calculate real time.
-  uint64_t rtp_ts_to_msec(uint32_t rtp_ts, uint64_t uts, uint64_t &wrap_offset);
-  rtp_packet *m_head, *m_tail;
-  int m_offset_in_pak;
-  uint32_t m_skip_on_advance_bytes;
-  uint32_t m_ts;
-  uint64_t m_total;
-  bool m_base_ts_set;
-  uint32_t m_base_rtp_ts;
-  uint64_t m_base_ts;
-  bool m_rtp_base_seq_set;
-  uint16_t m_rtp_base_seq;
-  uint64_t m_timescale;
-  int m_stream_ondemand;
-  uint64_t m_wrap_offset;
-  bool m_rtcp_received;
-  uint64_t m_rtcp_ts;
-  uint32_t m_rtcp_rtp_ts;
-  uint64_t m_wallclock_offset_wrap;
-  void calculate_wallclock_offset_from_rtcp(uint32_t ntp_frac,
-					    uint32_t ntp_sec,
-					    uint32_t rtp_ts);
-  SDL_mutex *m_rtp_packet_mutex;
-  int m_buffering;
-  uint64_t m_rtp_buffer_time;
-  unsigned int m_rtp_pt;
-  virtual int check_rtp_frame_complete_for_payload_type(void);
-  virtual void rtp_done_buffering(void) {};
-  uint32_t m_rtptime_last;
-  int m_recvd_pak;
-  int m_recvd_pak_timeout;
-  uint64_t m_recvd_pak_timeout_time;
-  uint64_t m_last_realtime;
-  format_list_t *m_fmt;
-  int m_eof;
-  int m_rtpinfo_set_from_pak;
-  uint16_t m_next_seq;
-  bool m_have_first_pak_ts;
-  uint64_t m_first_pak_ts;
-  uint32_t m_first_pak_rtp_ts;
-  CPlayerSession *m_psptr;
-  bool m_have_sync_info;
-  rtcp_sync_t m_sync_info;
-};
-
-class CRtpByteStream : public CRtpByteStreamBase
-{
- public:
-  CRtpByteStream(const char *name,
-		 format_list_t *fmt,
-		 unsigned int rtp_pt,
-		 int ondemand,
-		 uint64_t tickpersec,
-		 rtp_packet **head, 
-		 rtp_packet **tail,
-		 int rtp_seq_set,
-		 uint16_t rtp_base_seq,
-		 int rtp_ts_set,
-		 uint32_t rtp_base_ts,
-		 int rtcp_received,
-		 uint32_t ntp_frac,
-		 uint32_t ntp_sec,
-		 uint32_t rtp_ts);
-  ~CRtpByteStream();
-  uint64_t start_next_frame(uint8_t **buffer, uint32_t *buflen,
-			    void **userdata);
-  int skip_next_frame(uint64_t *ts, int *havesync, uint8_t **buffer,
-		      uint32_t *buflen, void **userdata = NULL);
-  void used_bytes_for_frame(uint32_t bytes);
-  int have_no_data(void);
-  void flush_rtp_packets(void);
-  void reset(void);
- protected:
-  uint8_t *m_buffer;
-  uint32_t m_buffer_len;
-  uint32_t m_buffer_len_max;
-  uint32_t m_bytes_used;
-};
-
-class CAudioRtpByteStream : public CRtpByteStream
-{
- public:
-  CAudioRtpByteStream(unsigned int rtp_pt,
-		      format_list_t *fmt,
-		      int ondemand,
-		      uint64_t tickpersec,
-		      rtp_packet **head, 
-		      rtp_packet **tail,
-		      int rtp_seq_set,
-		      uint16_t rtp_base_seq,
-		      int rtp_ts_set,
-		      uint32_t rtp_base_ts,
-		      int rtcp_received,
-		      uint32_t ntp_frac,
-		      uint32_t ntp_sec,
-		      uint32_t rtp_ts);
-  ~CAudioRtpByteStream();
-  int have_no_data(void);
-  int check_rtp_frame_complete_for_payload_type(void);
-  uint64_t start_next_frame(uint8_t **buffer, uint32_t *buflen,
-			    void **userdata);
-  void reset(void);
- private:
-  rtp_packet *m_working_pak;
-};
-int add_rtp_packet_to_queue(rtp_packet *pak,
-			    rtp_packet **head,
-			    rtp_packet **tail,
-			    const char *name);
-#endif
diff --git a/externals/pidip/include/pdp_mp4videosource.h b/externals/pidip/include/pdp_mp4videosource.h
deleted file mode 100644
index 7433d33c8a37f6eb476be4546625b2532022cae3..0000000000000000000000000000000000000000
--- a/externals/pidip/include/pdp_mp4videosource.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *        Dave Mackie        dmackie@cisco.com
- *        Bill May         wmay@cisco.com
- *
- * Adapted for PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-#ifndef __PDP_MP4VIDEOSOURCE__
-#define __PDP_MP4VIDEOSOURCE__
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <linux/videodev.h>
-
-#include "media_source.h"
-#include "video_encoder.h"
-
-class CPDPVideoSource : public CMediaSource {
-public:
-    CPDPVideoSource() : CMediaSource() {
-        m_videoMap = NULL;
-        m_videoFrameMap = NULL;
-    }
-
-    bool IsDone() {
-        return false;   
-    }
-
-    float GetProgress() {
-        return 0.0;     
-    }
-
-    void ProcessVideo(u_int8_t *pY, u_int8_t *pU, u_int8_t *pV);
-
-    void DoStart(void);
-
-    void DoStop(void);
-
-protected:
-    int ThreadMain(void);
-
-    bool Init(void);
-
-    int8_t StartTimeStamp(Timestamp &frameTimestamp);
-
-    bool EndTimeStamp(int8_t frameNumber);
-
-    Timestamp CalculateVideoTimestampFromFrames (uint64_t frame) {
-      double duration = frame;
-      duration *= TimestampTicks;
-      duration /= m_videoSrcFrameRate;
-      return m_videoCaptureStartTimestamp + (Timestamp)duration;
-    }
-protected:
-    u_int8_t             m_maxPasses;
-
-    struct video_mbuf    m_videoMbuf;
-    void*                m_videoMap;
-    struct video_mmap*   m_videoFrameMap;
-    Timestamp            m_videoCaptureStartTimestamp;
-    uint64_t             m_videoFrames;
-    Duration             m_videoSrcFrameDuration;
-    int8_t               m_captureHead;
-    int8_t               m_encodeHead;
-    float                m_videoSrcFrameRate;
-    uint64_t             *m_videoFrameMapFrame;
-    Timestamp            *m_videoFrameMapTimestamp;
-    uint64_t             m_lastVideoFrameMapFrameLoaded;
-    Timestamp            m_lastVideoFrameMapTimestampLoaded;
-    bool                 m_cacheTimestamp;
-};
-
-#endif /* __PDP_MP4VIDEOSOURCE__ */
diff --git a/externals/pidip/include/pdp_mp4videosync.h b/externals/pidip/include/pdp_mp4videosync.h
deleted file mode 100644
index a1bac852fe868ea1ee5ba7f0026fcb526763c1e2..0000000000000000000000000000000000000000
--- a/externals/pidip/include/pdp_mp4videosync.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *              Bill May        wmay@cisco.com
- *              video aspect ratio by:
- *              Peter Maersk-Moller peter@maersk-moller.net
- *
- * Adapted for PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-/*
- * video.h - contains the interface class between the codec and the video
- * display hardware.
- */
-
-#ifndef __PDP_MP4VIDEOSYNC__
-#define __PDP_MP4VIDEOSYNC__
-
-#include "video.h"
-#include "pdp_mp4player~.h"
-
-class CPDPVideoSync : public CVideoSync {
- public:
-  CPDPVideoSync(CPlayerSession *psptr, t_pdp_mp4player *pdp_father);
-  ~CPDPVideoSync(void);
-  int initialize_video(const char *name);  // from sync task
-  int is_video_ready(uint64_t &disptime);  // from sync task
-  int64_t play_video_at(uint64_t current_time, // from sync task
-			 int &have_eof);
-  int get_video_buffer(uint8_t **y,
-		       uint8_t **u,
-		       uint8_t **v);
-  void filled_video_buffers(uint64_t time);
-  void set_video_frame(const uint8_t *y,      // from codec
-		       const uint8_t *u,
-		       const uint8_t *v,
-		       int m_pixelw_y,
-		       int m_pixelw_uv,
-		       uint64_t time);
-  void config (int w, int h); // from codec
-  void set_wait_sem (SDL_sem *p) { m_decode_sem = p; };  // from set up
-  void flush_decode_buffers(void);    // from decoder task in response to stop
-  void flush_sync_buffers(void);      // from sync task in response to stop
-  void play_video(void);
- private:
-  int m_video_bpp;
-  int m_video_scale;
-  int m_fullscreen;
-  unsigned int m_width, m_height;
-  int m_video_initialized;
-  int m_config_set;
-  int m_paused;
-  int m_double_width;
-  volatile int m_have_data;
-  SDL_Surface *m_screen;
-  SDL_Overlay *m_image;
-  SDL_Rect m_dstrect;
-  uint32_t m_fill_index, m_play_index;
-  int m_decode_waiting;
-  volatile int m_buffer_filled[MAX_VIDEO_BUFFERS];
-  uint8_t *m_y_buffer[MAX_VIDEO_BUFFERS];
-  uint8_t *m_u_buffer[MAX_VIDEO_BUFFERS];
-  uint8_t *m_v_buffer[MAX_VIDEO_BUFFERS];
-  uint64_t m_play_this_at[MAX_VIDEO_BUFFERS];
-  int m_dont_fill;
-  int m_pixel_width;
-  int m_pixel_height;
-  int m_max_width;
-  int m_max_height;
-  t_pdp_mp4player *m_father;
-};
-
-CPDPVideoSync *pdp_create_video_sync(CPlayerSession *psptr, t_pdp_mp4player *pdp_father);
-
-#endif
diff --git a/externals/pidip/include/pdp_streaming.h b/externals/pidip/include/pdp_streaming.h
old mode 100644
new mode 100755
diff --git a/externals/pidip/include/pidip_config.h.in b/externals/pidip/include/pidip_config.h.in
old mode 100644
new mode 100755
index f9fa6629018eddcdda5ae0d6272265c2d1c383db..a8987adcc4feeda942758999829a062e5c05954d
--- a/externals/pidip/include/pidip_config.h.in
+++ b/externals/pidip/include/pidip_config.h.in
@@ -1,20 +1,103 @@
-/* quicktime library minor version */
-#undef QUICKTIME_NEWER
+/* include/pidip_config.h.in.  Generated from configure.ac by autoheader.  */
 
-/* Define to 1 if you have image magick */
+/* dc1394 cameras interface */
+#undef HAVE_DC1394
+
+/* M$ hacked kinect interface */
+#undef HAVE_FREENECT
+
+/* OpenCV library */
+#undef HAVE_OPENCV
+
+/* augmented reality toolkit plus */
+#undef HAVE_ARTKP
+
+/* image magick capture capability */
 #undef HAVE_IMAGE_MAGICK
 
-/* Define to 1 if you have ffmpeg source tree */
-#undef HAVE_PIDIP_FFMPEG
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
 
-/* Define to 1 if you have mpeg4ip source tree */
-#undef HAVE_PIDIP_MPEG4IP
+/* Define to 1 if you have the `bz2' library (-lbz2). */
+#undef HAVE_LIBBZ2
 
-/* Define to 1 if you have video 4 linux 2 */
-#undef HAVE_V4L2
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
 
-/* Define to 1 if you have libdv for firewire camera */
+/* build pdp_ieee1394 for linux */
 #undef HAVE_LIBDV
 
-/* Define to 1 if you have libdc1394 for dc camera */
-#undef HAVE_DC1394
+/* Define to 1 if you have the `mp3lame' library (-lmp3lame). */
+#undef HAVE_LIBMP3LAME
+
+/* Define to 1 if you have the `ogg' library (-logg). */
+#undef HAVE_LIBOGG
+
+/* Define to 1 if you have the `quicktime' library (-lquicktime). */
+#undef HAVE_LIBQUICKTIME
+
+/* Define to 1 if you have the `theora' library (-ltheora). */
+#undef HAVE_LIBTHEORA
+
+/* Define to 1 if you have the `vorbis' library (-lvorbis). */
+#undef HAVE_LIBVORBIS
+
+/* Define to 1 if you have the `vorbisenc' library (-lvorbisenc). */
+#undef HAVE_LIBVORBISENC
+
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* build pdp_vloopback */
+#undef HAVE_V4L
+
+/* build pdp_v4l2 */
+#undef HAVE_V4L2
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define if using the dmalloc debugging malloc package */
+#undef WITH_DMALLOC
diff --git a/externals/pidip/include/quantum-private.h b/externals/pidip/include/quantum-private.h
deleted file mode 100644
index 53dec318688263494dfbf3e95c420277eabc0a1a..0000000000000000000000000000000000000000
--- a/externals/pidip/include/quantum-private.h
+++ /dev/null
@@ -1,731 +0,0 @@
-/*
-  Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization
-  dedicated to making software imaging solutions freely available.
-
-  You may not use this file except in compliance with the License.
-  obtain a copy of the License at
-
-    http://www.imagemagick.org/script/license.php
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
-  MagickCore quantum inline methods.
-*/
-#ifndef _MAGICKCORE_QUANTUM_PRIVATE_H
-#define _MAGICKCORE_QUANTUM_PRIVATE_H
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-typedef struct _QuantumState
-{
-  EndianType
-    endian;
-
-  double
-    minimum,
-    scale;
-
-  unsigned long
-    pixel,
-    bits;
-
-  const unsigned long
-    *mask;
-} QuantumState;
-
-static inline MagickRealType ClipToQuantum(const MagickRealType value)
-{
-  if (value <= 0.0)
-    return(0.0);
-  if (value >= QuantumRange)
-    return((MagickRealType) QuantumRange);
-  return(value);
-}
-
-static inline void InitializeQuantumState(const QuantumInfo *quantum_info,
-  const EndianType endian,QuantumState *quantum_state)
-{
-  static const unsigned long mask[32] =
-  {
-    0x00000000UL, 0x00000001UL, 0x00000003UL, 0x00000007UL, 0x0000000fUL,
-    0x0000001fUL, 0x0000003fUL, 0x0000007fUL, 0x000000ffUL, 0x000001ffUL,
-    0x000003ffUL, 0x000007ffUL, 0x00000fffUL, 0x00001fffUL, 0x00003fffUL,
-    0x00007fffUL, 0x0000ffffUL, 0x0001ffffUL, 0x0003ffffUL, 0x0007ffffUL,
-    0x000fffffUL, 0x001fffffUL, 0x003fffffUL, 0x007fffffUL, 0x00ffffffUL,
-    0x01ffffffUL, 0x03ffffffUL, 0x07ffffffUL, 0x0fffffffUL, 0x1fffffffUL,
-    0x3fffffffUL, 0x7fffffffUL
-  };
-
-  (void) ResetMagickMemory(quantum_state,0,sizeof(&quantum_state));
-  quantum_state->endian=endian;
-  quantum_state->minimum=quantum_info->minimum;
-  quantum_state->scale=quantum_info->scale;
-  quantum_state->bits=0;
-  quantum_state->mask=mask;
-}
-
-static inline void PopCharPixel(const unsigned char pixel,
-  unsigned char **pixels)
-{
-  *(*pixels)++=(unsigned char) (pixel);
-}
-
-static inline void PopDoublePixel(const QuantumState *quantum_state,
-  const double pixel,unsigned char **pixels)
-{
-  unsigned char
-    quantum[8];
-
-  *((double *) quantum)=(double) (pixel*quantum_state->scale+
-    quantum_state->minimum); 
-  if (quantum_state->endian != LSBEndian)
-    {
-      *(*pixels)++=quantum[7];
-      *(*pixels)++=quantum[6];
-      *(*pixels)++=quantum[5];
-      *(*pixels)++=quantum[4];
-      *(*pixels)++=quantum[3];
-      *(*pixels)++=quantum[2];
-      *(*pixels)++=quantum[1];
-      *(*pixels)++=quantum[0];
-      return;
-    }
-  *(*pixels)++=quantum[0];
-  *(*pixels)++=quantum[1];
-  *(*pixels)++=quantum[2];
-  *(*pixels)++=quantum[3];
-  *(*pixels)++=quantum[4];
-  *(*pixels)++=quantum[5];
-  *(*pixels)++=quantum[6];
-  *(*pixels)++=quantum[7];
-}
-
-static inline void PopFloatPixel(const QuantumState *quantum_state,
-  const float pixel,unsigned char **pixels)
-{
-  unsigned char
-    quantum[4];
-
-  *((float *) quantum)=(float) ((double) pixel*quantum_state->scale+
-    quantum_state->minimum); 
-  if (quantum_state->endian != LSBEndian)
-    {
-      *(*pixels)++=quantum[3];
-      *(*pixels)++=quantum[2];
-      *(*pixels)++=quantum[1];
-      *(*pixels)++=quantum[0];
-      return;
-    }
-  *(*pixels)++=quantum[0];
-  *(*pixels)++=quantum[1];
-  *(*pixels)++=quantum[2];
-  *(*pixels)++=quantum[3];
-}
-
-static inline void PopLongPixel(const QuantumState *quantum_state,
-  const unsigned long pixel,unsigned char **pixels)
-{
-  if (quantum_state->endian != LSBEndian)
-    {
-      *(*pixels)++=(unsigned char) ((pixel) >> 24);
-      *(*pixels)++=(unsigned char) ((pixel) >> 16);
-      *(*pixels)++=(unsigned char) ((pixel) >> 8);
-      *(*pixels)++=(unsigned char) (pixel);
-      return;
-    }
-  *(*pixels)++=(unsigned char) (pixel);
-  *(*pixels)++=(unsigned char) ((pixel) >> 8);
-  *(*pixels)++=(unsigned char) ((pixel) >> 16);
-  *(*pixels)++=(unsigned char) ((pixel) >> 24);
-}
-
-static inline void PopQuantumPixel(QuantumState *quantum_state,
-  const unsigned long depth,const unsigned long pixel,unsigned char **pixels)
-{
-  register long
-    i;
-
-  register unsigned long
-    quantum_bits;
-
-  if (quantum_state->bits == 0UL)
-    quantum_state->bits=8UL;
-  for (i=(long) depth; i > 0L; )
-  {
-    quantum_bits=(unsigned long) i;
-    if (quantum_bits > quantum_state->bits)
-      quantum_bits=quantum_state->bits;
-    i-=quantum_bits;
-    if (quantum_state->bits == 8)
-      *(*pixels)='\0';
-    quantum_state->bits-=quantum_bits;
-    *(*pixels)|=(((pixel >> i) &~ ((~0UL) << quantum_bits)) <<
-      quantum_state->bits);
-    if (quantum_state->bits == 0UL)
-      {
-        (*pixels)++;
-        quantum_state->bits=8UL;
-      }
-  }
-}
-
-static inline void PopQuantumLongPixel(QuantumState *quantum_state,
-  const unsigned long depth,const unsigned long pixel,unsigned char **pixels)
-{
-  register long
-    i;
-
-  unsigned long
-    quantum_bits;
-
-  if (quantum_state->bits == 0UL)
-    quantum_state->bits=32UL;
-  for (i=(long) depth; i > 0; )
-  {
-    quantum_bits=(unsigned long) i;
-    if (quantum_bits > quantum_state->bits)
-      quantum_bits=quantum_state->bits;
-    quantum_state->pixel|=(((pixel >> (depth-i)) &
-      quantum_state->mask[quantum_bits]) << (32UL-quantum_state->bits));
-    i-=quantum_bits;
-    quantum_state->bits-=quantum_bits;
-    if (quantum_state->bits == 0U)
-      {
-        PopLongPixel(quantum_state,quantum_state->pixel,pixels);
-        quantum_state->pixel=0U;
-        quantum_state->bits=32UL;
-      }
-  }
-}
-
-static inline void PopShortPixel(const QuantumState *quantum_state,
-  const unsigned short pixel,unsigned char **pixels)
-{
-  if (quantum_state->endian != LSBEndian)
-    {
-      *(*pixels)++=(unsigned char) ((pixel) >> 8);
-      *(*pixels)++=(unsigned char) (pixel);
-      return;
-    }
-  *(*pixels)++=(unsigned char) (pixel);
-  *(*pixels)++=(unsigned char) ((pixel) >> 8);
-}
-
-static inline unsigned char PushCharPixel(const unsigned char **pixels)
-{
-  unsigned char
-    pixel;
-
-  pixel=(unsigned char) *(*pixels)++;
-  return(pixel);
-}
-
-static inline IndexPacket PushColormapIndex(Image *image,
-  const unsigned long index)
-{
-  assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
-  if (index < image->colors)
-    return((IndexPacket) index);
-  (void) ThrowMagickException(&image->exception,GetMagickModule(),
-    CorruptImageError,"InvalidColormapIndex","`%s'",image->filename);
-  return((IndexPacket) 0);
-}
-
-static inline double PushDoublePixel(const QuantumState *quantum_state,
-  const unsigned char **pixels)
-{
-  double
-    pixel;
-
-  unsigned char
-    quantum[8];
-
-  if (quantum_state->endian != LSBEndian)
-    {
-      quantum[7]=(*(*pixels)++);
-      quantum[6]=(*(*pixels)++);
-      quantum[5]=(*(*pixels)++);
-      quantum[5]=(*(*pixels)++);
-      quantum[3]=(*(*pixels)++);
-      quantum[2]=(*(*pixels)++);
-      quantum[1]=(*(*pixels)++);
-      quantum[0]=(*(*pixels)++);
-      pixel=(*((double *) quantum));
-      pixel-=quantum_state->minimum;
-      pixel*=quantum_state->scale;
-      return(pixel);
-    }
-  quantum[0]=(*(*pixels)++);
-  quantum[1]=(*(*pixels)++);
-  quantum[2]=(*(*pixels)++);
-  quantum[3]=(*(*pixels)++);
-  quantum[4]=(*(*pixels)++);
-  quantum[5]=(*(*pixels)++);
-  quantum[6]=(*(*pixels)++);
-  quantum[7]=(*(*pixels)++);
-  pixel=(*((double *) quantum));
-  pixel-=quantum_state->minimum;
-  pixel*=quantum_state->scale;
-  return(pixel);
-}
-
-static inline float PushFloatPixel(const QuantumState *quantum_state,
-  const unsigned char **pixels)
-{
-  float
-    pixel;
-
-  unsigned char
-    quantum[4];
-
-  if (quantum_state->endian != LSBEndian)
-    {
-      quantum[3]=(*(*pixels)++);
-      quantum[2]=(*(*pixels)++);
-      quantum[1]=(*(*pixels)++);
-      quantum[0]=(*(*pixels)++);
-      pixel=(*((float *) quantum));
-      pixel-=quantum_state->minimum;
-      pixel*=quantum_state->scale;
-      return(pixel);
-    }
-  quantum[0]=(*(*pixels)++);
-  quantum[1]=(*(*pixels)++);
-  quantum[2]=(*(*pixels)++);
-  quantum[3]=(*(*pixels)++);
-  pixel=(*((float *) quantum));
-  pixel-=quantum_state->minimum;
-  pixel*=quantum_state->scale;
-  return(pixel);
-}
-
-static inline unsigned long PushLongPixel(const QuantumState *quantum_state,
-  const unsigned char **pixels)
-{
-  unsigned long
-    pixel;
-
-  if (quantum_state->endian != LSBEndian)
-    {
-      pixel=(unsigned long) (*(*pixels)++ << 24);
-      pixel|=(unsigned long) (*(*pixels)++ << 16);
-      pixel|=(unsigned long) (*(*pixels)++ << 8);
-      pixel|=(unsigned long) (*(*pixels)++);
-      return(pixel);
-    }
-  pixel=(unsigned long) (*(*pixels)++);
-  pixel|=(unsigned long) (*(*pixels)++ << 8);
-  pixel|=(unsigned long) (*(*pixels)++ << 16);
-  pixel|=(unsigned long) (*(*pixels)++ << 24);
-  return(pixel);
-}
-
-static inline unsigned long PushQuantumPixel(QuantumState *quantum_state,
-  const unsigned long depth,const unsigned char **pixels)
-{
-  register long
-    i;
-
-  register unsigned long
-    quantum_bits,
-    quantum;
-
-  quantum=0UL;
-  for (i=(long) depth; i > 0L; )
-  {
-    if (quantum_state->bits == 0UL)
-      {
-        quantum_state->pixel=(*(*pixels)++);
-        quantum_state->bits=8UL;
-      }
-    quantum_bits=(unsigned long) i;
-    if (quantum_bits > quantum_state->bits)
-      quantum_bits=quantum_state->bits;
-    i-=quantum_bits;
-    quantum_state->bits-=quantum_bits;
-    quantum=(quantum << quantum_bits) | ((quantum_state->pixel >>
-      quantum_state->bits) &~ ((~0UL) << quantum_bits));
-  }
-  return(quantum);
-}
-
-static inline unsigned long PushQuantumLongPixel(QuantumState *quantum_state,
-  const unsigned long depth,const unsigned char **pixels)
-{
-  register long
-    i;
-
-  register unsigned long
-    quantum,
-    quantum_bits;
-      
-  quantum=0UL;
-  for (i=(long) depth; i > 0; )
-  {
-    if (quantum_state->bits == 0)
-      {
-        quantum_state->pixel=PushLongPixel(quantum_state,pixels);
-        quantum_state->bits=32UL;
-      }
-    quantum_bits=(unsigned long) i;
-    if (quantum_bits > quantum_state->bits)
-      quantum_bits=quantum_state->bits;
-    quantum|=(((quantum_state->pixel >> (32UL-quantum_state->bits)) &
-      quantum_state->mask[quantum_bits]) << (depth-i));
-    i-=quantum_bits;
-    quantum_state->bits-=quantum_bits;
-  }
-  return(quantum);
-}
-
-static inline unsigned short PushShortPixel(const QuantumState *quantum_state,
-  const unsigned char **pixels)
-{
-  unsigned short
-    pixel;
-
-  if (quantum_state->endian != LSBEndian)
-    {
-      pixel=(unsigned short) (*(*pixels)++ << 8);
-      pixel|=(unsigned short) (*(*pixels)++);
-      return(pixel);
-    }
-  pixel=(unsigned short) (*(*pixels)++);
-  pixel|=(unsigned short) (*(*pixels)++ << 8);
-  return(pixel);
-}
-
-static inline Quantum ScaleAnyToQuantum(const QuantumAny quantum,
-  const unsigned long depth)
-{
-  MagickRealType
-    scale;
-
-  scale=(MagickRealType) ((double) QuantumRange/(pow(2.0,1.0*depth)-1.0));
-  return((Quantum) (scale*quantum+0.5));
-}
-
-static inline QuantumAny ScaleQuantumToAny(const Quantum quantum,
-  const unsigned long depth)
-{
-  MagickRealType
-    scale;
-
-  scale=(MagickRealType) ((double) QuantumRange/(pow(2.0,1.0*depth)-1.0));
-  return((QuantumAny) (quantum/scale+0.5));
-}
-
-#if (MAGICKCORE_QUANTUM_DEPTH == 8)
-static inline Quantum ScaleCharToQuantum(const unsigned char value)
-{
-  return((Quantum) value);
-}
-
-static inline Quantum ScaleLongToQuantum(const unsigned long value)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) ((value+8421504UL)/16843009UL));
-#else
-  return((Quantum) (value/16843008.0));
-#endif
-}
-
-static inline Quantum ScaleMapToQuantum(const MagickRealType value)
-{
-#if defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) value);
-#else
-  if (value <= 0.0)
-    return(0);
-  if (value >= MaxMap)
-    return((Quantum) QuantumRange);
-  return((Quantum) (value+0.5));
-#endif
-}
-
-static inline unsigned long ScaleQuantumToLong(const Quantum quantum)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((unsigned long) (16843009UL*quantum));
-#else
-  if (quantum <= 0.0)
-    return(0UL);
-  if ((16843008.0*quantum) >= 4294967295.0)
-    return(4294967295UL);
-  return((unsigned long) (16843008.0*quantum));
-#endif
-}
-
-static inline unsigned long ScaleQuantumToMap(const Quantum quantum)
-{
-  if (quantum <= 0)
-    return(0UL);
-  if (quantum >= (Quantum) MaxMap)
-    return((unsigned long) MaxMap);
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((unsigned long) quantum);
-#else
-  return((unsigned long) (quantum+0.5));
-#endif
-}
-
-static inline unsigned short ScaleQuantumToShort(const Quantum quantum)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((unsigned short) (257UL*quantum));
-#else
-  if (quantum <= 0.0)
-    return(0);
-  if ((257.0*quantum) >= 65535.0)
-    return(65535);
-  return((unsigned short) (257.0*quantum));
-#endif
-}
-
-static inline Quantum ScaleShortToQuantum(const unsigned short value)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) ((value+128UL)/257UL));
-#else
-  return((Quantum) (value/257.0));
-#endif
-}
-#elif (MAGICKCORE_QUANTUM_DEPTH == 16)
-static inline Quantum ScaleCharToQuantum(const unsigned char value)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) (257UL*value));
-#else
-  return((Quantum) (257.0*value));
-#endif
-}
-
-static inline Quantum ScaleLongToQuantum(const unsigned long value)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) ((value+32768UL)/65537UL));
-#else
-  return((Quantum) (value/65537.0));
-#endif
-}
-
-static inline Quantum ScaleMapToQuantum(const MagickRealType value)
-{
-#if defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) value);
-#else
-  if (value <= 0.0)
-    return(0);
-  if (value >= MaxMap)
-    return((Quantum) QuantumRange);
-  return((Quantum) (value+0.5));
-#endif
-}
-
-static inline unsigned long ScaleQuantumToLong(const Quantum quantum)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((unsigned long) (65537UL*quantum));
-#else
-  if (quantum <= 0.0)
-    return(0UL);
-  if ((65537.0*quantum) >= 4294967295.0)
-    return(4294967295UL);
-  return((unsigned long) (65537.0*quantum));
-#endif
-}
-
-static inline unsigned long ScaleQuantumToMap(const Quantum quantum)
-{
-  if (quantum <= 0)
-    return(0);
-  if ((1UL*quantum) >= MaxMap)
-    return((unsigned long) MaxMap);
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((unsigned long) quantum);
-#else
-  return((unsigned long) (quantum+0.5));
-#endif
-}
-
-static inline unsigned short ScaleQuantumToShort(const Quantum quantum)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((unsigned short) quantum);
-#else
-  if (quantum <= 0.0)
-    return(0);
-  if (quantum >= 65535.0)
-    return(65535);
-  return((unsigned short) (quantum+0.5));
-#endif
-}
-
-static inline Quantum ScaleShortToQuantum(const unsigned short value)
-{
-  return((Quantum) value);
-}
-#elif (MAGICKCORE_QUANTUM_DEPTH == 32)
-static inline Quantum ScaleCharToQuantum(const unsigned char value)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) (16843009UL*value));
-#else
-  return((Quantum) (16843009.0*value));
-#endif
-}
-
-static inline Quantum ScaleLongToQuantum(const unsigned long value)
-{
-  return((Quantum) value);
-}
-
-static inline Quantum ScaleMapToQuantum(const MagickRealType value)
-{
-#if defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) (65537.0*value));
-#else
-  if (value <= 0.0)
-    return(0);
-  if (value >= MaxMap)
-    return(QuantumRange);
-  return((Quantum) (65537UL*value));
-#endif
-}
-
-static inline unsigned long ScaleQuantumToLong(const Quantum quantum)
-{
-  return((unsigned long) quantum);
-}
-
-static inline unsigned long ScaleQuantumToMap(const Quantum quantum)
-{
-  if (quantum <= 0.0)
-    return(0);
-  if ((quantum/65537.0) >= (MagickRealType) MaxMap)
-    return((unsigned long) MaxMap);
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  {
-    unsigned long
-      pixel;
-
-    pixel=(unsigned long) ((quantum+MagickULLConstant(32768))/
-      MagickULLConstant(65537));
-    return(pixel);
-  }
-#else
-  return((unsigned long) (quantum/65537.0));
-#endif
-}
-
-static inline unsigned short ScaleQuantumToShort(const Quantum quantum)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  unsigned short
-    pixel;
-
-  pixel=(unsigned short) ((quantum+MagickULLConstant(32768))/
-    MagickULLConstant(65537));
-  return(pixel);
-#else
-  if (quantum <= 0.0)
-    return(0);
-  if ((quantum/65537.0) >= 65535.0)
-    return(65535);
-  return((unsigned short) (quantum/65537.0));
-#endif
-}
-
-static inline Quantum ScaleShortToQuantum(const unsigned short value)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) (65537UL*value));
-#else
-  return((Quantum) (65537.0*value));
-#endif
-}
-#elif (MAGICKCORE_QUANTUM_DEPTH == 64)
-static inline Quantum ScaleCharToQuantum(const unsigned char value)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) (MagickULLConstant(71777214294589695)*value));
-#else
-  return((Quantum) (71777214294589695.0*value));
-#endif
-}
-
-static inline Quantum ScaleLongToQuantum(const unsigned long value)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) (4294967295UL*value));
-#else
-  return((Quantum) (4294967295.0*value));
-#endif
-}
-
-static inline Quantum ScaleMapToQuantum(const MagickRealType value)
-{
-#if defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) (281479271612415.0*value));
-#else
-  if (value <= 0.0)
-    return(0);
-  if (value >= MaxMap)
-    return(QuantumRange);
-  return((Quantum) (MagickULLConstant(281479271612415)*value));
-#endif
-}
-
-static inline unsigned long ScaleQuantumToLong(const Quantum quantum)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((unsigned long) ((quantum+2147483648.0)/4294967297.0));
-#else
-  return((unsigned long) (quantum/4294967297.0));
-#endif
-}
-
-static inline unsigned long ScaleQuantumToMap(const Quantum quantum)
-{
-  if (quantum <= 0.0)
-    return(0);
-  if ((quantum/281479271612415.0) >= (MagickRealType) MaxMap)
-    return((unsigned long) MaxMap);
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((unsigned long) ((quantum+2147450879.0)/281479271612415.0));
-#else
-  return((unsigned long) (quantum/281479271612415.0));
-#endif
-}
-
-static inline unsigned short ScaleQuantumToShort(const Quantum quantum)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((unsigned short) ((quantum+2147450879.0)/281479271612415.0));
-#else
-  return((unsigned short) (quantum/281479271612415.0));
-#endif
-}
-
-static inline Quantum ScaleShortToQuantum(const unsigned short value)
-{
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) (MagickULLConstant(281479271612415)*value));
-#else
-  return((Quantum) (281479271612415.0*value));
-#endif
-}
-#endif
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif
diff --git a/externals/pidip/include/xwindow-private.h b/externals/pidip/include/xwindow-private.h
deleted file mode 100644
index f6e3d4b1c4d87c9d6988ade7dfdeba85c5235ab2..0000000000000000000000000000000000000000
--- a/externals/pidip/include/xwindow-private.h
+++ /dev/null
@@ -1,600 +0,0 @@
-/*
-  Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization
-  dedicated to making software imaging solutions freely available.
-  
-  You may not use this file except in compliance with the License.
-  obtain a copy of the License at
-  
-    http://www.imagemagick.org/script/license.php
-  
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
-  MagickCore X11 window methods.
-*/
-#ifndef _MAGICKCORE_XWINDOW_PRIVATE_H
-#define _MAGICKCORE_XWINDOW_PRIVATE_H
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-#if defined(MAGICKCORE_X11_DELEGATE)
-
-#include <X11/Xos.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/cursorfont.h>
-#include <X11/keysym.h>
-#include <X11/Xresource.h>
-#include <X11/Xutil.h>
-#include "magick/exception.h"
-#include "magick/geometry.h"
-#include "magick/quantize.h"
-
-#if defined(__cplusplus) || defined(c_plusplus)
-# define klass  c_class
-#else
-# define klass  class
-#endif
-
-/*
-  Invoke pre-X11R6 ICCCM routines if XlibSpecificationRelease is not 6.
-*/
-#if XlibSpecificationRelease < 6
-#if !defined(PRE_R6_ICCCM)
-#define PRE_R6_ICCCM
-#endif
-#endif
-/*
-  Invoke pre-X11R5 ICCCM routines if XlibSpecificationRelease is not defined.
-*/
-#if !defined(XlibSpecificationRelease)
-#define PRE_R5_ICCCM
-#endif
-/*
-  Invoke pre-X11R4 ICCCM routines if PWinGravity is not defined.
-*/
-#if !defined(PWinGravity)
-#define PRE_R4_ICCCM
-#endif
-
-#define MaxIconSize  96
-#define MaxNumberPens  11
-#define MaxNumberFonts  11
-#define MaxXWindows  12
-#undef index
-
-#define ThrowXWindowException(severity,tag,context) \
-{ \
-  ExceptionInfo \
-    exception; \
- \
-  GetExceptionInfo(&exception); \
-  (void) ThrowMagickException(&exception,GetMagickModule(),severity, \
-    tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context, \
-    strerror(errno)); \
-  CatchException(&exception); \
-  (void) DestroyExceptionInfo(&exception); \
-}
-#define ThrowXWindowFatalException(severity,tag,context) \
-{ \
-   ThrowXWindowException(severity,tag,context); \
-  _exit(1); \
-}
-
-typedef enum
-{
-  ForegroundStencil,
-  BackgroundStencil,
-  OpaqueStencil,
-  TransparentStencil
-} AnnotationStencil;
-
-typedef enum
-{
-  UndefinedElement,
-  PointElement,
-  LineElement,
-  RectangleElement,
-  FillRectangleElement,
-  CircleElement,
-  FillCircleElement,
-  EllipseElement,
-  FillEllipseElement,
-  PolygonElement,
-  FillPolygonElement,
-  ColorElement,
-  MatteElement,
-  TextElement,
-  ImageElement
-} ElementType;
-
-typedef enum
-{
-  UndefinedColormap,
-  PrivateColormap,
-  SharedColormap
-} XColormapType;
-
-typedef struct _XDrawInfo
-{
-  int
-    x,
-    y;
-
-  unsigned int
-    width,
-    height;
-
-  double
-    degrees;
-
-  AnnotationStencil
-    stencil;
-
-  ElementType
-    element;
-
-  Pixmap
-    stipple;
-
-  unsigned int
-    line_width;
-
-  XSegment
-    line_info;
-
-  unsigned int
-    number_coordinates;
-
-  RectangleInfo
-    rectangle_info;
-
-  XPoint
-    *coordinate_info;
-
-  char
-    geometry[MaxTextExtent];
-} XDrawInfo;
-
-typedef enum
-{
-  DefaultState = 0x0000,
-  EscapeState = 0x0001,
-  ExitState = 0x0002,
-  FormerImageState = 0x0004,
-  ModifierState = 0x0008,
-  MontageImageState = 0x0010,
-  NextImageState = 0x0020,
-  RetainColorsState = 0x0040,
-  SuspendTime = 50,
-  UpdateConfigurationState = 0x0080,
-  UpdateRegionState = 0x0100
-} XState;
-
-typedef struct _XAnnotateInfo
-{
-  int
-    x,
-    y;
-
-  unsigned int
-    width,
-    height;
-
-  double
-    degrees;
-
-  XFontStruct
-    *font_info;
-
-  char
-    *text;
-
-  AnnotationStencil
-    stencil;
-
-  char
-    geometry[MaxTextExtent];
-
-  struct _XAnnotateInfo
-    *next,
-    *previous;
-} XAnnotateInfo;
-
-typedef struct _XPixelInfo
-{
-  unsigned long
-    colors,
-    *pixels;
-
-  XColor
-    foreground_color,
-    background_color,
-    border_color,
-    matte_color,
-    highlight_color,
-    shadow_color,
-    depth_color,
-    trough_color,
-    box_color,
-    pen_color,
-    pen_colors[MaxNumberPens];
-
-  GC
-    annotate_context,
-    highlight_context,
-    widget_context;
-
-  unsigned short
-    box_index,
-    pen_index;
-} XPixelInfo;
-
-typedef struct _XResourceInfo
-{
-  XrmDatabase
-    resource_database;
-
-  ImageInfo
-    *image_info;
-
-  QuantizeInfo
-    *quantize_info;
-
-  unsigned long
-    colors;
-
-  MagickBooleanType
-    close_server,
-    backdrop;
-
-  char
-    *background_color,
-    *border_color;
-
-  char
-    *client_name;
-
-  XColormapType
-    colormap;
-
-  unsigned int
-    border_width;
-
-  unsigned long
-    delay;
-
-  MagickBooleanType
-    color_recovery,
-    confirm_exit,
-    confirm_edit;
-
-  char
-    *display_gamma;
-
-  char
-    *font,
-    *font_name[MaxNumberFonts],
-    *foreground_color;
-
-  MagickBooleanType
-    display_warnings,
-    gamma_correct;
-
-  char
-    *icon_geometry;
-
-  MagickBooleanType
-    iconic,
-    immutable;
-
-  char
-    *image_geometry;
-
-  char
-    *map_type,
-    *matte_color,
-    *name;
-
-  unsigned int
-    magnify,
-    pause;
-
-  char
-    *pen_colors[MaxNumberPens];
-
-  char
-    *text_font,
-    *title;
-
-  int
-    quantum;
-
-  unsigned int
-    update;
-
-  MagickBooleanType
-    use_pixmap,
-    use_shared_memory;
-
-  unsigned long
-    undo_cache;
-
-  char
-    *visual_type,
-    *window_group,
-    *window_id,
-    *write_filename;
-
-  Image
-    *copy_image;
-
-  int
-    gravity;
-
-  char
-    home_directory[MaxTextExtent];
-} XResourceInfo;
-
-typedef struct _XWindowInfo
-{
-  Window
-    id;
-
-  Window
-    root;
-
-  Visual
-    *visual;
-
-  unsigned int
-    storage_class,
-    depth;
-
-  XVisualInfo
-    *visual_info;
-
-  XStandardColormap
-    *map_info;
-
-  XPixelInfo
-    *pixel_info;
-
-  XFontStruct
-    *font_info;
-
-  GC
-    annotate_context,
-    highlight_context,
-    widget_context;
-
-  Cursor
-    cursor,
-    busy_cursor;
-
-  char
-    *name,
-    *geometry,
-    *icon_name,
-    *icon_geometry,
-    *crop_geometry;
-
-  unsigned long
-    data,
-    flags;
-
-  int
-    x,
-    y;
-
-  unsigned int
-    width,
-    height,
-    min_width,
-    min_height,
-    width_inc,
-    height_inc,
-    border_width;
-
-  MagickBooleanType
-    use_pixmap,
-    immutable,
-    shape,
-    shared_memory;
-
-  int
-    screen;
-
-  XImage
-    *ximage,
-    *matte_image;
-
-  Pixmap
-    highlight_stipple,
-    shadow_stipple,
-    pixmap,
-    *pixmaps,
-    matte_pixmap,
-    *matte_pixmaps;
-
-  XSetWindowAttributes
-    attributes;
-
-  XWindowChanges
-    window_changes;
-
-  void
-    *segment_info;
-
-  unsigned long
-    mask;
-
-  MagickBooleanType
-    orphan,
-    mapped,
-    stasis;
-
-  Image
-    *image;
-
-  MagickBooleanType
-    destroy;
-} XWindowInfo;
-
-typedef struct _XWindows
-{
-  Display
-    *display;
-
-  XStandardColormap
-    *map_info,
-    *icon_map;
-
-  XVisualInfo
-    *visual_info,
-    *icon_visual;
-
-  XPixelInfo
-    *pixel_info,
-    *icon_pixel;
-
-  XFontStruct
-    *font_info;
-
-  XResourceInfo
-    *icon_resources;
-
-  XClassHint
-    *class_hints;
-
-  XWMHints
-    *manager_hints;
-
-  XWindowInfo
-    context,
-    group_leader,
-    backdrop,
-    icon,
-    image,
-    info,
-    magnify,
-    pan,
-    command,
-    widget,
-    popup;
-
-  Atom
-    wm_protocols,
-    wm_delete_window,
-    wm_take_focus,
-    im_protocols,
-    im_remote_command,
-    im_update_widget,
-    im_update_colormap,
-    im_former_image,
-    im_retain_colors,
-    im_next_image,
-    im_exit,
-    dnd_protocols;
-} XWindows;
-
-extern MagickExport char
-  *XGetResourceClass(XrmDatabase,const char *,const char *,char *),
-  *XGetResourceInstance(XrmDatabase,const char *,const char *,const char *),
-  *XGetScreenDensity(Display *);
-
-extern MagickExport Cursor
-  XMakeCursor(Display *,Window,Colormap,char *,char *);
-
-extern MagickExport int
-  XCheckDefineCursor(Display *,Window,Cursor),
-  XError(Display *,XErrorEvent *);
-
-extern MagickExport MagickBooleanType
-  XAnnotateImage(Display *,const XPixelInfo *,XAnnotateInfo *,Image *),
-  XDrawImage(Display *,const XPixelInfo *,XDrawInfo *,Image *),
-  XGetWindowColor(Display *,XWindows *,char *),
-  XMagickProgressMonitor(const char *,const MagickOffsetType,
-    const MagickSizeType,void *),
-  XMakeImage(Display *,const XResourceInfo *,XWindowInfo *,Image *,unsigned int,
-    unsigned int),
-  XQueryColorDatabase(const char *,XColor *),
-  XRemoteCommand(Display *,const char *,const char *);
-
-extern MagickExport void
-  DestroyXResources(void),
-  XBestIconSize(Display *,XWindowInfo *,Image *),
-  XBestPixel(Display *,const Colormap,XColor *,unsigned int,XColor *),
-  XCheckRefreshWindows(Display *,XWindows *),
-  XClientMessage(Display *,const Window,const Atom,const Atom,const Time),
-  XConfigureImageColormap(Display *,XResourceInfo *,XWindows *,Image *),
-  XConstrainWindowPosition(Display *,XWindowInfo *),
-  XDelay(Display *,const unsigned long),
-  XDestroyResourceInfo(XResourceInfo *),
-  XDestroyWindowColors(Display *,Window),
-  XDisplayImageInfo(Display *,const XResourceInfo *,XWindows *,Image *,Image *),
-  XFreeResources(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
-    XFontStruct *,XResourceInfo *,XWindowInfo *),
-  XFreeStandardColormap(Display *,const XVisualInfo *,XStandardColormap *,
-    XPixelInfo *),
-  XHighlightEllipse(Display *,Window,GC,const RectangleInfo *),
-  XHighlightLine(Display *,Window,GC,const XSegment *),
-  XHighlightRectangle(Display *,Window,GC,const RectangleInfo *),
-  XGetAnnotateInfo(XAnnotateInfo *),
-  XGetPixelPacket(Display *,const XVisualInfo *,const XStandardColormap *,
-    const XResourceInfo *,Image *,XPixelInfo *),
-  XGetMapInfo(const XVisualInfo *,const Colormap,XStandardColormap *),
-  XGetResourceInfo(XrmDatabase,const char *,XResourceInfo *),
-  XGetWindowInfo(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
-    XFontStruct *,XResourceInfo *,XWindowInfo *),
-  XMakeMagnifyImage(Display *,XWindows *),
-  XMakeStandardColormap(Display *,XVisualInfo *,XResourceInfo *,Image *,
-    XStandardColormap *,XPixelInfo *),
-  XMakeWindow(Display *,Window,char **,int,XClassHint *,XWMHints *,
-    XWindowInfo *),
-  XQueryPosition(Display *,const Window,int *,int *),
-  XRefreshWindow(Display *,const XWindowInfo *,const XEvent *),
-  XRetainWindowColors(Display *,const Window),
-  XSetCursorState(Display *,XWindows *,const MagickStatusType),
-  XUserPreferences(XResourceInfo *),
-  XWarning(const ExceptionType,const char *,const char *);
-
-extern MagickExport Window
-  XWindowByID(Display *,const Window,const unsigned long),
-  XWindowByName(Display *,const Window,const char *),
-  XWindowByProperty(Display *,const Window,const Atom);
-
-extern MagickExport XFontStruct
-  *XBestFont(Display *,const XResourceInfo *,const MagickBooleanType);
-
-extern MagickExport XrmDatabase
-  XGetResourceDatabase(Display *,const char *);
-
-extern MagickExport XVisualInfo
-  *XBestVisualInfo(Display *,XStandardColormap *,XResourceInfo *);
-
-extern MagickExport XWindows
-  *XInitializeWindows(Display *,XResourceInfo *),
-  *XSetWindows(XWindows *);
-
-static inline MagickRealType XPixelIntensity(const XColor *pixel)
-{
-  MagickRealType
-    intensity;
-
-  intensity=0.299*pixel->red+0.587*pixel->green+0.114*pixel->blue;
-  return(intensity);
-}
-
-#endif
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif
diff --git a/externals/pidip/include/yuv.h b/externals/pidip/include/yuv.h
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/Makefile.in b/externals/pidip/modules/Makefile.in
old mode 100644
new mode 100755
index 4e408a5d1d2771a1ce093953b30cc1d00dbb513f..96c30325fba0f4d8303774fd14281fff8381251c
--- a/externals/pidip/modules/Makefile.in
+++ b/externals/pidip/modules/Makefile.in
@@ -18,9 +18,11 @@ OBJECTS = pdp_intrusion.o  pdp_yqt.o  pdp_simura.o  pdp_underwatch.o  \
           pdp_ocanvas.o pdp_spotlight.o pdp_colorgrid.o \
 	  pdp_binary.o pdp_erode.o pdp_dilate.o pdp_hitandmiss.o \
           pdp_disintegration.o pdp_distance.o pdp_theorin~.o \
-          pdp_theorout~.o pdp_cropper.o pdp_background.o \
+          pdp_theorout~.o pdp_cropper.o pdp_background.o pdp_backgroundyuv.o \
           pdp_mapper.o pdp_theonice~.o pdp_icedthe~.o\
           pdp_fdiff.o pdp_hue.o pdp_dot.o pdp_qtext.o\
-         @PDP_CAPTURE_OBJECT@ @PDP_STREAMING_OBJECTS@ @PDP_DC1394_OBJECT@ # pdp_xcanvas.o pdp_aa.o
+          pdp_skeleton.o pdp_cluster.o pdp_ycfilter.o\
+         @PDP_CAPTURE_OBJECT@ @PDP_DC1394_OBJECT@ @PDP_FREENECT_OBJECT@\
+          @PDP_ARTKP_OBJECT@ @PDP_OPENCV_OBJECT@ #pdp_xcanvas.o pdp_aa.o
 
 all_modules: $(OBJECTS) 
diff --git a/externals/pidip/modules/pdp_aa.c b/externals/pidip/modules/pdp_aa.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_aging.c b/externals/pidip/modules/pdp_aging.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_ascii.c b/externals/pidip/modules/pdp_ascii.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_background.c b/externals/pidip/modules/pdp_background.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_baltan.c b/externals/pidip/modules/pdp_baltan.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_binary.c b/externals/pidip/modules/pdp_binary.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_cache.c b/externals/pidip/modules/pdp_cache.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_canvas.c b/externals/pidip/modules/pdp_canvas.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_capture.c b/externals/pidip/modules/pdp_capture.c
deleted file mode 100644
index 279a9a79fc23dee763e6960e5b8692103d58e6cd..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_capture.c
+++ /dev/null
@@ -1,969 +0,0 @@
-/*
- *   PiDiP module.
- *   Copyright (c) by Yves Degoyon (ydegoyon@free.fr)
- *
- *   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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*  This object lets you capture a portion of the screen
- *  and turn it into pdp packets
- *  ( inspired by ImageMagick code )
- */
-
-#include "pdp.h"
-#include "yuv.h"
-#include <math.h>
-#include <assert.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <magick/methods.h>
-#include <magick/api.h>
-#include <magick/magick.h>
-#include <magick/xwindow.h>
-
-#define PDP_DISPLAY_LENGTH 1024
-
-// trick to handle Image Magick compatibility
-#if MagickLibVersion >= 0x618
-#include "../include/xwindow-private.h"
-#include "../include/quantum-private.h"
-#endif
-
-static char   *pdp_capture_version = "pdp_capture: version 0.1, capture of screen written by Yves Degoyon (ydegoyon@free.fr)";
-
-typedef struct pdp_capture_struct
-{
-    t_object x_obj;
-
-    t_outlet *x_outlet0;
-    int x_packet0;
-    short int *x_data;
-    t_pdp *x_header;
-    int x_displayopen;
-
-    char *x_display;
-    int x_screen;
-    int x_x;
-    int x_y;
-    int x_vwidth;
-    int x_vheight;
-    int x_vsize;
-
-    Image *x_Ximage;
-    Display *x_dpy;
-} t_pdp_capture;
-
-/***********************************************/
-/* this code is borrowed from ImageMagick      */
-/* but not exported, sorry, guys and girls,    */
-/* i only need that                            */
-/***********************************************/
-
-static Window XMyGetSubwindow(t_pdp_capture *o, Display *display, Window window, int x, int y)
-{
-  Window source_window, target_window;
-  int status, x_offset, y_offset;
-
-  assert(display != (Display *) NULL);
-  source_window=XRootWindow(display, o->x_screen);
-  if (window == (Window) NULL)
-  {
-    return(source_window);
-  }
-  target_window=window;
-  for ( ; ; )
-  {
-    status=XTranslateCoordinates(display,source_window,window,x,y, &x_offset,&y_offset,&target_window);
-    if (status != 1)
-    {
-      break;
-    }
-    if (target_window == (Window) NULL)
-    {
-      break;
-    }
-    source_window=window;
-    window=target_window;
-    x=x_offset;
-    y=y_offset;
-  }
-  if (target_window == (Window) NULL)
-  {
-    target_window=window;
-  }
-  return(target_window);
-}
-
-static Window XMyClientWindow(t_pdp_capture *o, Display *display,Window target_window)
-{
-  Atom state, type;  
-  int format, status;
-  unsigned char *data;
-  unsigned long after, number_items;
-  Window client_window;
-
-  assert(display != (Display *) NULL);
-  state=XInternAtom(display,"WM_STATE",1);
-  if (state == (Atom) NULL)
-  {
-    return(target_window);
-  }
-  type=(Atom) NULL;
-  status=XGetWindowProperty(display,target_window,state,0L,0L,0, (Atom) AnyPropertyType,&type,&format,&number_items,&after,&data);
-  if ((status == Success) && (type != (Atom) NULL))
-  {
-    return(target_window);
-  }
-  client_window=XWindowByProperty(display,target_window,state);
-  if (client_window == (Window) NULL)
-  {
-    return(target_window);
-  }
-  return(client_window);
-}
-
-static Image *XMyGetWindowImage(t_pdp_capture *o, Display *display,const Window window, const unsigned int level)
-{
-  typedef struct _ColormapInfo
-  {
-    Colormap colormap;
-    XColor *colors;
-    struct _ColormapInfo *next;
-  } ColormapInfo;
-
-  typedef struct _WindowInfo
-  {
-    Window window, parent;
-    Visual *visual;
-    Colormap colormap;
-    XSegment bounds;
-    RectangleInfo crop_info;
-  } WindowInfo;
-
-  IndexPacket index;
-  int display_height, display_width, id, status, x_offset, y_offset;
-  RectangleInfo crop_info;
-  register IndexPacket *indexes;
-  register int i;
-  static ColormapInfo *colormap_info = (ColormapInfo *) NULL;
-  static int max_windows = 0, number_windows = 0;
-  static WindowInfo *window_info;
-  Window child, root_window;
-  XWindowAttributes window_attributes;
-
-  assert(display != (Display *) NULL);
-  status=XGetWindowAttributes(display,window,&window_attributes);
-  if ((status == 0) || (window_attributes.map_state != IsViewable))
-  {
-    return((Image *) NULL);
-  }
-  root_window=XRootWindow(display, o->x_screen );
-  (void) XTranslateCoordinates(display,window,root_window,0,0,&x_offset, &y_offset,&child);
-  crop_info.x=x_offset;
-  crop_info.y=y_offset;
-  crop_info.width=window_attributes.width;
-  crop_info.height=window_attributes.height;
-  if (crop_info.x < 0)
-  {
-      crop_info.width+=crop_info.x;
-      crop_info.x=0;
-  }
-  if (crop_info.y < 0)
-  {
-      crop_info.height+=crop_info.y;
-      crop_info.y=0;
-  }
-  display_width=XDisplayWidth(display, o->x_screen);
-  if ((int) (crop_info.x+crop_info.width) > display_width)
-  {
-    crop_info.width=display_width-crop_info.x;
-  }
-  display_height=XDisplayHeight(display, o->x_screen);
-  if ((int) (crop_info.y+crop_info.height) > display_height)
-  {
-    crop_info.height=display_height-crop_info.y;
-  }
-  if (number_windows >= max_windows)
-  {
-      max_windows+=1024;
-      if (window_info == (WindowInfo *) NULL)
-      {
-        window_info=(WindowInfo *) AcquireMemory(max_windows*sizeof(*window_info));
-      }
-      else
-      {
-        window_info=(WindowInfo *) ResizeMagickMemory(window_info,max_windows*sizeof(*window_info));
-      }
-  }
-  if (window_info == (WindowInfo *) NULL)
-  {
-      post("pdp_capture : MemoryAllocationFailed : UnableToReadXImage");
-      return((Image *) NULL);
-  }
-  id=number_windows++;
-  window_info[id].window=window;
-  window_info[id].visual=window_attributes.visual;
-  window_info[id].colormap=window_attributes.colormap;
-  window_info[id].bounds.x1=(short) crop_info.x;
-  window_info[id].bounds.y1=(short) crop_info.y;
-  window_info[id].bounds.x2=(short) (crop_info.x+(int) crop_info.width-1);
-  window_info[id].bounds.y2=(short) (crop_info.y+(int) crop_info.height-1);
-  crop_info.x-=x_offset;
-  crop_info.y-=y_offset;
-
-  window_info[id].crop_info=crop_info;
-  if (level != 0)
-  {
-      unsigned int number_children;
-      Window *children;
-
-      status=XQueryTree(display,window,&root_window,&window_info[id].parent, &children,&number_children);
-      for (i=0; i < id; i++)
-      {
-        if ((window_info[i].window == window_info[id].parent) &&
-            (window_info[i].visual == window_info[id].visual) &&
-            (window_info[i].colormap == window_info[id].colormap))
-        {
-          if ((window_info[id].bounds.x1 <= window_info[i].bounds.x1) ||
-              (window_info[id].bounds.x1 >= window_info[i].bounds.x2) ||
-              (window_info[id].bounds.y1 <= window_info[i].bounds.y1) ||
-              (window_info[id].bounds.y1 >= window_info[i].bounds.y2))
-          {
-              number_windows--;
-              break;
-          }
-        }
-      }
-      if ((status == 1) && (number_children != 0))
-      {
-          (void) XFree((void *) children);
-      }
-  }
-  if (level <= 1)
-  {
-      ColormapInfo *next;
-      Image *composite_image, *image;
-      int y;
-      register int j, x;
-      register PixelPacket *q;
-      register unsigned long pixel;
-      unsigned int import, number_colors;
-      XColor *colors;
-      XImage *ximage;
-
-      image=(Image *) NULL;
-      for (id=0; id < number_windows; id++)
-      {
-        import=(window_info[id].bounds.x2 >= window_info[0].bounds.x1) &&
-          (window_info[id].bounds.x1 <= window_info[0].bounds.x2) &&
-          (window_info[id].bounds.y2 >= window_info[0].bounds.y1) &&
-          (window_info[id].bounds.y1 <= window_info[0].bounds.y2);
-        for (j=0; j < id; j++)
-        {
-          if ((window_info[id].visual == window_info[j].visual) &&
-              (window_info[id].colormap == window_info[j].colormap) &&
-              (window_info[id].bounds.x1 >= window_info[j].bounds.x1) &&
-              (window_info[id].bounds.y1 >= window_info[j].bounds.y1) &&
-              (window_info[id].bounds.x2 <= window_info[j].bounds.x2) &&
-              (window_info[id].bounds.y2 <= window_info[j].bounds.y2))
-          {
-            import=0;
-          }
-          else
-          {
-            if ((window_info[id].visual != window_info[j].visual) ||
-                (window_info[id].colormap != window_info[j].colormap))
-            {
-              if ((window_info[id].bounds.x2 > window_info[j].bounds.x1) &&
-                  (window_info[id].bounds.x1 < window_info[j].bounds.x2) &&
-                  (window_info[id].bounds.y2 > window_info[j].bounds.y1) &&
-                  (window_info[id].bounds.y1 < window_info[j].bounds.y2))
-              {
-                import=1;
-              }
-            }
-          }
-        }
-        if (!import)
-        {
-          continue;
-        }
-        // post( "pdp_capture : get image : %ld [%d,%d,%d,%d]", window_info[id].window, 
-        //        (int) window_info[id].crop_info.x,
-        //        (int) window_info[id].crop_info.y,
-        //        (unsigned int) window_info[id].crop_info.width,
-        //        (unsigned int) window_info[id].crop_info.height );
-        ximage=XGetImage(display,window_info[id].window,
-          (int) window_info[id].crop_info.x,(int) window_info[id].crop_info.y,
-          (unsigned int) window_info[id].crop_info.width,
-          (unsigned int) window_info[id].crop_info.height,AllPlanes,ZPixmap);
-        if (ximage == (XImage *) NULL)
-        {
-          continue;
-        }
-        number_colors=0;
-        colors=(XColor *) NULL;
-        if (window_info[id].colormap != (Colormap) NULL)
-        {
-            ColormapInfo *p;
-
-            number_colors=window_info[id].visual->map_entries;
-            for (p=colormap_info; p != (ColormapInfo *) NULL; p=p->next)
-            {
-              if (p->colormap == window_info[id].colormap)
-              {
-                break;
-              }
-            }
-            if (p == (ColormapInfo *) NULL)
-            {
-                colors=(XColor *) AcquireMemory(number_colors*sizeof(XColor));
-                if (colors == (XColor *) NULL)
-                {
-                    XDestroyImage(ximage);
-                    return((Image *) NULL);
-                }
-#if MagickLibVersion >= 0x608
-                if ((window_info[id].visual->klass != DirectColor) &&
-                    (window_info[id].visual->klass != TrueColor))
-#else
-                if ((window_info[id].visual->storage_class != DirectColor) &&
-                    (window_info[id].visual->storage_class != TrueColor))
-#endif
-                {
-                  for (i=0; i < (int) number_colors; i++)
-                  {
-                    colors[i].pixel=i;
-                    colors[i].pad=0;
-                  }
-                }
-                else
-                {
-                  unsigned long blue, blue_bit, green, green_bit, red, red_bit;
-
-                    red=0;
-                    green=0;
-                    blue=0;
-                    red_bit=window_info[id].visual->red_mask &
-                      (~(window_info[id].visual->red_mask)+1);
-                    green_bit=window_info[id].visual->green_mask &
-                      (~(window_info[id].visual->green_mask)+1);
-                    blue_bit=window_info[id].visual->blue_mask &
-                      (~(window_info[id].visual->blue_mask)+1);
-                    for (i=0; i < (int) number_colors; i++)
-                    {
-                      colors[i].pixel=red | green | blue;
-                      colors[i].pad=0;
-                      red+=red_bit;
-                      if (red > window_info[id].visual->red_mask)
-                        red=0;
-                      green+=green_bit;
-                      if (green > window_info[id].visual->green_mask)
-                        green=0;
-                      blue+=blue_bit;
-                      if (blue > window_info[id].visual->blue_mask)
-                        blue=0;
-                    }
-                }
-                (void) XQueryColors(display,window_info[id].colormap,colors, (int) number_colors);
-                p=(ColormapInfo *) AcquireMemory(sizeof(ColormapInfo));
-                if (p == (ColormapInfo *) NULL)
-                  return((Image *) NULL);
-                p->colormap=window_info[id].colormap;
-                p->colors=colors;
-                p->next=colormap_info;
-                colormap_info=p;
-            }
-            colors=p->colors;
-        }
-        composite_image=AllocateImage((ImageInfo *) NULL);
-        if (composite_image == (Image *) NULL)
-        {
-            XDestroyImage(ximage);
-            return((Image *) NULL);
-        }
-#if MagickLibVersion >= 0x608
-        if ((window_info[id].visual->klass != DirectColor) &&
-            (window_info[id].visual->klass != TrueColor))
-#else
-        if ((window_info[id].visual->storage_class != DirectColor) &&
-            (window_info[id].visual->storage_class != TrueColor))
-#endif
-        {
-          composite_image->storage_class=PseudoClass;
-        }
-        composite_image->columns=ximage->width;
-        composite_image->rows=ximage->height;
-        switch (composite_image->storage_class)
-        {
-          case DirectClass:
-          default:
-          {
-            register unsigned long color, index;
-            unsigned long blue_mask, blue_shift, green_mask, green_shift, red_mask, red_shift;
-
-            red_mask=window_info[id].visual->red_mask;
-            red_shift=0;
-            while ((red_mask & 0x01) == 0)
-            {
-              red_mask>>=1;
-              red_shift++;
-            }
-            green_mask=window_info[id].visual->green_mask;
-            green_shift=0;
-            while ((green_mask & 0x01) == 0)
-            {
-              green_mask>>=1;
-              green_shift++;
-            }
-            blue_mask=window_info[id].visual->blue_mask;
-            blue_shift=0;
-            while ((blue_mask & 0x01) == 0)
-            {
-              blue_mask>>=1;
-              blue_shift++;
-            }
-            if ((number_colors != 0) &&
-#if MagickLibVersion >= 0x608
-                (window_info[id].visual->klass == DirectColor))
-#else
-                (window_info[id].visual->storage_class == DirectColor))
-#endif
-            {
-              for (y=0; y < (long) composite_image->rows; y++)
-              {
-                q=SetImagePixels(composite_image,0,y,
-                  composite_image->columns,1);
-                if (q == (PixelPacket *) NULL)
-                  break;
-                for (x=0; x < (long) composite_image->columns; x++)
-                {
-                  pixel=XGetPixel(ximage,x,y);
-                  index=(pixel >> red_shift) & red_mask;
-                  q->red=ScaleShortToQuantum(colors[index].red);
-                  index=(pixel >> green_shift) & green_mask;
-                  q->green=ScaleShortToQuantum(colors[index].green);
-                  index=(pixel >> blue_shift) & blue_mask;
-                  q->blue=ScaleShortToQuantum(colors[index].blue);
-                  q++;
-                }
-                if (!SyncImagePixels(composite_image))
-                  break;
-              }
-            }
-            else
-            {
-              for (y=0; y < (long) composite_image->rows; y++)
-              {
-                q=SetImagePixels(composite_image,0,y,
-                  composite_image->columns,1);
-                if (q == (PixelPacket *) NULL)
-                  break;
-                for (x=0; x < (long) composite_image->columns; x++)
-                {
-                  pixel=XGetPixel(ximage,x,y);
-                  color=(pixel >> red_shift) & red_mask;
-                  q->red=ScaleShortToQuantum((65535L*color)/red_mask);
-                  color=(pixel >> green_shift) & green_mask;
-                  q->green=ScaleShortToQuantum((65535L*color)/green_mask);
-                  color=(pixel >> blue_shift) & blue_mask;
-                  q->blue=ScaleShortToQuantum((65535L*color)/blue_mask);
-                  q++;
-                }
-                if (!SyncImagePixels(composite_image))
-                {
-                  break;
-                }
-              }
-            }
-            break;
-          }
-          case PseudoClass:
-          {
-            if (!AllocateImageColormap(composite_image,number_colors))
-            {
-                XDestroyImage(ximage);
-                DestroyImage(composite_image);
-                return((Image *) NULL);
-            }
-            for (i=0; i < (int) composite_image->colors; i++)
-            {
-              composite_image->colormap[colors[i].pixel].red=
-                ScaleShortToQuantum(colors[i].red);
-              composite_image->colormap[colors[i].pixel].green=
-                ScaleShortToQuantum(colors[i].green);
-              composite_image->colormap[colors[i].pixel].blue=
-                ScaleShortToQuantum(colors[i].blue);
-            }
-            for (y=0; y < (long) composite_image->rows; y++)
-            {
-              q=SetImagePixels(composite_image,0,y,composite_image->columns,1);
-              if (q == (PixelPacket *) NULL)
-                break;
-              indexes=GetIndexes(composite_image);
-              for (x=0; x < (long) composite_image->columns; x++)
-              {
-                index=(IndexPacket) XGetPixel(ximage,x,y);
-                indexes[x]=index;
-                *q++=composite_image->colormap[index];
-              }
-              if (!SyncImagePixels(composite_image))
-              {
-                break;
-              }
-            }
-            break;
-          }
-        }
-        XDestroyImage(ximage);
-        if (image == (Image *) NULL)
-        {
-            image=composite_image;
-            continue;
-        }
-        (void) XTranslateCoordinates(display,window_info[id].window,window,0,0, &x_offset,&y_offset,&child);
-        x_offset-=(int) crop_info.x;
-        if (x_offset < 0)
-        {
-          x_offset=0;
-        }
-        y_offset-=(int) crop_info.y;
-        if (y_offset < 0)
-        {
-          y_offset=0;
-        }
-        (void) CompositeImage(image,CopyCompositeOp,composite_image, x_offset,y_offset);
-      }
-      while (colormap_info != (ColormapInfo *) NULL)
-      {
-        next=colormap_info->next;
-#if MagickLibVersion >= 0x608
-        colormap_info->colors=(XColor *) RelinquishMagickMemory(colormap_info->colors);
-        colormap_info=(ColormapInfo *) RelinquishMagickMemory(colormap_info);
-#else
-        LiberateMemory((void **) &colormap_info->colors);
-        LiberateMemory((void **) &colormap_info);
-#endif
-        colormap_info=next;
-      }
-      /*
-        Free resources and restore initial state.
-      */
-#if MagickLibVersion >= 0x608
-      window_info=(WindowInfo *) RelinquishMagickMemory(window_info);
-#else
-      LiberateMemory((void **) &window_info);
-#endif
-      window_info=(WindowInfo *) NULL;
-      max_windows=0;
-      number_windows=0;
-      colormap_info=(ColormapInfo *) NULL;
-      return(image);
-  }
-  return((Image *) NULL);
-}
-
-/*************************************************/
-/* this code is adapted from ImageMagick         */
-/* mainly because i don't want user interactions */
-/* and i want to chose the screen also           */
-/*************************************************/
-
-static void pdp_capture_do_capture(t_pdp_capture *x)
-{
-  Colormap *colormaps;
-  Image *image;
-  int number_colormaps, number_windows, status, X, Y;
-  RectangleInfo crop_info;
-  Window *children, client, prior_target, root, target; 
-  XTextProperty window_name;
-  Window child;
-  XWindowAttributes window_attributes;
-
-  /*
-    Open X server connection.
-  */
-  if (!x->x_displayopen)
-  {
-      post( "pdp_capture : display not open : no capture" );
-      return;
-  }
-  (void) XSetErrorHandler(XError);
-  crop_info.x=x->x_x;
-  crop_info.y=x->x_y;
-  crop_info.width=x->x_vwidth;
-  crop_info.height=x->x_vheight;
-  root=XRootWindow(x->x_dpy, x->x_screen);
-  target=(Window) NULL;
-  prior_target=target;
-
-  target = XMyGetSubwindow(x, x->x_dpy,root,x->x_x,x->x_y);
-
-  client=target;   /* obsolete */
-  if (target != root)
-  {
-      unsigned int d;
-      status=XGetGeometry(x->x_dpy,target,&root,&X,&X,&d,&d,&d,&d);
-      if (status != 0)
-      {
-          for ( ; ; )
-          {
-            Window parent;
-
-            status=XQueryTree(x->x_dpy,target,&root,&parent,&children,&d);
-            if (status && (children != (Window *) NULL))
-            {
-              (void) XFree((char *) children);
-            }
-            if (!status || (parent == (Window) NULL) || (parent == root)) break;
-            target=parent;
-          }
-          client=XMyClientWindow(x, x->x_dpy, target);
-          target=client;
-          if (prior_target) target=prior_target;
-      }
-  }
-  status=XGetWindowAttributes(x->x_dpy,target,&window_attributes);
-  if (status == 0)
-  {
-     post( "pdp_capture : unable to read window attributes" );
-     (void) XCloseDisplay(x->x_dpy);
-     return;
-  }
-  (void) XTranslateCoordinates(x->x_dpy,target,root,0,0,&X,&Y,&child);
-  crop_info.x=x->x_x;
-  crop_info.y=x->x_y;
-  crop_info.width=x->x_vwidth;
-  crop_info.height=x->x_vheight;
-  target=root;
-
-  number_windows=0;
-  status=XGetWMColormapWindows(x->x_dpy,target,&children,&number_windows);
-  if ((status == 1) && (number_windows > 0))
-  {
-      (void) XFree ((char *) children);
-  }
-  colormaps=XListInstalledColormaps(x->x_dpy,target,&number_colormaps);
-  if (number_colormaps > 0)
-  {
-      (void) XFree((char *) colormaps);
-  }
-
-  image=XMyGetWindowImage(x, x->x_dpy, target, 1);
-  if (image == (Image *) NULL)
-  {
-    post( "pdp_capture : unable to read xwindow image" );
-  }
-  else
-  {
-     Image *clone_image;
-
-      clone_image=CloneImage(image,0,0,1,&image->exception);
-      if (clone_image != (Image *) NULL)
-      {
-         x->x_Ximage=CropImage(clone_image,&crop_info,&image->exception);
-         if (x->x_Ximage != (Image *) NULL)
-         {
-             DestroyImage(image);
-             DestroyImage(clone_image);
-             image=x->x_Ximage;
-         }
-      }
-      status=XGetWMName(x->x_dpy,target,&window_name);
-  }
-  return;
-}
-
-static void pdp_capture_display(t_pdp_capture *x, t_symbol *s)
-{
-    if ( x->x_displayopen ) 
-    {
-      if ( XCloseDisplay(x->x_dpy) == -1 )
-      {
-         post( "pdp_capture : could not close display" );
-      }
-    } 
-    strcpy( x->x_display, s->s_name );
-    if ( ( x->x_dpy = XOpenDisplay( x->x_display ) ) != NULL )
-    {
-       x->x_displayopen = 1;
-
-       x->x_vwidth=XDisplayWidth(x->x_dpy, x->x_screen);
-       x->x_vheight=XDisplayHeight(x->x_dpy, x->x_screen);
-       x->x_vsize=x->x_vwidth*x->x_vheight;
-
-    }
-}
-
-static void pdp_capture_screen(t_pdp_capture *x, t_floatarg fscreen)
-{
-   if ( (int)fscreen > 0 )
-   {
-      x->x_screen = (int) fscreen;
-   }
-}
-
-static void pdp_capture_x(t_pdp_capture *x, t_floatarg fx)
-{
-  int width;
-  int err;
-
-   if (!x->x_displayopen)
-   {
-      post( "pdp_capture : display not open : not setting x" );
-      return;
-   }
-   width = XDisplayWidth( x->x_dpy, x->x_screen );
-   if ( ( (int)fx > 0 ) && ( (int)fx <= width ) )
-   {
-      x->x_x = (int) fx;
-      if ( x->x_x + x->x_vwidth > width )
-      {
-         x->x_vwidth = width - x->x_x;
-         x->x_vsize = x->x_vwidth * x->x_vheight;
-      }
-   }
-   else
-   {
-      post( "pdp_capture : x position out of range : [0, %d]", width );
-   }
-}
-
-static void pdp_capture_y(t_pdp_capture *x, t_floatarg fy)
-{
-  int height;
-  int err;
-
-   if (!x->x_displayopen)
-   {
-      post( "pdp_capture : display not open : not setting y" );
-      return;
-   }
-   height = XDisplayHeight( x->x_dpy, x->x_screen );
-   if ( ( (int)fy > 0 ) && ( (int)fy <= height ) )
-   {
-      x->x_y = (int) fy;
-      if ( x->x_y + x->x_vheight > height )
-      {
-         x->x_vheight = height - x->x_y;
-         x->x_vsize = x->x_vwidth * x->x_vheight;
-      }
-   }
-   else
-   {
-      post( "pdp_capture : y position out of range : [0, %d]", height );
-   }
-}
-
-static void pdp_capture_width(t_pdp_capture *x, t_floatarg fwidth)
-{
-  int width;
-  int err;
-
-   if (!x->x_displayopen)
-   {
-      post( "pdp_capture : display not open : not setting width" );
-      return;
-   }
-   width = XDisplayWidth( x->x_dpy, x->x_screen );
-   if ( ( (int)fwidth > 0 ) && ( (int)fwidth <= (width-x->x_x) ) )
-   {
-      x->x_vwidth = (int) fwidth;
-      x->x_vsize = x->x_vwidth * x->x_vheight;
-   }
-   else
-   {
-      post( "pdp_capture : width out of range : [0, %d]", width-x->x_x );
-   }
-}
-
-static void pdp_capture_height(t_pdp_capture *x, t_floatarg fheight)
-{
-  int height;
-  int err;
-
-   if (!x->x_displayopen)
-   {
-      post( "pdp_capture : display not open : not setting height" );
-      return;
-   }
-   height = XDisplayWidth( x->x_dpy, x->x_screen );
-   if ( ( (int)fheight > 0 ) && ( (int)fheight <= (height-x->x_y) ) )
-   {
-      x->x_vheight = (int) fheight;
-      x->x_vsize = x->x_vwidth * x->x_vheight;
-   }
-   else
-   {
-      post( "pdp_capture : width out of range : [0, %d]", height-x->x_y );
-   }
-}
-
-static void pdp_capture_sendpacket(t_pdp_capture *x)
-{
-    /* unregister and propagate if valid dest packet */
-    if (x->x_packet0 != -1 )
-    {
-        pdp_packet_pass_if_valid(x->x_outlet0, &x->x_packet0);
-    }
-}
-
-static void pdp_capture_bang(t_pdp_capture *x)
-{
-   PixelPacket pixel;
-   short int *pY, *pU, *pV;
-   unsigned char y, u, v;
-   int px, py, r, g, b;
-   long number_pixels;
-
-    // capture the image and output a PDP packet
-    pdp_capture_do_capture( x );
-
-    x->x_vwidth = x->x_Ximage->columns;
-    x->x_vheight = x->x_Ximage->rows;
-    x->x_vsize = x->x_vwidth*x->x_vheight;
-
-    x->x_packet0 = pdp_packet_new_image_YCrCb( x->x_vwidth, x->x_vheight );
-    x->x_data = (short int *)pdp_packet_data(x->x_packet0);
-    x->x_header = pdp_packet_header(x->x_packet0);
-
-    x->x_header->info.image.encoding = PDP_IMAGE_YV12;
-    x->x_header->info.image.width = x->x_vwidth;
-    x->x_header->info.image.height = x->x_vheight;
-
-    number_pixels=(long) GetPixelCacheArea(x->x_Ximage);
-    
-    // post( "pdp_capture : capture done : w=%d h=%d pixels=%ld", x->x_vwidth, x->x_vheight, number_pixels );
-
-    pY = x->x_data;
-    pV = x->x_data+x->x_vsize;
-    pU = x->x_data+x->x_vsize+(x->x_vsize>>2);
-    for ( py=0; py<x->x_vheight; py++ )
-    {
-       for ( px=0; px<x->x_vwidth; px++ )
-       {
-          pixel = GetOnePixel(x->x_Ximage, px, py);
-          // scale values
-          r = (pixel.red*255)/65535;
-          g = (pixel.green*255)/65535;
-          b = (pixel.blue*255)/65535;
-          // post( "pdp_capture : pixel : [%d, %d] : %d,%d,%d", px, py, r, g, b );
-          y = yuv_RGBtoY(((r)<<16)+((g)<<8)+(b));
-          u = yuv_RGBtoU(((r)<<16)+((g)<<8)+(b));
-          v = yuv_RGBtoV(((r)<<16)+((g)<<8)+(b));
-
-          *(pY) = y<<7;
-          if ( (px%2==0) && (py%2==0) )
-          {
-              *(pV) = (v-128)<<8;
-              *(pU) = (u-128)<<8;
-          }
-          pY++;
-          if ( (px%2==0) && (py%2==0) )
-          {
-            pV++;pU++;
-          }
-       }
-    }
-
-    // output the new packet
-    pdp_capture_sendpacket( x );
-
-    DestroyImage( x->x_Ximage );
-}
-
-static void pdp_capture_free(t_pdp_capture *x)
-{
-  int i;
-
-    if ( x->x_packet0 != -1 )
-    {
-      pdp_packet_mark_unused(x->x_packet0);
-    }
-    if ( x->x_displayopen ) 
-    {
-      if ( XCloseDisplay(x->x_dpy) == -1 )
-      {
-         post( "pdp_capture : could not close display" );
-      }
-    } 
-}
-
-t_class *pdp_capture_class;
-
-void *pdp_capture_new(void)
-{
-    int i;
-
-    t_pdp_capture *x = (t_pdp_capture *)pd_new(pdp_capture_class);
-    inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("x"));
-    inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("y"));
-    inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("width"));
-    inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("height"));
-
-    x->x_outlet0 = outlet_new(&x->x_obj, &s_anything); 
-    x->x_packet0 = -1;
-
-    x->x_display = (char *) malloc( PDP_DISPLAY_LENGTH );
-    strcpy( x->x_display, ":0.0" );
-
-    x->x_displayopen = 0;
-    if ( ( x->x_dpy = XOpenDisplay( x->x_display ) ) != NULL )
-    {
-       x->x_displayopen = 1;
-
-       x->x_vwidth=XDisplayWidth(x->x_dpy, x->x_screen);
-       x->x_vheight=XDisplayWidth(x->x_dpy, x->x_screen);
-       x->x_vsize=x->x_vwidth*x->x_vheight;
-
-    }
-
-    x->x_screen = 0;
-    x->x_x = 0;
-    x->x_y = 0;
-    x->x_vwidth = 320;
-    x->x_vheight = 240;
-
-    return (void *)x;
-}
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-void pdp_capture_setup(void)
-{
-    // post( pdp_capture_version );
-    pdp_capture_class = class_new(gensym("pdp_capture"), (t_newmethod)pdp_capture_new,
-    	(t_method)pdp_capture_free, sizeof(t_pdp_capture), 0, A_NULL);
-
-    class_addmethod(pdp_capture_class, (t_method)pdp_capture_bang, gensym("bang"), A_NULL);
-    class_addmethod(pdp_capture_class, (t_method)pdp_capture_display, gensym("display"), A_SYMBOL, A_NULL);
-    class_addmethod(pdp_capture_class, (t_method)pdp_capture_screen, gensym("screen"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_capture_class, (t_method)pdp_capture_x, gensym("x"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_capture_class, (t_method)pdp_capture_y, gensym("y"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_capture_class, (t_method)pdp_capture_width, gensym("width"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_capture_class, (t_method)pdp_capture_height, gensym("height"), A_DEFFLOAT, A_NULL);
-
-
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/externals/pidip/modules/pdp_cmap.c b/externals/pidip/modules/pdp_cmap.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_colorgrid.c b/externals/pidip/modules/pdp_colorgrid.c
old mode 100644
new mode 100755
index c5abfd1bce90e0a8a56c2914fd9cbb2a8efe3571..b60be7238206fc050a10405bb8d17f6534881bf1
--- a/externals/pidip/modules/pdp_colorgrid.c
+++ b/externals/pidip/modules/pdp_colorgrid.c
@@ -61,7 +61,7 @@ typedef struct _pdp_colorgrid
     t_symbol*  x_fname;
 } t_pdp_colorgrid;
 
-void load_tk_procs () {
+void load_tk_procs (void) {
 	// ########### pdp_colorgrid procedures -- ydegoyon@free.fr #########
 	// package require Img
 	sys_gui("package require base64\n");
@@ -99,7 +99,7 @@ void load_tk_procs () {
 	sys_gui("set $var_graph_pdp_colorgrid $pdp_colorgrid\n");
 	sys_gui("set $var_graph_xlines $xlines\n");
 	sys_gui("set $var_graph_ylines $ylines\n");
-	sys_gui("toplevel $id -class [winfo class .]\n");
+	sys_gui("toplevel $id\n");
 	sys_gui("wm title $id {pdp_colorgrid}\n");
 	sys_gui("wm protocol $id WM_DELETE_WINDOW [concat pdp_colorgrid_cancel $id]\n");
 	sys_gui("label $id.label -text {COLORGRID PROPERTIES}\n");
diff --git a/externals/pidip/modules/pdp_compose.c b/externals/pidip/modules/pdp_compose.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_cropper.c b/externals/pidip/modules/pdp_cropper.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_ctrack.c b/externals/pidip/modules/pdp_ctrack.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_cycle.c b/externals/pidip/modules/pdp_cycle.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_dice.c b/externals/pidip/modules/pdp_dice.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_dilate.c b/externals/pidip/modules/pdp_dilate.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_disintegration.c b/externals/pidip/modules/pdp_disintegration.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_distance.c b/externals/pidip/modules/pdp_distance.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_dot.c b/externals/pidip/modules/pdp_dot.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_edge.c b/externals/pidip/modules/pdp_edge.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_erode.c b/externals/pidip/modules/pdp_erode.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_fcqt.c b/externals/pidip/modules/pdp_fcqt.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_fdiff.c b/externals/pidip/modules/pdp_fdiff.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_ffmpeg~.c b/externals/pidip/modules/pdp_ffmpeg~.c
deleted file mode 100644
index 382da30486e632b148dea7d42a5ad1e56a4081f6..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_ffmpeg~.c
+++ /dev/null
@@ -1,1061 +0,0 @@
-/*
- *   PiDiP module.
- *   Copyright (c) by Yves Degoyon (ydegoyon@free.fr)
- *
- *   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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*  This object is a streaming object towards a ffmeg server
- *  A lot of this object code is inspired by the excellent ffmpeg.c
- *  Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *  The rest is written by Yves Degoyon ( ydegoyon@free.fr )                             
- */
-
-
-#include "pdp.h"
-#include <math.h>
-#include <time.h>
-#include <sys/time.h>
-#include <avformat.h>
-
-#define VIDEO_BUFFER_SIZE (1024*1024)
-#define MAX_AUDIO_PACKET_SIZE (128 * 1024)
-#define AUDIO_PACKET_SIZE (2*1152)
-
-static char   *pdp_ffmpeg_version = "pdp_ffmpeg~: version 0.1, a video streaming object (towards ffserver)";
-
-typedef struct pdp_ffmpeg_struct
-{
-    t_object x_obj;
-    t_float x_f;
-
-    int x_packet0;
-    int x_dropped;
-    int x_queue_id;
-
-    int x_vwidth;
-    int x_vheight;
-    int x_vsize;
-
-    t_outlet *x_outlet_streaming;  // indicates the action of streaming
-    t_outlet *x_outlet_nbframes;   // number of frames emitted
-    t_outlet *x_outlet_framerate;  // real framerate
-    t_outlet *x_outlet_nbframes_dropped; // number of frames dropped
-
-    char  *x_feedname;
-    int x_streaming;   // streaming flag
-    int x_nbframes;    // number of frames emitted
-    int x_nbframes_dropped; // number of frames dropped
-    int x_nbvideostreams; // number of video streams
-    int x_nbaudiostreams; // number of audio streams
-    int x_cursec;   // current second
-    int *x_secondcount; // number of frames emitted in the current second ( per video stream )
-
-      /* AV data structures */
-    AVFormatContext  *x_avcontext;
-    AVFormatParameters x_avparameters; // unused but the call is necessary to allocate structures
-    AVPicture *x_final_picture;
-    AVPicture *x_formatted_picture;
-    AVPicture x_picture_format;
-    AVPicture x_picture_final;
-    ImgReSampleContext *x_img_resample_ctx;
-    uint8_t *x_video_buffer;
-    uint8_t *x_rdata;
-    uint8_t *x_buf1;
-    uint8_t *x_buf2;
-
-      /* audio structures */
-    short x_audio_buf[2*MAX_AUDIO_PACKET_SIZE]; /* buffer for incoming audio */
-    short x_audio_enc_buf[2*MAX_AUDIO_PACKET_SIZE]; /* buffer for audio to be encoded */
-    uint8_t x_audio_out[4*MAX_AUDIO_PACKET_SIZE]; /* buffer for encoded audio */
-    int x_audioin_position; // writing position for incoming audio
-    int x_audio_per_frame;  // number of audio samples to transmit for each frame
-    ReSampleContext *x_audio_resample_ctx; // structures for audio resample
-    FifoBuffer      *x_audio_fifo;  // audio fifos ( one per codec )
-
-} t_pdp_ffmpeg;
-
-static int pdp_ffmpeg_read_ffserver_streams(t_pdp_ffmpeg *x)
-{
-    int i, err;
-    AVFormatContext *ic;
-    
-    err = av_open_input_file(&ic, x->x_feedname, NULL, FFM_PACKET_SIZE, NULL);
-    if (err < 0)
-    {
-       return err;
-    }
-
-    /* copy stream format */
-    x->x_avcontext->nb_streams = ic->nb_streams;
-    x->x_nbvideostreams = 0;
-    x->x_nbaudiostreams = 0;
-
-    for(i=0;i<ic->nb_streams;i++) 
-    {
-      AVStream *st;
-
-        st = av_mallocz(sizeof(AVFormatContext));
-        memcpy(st, ic->streams[i], sizeof(AVStream));
-        x->x_avcontext->streams[i] = st;
- 
-#if FFMPEG_VERSION_INT >= 0x000409
-        if ( ic->streams[i]->codec->codec_type == CODEC_TYPE_UNKNOWN )
-        {
-           post( "pdp_ffmpeg~ : stream #%d # type : unknown", i ); 
-        }
-        if ( ic->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO )
-        {
-           post( "pdp_ffmpeg~ : stream #%d # type : audio # id : %d # bitrate : %d", 
-                 i, ic->streams[i]->codec->codec_id, ic->streams[i]->codec->bit_rate ); 
-           post( "pdp_ffmpeg~ : sample rate : %d # channels : %d", 
-                 ic->streams[i]->codec->sample_rate, ic->streams[i]->codec->channels ); 
-           x->x_nbaudiostreams++;
-        }
-        if ( ic->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
-        {
-           post( "pdp_ffmpeg~ : stream #%d # type : video # id : %d # bitrate : %d", 
-                 i, ic->streams[i]->codec->codec_id, ic->streams[i]->codec->bit_rate ); 
-           post( "pdp_ffmpeg~ : framerate : %d # width : %d # height : %d", 
-                 av_q2d( ic->streams[i]->r_frame_rate ), ic->streams[i]->codec->width, ic->streams[i]->codec->height ); 
-           x->x_nbvideostreams++;
-        }
-#else
-        if ( ic->streams[i]->codec.codec_type == CODEC_TYPE_UNKNOWN )
-        {
-           post( "pdp_ffmpeg~ : stream #%d # type : unknown", i ); 
-        }
-        if ( ic->streams[i]->codec.codec_type == CODEC_TYPE_AUDIO )
-        {
-           post( "pdp_ffmpeg~ : stream #%d # type : audio # id : %d # bitrate : %d", 
-                 i, ic->streams[i]->codec.codec_id, ic->streams[i]->codec.bit_rate ); 
-           post( "pdp_ffmpeg~ : sample rate : %d # channels : %d", 
-                 ic->streams[i]->codec.sample_rate, ic->streams[i]->codec.channels ); 
-           x->x_nbaudiostreams++;
-        }
-        if ( ic->streams[i]->codec.codec_type == CODEC_TYPE_VIDEO )
-        {
-           post( "pdp_ffmpeg~ : stream #%d # type : video # id : %d # bitrate : %d", 
-                 i, ic->streams[i]->codec.codec_id, ic->streams[i]->codec.bit_rate ); 
-           post( "pdp_ffmpeg~ : framerate : %d # width : %d # height : %d", 
-                 ic->streams[i]->codec.frame_rate/10000, ic->streams[i]->codec.width, ic->streams[i]->codec.height ); 
-           x->x_nbvideostreams++;
-        }
-#endif
-    }
-
-    if ( x->x_secondcount ) free( x->x_secondcount );
-    x->x_secondcount = (int*) malloc( x->x_nbvideostreams*sizeof(int) );
-    memset( x->x_secondcount, 0x00, x->x_nbvideostreams*sizeof(int) );
-    x->x_audio_fifo = (FifoBuffer*) malloc( x->x_nbaudiostreams*sizeof(FifoBuffer) );
-    for ( i=0; i<x->x_nbaudiostreams; i++)
-    {
-       fifo_init(&x->x_audio_fifo[i], 2 * MAX_AUDIO_PACKET_SIZE);
-    }
-
-    av_close_input_file(ic);
-
-    return 0;
-}
-
-static void pdp_ffmpeg_starve(t_pdp_ffmpeg *x)
-{
- int ret, i;
-
-   if (!x->x_streaming)
-   {
-     post("pdp_ffmpeg~ : close request but no feed is opened ... ignored" );
-     return;
-   }
-
-   x->x_streaming = 0;
-   outlet_float( x->x_outlet_streaming, x->x_streaming );
-   x->x_nbframes = 0;
-   outlet_float( x->x_outlet_nbframes, x->x_nbframes );
-   x->x_nbframes_dropped = 0;
-   outlet_float( x->x_outlet_nbframes_dropped, x->x_nbframes_dropped );
-   if ( x->x_buf1 ) free( x->x_buf1 );
-   x->x_buf1 = NULL;
-   if ( x->x_buf2 ) free( x->x_buf2 );
-   x->x_buf2 = NULL;
-
-   if (x->x_img_resample_ctx) 
-   {
-     img_resample_close(x->x_img_resample_ctx);
-     x->x_img_resample_ctx = NULL;
-   }
-
-   if (x->x_audio_resample_ctx) 
-   {
-     audio_resample_close(x->x_audio_resample_ctx);
-     x->x_audio_resample_ctx = NULL;
-   }
-
-   if ( ( ret = url_fclose(&x->x_avcontext->pb) ) < 0 )
-   {
-     post("pdp_ffmpeg~ : could not close stream (ret=%d)", ret );
-   }
-   
-   for(i=0;i<x->x_avcontext->nb_streams;i++)
-   {
-#if FFMPEG_VERSION_INT >= 0x000409
-     avcodec_close( x->x_avcontext->streams[i]->codec );
-#else
-     avcodec_close( &x->x_avcontext->streams[i]->codec );
-#endif
-     av_free( x->x_avcontext->streams[i] );
-   }
-
-}
-
-static void pdp_ffmpeg_feed(t_pdp_ffmpeg *x, t_symbol *s)
-{
-  int ret, i;
-
-   if (x->x_streaming)
-   {
-     post("pdp_ffmpeg~ : feed request but a feed is running ... ignored" );
-     return;
-   }
-
-   if ( !strstr( s->s_name, "http:" ) || !strstr( s->s_name, ".ffm" ) )
-   {
-      post( "pdp_ffmpeg~ : wrong feed format <%s>: should be like http://localhost:8090/test.ffm", s->s_name );
-   }
-   if ( x->x_feedname ) free( x->x_feedname );
-   x->x_feedname = (char*) malloc( strlen( s->s_name ) + 1 );
-   strcpy( x->x_feedname, s->s_name );
-
-     /* set output format */
-   x->x_avcontext->oformat = guess_format(NULL, s->s_name, NULL);
-
-   if ( ( ret = pdp_ffmpeg_read_ffserver_streams(x) ) < 0 )
-   {
-      post( "pdp_ffmpeg~ : error encountered while reading feed informations :", ret );
-      if ( ret == -1 ) post( "pdp_ffmpeg~ : unknown error" );
-      if ( ret == -2 ) post( "pdp_ffmpeg~ : i/o error" );
-      if ( ret == -3 ) post( "pdp_ffmpeg~ : number syntax expected in filename" );
-      if ( ret == -4 ) post( "pdp_ffmpeg~ : invalid data found" );
-      if ( ret == -5 ) post( "pdp_ffmpeg~ : not enough memory" );
-      if ( ret == -6 ) post( "pdp_ffmpeg~ : unknown format" );
-
-      x->x_streaming = 0;
-      outlet_float( x->x_outlet_streaming, x->x_streaming );
-      return;
-   } 
-
-     /* open the stream now */
-   if (url_fopen(&x->x_avcontext->pb, s->s_name, URL_WRONLY) < 0) 
-   {
-      post("pdp_ffmpeg~ : could not open stream '%s'", s->s_name);
-      x->x_streaming = 0;
-      outlet_float( x->x_outlet_streaming, x->x_streaming );
-      return;
-   }
-   else
-   {
-      post("pdp_ffmpeg~ : opened stream '%s'", s->s_name);
-   }
-
-     /* open each encoder */
-   for(i=0;i<x->x_avcontext->nb_streams;i++) 
-   {
-      AVCodec *codec;
-#if FFMPEG_VERSION_INT >= 0x000409
-      codec = avcodec_find_encoder(x->x_avcontext->streams[i]->codec->codec_id);
-#else
-      codec = avcodec_find_encoder(x->x_avcontext->streams[i]->codec.codec_id);
-#endif
-      if (!codec) 
-      {
-          post("pdp_ffmpeg~ : unsupported codec for output stream #%d\n", i );
-          x->x_streaming = 0;
-          outlet_float( x->x_outlet_streaming, x->x_streaming );
-          return;
-      }
-#if FFMPEG_VERSION_INT >= 0x000409
-      if (avcodec_open(x->x_avcontext->streams[i]->codec, codec) < 0) 
-#else
-      if (avcodec_open(&x->x_avcontext->streams[i]->codec, codec) < 0) 
-#endif
-      {
-          post("pdp_ffmpeg~ : error while opening codec for stream #%d - maybe incorrect parameters such as bit_rate, rate, width or height\n", i);
-          x->x_streaming = 0;
-          outlet_float( x->x_outlet_streaming, x->x_streaming );
-          return;
-      }
-      else
-      {
-          post("pdp_ffmpeg~ : opened encoder for stream #%d", i);
-      }
-    }
-
-      /* set parameters */
-    if (av_set_parameters(x->x_avcontext, &x->x_avparameters) < 0) 
-    {
-       post("pdp_ffmpeg~ : severe error : could not set encoding parameters" );
-       x->x_streaming = 0;
-       outlet_float( x->x_outlet_streaming, x->x_streaming );
-       return;
-    }
-    
-      /* write header */
-    if (av_write_header(x->x_avcontext) < 0) 
-    {
-       post("pdp_ffmpeg~ : could not write header (incorrect codec parameters ?)\n", i);
-       x->x_streaming = 0;
-       outlet_float( x->x_outlet_streaming, x->x_streaming );
-       return;
-    }
-
-    x->x_streaming = 1;
-    outlet_float( x->x_outlet_streaming, x->x_streaming );
-    x->x_nbframes = 0;
-    outlet_float( x->x_outlet_nbframes, x->x_nbframes );
-    x->x_nbframes_dropped = 0;
-    outlet_float( x->x_outlet_nbframes_dropped, x->x_nbframes_dropped );
-
-}
-
-static void pdp_ffmpeg_allocate(t_pdp_ffmpeg *x)
-{
-    x->x_rdata = (uint8_t*) getbytes( (x->x_vsize+(x->x_vsize>>1))*sizeof(uint8_t) );
-}
-
-static void pdp_ffmpeg_free_ressources(t_pdp_ffmpeg *x)
-{
-    if (x->x_rdata) freebytes( x->x_rdata, (x->x_vsize+(x->x_vsize>>1))*sizeof(uint8_t) );
-}
-
-static void pdp_ffmpeg_process_yv12(t_pdp_ffmpeg *x)
-{
-    t_pdp     *header = pdp_packet_header(x->x_packet0);
-    short int *data   = (short int *)pdp_packet_data(x->x_packet0);
-    t_pdp     *newheader = 0;
-    short int *newdata = 0;
-    int     newpacket = -1, i, j;
-    short int *pY, *pU, *pV;
-    uint8_t     *pnY, *pnU, *pnV;
-    int     px, py;
-    int     svideoindex;
-    int     saudioindex;
-    struct timeval etime;
-    int   sizeout, size, encsize;
-    int   framebytes;
-    int   owidth, oheight;
-    short   *pencbuf;
-    int   framerate, atime, ttime;
-
-        /* allocate all ressources */
-    if ( ((int)header->info.image.width != x->x_vwidth) ||
-         ((int)header->info.image.height != x->x_vheight) )
-    {
-        pdp_ffmpeg_free_ressources(x); 
-        x->x_vwidth = header->info.image.width;
-        x->x_vheight = header->info.image.height;
-        x->x_vsize = x->x_vwidth*x->x_vheight;
-        pdp_ffmpeg_allocate(x); 
-    }
-
-    if ( x->x_streaming )
-    {
-       AVPicture pdppict;
-         
-         pY = data;
-         pV = data+x->x_vsize;
-         pU = data+x->x_vsize+(x->x_vsize>>2);
-         pnY = x->x_rdata;
-         pnU = x->x_rdata+x->x_vsize;
-         pnV = x->x_rdata+x->x_vsize+(x->x_vsize>>2);
-         for(py=0; py<x->x_vheight; py++)
-         {
-            for(px=0; px<x->x_vwidth; px++)
-            {
-               *pnY = (uint8_t) (*(pY++)>>7); 
-               pnY++;
-               if ( (px%2==0) && (py%2==0) )
-               {
-                   *pnV = (uint8_t) (((*(pV++))>>8)+128); 
-                   *pnU = (uint8_t) (((*(pU++))>>8)+128); 
-                   pnU++;pnV++;
-               }
-            }
-         }
-	
-         if ( avpicture_fill(&pdppict, x->x_rdata,
-                        PIX_FMT_YUV420P,
-                        x->x_vwidth,
-                        x->x_vheight) < 0 )
-         {
-            post( "pdp_ffmpeg~ : could not build av picture" );
-         }
-
-         // output all video streams
-         svideoindex=0;
-         saudioindex=0;
-#if FFMPEG_VERSION_INT >= 0x000409
-        for (i=0; i<x->x_avcontext->nb_streams; i++)
-        {
-             /* convert pixel format and size if needed */
-           if ( x->x_avcontext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
-           {
-             int size;
-
-             // check if the framerate has been exceeded
-             if ( gettimeofday(&etime, NULL) == -1)
-             {
-                post("pdp_ffmpeg~ : could not read time" );
-             }
-             if ( etime.tv_sec != x->x_cursec )
-             {
-                x->x_cursec = etime.tv_sec;
-                outlet_float( x->x_outlet_framerate, x->x_secondcount[ svideoindex ] );
-                for (j=0; j<x->x_nbvideostreams; j++)
-                {
-                   x->x_secondcount[ j ] = 0;
-                }
-             }
-             framerate = av_q2d( x->x_avcontext->streams[i]->r_frame_rate );
-             ttime = ( ( x->x_nbframes + 1 ) % framerate ) * ( 1000 / framerate );
-             atime = ( etime.tv_usec / 1000 );
-             // post("pdp_theonice~ : actual : %d, theoretical : %d", atime, ttime );
-             if ( atime < ttime )
-             {
-                x->x_nbframes_dropped++;
-                continue;
-             }
-
-             if ( x->x_avcontext->streams[i]->codec->pix_fmt != PIX_FMT_YUV420P )
-             {
-               /* create temporary picture */
-               size = avpicture_get_size(x->x_avcontext->streams[i]->codec->pix_fmt, 
-                                         x->x_vwidth, x->x_vheight );  
-               if (!x->x_buf1) x->x_buf1 = (uint8_t*) malloc(size);
-               if (!x->x_buf1)
-               {
-                 post ("pdp_ffmpeg~ : severe error : could not allocate image buffer" );
-                 return;
-               }
-               x->x_formatted_picture = &x->x_picture_format;
-               avpicture_fill(x->x_formatted_picture, x->x_buf1, 
-                              x->x_avcontext->streams[i]->codec->pix_fmt, 
-                              x->x_vwidth, x->x_vheight );  
-  
-               if (img_convert(x->x_formatted_picture, 
-                          x->x_avcontext->streams[i]->codec->pix_fmt,
-                          &pdppict, PIX_FMT_YUV420P,
-                          x->x_vwidth, x->x_vheight ) < 0) 
-               {
-                 post ("pdp_ffmpeg~ : error : image conversion failed" );
-               }
-             }
-             else
-             {
-                 x->x_formatted_picture = &pdppict;
-             }
-
-             // post ( "pdp_ffmpeg~ : resampling [%d,%d] -> [%d,%d]",
-             //        x->x_vwidth, x->x_vheight,
-             //        x->x_avcontext->streams[i]->codec->width,
-             //        x->x_avcontext->streams[i]->codec->height );
-             if ( ( x->x_avcontext->streams[i]->codec->width < x->x_vwidth ) &&
-                  ( x->x_avcontext->streams[i]->codec->height < x->x_vheight ) )
-             {
-               owidth = x->x_avcontext->streams[i]->codec->width;
-               oheight = x->x_avcontext->streams[i]->codec->height;
-
-               if (x->x_img_resample_ctx) img_resample_close(x->x_img_resample_ctx);
-		
-#if LIBAVCODEC_BUILD > 4715	
-               x->x_img_resample_ctx = img_resample_full_init(
-                              owidth, oheight, 
-                              x->x_vwidth, x->x_vheight, 
-                              0, 0, 0, 0,
-                              0, 0, 0, 0);
-#else
-               x->x_img_resample_ctx = img_resample_full_init(
-                              owidth, oheight, 
-                              x->x_vwidth, x->x_vheight, 0, 0, 0, 0);
-#endif
-                 
-               size = avpicture_get_size(x->x_avcontext->streams[i]->codec->pix_fmt, 
-                                         owidth, oheight );
-               if ( !x->x_buf2 ) 
-               {
-                  x->x_buf2 = (uint8_t*) malloc(size);
-               }
-               if (!x->x_buf2)
-               {
-                 post ("pdp_ffmpeg~ : severe error : could not allocate image buffer" );
-                 return;
-               }
-               x->x_final_picture = &x->x_picture_final;
-               avpicture_fill(x->x_final_picture, x->x_buf2, 
-                              x->x_avcontext->streams[i]->codec->pix_fmt, 
-                              owidth, oheight );
-  
-               img_resample(x->x_img_resample_ctx, x->x_final_picture, x->x_formatted_picture);
-    
-             }
-             else
-             {
-               x->x_final_picture = x->x_formatted_picture;
-             }
-
-             // encode and send the picture
-             {
-               AVFrame aframe;
-#if LIBAVCODEC_BUILD > 4715	
-               AVPacket vpkt;
-#endif
-               int fsize, ret;
-                
-                 memset(&aframe, 0, sizeof(AVFrame));
-                 *(AVPicture*)&aframe= *x->x_final_picture;
-                 aframe.pts = etime.tv_sec*1000000 + etime.tv_usec;
-                 aframe.quality = x->x_avcontext->streams[i]->quality;
-  
-                 fsize = avcodec_encode_video(x->x_avcontext->streams[i]->codec,
-                             x->x_video_buffer, VIDEO_BUFFER_SIZE,
-                             &aframe);
-
-#if LIBAVCODEC_BUILD > 4715	
-                 av_init_packet(&vpkt);
-
-                 vpkt.pts = aframe.pts;
-                 if(x->x_avcontext->streams[i]->codec->coded_frame->key_frame) 
-                        vpkt.flags |= PKT_FLAG_KEY;
-                 vpkt.stream_index= i;
-                 vpkt.data= (uint8_t *)x->x_video_buffer;
-                 vpkt.size= fsize;
-
-                 if ( ( ret = av_write_frame( x->x_avcontext, &vpkt) ) < 0 )
-#else
-                 if ( ( ret = av_write_frame( x->x_avcontext, i, x->x_video_buffer, fsize) ) < 0 )
-#endif
-                 {
-                    post ("pdp_ffmpeg~ : error : could not send frame : (ret=%d)", ret );
-                    return;
-                 }
-                 else
-                 {
-                    x->x_nbframes++;
-                    x->x_secondcount[ svideoindex ]++;
-                    // post ("pdp_ffmpeg~ : index=%d count=%d", svideoindex, x->x_secondcount[ svideoindex ] );
-                    svideoindex++;
-                 }
-             }
-           } 
-
-              /* convert and stream audio data */
-           if ( x->x_avcontext->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO )
-           {
-                    // we assume audio is synchronized on next video stream 
-                 if ( ( (i+1) < x->x_avcontext->nb_streams ) &&
-                      ( x->x_avcontext->streams[i+1]->codec->codec_type == CODEC_TYPE_VIDEO ) )
-                 {
-                     x->x_audio_per_frame = 
-                        // 2*( (int) sys_getsr() ) / av_q2d( x->x_avcontext->streams[i+1]->r_frame_rate ) ;
-                        AUDIO_PACKET_SIZE;
-                     // post ("pdp_ffmpeg~ : transmit %d samples", x->x_audio_per_frame );
-                 }
-                 else
-                 {
-                     post ("pdp_ffmpeg~ : can't stream audio : video stream is not found" );
-                     continue;
-                 }
-       
-                 if ( x->x_audioin_position > x->x_audio_per_frame )
-                 {
-                    size = x->x_audioin_position;
-                    if ( ( x->x_avcontext->streams[i]->codec->sample_rate != (int)sys_getsr() ) ||
-                         ( x->x_avcontext->streams[i]->codec->channels != 2 ) )
-                    {
-                      if (x->x_audio_resample_ctx) audio_resample_close(x->x_audio_resample_ctx);
-                      x->x_audio_resample_ctx = 
-                       audio_resample_init(x->x_avcontext->streams[i]->codec->channels, 2,
-                                         x->x_avcontext->streams[i]->codec->sample_rate,
-                                         (int)sys_getsr());
-                      sizeout = audio_resample(x->x_audio_resample_ctx,
-                                    x->x_audio_enc_buf, 
-                                    x->x_audio_buf,
-                                    size / (x->x_avcontext->streams[i]->codec->channels * 2));
-                      pencbuf = (short*) &x->x_audio_enc_buf;
-                      sizeout = sizeout * x->x_avcontext->streams[i]->codec->channels * 2;
-                    }
-                    else
-                    {
-                      pencbuf = (short*) &x->x_audio_buf;
-                      sizeout = size;
-                    }
-
-                      /* output resampled raw samples */
-                    fifo_write(&x->x_audio_fifo[saudioindex], (uint8_t*)pencbuf, sizeout,
-                               &x->x_audio_fifo[saudioindex].wptr);
-
-                    framebytes = x->x_avcontext->streams[i]->codec->frame_size * 2 * 
-                                 x->x_avcontext->streams[i]->codec->channels;
- 
-                    while (fifo_read(&x->x_audio_fifo[saudioindex], (uint8_t*)pencbuf, framebytes,
-                                     &x->x_audio_fifo[saudioindex].rptr) == 0) 
-                    {
-#if LIBAVCODEC_BUILD > 4715	
-                      AVPacket apkt;
-#endif
-                         encsize = avcodec_encode_audio(x->x_avcontext->streams[i]->codec, 
-                                       (uint8_t*)&x->x_audio_out, sizeof(x->x_audio_out),
-                                       (short *)pencbuf);
-#if LIBAVCODEC_BUILD > 4715	
-                         av_init_packet(&apkt);
-
-                         apkt.pts = etime.tv_sec*1000000 + etime.tv_usec;
-                         if(x->x_avcontext->streams[i]->codec->coded_frame->key_frame) 
-                                  apkt.flags |= PKT_FLAG_KEY;
-                         apkt.stream_index= i;
-                         apkt.data= (uint8_t *)x->x_audio_out;
-                         apkt.size= encsize;
-                         
-                         av_write_frame(x->x_avcontext, &apkt);
-#else
-                         av_write_frame(x->x_avcontext, i, x->x_audio_out, encsize);
-#endif
-                    }
-                    saudioindex++;
-                 }
-           }
-        }
-#else
-        for (i=0; i<x->x_avcontext->nb_streams; i++)
-        {
-             /* convert pixel format and size if needed */
-           if ( x->x_avcontext->streams[i]->codec.codec_type == CODEC_TYPE_VIDEO )
-           {
-             int size;
-
-             // check if the framerate has been exceeded
-             if ( gettimeofday(&etime, NULL) == -1)
-             {
-                post("pdp_ffmpeg~ : could not read time" );
-             }
-             if ( etime.tv_sec != x->x_cursec )
-             {
-                x->x_cursec = etime.tv_sec;
-                outlet_float( x->x_outlet_framerate, x->x_secondcount[ svideoindex ] );
-                for (j=0; j<x->x_nbvideostreams; j++)
-                {
-                   x->x_secondcount[ j ] = 0;
-                }
-             }
-             framerate = x->x_avcontext->streams[i]->codec.frame_rate/10000;
-             ttime = ( ( x->x_nbframes + 1 ) % framerate ) * ( 1000 / framerate );
-             atime = ( etime.tv_usec / 1000 );
-             // post("pdp_theonice~ : actual : %d, theoretical : %d", atime, ttime );
-             if ( atime < ttime )
-             {
-                x->x_nbframes_dropped++;
-                continue;
-             }
-
-             if ( x->x_avcontext->streams[i]->codec.pix_fmt != PIX_FMT_YUV420P )
-             {
-               /* create temporary picture */
-               size = avpicture_get_size(x->x_avcontext->streams[i]->codec.pix_fmt, 
-                                         x->x_vwidth, x->x_vheight );  
-               if (!x->x_buf1) x->x_buf1 = (uint8_t*) malloc(size);
-               if (!x->x_buf1)
-               {
-                 post ("pdp_ffmpeg~ : severe error : could not allocate image buffer" );
-                 return;
-               }
-               x->x_formatted_picture = &x->x_picture_format;
-               avpicture_fill(x->x_formatted_picture, x->x_buf1, 
-                              x->x_avcontext->streams[i]->codec.pix_fmt, 
-                              x->x_vwidth, x->x_vheight );  
-  
-               if (img_convert(x->x_formatted_picture, 
-                          x->x_avcontext->streams[i]->codec.pix_fmt,
-                          &pdppict, PIX_FMT_YUV420P,
-                          x->x_vwidth, x->x_vheight ) < 0) 
-               {
-                 post ("pdp_ffmpeg~ : error : image conversion failed" );
-               }
-             }
-             else
-             {
-                 x->x_formatted_picture = &pdppict;
-             }
-
-             // post ( "pdp_ffmpeg~ : resampling [%d,%d] -> [%d,%d]",
-             //        x->x_vwidth, x->x_vheight,
-             //        x->x_avcontext->streams[i]->codec.width,
-             //        x->x_avcontext->streams[i]->codec.height );
-             if ( ( x->x_avcontext->streams[i]->codec.width < x->x_vwidth ) &&
-                  ( x->x_avcontext->streams[i]->codec.height < x->x_vheight ) )
-             {
-               owidth = x->x_avcontext->streams[i]->codec.width;
-               oheight = x->x_avcontext->streams[i]->codec.height;
-
-               if (x->x_img_resample_ctx) img_resample_close(x->x_img_resample_ctx);
-		
-#if LIBAVCODEC_BUILD > 4715	
-               x->x_img_resample_ctx = img_resample_full_init(
-                              owidth, oheight, 
-                              x->x_vwidth, x->x_vheight, 
-                              0, 0, 0, 0,
-                              0, 0, 0, 0);
-#else
-               x->x_img_resample_ctx = img_resample_full_init(
-                              owidth, oheight, 
-                              x->x_vwidth, x->x_vheight, 0, 0, 0, 0);
-#endif
-                 
-               size = avpicture_get_size(x->x_avcontext->streams[i]->codec.pix_fmt, 
-                                         owidth, oheight );
-               if ( !x->x_buf2 ) 
-               {
-                  x->x_buf2 = (uint8_t*) malloc(size);
-               }
-               if (!x->x_buf2)
-               {
-                 post ("pdp_ffmpeg~ : severe error : could not allocate image buffer" );
-                 return;
-               }
-               x->x_final_picture = &x->x_picture_final;
-               avpicture_fill(x->x_final_picture, x->x_buf2, 
-                              x->x_avcontext->streams[i]->codec.pix_fmt, 
-                              owidth, oheight );
-  
-               img_resample(x->x_img_resample_ctx, x->x_final_picture, x->x_formatted_picture);
-    
-             }
-             else
-             {
-               x->x_final_picture = x->x_formatted_picture;
-             }
-
-             // encode and send the picture
-             {
-               AVFrame aframe;
-#if LIBAVCODEC_BUILD > 4715	
-               AVPacket vpkt;
-#endif
-               int fsize, ret;
-                
-                 memset(&aframe, 0, sizeof(AVFrame));
-                 *(AVPicture*)&aframe= *x->x_final_picture;
-                 aframe.pts = etime.tv_sec*1000000 + etime.tv_usec;
-                 aframe.quality = x->x_avcontext->streams[i]->quality;
-  
-                 fsize = avcodec_encode_video(&x->x_avcontext->streams[i]->codec,
-                             x->x_video_buffer, VIDEO_BUFFER_SIZE,
-                             &aframe);
-
-#if LIBAVCODEC_BUILD > 4715	
-                 av_init_packet(&vpkt);
-
-                 vpkt.pts = aframe.pts;
-                 if((&x->x_avcontext->streams[i]->codec)->coded_frame->key_frame) 
-                        vpkt.flags |= PKT_FLAG_KEY;
-                 vpkt.stream_index= i;
-                 vpkt.data= (uint8_t *)x->x_video_buffer;
-                 vpkt.size= fsize;
-
-                 if ( ( ret = av_write_frame( x->x_avcontext, &vpkt) ) < 0 )
-#else
-                 if ( ( ret = av_write_frame( x->x_avcontext, i, x->x_video_buffer, fsize) ) < 0 )
-#endif
-                 {
-                    post ("pdp_ffmpeg~ : error : could not send frame : (ret=%d)", ret );
-                    return;
-                 }
-                 else
-                 {
-                    x->x_nbframes++;
-                    x->x_secondcount[ svideoindex ]++;
-                    // post ("pdp_ffmpeg~ : index=%d count=%d", svideoindex, x->x_secondcount[ svideoindex ] );
-                    svideoindex++;
-                 }
-             }
-           } 
-
-              /* convert and stream audio data */
-           if ( x->x_avcontext->streams[i]->codec.codec_type == CODEC_TYPE_AUDIO )
-           {
-                    // we assume audio is synchronized on next video stream 
-                 if ( ( (i+1) < x->x_avcontext->nb_streams ) &&
-                      ( x->x_avcontext->streams[i+1]->codec.codec_type == CODEC_TYPE_VIDEO ) )
-                 {
-                     x->x_audio_per_frame = 
-                        // 2*( (int) sys_getsr() ) / ( x->x_avcontext->streams[i+1]->codec.frame_rate/10000);
-                        AUDIO_PACKET_SIZE;
-                     // post ("pdp_ffmpeg~ : transmit %d samples", x->x_audio_per_frame );
-                 }
-                 else
-                 {
-                     post ("pdp_ffmpeg~ : can't stream audio : video stream is not found" );
-                     continue;
-                 }
-       
-                 if ( x->x_audioin_position > x->x_audio_per_frame )
-                 {
-                    size = x->x_audioin_position;
-                    if ( ( x->x_avcontext->streams[i]->codec.sample_rate != (int)sys_getsr() ) ||
-                         ( x->x_avcontext->streams[i]->codec.channels != 2 ) )
-                    {
-                      if (x->x_audio_resample_ctx) audio_resample_close(x->x_audio_resample_ctx);
-                      x->x_audio_resample_ctx = 
-                       audio_resample_init(x->x_avcontext->streams[i]->codec.channels, 2,
-                                         x->x_avcontext->streams[i]->codec.sample_rate,
-                                         (int)sys_getsr());
-                      sizeout = audio_resample(x->x_audio_resample_ctx,
-                                    x->x_audio_enc_buf, 
-                                    x->x_audio_buf,
-                                    size / (x->x_avcontext->streams[i]->codec.channels * 2));
-                      pencbuf = (short*) &x->x_audio_enc_buf;
-                      sizeout = sizeout * x->x_avcontext->streams[i]->codec.channels * 2;
-                    }
-                    else
-                    {
-                      pencbuf = (short*) &x->x_audio_buf;
-                      sizeout = size;
-                    }
-
-                      /* output resampled raw samples */
-                    fifo_write(&x->x_audio_fifo[saudioindex], (uint8_t*)pencbuf, sizeout,
-                               &x->x_audio_fifo[saudioindex].wptr);
-
-                    framebytes = x->x_avcontext->streams[i]->codec.frame_size * 2 * 
-                                 x->x_avcontext->streams[i]->codec.channels;
- 
-                    while (fifo_read(&x->x_audio_fifo[saudioindex], (uint8_t*)pencbuf, framebytes,
-                                     &x->x_audio_fifo[saudioindex].rptr) == 0) 
-                    {
-#if LIBAVCODEC_BUILD > 4715	
-                      AVPacket apkt;
-#endif
-                         encsize = avcodec_encode_audio(&x->x_avcontext->streams[i]->codec, 
-                                       (uint8_t*)&x->x_audio_out, sizeof(x->x_audio_out),
-                                       (short *)pencbuf);
-#if LIBAVCODEC_BUILD > 4715	
-                         av_init_packet(&apkt);
-
-                         apkt.pts = etime.tv_sec*1000000 + etime.tv_usec;
-                         if((&x->x_avcontext->streams[i]->codec)->coded_frame->key_frame) 
-                                  apkt.flags |= PKT_FLAG_KEY;
-                         apkt.stream_index= i;
-                         apkt.data= (uint8_t *)x->x_audio_out;
-                         apkt.size= encsize;
-                         
-                         av_write_frame(x->x_avcontext, &apkt);
-#else
-                         av_write_frame(x->x_avcontext, i, x->x_audio_out, encsize);
-#endif
-                    }
-                    saudioindex++;
-                 }
-           }
-        }
-#endif
-        x->x_audioin_position=0;
-    }
-    return;
-}
-
-static void pdp_ffmpeg_killpacket(t_pdp_ffmpeg *x)
-{
-    /* delete source packet */
-    pdp_packet_mark_unused(x->x_packet0);
-    x->x_packet0 = -1;
-}
-
-    /* store audio data in PCM format and stream it */
-static t_int *pdp_ffmpeg_perform(t_int *w)
-{
-  t_float *in1   = (t_float *)(w[1]);       // left audio inlet
-  t_float *in2   = (t_float *)(w[2]);       // right audio inlet 
-  t_pdp_ffmpeg *x = (t_pdp_ffmpeg *)(w[3]);
-  int n = (int)(w[4]);                      // number of samples 
-  t_float fsample;
-  int   isample, i;
-
-    // just fills the buffer
-    while (n--)
-    {
-       fsample=*(in1++); 
-       if (fsample > 1.0) { fsample = 1.0; }
-       if (fsample < -1.0) { fsample = -1.0; }
-       isample=(short) (32767.0 * fsample);
-       *(x->x_audio_buf+x->x_audioin_position)=isample;
-       x->x_audioin_position=(x->x_audioin_position+1)%(2*MAX_AUDIO_PACKET_SIZE); 
-       if ( x->x_audioin_position == 2*MAX_AUDIO_PACKET_SIZE-1 ) 
-       {
-          // post( "pdp_ffmpeg~ : reaching end of audio buffer" );
-       }
-       fsample=*(in2++); 
-       if (fsample > 1.0) { fsample = 1.0; }
-       if (fsample < -1.0) { fsample = -1.0; }
-       isample=(short) (32767.0 * fsample);
-       *(x->x_audio_buf+x->x_audioin_position)=isample;
-       x->x_audioin_position=(x->x_audioin_position+1)%(2*MAX_AUDIO_PACKET_SIZE); 
-       if ( x->x_audioin_position == 2*MAX_AUDIO_PACKET_SIZE-1 ) 
-       {
-          // post( "pdp_ffmpeg~ : reaching end of audio buffer" );
-       }
-    }
-
-    return (w+5);
-}
-
-static void pdp_ffmpeg_dsp(t_pdp_ffmpeg *x, t_signal **sp)
-{
-    dsp_add(pdp_ffmpeg_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);
-}
-
-static void pdp_ffmpeg_process(t_pdp_ffmpeg *x)
-{
-   int encoding;
-   t_pdp *header = 0;
-
-   /* check if image data packets are compatible */
-   if ( (header = pdp_packet_header(x->x_packet0))
-	&& (PDP_IMAGE == header->type)){
-    
-	/* pdp_ffmpeg_process inputs and write into active inlet */
-	switch(pdp_packet_header(x->x_packet0)->info.image.encoding)
-        {
-
-	  case PDP_IMAGE_YV12:
-            pdp_queue_add(x, pdp_ffmpeg_process_yv12, pdp_ffmpeg_killpacket, &x->x_queue_id);
-            outlet_float( x->x_outlet_nbframes, x->x_nbframes );
-            outlet_float( x->x_outlet_nbframes_dropped, x->x_nbframes_dropped );
-	    break;
-
-	  case PDP_IMAGE_GREY:
-            // should write something to handle these one day
-            // but i don't use this mode                      
-	    break;
-
-	  default:
-	    /* don't know the type, so dont pdp_ffmpeg_process */
-	    break;
-	    
-	}
-    }
-
-}
-
-static void pdp_ffmpeg_input_0(t_pdp_ffmpeg *x, t_symbol *s, t_floatarg f)
-{
-
-    /* if this is a register_ro message or register_rw message, register with packet factory */
-
-    if (s== gensym("register_rw"))
-       x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("image/YCrCb/*") );
-
-    if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped))
-    {
-        /* add the process method and callback to the process queue */
-        pdp_ffmpeg_process(x);
-    }
-
-}
-
-static void pdp_ffmpeg_free(t_pdp_ffmpeg *x)
-{
-  int i;
-
-    pdp_queue_finish(x->x_queue_id);
-    pdp_packet_mark_unused(x->x_packet0);
-    pdp_ffmpeg_free_ressources(x); 
-    if (x->x_img_resample_ctx) 
-    {
-      img_resample_close(x->x_img_resample_ctx);
-      x->x_img_resample_ctx = NULL;
-    }
-    if (x->x_audio_resample_ctx) 
-    {
-      audio_resample_close(x->x_audio_resample_ctx);
-      x->x_audio_resample_ctx = NULL;
-    }
-    av_free_static();
-}
-
-t_class *pdp_ffmpeg_class;
-
-void *pdp_ffmpeg_new(void)
-{
-    int i;
-
-    t_pdp_ffmpeg *x = (t_pdp_ffmpeg *)pd_new(pdp_ffmpeg_class);
-    inlet_new (&x->x_obj, &x->x_obj.ob_pd, gensym ("signal"), gensym ("signal"));
-
-    x->x_outlet_streaming = outlet_new(&x->x_obj, &s_float);
-    x->x_outlet_nbframes = outlet_new(&x->x_obj, &s_float);
-    x->x_outlet_nbframes_dropped = outlet_new(&x->x_obj, &s_float);
-    x->x_outlet_framerate = outlet_new(&x->x_obj, &s_float);
-
-    x->x_packet0 = -1;
-    x->x_queue_id = -1;
-    x->x_nbframes = 0;
-    x->x_nbframes_dropped = 0;
-    x->x_img_resample_ctx = NULL;
-    x->x_audio_resample_ctx = NULL;
-    x->x_secondcount = NULL;
-    x->x_nbvideostreams = 0;
-    x->x_audioin_position = 0;
-
-    x->x_rdata = NULL;
-    x->x_buf1 = NULL;
-    x->x_buf2 = NULL;
-    x->x_avcontext = av_mallocz(sizeof(AVFormatContext));
-    x->x_video_buffer = av_malloc( VIDEO_BUFFER_SIZE );
-    if ( !x->x_video_buffer || !x->x_avcontext )
-    {
-       post( "pdp_ffmpeg~ : severe error : could not allocate video structures." );
-       return NULL;
-    }
-
-    // activate codecs
-    av_register_all();
-
-    return (void *)x;
-}
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-void pdp_ffmpeg_tilde_setup(void)
-{
-    // post( pdp_ffmpeg_version );
-    pdp_ffmpeg_class = class_new(gensym("pdp_ffmpeg~"), (t_newmethod)pdp_ffmpeg_new,
-    	(t_method)pdp_ffmpeg_free, sizeof(t_pdp_ffmpeg), 0, A_NULL);
-
-    CLASS_MAINSIGNALIN(pdp_ffmpeg_class, t_pdp_ffmpeg, x_f );
-    class_addmethod(pdp_ffmpeg_class, (t_method)pdp_ffmpeg_input_0, gensym("pdp"),  A_SYMBOL, A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_ffmpeg_class, (t_method)pdp_ffmpeg_dsp, gensym("dsp"), 0);
-    class_addmethod(pdp_ffmpeg_class, (t_method)pdp_ffmpeg_feed, gensym("feed"), A_SYMBOL, A_NULL);
-    class_addmethod(pdp_ffmpeg_class, (t_method)pdp_ffmpeg_starve, gensym("starve"), A_NULL);
-
-
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/externals/pidip/modules/pdp_form.c b/externals/pidip/modules/pdp_form.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_fqt.c b/externals/pidip/modules/pdp_fqt.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_hitandmiss.c b/externals/pidip/modules/pdp_hitandmiss.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_hue.c b/externals/pidip/modules/pdp_hue.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_i.c b/externals/pidip/modules/pdp_i.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_icedthe~.c b/externals/pidip/modules/pdp_icedthe~.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_ieee1394.c b/externals/pidip/modules/pdp_ieee1394.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_imgloader.c b/externals/pidip/modules/pdp_imgloader.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_imgsaver.c b/externals/pidip/modules/pdp_imgsaver.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_intrusion.c b/externals/pidip/modules/pdp_intrusion.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_juxta.c b/externals/pidip/modules/pdp_juxta.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_lens.c b/externals/pidip/modules/pdp_lens.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_live~.c b/externals/pidip/modules/pdp_live~.c
deleted file mode 100644
index f431048c4c39f572523b8e4745d123aba17aebb4..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_live~.c
+++ /dev/null
@@ -1,1101 +0,0 @@
-/*
- *   PiDiP module.
- *   Copyright (c) by Yves Degoyon (ydegoyon@free.fr)
- *
- *   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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*  This object is a stream decoder object
- *  A lot of this object code is inspired by the excellent ffmpeg.c
- *  Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *  The rest is written by Yves Degoyon ( ydegoyon@free.fr )                             
- */
-
-
-#include "pdp.h"
-#include "yuv.h"
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <math.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <avformat.h>
-#include <sys/types.h>
-#include <signal.h>
-
-#define VIDEO_BUFFER_SIZE (1024*1024)
-#define MAX_AUDIO_PACKET_SIZE (128 * 1024)
-#define MIN_AUDIO_SIZE (512)
-#define AUDIO_PACKET_SIZE (2*1152)
-
-#define DEFAULT_CHANNELS 1
-#define DEFAULT_WIDTH 320
-#define DEFAULT_HEIGHT 240
-#define DEFAULT_FRAME_RATE 25
-#define END_OF_STREAM 20
-#define MIN_PRIORITY 0
-#define DEFAULT_PRIORITY 1
-#define MAX_PRIORITY 20
-
-/* a trick to cope with ffmpeg versions */
-#ifndef AVFMT_NOHEADER
-#define AVFMT_NOHEADER AVFMTCTX_NOHEADER
-#endif
-
-static char   *pdp_live_version = "pdp_live~: version 0.1, a video stream decoder ( ydegoyon@free.fr).";
-
-typedef struct pdp_live_struct
-{
-    t_object x_obj;
-    t_float x_f;
-
-    int x_packet0;
-    int x_dropped;
-
-    t_pdp *x_header;
-    unsigned char *x_data;
-    int x_vwidth;
-    int x_vheight;
-    int x_vsize;
-
-    t_outlet *x_pdp_out;           // output decoded pdp packets
-    t_outlet *x_outlet_left;       // left audio output
-    t_outlet *x_outlet_right;      // right audio output
-    t_outlet *x_outlet_streaming;  // indicates the action of streaming
-    t_outlet *x_outlet_nbframes;   // number of frames emitted
-    t_outlet *x_outlet_framerate;  // real framerate
-    t_outlet *x_outlet_endofstream;// for signaling the end of the stream
-
-    pthread_t x_connectchild;      // thread used for connecting to a stream
-    pthread_t x_decodechild;       // stream decoding thread
-    pthread_mutex_t x_audiolock;   // audio mutex
-    pthread_mutex_t x_videolock;   // video mutex
-    int x_usethread;             // flag to activate decoding in a thread
-    int x_autoplay;              // flag to autoplay the file ( default = true )
-    int x_nextimage;             // flag to play next image in manual mode
-    int x_priority;              // priority of decoding thread
-
-    char  *x_url;
-    int x_streaming;      // streaming flag
-    int x_decoding;       // decoding flag
-    int x_loop;           // looping flag ( default = on )
-    int x_nopackets;      // no packet to decode
-    int x_endofstream;    // end of the stream reached
-    int x_nbframes;       // number of frames emitted
-    int x_framerate;      // framerate
-    int x_samplerate;     // audio sample rate
-    int x_audiochannels;  // audio channels
-    int x_audioon;        // enough audio data to start playing
-    int x_blocksize;      // audio block size
-    struct timeval x_starttime; // streaming starting time
-    int x_cursec;         // current second
-    int x_secondcount;    // number of frames received in the current second
-    int x_nbvideostreams; // number of video streams
-    int x_nbaudiostreams; // number of audio streams
-    int x_videoindex;     // index of the first video stream
-
-      /* AV data structures */
-    AVFormatContext  *x_avcontext;
-    AVFormatParameters x_avparameters; // unused but the call is necessary to allocate structures
-    AVPacket x_pkt;                    // packet received on the stream
-    AVPicture x_picture_decoded;
-    long long int x_pts;               // presentation time stamp
-    long long int x_previouspts;       // previous presentation time stamp
-    long long int x_firstpts;          // first presentation time stamp ( time origin )
-    int x_newpicture;
-
-      /* audio structures */
-    int x_audio;           // flag to activate the decoding of audio
-    short x_audio_buf[4*MAX_AUDIO_PACKET_SIZE]; /* buffer for audio from stream*/
-    short x_audio_in[4*MAX_AUDIO_PACKET_SIZE]; /* buffer for resampled PCM audio */
-    int x_audioin_position; // writing position for incoming audio
-    ReSampleContext *x_audio_resample_ctx; // structures for audio resample
-
-} t_pdp_live;
-
-static void pdp_live_priority(t_pdp_live *x, t_floatarg fpriority )
-{
-   if ( ( x->x_priority >= MIN_PRIORITY ) && ( x->x_priority <= MAX_PRIORITY ) )
-   {
-     x->x_priority = (int)fpriority;
-   }
-}
-
-static void pdp_live_threadify(t_pdp_live *x, t_floatarg fusethread )
-{
-   if ( ( fusethread == 0 ) || ( fusethread == 1 ) ) 
-   {
-      x->x_usethread = (int)fusethread;
-   }
-}
-
-static void pdp_live_audio(t_pdp_live *x, t_floatarg faudio )
-{
-   if ( ( faudio == 0. ) || ( faudio == 1. ) )
-   {
-      x->x_audio = (int)faudio;
-   }
-}
-
-static void pdp_live_autoplay(t_pdp_live *x, t_floatarg fautoplay )
-{
-   if ( ( fautoplay == 0. ) || ( fautoplay == 1. ) )
-   {
-      x->x_autoplay = (int)fautoplay;
-   }
-}
-
-static void pdp_live_loop(t_pdp_live *x, t_floatarg floop )
-{
-   if ( ( floop == 0. ) || ( floop == 1. ) )
-   {
-      x->x_loop = (int)floop;
-   }
-}
-
-static void pdp_live_bang(t_pdp_live *x)
-{
-   if ( x->x_nextimage == 1 )
-   {
-      // post( "pdp_live~ : banging too fast, previous image is not decoded yet... ignored" );
-      return;
-   }
-   x->x_nextimage = 1;
-}
-
-static void pdp_live_frame_cold(t_pdp_live *x, t_floatarg frameindex)
-{
-    int frame = (int)frameindex;
-    int ret, flags=0;
-    uint64_t newpts;
-
-    if (!(x->x_streaming)) return;
-
-#if FFMPEG_VERSION_INT >= 0x000409
-    if ( ( ( x->x_avcontext->iformat->flags & AVFMT_NOFILE ) == 0 ) && ( x->x_videoindex != -1 ) )
-    {
-      if ( x->x_framerate != 0 ) 
-      {
-        newpts = x->x_firstpts + ( frame * 1000000 ) / x->x_framerate;
-      }
-      else
-      {
-        post( "pdp_live~ : couldn't seek requested frame ( framerate = %d )", x->x_framerate );
-        return;
-      }
-      if ( frame < x->x_nbframes ) flags = AVSEEK_FLAG_BACKWARD;
-      if ( ( ret = av_seek_frame(x->x_avcontext, x->x_videoindex, newpts, flags) ) < 0 )
-      {
-        post( "pdp_live~ : couldn't seek the requested frame (ret=%d)", ret );
-      }
-    }
-#else
-    post( "pdp_live~ : no seek function with ffmpeg < 4.0.9");
-#endif
-} 
-
-static int pdp_live_decode_packet(t_pdp_live *x)
-{
-  int chunksize=0, length, err, ret;
-  int audiosize, sizeout, imagesize, pictureok;
-  AVFrame frame;
-  uint8_t *pcktptr;
-  unsigned char *pY, *pU, *pV; 
-  uint8_t *psY, *psU, *psV; 
-  int px, py;
-  long long tplaying;
-  long long ttheoretical;
-  struct timeval ctime;
-  struct timespec mwait;
-
-   if ( !x->x_streaming )
-   {
-      return -1;
-   }
-
-   // post( "pdp_live~ : trying to read packet" );
-   // read new packet on the stream
-   if ( x->x_streaming && av_read_packet(x->x_avcontext, &x->x_pkt) < 0) 
-   {
-      x->x_nopackets++;
-      // post( "pdp_live~ : decoding thread : nothing to decode : no packets :%d", x->x_nopackets );
-      if ( x->x_nopackets > END_OF_STREAM )
-      {
-        x->x_endofstream = 1;
-        if ( x->x_loop )
-        {
-
-#if FFMPEG_VERSION_INT >= 0x000409
-
-          if ( ( x->x_avcontext->iformat->flags & AVFMT_NOFILE ) == 0 )
-          {
-            post( "pdp_live~ : looping file reading..." );
-            if ( ( ret = av_seek_frame(x->x_avcontext, x->x_videoindex, 0, 0) ) < 0 )
-            {
-               post( "pdp_live~ : couldn't seek the requested frame (ret=%d)", ret );
-            }
-            else
-            {
-              x->x_endofstream = 0;
-            }
-          }
-
-#else
-          post( "pdp_live~ : no seek function with ffmpeg < 4.0.9");
-#endif
-        }
-      }
-      return -1;
-   }
-   // post( "pdp_live~ : read packet ( size=%d )", x->x_pkt.size );
-   x->x_nopackets = 0;
-
-   if (x->x_pkt.stream_index >= x->x_avcontext->nb_streams)
-   {
-      post("pdp_live~ : stream received out of range !! ");
-      return -1;
-   }
-
-   length = x->x_pkt.size;
-   pcktptr = x->x_pkt.data;
-   while (length > 0) 
-   {
-         if ( !x->x_streaming ) break;
-#if FFMPEG_VERSION_INT >= 0x000409
-         switch(x->x_avcontext->streams[x->x_pkt.stream_index]->codec->codec_type) 
-#else
-         switch(x->x_avcontext->streams[x->x_pkt.stream_index]->codec.codec_type) 
-#endif
-         {
-             case CODEC_TYPE_AUDIO:
-                    if ( !x->x_audio )
-                    {
-                      av_free_packet(&x->x_pkt);
-                      return 0;
-                    }
-#if FFMPEG_VERSION_INT >= 0x000409
-                    chunksize = avcodec_decode_audio(x->x_avcontext->streams[x->x_pkt.stream_index]->codec, 
-#else
-                    chunksize = avcodec_decode_audio(&x->x_avcontext->streams[x->x_pkt.stream_index]->codec, 
-#endif
-                                               &x->x_audio_buf[0], &audiosize,
-                                               pcktptr, length);
-                    if (chunksize < 0)
-                    {
-                       post("pdp_live~ : could not decode audio input (ret=%d)", chunksize );
-                       av_free_packet(&x->x_pkt);
-                       continue;
-                    }
-                    // some bug in mpeg audio decoder gives
-                    // data_size < 0, it seems they are overflows
-                    if (audiosize <= 0) 
-                    {
-                        /* no audio frame */
-                        pcktptr += chunksize;
-                        length -= chunksize;
-                        // post("pdp_live~ : audio overflow in decoder!");
-                        continue;
-                    }
-
-                    if ( pthread_mutex_lock( &x->x_audiolock ) < 0 )
-                    {
-                      post( "pdp_live~ : unable to lock audio mutex" );
-                      perror( "pthread_mutex_lock" );
-                    }
-
-                    // resample received audio
-                    // post( "pdp_live~ : resampling from %dHz-%dch to %dHz-%dch (in position=%d)",
-                    //                x->x_avcontext->streams[x->x_pkt.stream_index]->codec.sample_rate,
-                    //                x->x_avcontext->streams[x->x_pkt.stream_index]->codec.channels,
-                    //                (int)sys_getsr(), 2, x->x_audioin_position );
-
-#if FFMPEG_VERSION_INT >= 0x000409
-                    x->x_audiochannels = x->x_avcontext->streams[x->x_pkt.stream_index]->codec->channels;
-                    x->x_samplerate = x->x_avcontext->streams[x->x_pkt.stream_index]->codec->sample_rate;
-                    if (x->x_audio_resample_ctx) audio_resample_close(x->x_audio_resample_ctx);
-                    x->x_audio_resample_ctx =
-                          audio_resample_init(DEFAULT_CHANNELS, 
-                                         x->x_avcontext->streams[x->x_pkt.stream_index]->codec->channels,
-                                         (int)sys_getsr(),
-                                         x->x_avcontext->streams[x->x_pkt.stream_index]->codec->sample_rate);
-
-                    sizeout = audio_resample(x->x_audio_resample_ctx,
-                                    &x->x_audio_in[x->x_audioin_position],
-                                    &x->x_audio_buf[0],
-                                    audiosize/(x->x_avcontext->streams[x->x_pkt.stream_index]->codec->channels * sizeof(short)));
-#else
-                    x->x_audiochannels = x->x_avcontext->streams[x->x_pkt.stream_index]->codec.channels;
-                    x->x_samplerate = x->x_avcontext->streams[x->x_pkt.stream_index]->codec.sample_rate;
-                    if (x->x_audio_resample_ctx) audio_resample_close(x->x_audio_resample_ctx);
-                    x->x_audio_resample_ctx =
-                          audio_resample_init(DEFAULT_CHANNELS, 
-                                         x->x_avcontext->streams[x->x_pkt.stream_index]->codec.channels,
-                                         (int)sys_getsr(),
-                                         x->x_avcontext->streams[x->x_pkt.stream_index]->codec.sample_rate);
-
-                    sizeout = audio_resample(x->x_audio_resample_ctx,
-                                    &x->x_audio_in[x->x_audioin_position],
-                                    &x->x_audio_buf[0],
-                                    audiosize/(x->x_avcontext->streams[x->x_pkt.stream_index]->codec.channels * sizeof(short)));
-#endif
-                    sizeout = sizeout * DEFAULT_CHANNELS;
-
-                    if ( ( x->x_audioin_position + sizeout ) < 3*MAX_AUDIO_PACKET_SIZE )
-                    {
-                      x->x_audioin_position = x->x_audioin_position + sizeout;
-                    }
-                    else
-                    {
-                      post( "pdp_live~ : audio overflow : packet ignored...");
-                      x->x_audioin_position = 0;
-                    }
-                    if ( ( x->x_audioin_position > 4*x->x_blocksize ) && (!x->x_audioon) )
-                    {
-                       x->x_audioon = 1;
-                       // post( "pdp_live~ : audio on" );
-                    }
-                    if ( pthread_mutex_unlock( &x->x_audiolock ) < 0 )
-                    {
-                      post( "pdp_live~ : unable to unlock audio mutex" );
-                      perror( "pthread_mutex_unlock" );
-                    }
-                    break;
-
-             case CODEC_TYPE_VIDEO:
-
-#if FFMPEG_VERSION_INT >= 0x000409
-                    imagesize = (x->x_avcontext->streams[x->x_pkt.stream_index]->codec->width * 
-                                 x->x_avcontext->streams[x->x_pkt.stream_index]->codec->height * 3) / 2; // yuv planar
-
-                    x->x_framerate = ( int ) av_q2d( x->x_avcontext->streams[x->x_pkt.stream_index]->r_frame_rate );
-                    if ( x->x_framerate == 0 ) x->x_framerate = DEFAULT_FRAME_RATE;
-                    x->x_videoindex = x->x_pkt.stream_index; 
-
-                    chunksize = avcodec_decode_video(
-                                   x->x_avcontext->streams[x->x_pkt.stream_index]->codec,
-                                   &frame, &pictureok, 
-                                   pcktptr, length);
-                    if ( x->x_avcontext->streams[x->x_pkt.stream_index]->codec->pix_fmt != PIX_FMT_YUV420P )
-                    {
-                       post( "pdp_live~ : unsupported image format : %d", 
-                              x->x_avcontext->streams[x->x_pkt.stream_index]->codec->pix_fmt ); 
-                       pictureok = 0;
-                    }
-#else
-                    imagesize = (x->x_avcontext->streams[x->x_pkt.stream_index]->codec.width * 
-                                 x->x_avcontext->streams[x->x_pkt.stream_index]->codec.height * 3) / 2; // yuv planar
-
-                    x->x_framerate = x->x_avcontext->streams[x->x_pkt.stream_index]->codec.frame_rate / 10000;
-                    if ( x->x_framerate == 0 ) x->x_framerate = DEFAULT_FRAME_RATE;
-                    x->x_videoindex = x->x_pkt.stream_index; 
-
-                    chunksize = avcodec_decode_video(
-                                   &x->x_avcontext->streams[x->x_pkt.stream_index]->codec,
-                                   &frame, &pictureok, 
-                                   pcktptr, length);
-                    if ( x->x_avcontext->streams[x->x_pkt.stream_index]->codec.pix_fmt != PIX_FMT_YUV420P )
-                    {
-                       post( "pdp_live~ : unsupported image format : %d", 
-                              x->x_avcontext->streams[x->x_pkt.stream_index]->codec.pix_fmt ); 
-                       pictureok = 0;
-                    }
-#endif
-                    x->x_picture_decoded = *(AVPicture*)&frame;
-                    x->x_avcontext->streams[x->x_pkt.stream_index]->quality= frame.quality;
-                    if (chunksize < 0) 
-                    {
-                       av_free_packet(&x->x_pkt);
-                       post("pdp_live~ : could not decode video frame (ret=%d)", chunksize );
-                       return 0;
-                    }
-                    if (!pictureok) 
-                    {
-                       // no picture yet 
-                       pcktptr += chunksize;
-                       length -= chunksize;
-                       continue;
-                    }
-                    else
-                    {  
-                        if ( pthread_mutex_lock( &x->x_videolock ) < 0 )
-                        {
-                          post( "pdp_live~ : unable to lock video mutex" );
-                          perror( "pthread_mutex_lock" );
-                        }
-                        x->x_newpicture=1;
-#if FFMPEG_VERSION_INT >= 0x000409
-                        x->x_vwidth = x->x_avcontext->streams[x->x_pkt.stream_index]->codec->width;
-                        x->x_vheight = x->x_avcontext->streams[x->x_pkt.stream_index]->codec->height;
-#else
-                        x->x_vwidth = x->x_avcontext->streams[x->x_pkt.stream_index]->codec.width;
-                        x->x_vheight = x->x_avcontext->streams[x->x_pkt.stream_index]->codec.height;
-#endif
-                        x->x_vsize = x->x_vwidth*x->x_vheight;
-
-                        // create a new pdp packet from BITMAP YV12 image format
-                        x->x_packet0 = pdp_packet_new_bitmap_yv12( x->x_vwidth, x->x_vheight );
-                        x->x_header = pdp_packet_header(x->x_packet0);
-                        x->x_data = (unsigned char *)pdp_packet_data(x->x_packet0);
-
-                        pY = x->x_data;
-                        pV = x->x_data+x->x_vsize;
-                        pU = x->x_data+x->x_vsize+(x->x_vsize>>2);
-
-                        psY = x->x_picture_decoded.data[0];
-                        psU = x->x_picture_decoded.data[1];
-                        psV = x->x_picture_decoded.data[2];
-
-                        for ( py=0; py<x->x_vheight; py++)
-                        {
-                          memcpy( (void*)pY, (void*)psY, x->x_vwidth );
-                          pY += x->x_vwidth;
-                          psY += x->x_picture_decoded.linesize[0];
-                          if ( py%2==0 )
-                          {
-                            memcpy( (void*)pU, (void*)psU, (x->x_vwidth>>1) );
-                            memcpy( (void*)pV, (void*)psV, (x->x_vwidth>>1) );
-                            pU += (x->x_vwidth>>1);
-                            pV += (x->x_vwidth>>1);
-                            psU += x->x_picture_decoded.linesize[1];
-                            psV += x->x_picture_decoded.linesize[2];
-                          }
-                        }
-         
-                        if ( x->x_firstpts == -1 )
-                        {
-                          x->x_firstpts = x->x_pts;
-                        }
-                        x->x_previouspts = x->x_pts;
-                        x->x_pts = frame.pts;
-                        // post( "pdp_live : frame pts : %ld", x->x_pts );
-
-                        if ( x->x_nbframes > 0 )
-                        {
-                          if ( gettimeofday(&ctime, NULL) == -1)
-                          {
-                            post("pdp_live~ : could not read time" );
-                          }
-
-                          tplaying = ( ctime.tv_sec-x->x_starttime.tv_sec )*1000 +
-                                     ( ctime.tv_usec-x->x_starttime.tv_usec )/1000;
-                          ttheoretical = ((x->x_nbframes)*1000 )/x->x_framerate;
-                          // post( "pdp_live~ : %d playing since : %lldms ( theory : %lldms )",
-                          //              x->x_nbframes, tplaying, ttheoretical );
-     
-                          if ( tplaying < ttheoretical )
-                          {
-                            mwait.tv_sec = 0; 
-                            mwait.tv_nsec = (ttheoretical - tplaying)*1000000;
-
-                            // wait between the two successive frames
-                            if ( x->x_autoplay ) nanosleep( &mwait, NULL );
-                          }
-                        }
-                        if ( pthread_mutex_unlock( &x->x_videolock ) < 0 )
-                        {
-                          post( "pdp_live~ : unable to unlock video mutex" );
-                          perror( "pthread_mutex_unlock" );
-                        }
-                    }
-                    break;
-         }
-         pcktptr += chunksize;
-         length -= chunksize;
-   }
-   av_free_packet(&x->x_pkt);
-
-   // post( "pdp_live~ : decoded one packet" );
-   return 0;
-
-}
-
-static void *pdp_decode_stream_from_url(void *tdata)
-{
-  t_pdp_live *x = (t_pdp_live*)tdata;
-  struct sched_param schedprio;
-  int pmin, pmax;
-  struct timespec twait;
-
-    twait.tv_sec = 0; 
-    twait.tv_nsec = 10000000; // 10 ms
- 
-    schedprio.sched_priority = sched_get_priority_min(SCHED_FIFO) + x->x_priority;
-#ifdef __gnu_linux__
-    if ( sched_setscheduler(0,SCHED_FIFO,&schedprio) == -1)
-    {
-        post("pdp_live~ : couldn't set priority for decoding thread.");
-    }
-#endif
-    if ( ! (x->x_avcontext->iformat->flags & AVFMT_NOHEADER ) )
-    {
-       if (x->x_avcontext->iformat->read_header(x->x_avcontext, &x->x_avparameters) < 0) 
-       {
-          post( "pdp_live~ : couldn't read header" );
-       }
-       post( "pdp_live~ : read header." );
-    }
-
-    while ( x->x_decodechild )
-    {
-      if ( ( x->x_streaming ) && ( ( x->x_autoplay ) || ( x->x_nextimage == 1 ) ) )
-      {
-        x->x_decoding = 1;
-        while ( x->x_newpicture ) nanosleep( &twait, NULL );
-     
-        // decode incoming packets
-        if ( ( x->x_streaming ) && ( pdp_live_decode_packet( x ) < 0 ) )
-        {
-           nanosleep( &twait, NULL ); // nothing to read, just wait
-        }
-        x->x_nextimage = -1;
-      }
-      else
-      {
-        x->x_decoding = 0;
-        nanosleep( &twait, NULL ); // nothing to do, just wait
-      }
-    }
-
-    x->x_decodechild = 0;
-    pthread_exit(NULL);
-}
-
-static void *pdp_live_connect_to_url(void *tdata)
-{
-  int i, err;
-  t_pdp_live *x = (t_pdp_live*)tdata;
-  pthread_attr_t decode_child_attr;
-
-    memset(&x->x_avparameters, 0, sizeof(AVFormatParameters));
-    x->x_avparameters.sample_rate = sys_getsr();
-    x->x_avparameters.channels = DEFAULT_CHANNELS;
-    x->x_avparameters.width = DEFAULT_WIDTH;
-    if ( x->x_framerate = 0 ) x->x_framerate = DEFAULT_FRAME_RATE;
-    x->x_avparameters.height = DEFAULT_HEIGHT;
-    x->x_avparameters.image_format = PIX_FMT_YUV420P;
-
-    post( "pdp_live~ : opening url : %s", x->x_url );
-    err = av_open_input_file(&x->x_avcontext, x->x_url, x->x_avcontext->iformat, 0, &x->x_avparameters);
-    if (err < 0)
-    {
-      if ( err == -1 ) post( "pdp_live~ : unknown error" );
-      if ( err == -2 ) post( "pdp_live~ : i/o error" );
-      if ( err == -3 ) post( "pdp_live~ : number syntax expected in filename" );
-      if ( err == -4 ) post( "pdp_live~ : invalid data found" );
-      if ( err == -5 ) post( "pdp_live~ : not enough memory" );
-      if ( err == -6 ) post( "pdp_live~ : unknown format ( stream not found? )" );
-      x->x_connectchild = 0;
-      pthread_exit(NULL);
-    }
-    /* If not enough info to get the stream parameters, we decode the
-       first frames to get it. (used in mpeg case for example) */
-    err = av_find_stream_info(x->x_avcontext);
-    if (err < 0) 
-    {
-      post( "pdp_live~ : %s: could not find codec parameters\n", x->x_url);
-      x->x_connectchild = 0;
-      av_close_input_file(x->x_avcontext);
-      x->x_avcontext = av_mallocz(sizeof(AVFormatContext));
-      pthread_exit(NULL);
-    }
-
-    // post( "pdp_live~ : stream reader : %x", x->x_avcontext->iformat );
-
-    /* copy stream format */
-    x->x_nbvideostreams = 0;
-    x->x_nbaudiostreams = 0;
-
-    for(i=0;i<x->x_avcontext->nb_streams;i++) 
-    {
-      AVStream *st;
-
-#if FFMPEG_VERSION_INT >= 0x000409
-        if ( x->x_avcontext->streams[i]->codec->codec_type == CODEC_TYPE_UNKNOWN )
-        {
-           post( "pdp_live~ : stream #%d # type : unknown", i ); 
-        }
-        if ( x->x_avcontext->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO )
-        {
-           post( "pdp_live~ : stream #%d # type : audio # id : %d # bitrate : %d", 
-                 i, x->x_avcontext->streams[i]->codec->codec_id, x->x_avcontext->streams[i]->codec->bit_rate ); 
-           post( "pdp_live~ : sample rate : %d # channels : %d", 
-                 x->x_avcontext->streams[i]->codec->sample_rate, x->x_avcontext->streams[i]->codec->channels ); 
-           x->x_nbaudiostreams++;
-        }
-        if ( x->x_avcontext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
-        {
-           post( "pdp_live~ : stream #%d # type : video # id : %d # bitrate : %d", 
-                 i, x->x_avcontext->streams[i]->codec->codec_id, 
-                 x->x_avcontext->streams[i]->codec->bit_rate ); 
-           post( "pdp_live~ : framerate : %d # width : %d # height : %d", 
-                 av_q2d( x->x_avcontext->streams[i]->r_frame_rate )/10000, 
-                 x->x_avcontext->streams[i]->codec->width, 
-                 x->x_avcontext->streams[i]->codec->height ); 
-           x->x_nbvideostreams++;
-        }
-#else
-        if ( x->x_avcontext->streams[i]->codec.codec_type == CODEC_TYPE_UNKNOWN )
-        {
-           post( "pdp_live~ : stream #%d # type : unknown", i ); 
-        }
-        if ( x->x_avcontext->streams[i]->codec.codec_type == CODEC_TYPE_AUDIO )
-        {
-           post( "pdp_live~ : stream #%d # type : audio # id : %d # bitrate : %d", 
-                 i, x->x_avcontext->streams[i]->codec.codec_id, x->x_avcontext->streams[i]->codec.bit_rate ); 
-           post( "pdp_live~ : sample rate : %d # channels : %d", 
-                 x->x_avcontext->streams[i]->codec.sample_rate, x->x_avcontext->streams[i]->codec.channels ); 
-           x->x_nbaudiostreams++;
-        }
-        if ( x->x_avcontext->streams[i]->codec.codec_type == CODEC_TYPE_VIDEO )
-        {
-           post( "pdp_live~ : stream #%d # type : video # id : %d # bitrate : %d", 
-                 i, x->x_avcontext->streams[i]->codec.codec_id, 
-                 x->x_avcontext->streams[i]->codec.bit_rate ); 
-           post( "pdp_live~ : framerate : %d # width : %d # height : %d", 
-                 x->x_avcontext->streams[i]->codec.frame_rate/10000, 
-                 x->x_avcontext->streams[i]->codec.width, 
-                 x->x_avcontext->streams[i]->codec.height ); 
-           x->x_nbvideostreams++;
-        }
-#endif
-    }
-
-     /* open each decoder */
-    for(i=0;i<x->x_avcontext->nb_streams;i++) 
-    {
-      AVCodec *codec;
-      post("pdp_live~ : opening decoder for stream #%d", i);
-#if FFMPEG_VERSION_INT >= 0x000409
-      codec = avcodec_find_decoder(x->x_avcontext->streams[i]->codec->codec_id);
-#else
-      codec = avcodec_find_decoder(x->x_avcontext->streams[i]->codec.codec_id);
-#endif
-      if (!codec) 
-      {
-          post("pdp_live~ : unsupported codec for output stream #%d\n", i );
-          x->x_streaming = 0;
-          x->x_connectchild = 0;
-          av_close_input_file(x->x_avcontext);
-          x->x_avcontext = av_mallocz(sizeof(AVFormatContext));
-          pthread_exit(NULL);
-      }
-#if FFMPEG_VERSION_INT >= 0x000409
-      if (avcodec_open(x->x_avcontext->streams[i]->codec, codec) < 0) 
-#else
-      if (avcodec_open(&x->x_avcontext->streams[i]->codec, codec) < 0) 
-#endif
-      {
-          post("pdp_live~ : error while opening codec for stream #%d - maybe incorrect parameters such as bit_rate, rate, width or height\n", i);
-          x->x_streaming = 0;
-          x->x_connectchild = 0;
-          av_close_input_file(x->x_avcontext);
-          x->x_avcontext = av_mallocz(sizeof(AVFormatContext));
-          pthread_exit(NULL);
-      }
-      else
-      {
-          post("pdp_live~ : opened decoder for stream #%d", i);
-      }
-    }
-
-    if ( gettimeofday(&x->x_starttime, NULL) == -1)
-    {
-       post("pdp_live~ : could not set start time" );
-    }
-    x->x_streaming = 1;
-    x->x_nopackets = 0;
-    x->x_endofstream = 0;
-    x->x_nbframes = 0;
-    x->x_pts = -1;
-    x->x_previouspts = -1;
-    x->x_firstpts = -1;
-
-    if ( x->x_usethread && ( x->x_decodechild == 0 ))
-    {
-      x->x_decodechild = 1; // trick & treets
-      // launch decoding thread
-      if ( pthread_attr_init( &decode_child_attr ) < 0 ) 
-      {
-         post( "pdp_live~ : could not launch decoding thread" );
-         perror( "pthread_attr_init" );
-         av_close_input_file(x->x_avcontext);
-         x->x_avcontext = av_mallocz(sizeof(AVFormatContext));
-         pthread_exit(NULL);
-      }
-      if ( pthread_create( &x->x_decodechild, &decode_child_attr, pdp_decode_stream_from_url, x ) < 0 ) 
-      {
-         post( "pdp_live~ : could not launch decoding thread" );
-         perror( "pthread_create" );
-         av_close_input_file(x->x_avcontext);
-         x->x_avcontext = av_mallocz(sizeof(AVFormatContext));
-         pthread_exit(NULL);
-      }
-      else
-      {
-         post( "pdp_live~ : decoding thread %d launched", (int)x->x_decodechild );
-      }
-    }
-   
-    pthread_exit(NULL);
-}
-
-static void pdp_live_disconnect(t_pdp_live *x)
-{
- int ret, i, count=0;
- struct timespec twait;
-
-   twait.tv_sec = 0; 
-   twait.tv_nsec = 10000000; // 10 ms
-
-   if (!x->x_streaming)
-   {
-     post("pdp_live~ : close request but no stream is played ... ignored" );
-     return;
-   }
-
-   if ( x->x_streaming )
-   {
-     x->x_streaming = 0;
-     x->x_newpicture = 0;
-     post("pdp_live~ : waiting end of decoding..." );
-     while ( x->x_decoding ) nanosleep( &twait, NULL );
-     /* close each decoder */
-     for(i=0;i<x->x_avcontext->nb_streams;i++) 
-     {
-#if FFMPEG_VERSION_INT >= 0x000409
-       if (avcodec_close(x->x_avcontext->streams[i]->codec) < 0) 
-#else
-       if (avcodec_close(&x->x_avcontext->streams[i]->codec) < 0) 
-#endif
-       {
-           post("pdp_live~ : error while closing codec for stream #%d", i);
-       }
-     }
-     post("pdp_live~ : closing input file..." );
-     av_close_input_file(x->x_avcontext);
-     x->x_avcontext = av_mallocz(sizeof(AVFormatContext));
-   }
-
-   outlet_float( x->x_outlet_streaming, x->x_streaming );
-   x->x_nbframes = 0;
-   outlet_float( x->x_outlet_nbframes, x->x_nbframes );
-   x->x_framerate = 0;
-   outlet_float( x->x_outlet_framerate, x->x_framerate );
-
-   if (x->x_audio_resample_ctx) 
-   {
-     audio_resample_close(x->x_audio_resample_ctx);
-     x->x_audio_resample_ctx = NULL;
-   }
-
-}
-
-static void pdp_live_connect(t_pdp_live *x, t_symbol *s)
-{
-  int ret, i;
-  pthread_attr_t connect_child_attr;
-
-   if ( ( x->x_streaming ) || ( x->x_connectchild != 0 ) )
-   {
-     post("pdp_live~ : connection request but a connection is pending ... disconnecting" );
-     pdp_live_disconnect(x);
-   }
-
-   if ( x->x_url ) free( x->x_url );
-   x->x_url = (char*) malloc( strlen( s->s_name ) + 1 );
-   strcpy( x->x_url, s->s_name );
-
-   // launch connection thread
-   if ( pthread_attr_init( &connect_child_attr ) < 0 ) {
-       post( "pdp_live~ : could not launch connection thread" );
-       perror( "pthread_attr_init" );
-       return;
-   }
-   if ( pthread_attr_setdetachstate( &connect_child_attr, PTHREAD_CREATE_DETACHED ) < 0 ) {
-       post( "pdp_live~ : could not launch connection thread" );
-       perror( "pthread_attr_setdetachstate" );
-       return;
-   }
-   if ( pthread_create( &x->x_connectchild, &connect_child_attr, pdp_live_connect_to_url, x ) < 0 ) {
-       post( "pdp_live~ : could not launch connection thread" );
-       perror( "pthread_create" );
-       return;
-   }
-   else
-   {
-       post( "pdp_live~ : connection thread %d launched", (int)x->x_connectchild );
-   }
-   
-   return;
-}
-
-    /* decode the stream to fill up buffers */
-static t_int *pdp_live_perform(t_int *w)
-{
-  t_float *out1   = (t_float *)(w[1]);       // left audio inlet
-  t_float *out2   = (t_float *)(w[2]);       // right audio inlet 
-  t_pdp_live *x = (t_pdp_live *)(w[3]);
-  int n = (int)(w[4]);                      // number of samples 
-  short sampleL, sampleR;
-  struct timeval etime;
-  int sn;
-
-    // decode a packet if not in thread mode
-    if ( !x->x_usethread && x->x_streaming )
-    {
-      pdp_live_decode_packet( x );
-    }
-
-    x->x_blocksize = n;
-
-    // just read the buffer
-    if ( x->x_audioon )
-    {
-      if ( pthread_mutex_lock( &x->x_audiolock ) < 0 )
-      {
-        post( "pdp_live~ : unable to lock audio mutex" );
-        perror( "pthread_mutex_lock" );
-      }
-      sn=0;
-      while (n--) 
-      {
-        sampleL=x->x_audio_in[ sn++ ];
-        *(out1) = ((t_float)sampleL)/32768.0;
-        if ( DEFAULT_CHANNELS == 1 )
-        {
-          *(out2) = *(out1);
-        }
-        if ( DEFAULT_CHANNELS == 2 )
-        {
-          sampleR=x->x_audio_in[ sn++ ];
-          *(out2) = ((t_float)sampleR)/32768.0;
-        }
-        out1++;
-        out2++;
-      }
-      memcpy( &x->x_audio_in[0], &x->x_audio_in[sn], 4*MAX_AUDIO_PACKET_SIZE-sn );
-      x->x_audioin_position-=sn;
-      // post( "pdp_live~ : audio in position : %d", x->x_audioin_position );
-      if ( x->x_audioin_position <= 0 )
-      {
-         x->x_audioon = 0;
-         // post( "pdp_live~ : audio off" );
-      }
-      if ( pthread_mutex_unlock( &x->x_audiolock ) < 0 )
-      {
-        post( "pdp_live~ : unable to audio unlock mutex" );
-        perror( "pthread_mutex_unlock" );
-      }
-    }
-    else
-    {
-      // post("pdp_live~ : no available audio" );
-      while (n--)
-      {
-        *(out1++) = 0.0;
-        *(out2++) = 0.0;
-      }
-    }	
-
-    // check if the framerate has been exceeded
-    if ( gettimeofday(&etime, NULL) == -1)
-    {
-       post("pdp_live~ : could not read time" );
-    }
-    if ( etime.tv_sec != x->x_cursec )
-    {
-       x->x_cursec = etime.tv_sec;
-       if (x->x_streaming) outlet_float( x->x_outlet_framerate, x->x_secondcount );
-       x->x_secondcount = 0;
-    }
-    if ( x->x_secondcount >= x->x_framerate )
-    {
-       // return (w+5);
-    }
-
-    // output image if there's a new one decoded
-    if ( x->x_newpicture )
-    {
-       if ( pthread_mutex_lock( &x->x_videolock ) < 0 )
-       {
-         post( "pdp_live~ : unable to lock video mutex" );
-         perror( "pthread_mutex_lock" );
-       }
-       pdp_packet_pass_if_valid(x->x_pdp_out, &x->x_packet0);
-       x->x_newpicture = 0;
-
-       // update streaming status
-       x->x_nbframes++;
-       x->x_secondcount++;
-       outlet_float( x->x_outlet_nbframes, x->x_nbframes );
-       if ( pthread_mutex_unlock( &x->x_videolock ) < 0 )
-       {
-         post( "pdp_live~ : unable to unlock video mutex" );
-         perror( "pthread_mutex_unlock" );
-       }
-    }
-    outlet_float( x->x_outlet_streaming, x->x_streaming );
-    outlet_float( x->x_outlet_endofstream, x->x_endofstream );
-
-    return (w+5);
-}
-
-static void pdp_live_dsp(t_pdp_live *x, t_signal **sp)
-{
-    dsp_add(pdp_live_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);
-}
-
-static void pdp_live_free(t_pdp_live *x)
-{
-  int i;
-
-    if ( x->x_decodechild )
-    {
-      x->x_decodechild = 0;
-      x->x_decoding = 0;
-      sleep( 5 ); // let the decoding thread exiting
-    }
-
-    if ( x->x_streaming )
-    {
-       pdp_live_disconnect(x);
-    }
-    post( "pdp_live~ : freeing object" );
-    pdp_packet_mark_unused(x->x_packet0);
-    av_free_static();
-    
-    if ( pthread_mutex_destroy( &x->x_audiolock ) < 0 )
-    {
-      post( "pdp_live~ : unable to destroy audio mutex" );
-      perror( "pthread_mutex_destroy" );
-    }
-    if ( pthread_mutex_destroy( &x->x_videolock ) < 0 )
-    {
-      post( "pdp_live~ : unable to destroy video mutex" );
-      perror( "pthread_mutex_destroy" );
-    }
-}
-
-t_class *pdp_live_class;
-
-void *pdp_live_new(void)
-{
-    int i;
-
-    t_pdp_live *x = (t_pdp_live *)pd_new(pdp_live_class);
-
-    inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("frame_cold"));
-
-    x->x_pdp_out = outlet_new(&x->x_obj, &s_anything);
-
-    x->x_outlet_left = outlet_new(&x->x_obj, &s_signal);
-    x->x_outlet_right = outlet_new(&x->x_obj, &s_signal);
-
-    x->x_outlet_streaming = outlet_new(&x->x_obj, &s_float);
-    x->x_outlet_nbframes = outlet_new(&x->x_obj, &s_float);
-    x->x_outlet_framerate = outlet_new(&x->x_obj, &s_float);
-    x->x_outlet_endofstream = outlet_new(&x->x_obj, &s_float);
-
-    x->x_packet0 = -1;
-    x->x_connectchild = 0;
-    x->x_decodechild = 0;
-    x->x_decoding = 0;
-    x->x_usethread = 1;
-    x->x_priority = DEFAULT_PRIORITY;
-    x->x_framerate = DEFAULT_FRAME_RATE;
-    x->x_nbframes = 0;
-    x->x_framerate = 0;
-    x->x_samplerate = 0;
-    x->x_audiochannels = 0;
-    x->x_cursec = 0;
-    x->x_secondcount = 0;
-    x->x_audio_resample_ctx = NULL;
-    x->x_nbvideostreams = 0;
-    x->x_videoindex = -1;
-    x->x_audioin_position = 0;
-    x->x_newpicture = 0;
-    x->x_endofstream = 0;
-    x->x_nopackets = 0;
-    x->x_blocksize = MIN_AUDIO_SIZE;
-    x->x_autoplay = 1;
-    x->x_loop = 1;
-    x->x_nextimage = 0;
-
-    x->x_pts = -1;
-    x->x_previouspts = -1;
-    x->x_firstpts = -1;
-
-    if ( pthread_mutex_init( &x->x_audiolock, NULL ) < 0 )
-    {
-       post( "pdp_live~ : unable to initialize audio mutex" );
-       perror( "pthread_mutex_init" );
-       return NULL;
-    }
-    if ( pthread_mutex_init( &x->x_videolock, NULL ) < 0 )
-    {
-       post( "pdp_live~ : unable to initialize video mutex" );
-       perror( "pthread_mutex_init" );
-       return NULL;
-    }
-
-    x->x_avcontext = av_mallocz(sizeof(AVFormatContext));
-    if ( !x->x_avcontext )
-    {
-       post( "pdp_live~ : severe error : could not allocate video structures." );
-       return NULL;
-    }
-
-    // activate codecs
-    av_register_all();
-
-    memset( &x->x_audio_buf[0], 0x0, 4*MAX_AUDIO_PACKET_SIZE*sizeof(short) );
-    memset( &x->x_audio_in[0], 0x0, 4*MAX_AUDIO_PACKET_SIZE*sizeof(short) );
-
-    return (void *)x;
-}
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-void pdp_live_tilde_setup(void)
-{
-    // post( pdp_live_version );
-    pdp_live_class = class_new(gensym("pdp_live~"), (t_newmethod)pdp_live_new,
-    	(t_method)pdp_live_free, sizeof(t_pdp_live), 0, A_NULL);
-
-    class_addmethod(pdp_live_class, (t_method)pdp_live_dsp, gensym("dsp"), A_NULL);
-    class_addmethod(pdp_live_class, (t_method)pdp_live_connect, gensym("connect"), A_SYMBOL, A_NULL);
-    class_addmethod(pdp_live_class, (t_method)pdp_live_disconnect, gensym("disconnect"), A_NULL);
-    class_addmethod(pdp_live_class, (t_method)pdp_live_priority, gensym("priority"), A_FLOAT, A_NULL);
-    class_addmethod(pdp_live_class, (t_method)pdp_live_audio, gensym("audio"), A_FLOAT, A_NULL);
-    class_addmethod(pdp_live_class, (t_method)pdp_live_autoplay, gensym("autoplay"), A_FLOAT, A_NULL);
-    class_addmethod(pdp_live_class, (t_method)pdp_live_loop, gensym("loop"), A_FLOAT, A_NULL);
-    class_addmethod(pdp_live_class, (t_method)pdp_live_threadify, gensym("thread"), A_FLOAT, A_NULL);
-    class_addmethod(pdp_live_class, (t_method)pdp_live_bang, gensym("bang"), A_NULL);
-    class_addmethod(pdp_live_class, (t_method)pdp_live_frame_cold, gensym("frame_cold"), A_FLOAT, A_NULL);
-
-
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/externals/pidip/modules/pdp_lumafilt.c b/externals/pidip/modules/pdp_lumafilt.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_mapper.c b/externals/pidip/modules/pdp_mapper.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_mgrid.c b/externals/pidip/modules/pdp_mgrid.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_mosaic.c b/externals/pidip/modules/pdp_mosaic.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_mp4audiosource.cpp b/externals/pidip/modules/pdp_mp4audiosource.cpp
deleted file mode 100644
index 40a8c91d89dd8696256aba350271ec6315c98990..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_mp4audiosource.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000-2002.  All Rights Reserved.
- * 
- * Contributor(s): 
- *		Dave Mackie		dmackie@cisco.com
- *		Bill May 		wmay@cisco.com
- *
- * Adapted for PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-#include "m_pd.h"
-
-#ifndef debug_message
-#define debug_message post
-#endif
-#include "pdp_mp4audiosource.h"
-
-//#define DEBUG_TIMESTAMPS 1
-
-CPDPAudioSource::CPDPAudioSource(CLiveConfig *pConfig) : CMediaSource() 
-{
-  SetConfig(pConfig);
-
-  m_pcmFrameBuffer = NULL;
-  m_prevTimestamp = 0;
-  m_timestampOverflowArray = NULL;
-  m_timestampOverflowArrayIndex = 0;
-  m_audioOssMaxBufferSize = 0;
-}
-
-int CPDPAudioSource::ThreadMain(void) 
-{
-  // just a stub, we don't use the threaded mode
-  return 0;
-}
-
-void CPDPAudioSource::DoStart()
-{
-  if (m_source) {
-    return;
-  }
-
-  if (!Init()) {
-    return;
-  }
-
-  m_source = true;
-}
-
-void CPDPAudioSource::DoStop()
-{
-  if (!m_source) {
-    return;
-  }
-
-  CMediaSource::DoStopAudio();
-
-  CHECK_AND_FREE(m_timestampOverflowArray);
-  free(m_pcmFrameBuffer);
-  m_pcmFrameBuffer = NULL;
-
-  m_source = false;
-}
-
-bool CPDPAudioSource::Init(void)
-{
-  bool rc = InitAudio(true);
-  if (!rc) {
-    return false;
-  }
-
-  m_channelsConfigured = m_pConfig->GetIntegerValue(CONFIG_AUDIO_CHANNELS);
-  
-  debug_message("pdp_mp4live~ : init audio : (m_audioDstChannels=%d m_audioDstSampleRate=%d )", 
-                           m_audioDstChannels, m_audioDstSampleRate);
-
-  rc = SetAudioSrc(PCMAUDIOFRAME,
-                   m_channelsConfigured,
-                   m_pConfig->GetIntegerValue(CONFIG_AUDIO_SAMPLE_RATE));
-
-  if (!rc) {
-    return false;
-  }
-
-  debug_message("pdp_mp4live~ : set audio src : (m_audioDstSamplesPerFrame=%d m_audioSrcChannels=%d)", 
-                           m_audioDstSamplesPerFrame, m_audioSrcChannels);
-
-  // for live capture we can match the source to the destination
-  m_audioSrcSamplesPerFrame = m_audioDstSamplesPerFrame;
-  m_pcmFrameSize = m_audioSrcSamplesPerFrame * m_audioSrcChannels * sizeof(u_int16_t);
-
-  if (m_audioOssMaxBufferSize > 0) {
-    size_t array_size;
-    m_audioOssMaxBufferFrames = m_audioOssMaxBufferSize / m_pcmFrameSize;
-    array_size = m_audioOssMaxBufferFrames * sizeof(*m_timestampOverflowArray);
-    m_timestampOverflowArray = (Timestamp *)malloc(array_size);
-    memset(m_timestampOverflowArray, 0, array_size);
-  }
-    
-  m_pcmFrameBuffer = (u_int8_t*)malloc(m_pcmFrameSize);
-  if (!m_pcmFrameBuffer) {
-    goto init_failure;
-  }
-
-  // maximum number of passes in ProcessAudio, approx 1 sec.
-  m_maxPasses = m_audioSrcSampleRate / m_audioSrcSamplesPerFrame;
-
-  debug_message("pdp_mp4live~ : audio source initialization done : ( frame size=%d )", m_pcmFrameSize );
-
-  return true;
-
- init_failure:
-  debug_message("pdp_mp4live~ : audio initialization failed");
-
-  free(m_pcmFrameBuffer);
-  m_pcmFrameBuffer = NULL;
-
-  return false;
-}
-
-void CPDPAudioSource::ProcessAudio(u_int8_t* pcmBuffer, u_int32_t pcmBufferSize)
-{
-  Timestamp currentTime = GetTimestamp();
-  Timestamp timestamp;
-
-    if ( pcmBufferSize > m_pcmFrameSize )
-    {
-       debug_message( "pdp_mp4live~ : too many audio samples : %d should be %d",
-                      pcmBufferSize, m_pcmFrameSize );
-       memcpy( m_pcmFrameBuffer, pcmBuffer, m_pcmFrameSize );
-    }
-    else if ( pcmBufferSize < m_pcmFrameSize )
-    {
-       debug_message( "pdp_mp4live~ : too little audio samples : %d should be %d",
-                      pcmBufferSize, m_pcmFrameSize );
-       memcpy( m_pcmFrameBuffer, pcmBuffer, pcmBufferSize );
-    }
-    else
-    {
-       memcpy( m_pcmFrameBuffer, pcmBuffer, pcmBufferSize );
-    }
-
-    timestamp = currentTime - SrcSamplesToTicks(SrcBytesToSamples(pcmBufferSize));
-
-#ifdef DEBUG_TIMESTAMPS
-    debug_message("pdp_mp4live~ : bytes=%d t=%llu timestamp=%llu delta=%llu",
-                  pcmBufferSize, currentTime, timestamp, timestamp - m_prevTimestamp);
-#endif
-
-    m_prevTimestamp = timestamp;
-
-    ProcessAudioFrame(m_pcmFrameBuffer, m_pcmFrameSize, timestamp, false);
-}
diff --git a/externals/pidip/modules/pdp_mp4audiosync.cpp b/externals/pidip/modules/pdp_mp4audiosync.cpp
deleted file mode 100644
index e53a5331ac083bdbf4bf14485189e82df73ae84b..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_mp4audiosync.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *              Bill May        wmay@cisco.com
- *
- * Adapted to PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-/*
- * audio.cpp provides an interface (CPDPAudioSync) between the codec and
- * the SDL audio APIs.
- */
-#include <stdlib.h>
-#include <string.h>
-#include "pdp_mp4playersession.h"
-#include "pdp_mp4audiosync.h"
-#include "player_util.h"
-#include "our_config_file.h"
-#include "m_pd.h"
-
-static void pdp_audio_callback (void *userdata, Uint8 *stream, int len)
-{
-  CPDPAudioSync *a = (CPDPAudioSync *)userdata;
-  // post( "pdp_mp4audiosync : audio callback" );
-  a->audio_callback(stream, len);
-}
-
-CPDPAudioSync::CPDPAudioSync (CPlayerSession *psptr, t_pdp_mp4player *pdp_father) : CAudioSync(psptr)
-{
-  m_config_set = 0;
-  m_audio_initialized = 1;
-  m_audio_paused = 0;
-  m_resync_required = 0;
-  m_dont_fill = 0;
-  m_play_time = 0         ;
-  m_buffer_latency = 0;
-  m_first_time = 1;
-  m_convert_buffer = NULL;
-  m_father = pdp_father;
-  post( "pdp_mp4audiosync : created audio sync" );
-}
-
-CPDPAudioSync::~CPDPAudioSync (void)
-{
-  if (m_sample_buffer[0] != NULL)
-  {
-    free(m_sample_buffer[0]);
-  }
-  m_sample_buffer[0] = NULL;
-  CHECK_AND_FREE(m_convert_buffer);
-}
-
-void CPDPAudioSync::set_config (int freq, 
-			     int channels, 
-			     int format, 
-			     uint32_t sample_size) 
-{
-  if (m_config_set != 0) 
-    return;
-  
-  if (format == AUDIO_U8 || format == AUDIO_S8)
-    m_bytes_per_sample = 1;
-  else
-    m_bytes_per_sample = 2;
-
-  if (sample_size == 0) {
-    int temp;
-    temp = freq;
-    while ((temp & 0x1) == 0) temp >>= 1;
-    sample_size = temp;
-    while (sample_size < 1024) sample_size *= 2;
-    while (((sample_size * 1000) % freq) != 0) sample_size *= 2;
-  } 
-  
-  m_buffer_size = channels * sample_size * m_bytes_per_sample;
-
-  m_buffer_filled[0] = 0;
-  m_sample_buffer[0] = (uint8_t *)malloc(2 * m_buffer_size);
-
-  m_freq = freq;
-  m_channels = channels;
-  m_format = format;
-  if (m_format == AUDIO_U8) {
-    m_silence = 0x80;
-  } else {
-    m_silence = 0x00;
-  }
-  m_config_set = 1;
-  m_msec_per_frame = (sample_size * 1000) / m_freq;
-  post("pdp_mp4audiosync : buffer size %d msec per frame %d", m_buffer_size, m_msec_per_frame);
-};
-
-uint8_t *CPDPAudioSync::get_audio_buffer (void)
-{
-  int ret;
-  int locked = 0;
-  if (m_dont_fill == 1) {
-    return (NULL);
-  }
-
-  ret = m_buffer_filled[0];
-  if (ret == 1) 
-  {
-    post("pdp_mp4audiosync : no buffer");
-    return (NULL);
-  }
-  // post("pdp_mp4audiosync : get_audio_buffer : return %x", m_sample_buffer[0]);
-  return (m_sample_buffer[0]);
-}
-
-void CPDPAudioSync::load_audio_buffer (uint8_t *from, 
-				       uint32_t bytes, 
-				       uint64_t ts, 
-				       int resync)
-{
-  uint8_t *to;
-  uint32_t copied;
-  copied = 0;
-
-  post( "pdp_mp4audiosync : load audio buffer : length=%d", bytes );
-
-  to = get_audio_buffer();
-  if (to == NULL) 
-  {
-    return;
-  }
-  int copy;
-  uint32_t left;
-
-  bytes = MIN(m_buffer_size, bytes);
-  memcpy(to, from, bytes);
-
-  return;
-}
-
-void CPDPAudioSync::filled_audio_buffer (uint64_t ts, int resync)
-{
-  // post( "pdp_mp4audiosync : filled audio buffer" );
-  // if (resync) m_psptr->wake_sync_thread();
-
-  if (  m_father->x_audio )
-  {
-    // copy the buffer filled by the codec towards pdp
-    if ( (m_father->x_audioin_position*sizeof(short)+m_buffer_size) < (4*MAX_AUDIO_PACKET_SIZE*sizeof(short)) )
-    {
-      memcpy( m_father->x_audio_in+m_father->x_audioin_position, m_sample_buffer[0], m_buffer_size );
-      m_father->x_audioin_position+=(m_buffer_size/sizeof(short));
-      // post( "pdp_mp4audiosync : filled_audio_buffer : copied %d PCM samples : audio in : %d : resync : %d", 
-      //                           m_buffer_size/sizeof(short), m_father->x_audioin_position, resync );
-      if ( ( m_father->x_audioin_position > DEFAULT_CHANNELS*m_father->x_blocksize ) 
-           && (!m_father->x_audioon) )
-      {
-        m_father->x_audioon = 1;
-        // post( "pdp_mp4audiosync : audio on" );
-      }
-    }
-    else
-    {
-      post( "pdp_mp4audiosync : filled_audio_buffer : skipped buffer : (in : %d)", 
-             m_father->x_audioin_position );
-    }
-  }
-  
-  return;
-}
-
-void CPDPAudioSync::set_eof(void) 
-{ 
-  uint8_t *to;
-
-  to = get_audio_buffer();
-  CAudioSync::set_eof();
-}
-
-int CPDPAudioSync::initialize_audio (int have_audio) 
-{
-  m_audio_initialized = 1;
-  return (1);
-}
-
-int CPDPAudioSync::is_audio_ready (uint64_t &disptime)
-{
-  return (1);
-}
-
-uint64_t CPDPAudioSync::check_audio_sync (uint64_t current_time, int &have_eof)
-{
-  return (0);
-}
-
-void CPDPAudioSync::audio_callback (Uint8 *stream, int ilen)
-{
-  int freed_buffer = 0;
-  uint32_t bufferBytes = (uint32_t)ilen;
-  uint64_t this_time;
-  int delay = 0;
-  int playtime;
-
-  post( "pdp_mp4audiosync : audio callback" );
-
-}
-
-void CPDPAudioSync::play_audio (void)
-{
-  m_first_time = 1;
-  m_audio_paused = 0;
-  m_play_sample_index = 0;
-}
-
-void CPDPAudioSync::flush_sync_buffers (void)
-{
-  post( "pdp_mp4audiosync : flush sync buffer" );
-  clear_eof();
-}
-
-void CPDPAudioSync::flush_decode_buffers (void)
-{
-  post( "pdp_mp4audiosync : flush decode buffer" );
-  m_buffer_filled[0] = 0;
-}
-
-void CPDPAudioSync::set_volume (int volume)
-{
-  m_volume = (volume * SDL_MIX_MAXVOLUME)/100;
-}
-
-void CPDPAudioSync::audio_convert_data (void *from, uint32_t samples)
-{
-  if (m_obtained.format == AUDIO_U8 || m_obtained.format == AUDIO_S8) {
-    // bytewise - easy
-    int8_t *src, *dst;
-    src = (int8_t *) from;
-    dst = (int8_t *) m_convert_buffer;
-    if (m_channels == 2) {
-      // we got 1, wanted 2
-      for (uint32_t ix = 0; ix < samples; ix++) {
-	int16_t sum = *src++;
-	sum += *src++;
-	sum /= 2;
-	if (sum < -128) sum = -128;
-	else if (sum > 128) sum = 128;
-	*dst++ = sum & 0xff;
-      }
-    } else {
-      // we got 2, wanted 1
-      for (uint32_t ix = 0; ix < samples; ix++) {
-	*dst++ = *src;
-	*dst++ = *src++;
-      }
-    }
-  } else {
-    int16_t *src, *dst;
-    src = (int16_t *) from;
-    dst = (int16_t *) m_convert_buffer;
-    samples /= 2;
-    if (m_channels == 1) {
-      // 1 channel to 2
-      for (uint32_t ix = 0; ix < samples; ix++) {
-	*dst++ = *src;
-	*dst++ = *src;
-	src++;
-      }
-    } else {
-      // 2 channels to 1
-      for (uint32_t ix = 0; ix < samples; ix++) {
-	int32_t sum = *src++;
-	sum += *src++;
-	sum /= 2;
-	if (sum < -32768) sum = -32768;
-	else if (sum > 32767) sum = 32767;
-	*dst++ = sum & 0xffff;
-      }
-    }
-
-  }
-}
-
-static void pdp_audio_config (void *ifptr, int freq, 
-			    int chans, int format, uint32_t max_buffer_size)
-{
-  ((CPDPAudioSync *)ifptr)->set_config(freq,
-				    chans,
-				    format,
-				    max_buffer_size);
-}
-
-static uint8_t *pdp_get_audio_buffer (void *ifptr)
-{
-  return ((CPDPAudioSync *)ifptr)->get_audio_buffer();
-}
-
-static void pdp_filled_audio_buffer (void *ifptr,
-				   uint64_t ts,
-				   int resync_req)
-{
-  ((CPDPAudioSync *)ifptr)->filled_audio_buffer(ts, 
-				   resync_req);
-}
-
-static void pdp_load_audio_buffer (void *ifptr, 
-				     uint8_t *from, 
-				     uint32_t bytes, 
-				     uint64_t ts, 
-				     int resync)
-{
-  ((CPDPAudioSync *)ifptr)->load_audio_buffer(from,
-					      bytes,
-					      ts, 
-					      resync);
-}
-  
-audio_vft_t audio_vft = {
-  message,
-  pdp_audio_config,
-  pdp_get_audio_buffer,
-  pdp_filled_audio_buffer,
-  pdp_load_audio_buffer
-};
-
-audio_vft_t *get_audio_vft (void)
-{
-  return &audio_vft;
-}
-
-CPDPAudioSync *pdp_create_audio_sync (CPlayerSession *psptr, t_pdp_mp4player *pdp_father)
-{
-  return new CPDPAudioSync(psptr, pdp_father);
-}
-
-int do_we_have_audio (void) 
-{
-  return 1;
-}
diff --git a/externals/pidip/modules/pdp_mp4config.cpp b/externals/pidip/modules/pdp_mp4config.cpp
deleted file mode 100644
index 3fbcb9f2d9973a5a5f154f92256b4d3705d5a16f..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_mp4config.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *		Dave Mackie		dmackie@cisco.com
- *		Bill May 		wmay@cisco.com
- *
- * Adapted for PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-#include "pdp_mp4config.h"
-
-CLiveConfig::CLiveConfig(
-	SConfigVariable* variables, 
-	config_index_t numVariables, 
-	const char* defaultFileName)
-: CConfigSet(variables, numVariables, defaultFileName) 
-{
-	m_appAutomatic = false;
-	m_videoEncode = true;
-	m_videoMaxWidth = 768;
-	m_videoMaxHeight = 576;
-	m_videoNeedRgbToYuv = false;
-	m_videoMpeg4ConfigLength = 0;
-	m_videoMpeg4Config = NULL;
-	m_videoMaxVopSize = 128 * 1024;
-	m_audioEncode = true;
-}
-
-CLiveConfig::~CLiveConfig()
-{
-	CHECK_AND_FREE(m_videoMpeg4Config);
-}
-
-// recalculate derived values
-void CLiveConfig::Update() 
-{
-	UpdateVideo();
-	UpdateAudio();
-}
-
-void CLiveConfig::UpdateVideo() 
-{
-	m_videoEncode = true;
-
-	CalculateVideoFrameSize();
-
-	GenerateMpeg4VideoConfig(this);
-}
-
-void CLiveConfig::UpdateFileHistory(const char* fileName)
-{
-}
-
-void CLiveConfig::CalculateVideoFrameSize()
-{
-	u_int16_t frameHeight;
-	float aspectRatio = GetFloatValue(CONFIG_VIDEO_ASPECT_RATIO);
-
-	// crop video to appropriate aspect ratio modulo 16 pixels
-	if ((aspectRatio - VIDEO_STD_ASPECT_RATIO) < 0.1) {
-		frameHeight = GetIntegerValue(CONFIG_VIDEO_RAW_HEIGHT);
-	} else {
-		frameHeight = (u_int16_t)(
-			(float)GetIntegerValue(CONFIG_VIDEO_RAW_WIDTH) 
-			/ aspectRatio);
-
-		if ((frameHeight % 16) != 0) {
-			frameHeight += 16 - (frameHeight % 16);
-		}
-
-		if (frameHeight > GetIntegerValue(CONFIG_VIDEO_RAW_HEIGHT)) {
-			// OPTION might be better to insert black lines 
-			// to pad image but for now we crop down
-			frameHeight = GetIntegerValue(CONFIG_VIDEO_RAW_HEIGHT);
-			if ((frameHeight % 16) != 0) {
-				frameHeight -= (frameHeight % 16);
-			}
-		}
-	}
-
-	m_videoWidth = GetIntegerValue(CONFIG_VIDEO_RAW_WIDTH);
-	m_videoHeight = frameHeight;
-
-	m_ySize = m_videoWidth * m_videoHeight;
-	m_uvSize = m_ySize / 4;
-	m_yuvSize = (m_ySize * 3) / 2;
-}
-
-void CLiveConfig::UpdateAudio() 
-{
-	m_audioEncode = true;
-}
-
-void CLiveConfig::UpdateRecord()
-{
-}
-
-bool CLiveConfig::IsOneSource()
-{
-   return true;
-}
-
-bool CLiveConfig::IsCaptureVideoSource()
-{
-   return false;
-}
-
-bool CLiveConfig::IsCaptureAudioSource()
-{
-   return false;
-}
-
-bool CLiveConfig::IsFileVideoSource()
-{
-   return false;
-}
-
-bool CLiveConfig::IsFileAudioSource()
-{
-   return false;
-}
diff --git a/externals/pidip/modules/pdp_mp4live~.cpp b/externals/pidip/modules/pdp_mp4live~.cpp
deleted file mode 100644
index 2c3f52c9cef9762362b161f183ab3c595ddbbb5c..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_mp4live~.cpp
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
- *   PiDiP module.
- *   Copyright (c) by Yves Degoyon (ydegoyon@free.fr )
- *
- *   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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*  This object is a mpeg4ip streaming object towards a Darwin or Quicktime streaming server
- *  A lot of this object code is inspired by the code from mpeg4ip
- *  Copyright (c) 2000, 2001, 2002 Dave Mackie, Bill May & others
- *  The rest is written by Yves Degoyon ( ydegoyon@free.fr )                             
- */
-
-
-#include "pdp.h"
-#include <math.h>
-#include <time.h>
-#include <sys/time.h>
-
-/* mpeg4ip includes taken from the source tree ( not exported ) */
-#include <mp4.h>
-#define  DECLARE_CONFIG_VARIABLES
-#include "config_set.h"
-
-#undef CONFIG_BOOL
-#define CONFIG_BOOL(var, name, defval) \
- { &(var), (name), CONFIG_TYPE_BOOL, (defval), (defval) }
-#undef CONFIG_FLOAT
-#define CONFIG_FLOAT(var, name, defval) \
- { &(var), (name), CONFIG_TYPE_FLOAT,(float) (defval), (float) (defval) }
-#undef CONFIG_INT
-#define CONFIG_INT(var, name, defval) \
- { &(var), (name), CONFIG_TYPE_INTEGER,(config_integer_t) (defval), (config_integer_t)(defval) }
-#undef CONFIG_STRING
-#define CONFIG_STRING(var, name, defval) \
- { &(var), (name), CONFIG_TYPE_STRING, (defval), (defval) }
-
-#include "pdp_mp4config.h"
-
-#undef   DECLARE_CONFIG_VARIABLES
-#ifndef debug_message
-#define debug_message post 
-#endif
-#include "rtp_transmitter.h"
-#include "pdp_mp4videosource.h"
-#include "pdp_mp4audiosource.h"
-
-#define VIDEO_BUFFER_SIZE (1024*1024)
-#define MAX_AUDIO_PACKET_SIZE (128 * 1024)
-#define AUDIO_PACKET_SIZE (2*1024*2) /* using aac encoding, 2 channels, 2 bytes per sample */
-
-static char   *pdp_mp4live_version = "pdp_mp4live~: version 0.1, an mpeg4ip video streaming object ( ydegoyon@free.fr )";
-
-typedef struct pdp_mp4live_struct
-{
-    t_object x_obj;
-    t_float x_f;
-
-    t_int x_packet0;
-    t_int x_dropped;
-    t_int x_queue_id;
-
-    t_int x_vwidth;
-    t_int x_vheight;
-    t_int x_vsize;
-
-    t_outlet *x_outlet_streaming;  // indicates the status of streaming
-    t_outlet *x_outlet_nbframes;   // number of frames emitted
-    t_outlet *x_outlet_framerate;  // current frame rate
-
-    t_int x_streaming;   // streaming flag
-    t_int x_nbframes;    // number of frames emitted
-    t_int x_framerate;   // framerate
-
-    t_int x_cursec;   // current second
-    t_int x_secondcount; // number of frames emitted in the current second
-
-      /* audio structures */
-    short x_audio_buf[2*MAX_AUDIO_PACKET_SIZE]; /* buffer for incoming audio */
-    t_int x_audioin_position; // writing position for incoming audio
-    t_int x_audio_per_frame;  // number of audio samples to transmit for each frame
-
-      /* mpeg4ip data */
-    CLiveConfig *x_mp4Config;
-    CRtpTransmitter *x_rtpTransmitter;
-    CPDPVideoSource *x_videosource;
-    CPDPAudioSource *x_audiosource;
-
-} t_pdp_mp4live;
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-static void pdp_mp4live_add_sink(t_pdp_mp4live *x, CMediaSink* pSink)
-{
-   if (x->x_videosource)
-   {
-      x->x_videosource->AddSink(pSink);
-   }
-   if (x->x_audiosource)
-   {
-      x->x_audiosource->AddSink(pSink);
-   }
-}
-
-static void pdp_mp4live_remove_sink(t_pdp_mp4live *x, CMediaSink* pSink)
-{
-   if (x->x_videosource)
-   {
-      x->x_videosource->RemoveSink(pSink);
-   }
-   if (x->x_audiosource)
-   {
-      x->x_audiosource->RemoveSink(pSink);
-   }
-}
-
-static void pdp_mp4live_disconnect(t_pdp_mp4live *x)
-{
- t_int ret, i;
-
-   if (!x->x_streaming)
-   {
-     post("pdp_mp4live~ : disconnect request but not connected ... ignored" );
-     return;
-   }
-
-   if (x->x_audiosource) 
-   {
-     x->x_audiosource->DoStop();
-     delete x->x_audiosource;
-     x->x_audiosource = NULL;
-   }
-
-   if (x->x_videosource) 
-   {
-     x->x_videosource->DoStop();
-     delete x->x_videosource;
-     x->x_videosource = NULL;
-   }
-
-   if (x->x_rtpTransmitter) 
-   {
-     pdp_mp4live_remove_sink(x, x->x_rtpTransmitter);
-     x->x_rtpTransmitter->StopThread();
-     delete x->x_rtpTransmitter;
-     x->x_rtpTransmitter = NULL;
-   }
-
-   x->x_streaming = 0;
-   outlet_float( x->x_outlet_streaming, x->x_streaming );
-   x->x_nbframes = 0;
-   outlet_float( x->x_outlet_nbframes, x->x_nbframes );
-   x->x_framerate = 0;
-   outlet_float( x->x_outlet_framerate, x->x_framerate );
-}
-
-static void pdp_mp4live_connect(t_pdp_mp4live *x )
-{
-  t_int ret, i;
-
-   if (x->x_streaming)
-   {
-     post("pdp_mp4live~ : connect request but already connected ... ignored" );
-     return;
-   }
-
-   post("pdp_mp4live~ : creating video source");
-   if ( x->x_videosource == NULL )
-   {
-      x->x_videosource = new CPDPVideoSource();
-      x->x_videosource->SetConfig(x->x_mp4Config);
-   }
-   
-   post("pdp_mp4live~ : creating audio source");
-   if ( x->x_audiosource == NULL )
-   {
-       x->x_audiosource = new CPDPAudioSource(x->x_mp4Config);
-   }
-
-   post("pdp_mp4live~ : creating rtp transmitter");
-   x->x_rtpTransmitter = new CRtpTransmitter(x->x_mp4Config);
-   x->x_rtpTransmitter->StartThread();
-
-   post("pdp_mp4live~ : creating audio destination");
-   x->x_rtpTransmitter->CreateAudioRtpDestination(0,
-                      x->x_mp4Config->GetStringValue(CONFIG_RTP_AUDIO_DEST_ADDRESS),
-                      x->x_mp4Config->GetIntegerValue(CONFIG_RTP_AUDIO_DEST_PORT),
-                      0);
-
-   post("pdp_mp4live~ : creating video destination");
-   x->x_rtpTransmitter->CreateVideoRtpDestination(0,
-                     x->x_mp4Config->GetStringValue(CONFIG_RTP_DEST_ADDRESS),
-                     x->x_mp4Config->GetIntegerValue(CONFIG_RTP_VIDEO_DEST_PORT),
-                     0);
-
-   post("pdp_mp4live~ : starting rtp");
-   if ( x->x_rtpTransmitter )
-   {
-      pdp_mp4live_add_sink(x, x->x_rtpTransmitter);
-      x->x_rtpTransmitter->Start();
-   }
-
-   if (x->x_videosource) 
-   {
-      post("pdp_mp4live~ : starting video source");
-      x->x_videosource->DoStart();
-      post("pdp_mp4live~ : generating key frame");
-      x->x_videosource->GenerateKeyFrame();
-   }
-
-   if (x->x_audiosource) 
-   {
-      post("pdp_mp4live~ : starting audio source");
-      x->x_audiosource->DoStart();
-   }
-
-   x->x_streaming = 1;
-   outlet_float( x->x_outlet_streaming, x->x_streaming );
-   x->x_nbframes = 0;
-   outlet_float( x->x_outlet_nbframes, x->x_nbframes );
-   x->x_framerate = 0;
-   outlet_float( x->x_outlet_framerate, x->x_framerate );
-
-}
-
-static void pdp_mp4live_ipaddr(t_pdp_mp4live *x, t_symbol *sIpAddr )
-{
-  t_int a, b, c, d;
-
-   if ( !strcmp( sIpAddr->s_name, "" ) )
-   {
-     post("pdp_mp4live~ : wrong ip address" );
-     return;
-   }
-
-   if ( sscanf( sIpAddr->s_name, "%d.%d.%d.%d", &a, &b, &c, &d ) < 4 )
-   {
-     post("pdp_mp4live~ : wrong ip address : %s", sIpAddr->s_name );
-     return;
-   }
-
-   post( "pdp_mp4live~ : setting ip address: %s", sIpAddr->s_name );
-   x->x_mp4Config->SetStringValue( CONFIG_RTP_DEST_ADDRESS, sIpAddr->s_name );
-   x->x_mp4Config->SetStringValue( CONFIG_RTP_AUDIO_DEST_ADDRESS, sIpAddr->s_name );
-}
-
-static void pdp_mp4live_aport(t_pdp_mp4live *x, t_floatarg fAudioPort )
-{
-   if ( ( (t_int) fAudioPort <= 0 ) || ( (t_int) fAudioPort > 65535 ) )
-   {
-     post("pdp_mp4live~ : wrong audio port : %d", fAudioPort );
-     return;
-   }
-
-   post( "pdp_mp4live~ : setting audio port: %d", (t_int) fAudioPort );
-   x->x_mp4Config->SetIntegerValue( CONFIG_RTP_AUDIO_DEST_PORT, (t_int) fAudioPort );
-
-}
-
-static void pdp_mp4live_vport(t_pdp_mp4live *x, t_floatarg fVideoPort )
-{
-   if ( ( (t_int) fVideoPort <= 0 ) || ( (t_int) fVideoPort > 65535 ) )
-   {
-     post("pdp_mp4live~ : wrong video port : %d", fVideoPort );
-     return;
-   }
-
-   post( "pdp_mp4live~ : setting video port: %d", (t_int) fVideoPort );
-   x->x_mp4Config->SetIntegerValue( CONFIG_RTP_VIDEO_DEST_PORT, (t_int) fVideoPort );
-
-}
-
-static void pdp_mp4live_ttl(t_pdp_mp4live *x, t_floatarg fTtl )
-{
-   if ( ( (t_int) fTtl <= 0 ) || ( (t_int) fTtl > 255 ) )
-   {
-     post("pdp_mp4live~ : wrong ttl : %d", fTtl );
-     return;
-   }
-
-   post( "pdp_mp4live~ : setting ttl : %d", (t_int) fTtl );
-   x->x_mp4Config->SetIntegerValue( CONFIG_RTP_MCAST_TTL, (t_int) fTtl );
-
-}
-
-static void pdp_mp4live_vwidth(t_pdp_mp4live *x, t_floatarg fWidth )
-{
-   if ( ( (t_int) fWidth <= 0 ) )
-   {
-     post("pdp_mp4live~ : wrong width : %d", fWidth );
-     return;
-   }
-
-   post( "pdp_mp4live~ : setting width : %d", (t_int) fWidth );
-   x->x_mp4Config->SetIntegerValue( CONFIG_VIDEO_RAW_WIDTH, (t_int) fWidth );
-
-}
-
-static void pdp_mp4live_vheight(t_pdp_mp4live *x, t_floatarg fHeight )
-{
-   if ( ( (t_int) fHeight <= 0 ) )
-   {
-     post("pdp_mp4live~ : wrong height : %d", fHeight );
-     return;
-   }
-
-   post( "pdp_mp4live~ : setting height : %d", (t_int) fHeight );
-   x->x_mp4Config->SetIntegerValue( CONFIG_VIDEO_RAW_HEIGHT, (t_int) fHeight );
-
-}
-
-static void pdp_mp4live_framerate(t_pdp_mp4live *x, t_floatarg fFrameRate )
-{
-   if ( ( (t_int) fFrameRate <= 0 ) )
-   {
-     post("pdp_mp4live~ : wrong framerate : %d", fFrameRate );
-     return;
-   }
-
-   post( "pdp_mp4live~ : setting framerate : %d", (t_int) fFrameRate );
-   x->x_mp4Config->SetFloatValue( CONFIG_VIDEO_FRAME_RATE, (t_float) fFrameRate );
-
-}
-
-static void pdp_mp4live_vbitrate(t_pdp_mp4live *x, t_floatarg fVBitrate )
-{
-   if ( ( (t_int) fVBitrate <= 0 ) )
-   {
-     post("pdp_mp4live~ : wrong video bit rate : %d", fVBitrate );
-     return;
-   }
-
-   post( "pdp_mp4live~ : setting video bit rate : %d", (t_int) fVBitrate );
-   x->x_mp4Config->SetIntegerValue( CONFIG_VIDEO_BIT_RATE, (t_int) fVBitrate );
-
-}
-
-static void pdp_mp4live_samplerate(t_pdp_mp4live *x, t_floatarg fSampleRate )
-{
-   if ( ( (t_int) fSampleRate != 44100 ) &&
-        ( (t_int) fSampleRate != 22050 ) &&
-        ( (t_int) fSampleRate != 11025 ) &&
-        ( (t_int) fSampleRate != 8000 )
-        )
-   {
-     post("pdp_mp4live~ : wrong samplerate : %d", fSampleRate );
-     return;
-   }
-
-   post( "pdp_mp4live~ : setting samplerate : %d", (t_int) fSampleRate );
-   x->x_mp4Config->SetIntegerValue( CONFIG_AUDIO_SAMPLE_RATE, (t_int) fSampleRate );
-
-}
-
-static void pdp_mp4live_abitrate(t_pdp_mp4live *x, t_floatarg fABitrate )
-{
-   if ( ( (t_int) fABitrate <= 0 ) )
-   {
-     post("pdp_mp4live~ : wrong audio bit rate : %d", fABitrate );
-     return;
-   }
-
-   post( "pdp_mp4live~ : setting audio bit rate : %d", (t_int) fABitrate );
-   x->x_mp4Config->SetIntegerValue( CONFIG_AUDIO_BIT_RATE_KBPS, (t_int) fABitrate );
-   x->x_mp4Config->SetIntegerValue( CONFIG_AUDIO_BIT_RATE, ((t_int) fABitrate)*1000 );
-
-}
-
-static void pdp_mp4live_sdp(t_pdp_mp4live *x, t_symbol *sSdpFile )
-{
-  t_int ret;
-
-   post( "pdp_mp4live~ : setting sdp filename : %s", (char *) sSdpFile->s_name );
-   x->x_mp4Config->SetStringValue( CONFIG_SDP_FILE_NAME, (char *) sSdpFile->s_name );
-
-   post( "pdp_mp4live~ : writing sdp file : %s", (char *) sSdpFile->s_name );
-   if ( ( ret = GenerateSdpFile( x->x_mp4Config ) ) )
-   {
-     post( "pdp_mp4live~ : written sdp file : %s", (char *) sSdpFile->s_name );
-   }
-   else
-   {
-     post( "pdp_mp4live~ : could not write sdp file : %s", 
-            (char *) sSdpFile->s_name );
-   }
-}
-
-static void pdp_mp4live_process_yv12(t_pdp_mp4live *x)
-{
-    t_pdp     *header = pdp_packet_header(x->x_packet0);
-    u_int8_t  *data   = (uint8_t *)pdp_packet_data(x->x_packet0);
-    u_int8_t  *pY, *pU, *pV;
-    struct timeval etime;
-
-        /* allocate all ressources */
-    if ( ((int)header->info.image.width != x->x_vwidth) ||
-         ((int)header->info.image.height != x->x_vheight) )
-    {
-        x->x_vwidth = header->info.image.width;
-        x->x_vheight = header->info.image.height;
-        x->x_vsize = x->x_vwidth*x->x_vheight;
-    }
-
-    if ( x->x_streaming )
-    {
-         pY = data;
-         pU = data+x->x_vsize;
-         pV = data+x->x_vsize+(x->x_vsize>>2);
-
-            /* update frames counter */
-
-         if ( gettimeofday(&etime, NULL) == -1)
-         {
-            post("pdp_ffmpeg~ : could not read time" );
-         }
-         if ( etime.tv_sec != x->x_cursec )
-         {
-            x->x_cursec = etime.tv_sec;
-            x->x_framerate = x->x_secondcount;
-            x->x_secondcount = 0;
-         }
-         x->x_nbframes++;
-         x->x_secondcount++;
-
-         x->x_videosource->ProcessVideo( pY, pV, pU );
-
-    }
-    return;
-}
-
-static void pdp_mp4live_killpacket(t_pdp_mp4live *x)
-{
-    /* delete source packet */
-    pdp_packet_mark_unused(x->x_packet0);
-    x->x_packet0 = -1;
-}
-
-    /* store audio data in PCM format and stream it */
-static t_int *pdp_mp4live_perform(t_int *w)
-{
-  t_float *in1   = (t_float *)(w[1]);       // left audio inlet
-  t_float *in2   = (t_float *)(w[2]);       // right audio inlet 
-  t_pdp_mp4live *x = (t_pdp_mp4live *)(w[3]);
-  int n = (int)(w[4]);                      // number of samples 
-  t_float fsample;
-  t_int   isample, i;
-
-    // just fills the buffer ( a pcm buffer )
-    while (n--)
-    {
-       fsample=*(in1++); 
-       if (fsample > 1.0) { fsample = 1.0; }
-       if (fsample < -1.0) { fsample = -1.0; }
-       isample=(short) (32767.0 * fsample);
-       *(x->x_audio_buf+x->x_audioin_position)=isample;
-       x->x_audioin_position=(x->x_audioin_position+1)%(2*MAX_AUDIO_PACKET_SIZE); 
-       if ( x->x_audioin_position == 2*MAX_AUDIO_PACKET_SIZE-1 ) 
-       {
-          // post( "pdp_mp4live~ : reaching end of audio buffer" );
-       }
-       fsample=*(in2++); 
-       if (fsample > 1.0) { fsample = 1.0; }
-       if (fsample < -1.0) { fsample = -1.0; }
-       isample=(short) (32767.0 * fsample);
-       *(x->x_audio_buf+x->x_audioin_position)=isample;
-       x->x_audioin_position=(x->x_audioin_position+1)%(2*MAX_AUDIO_PACKET_SIZE); 
-       if ( x->x_audioin_position == 2*MAX_AUDIO_PACKET_SIZE-1 ) 
-       {
-          // post( "pdp_mp4live~ : reaching end of audio buffer" );
-       }
-    }
-
-    if ( x->x_streaming )
-    {
-          /* send an audio frame */
-       if ( (t_int)(x->x_audioin_position*sizeof(short)) > (t_int)x->x_audio_per_frame )
-       {
-         x->x_audiosource->ProcessAudio( (u_int8_t*)x->x_audio_buf, 
-                        (u_int32_t)x->x_audio_per_frame );
-
-           /* recopy the buffer and set new pointers */
-         memcpy( x->x_audio_buf, x->x_audio_buf+(x->x_audio_per_frame/sizeof(short)), 
-                    x->x_audioin_position*sizeof(short)-x->x_audio_per_frame ); 
-         x->x_audioin_position-=(x->x_audio_per_frame/sizeof(short));
-       }
-    }
- 
-    return (w+5);
-}
-
-static void pdp_mp4live_dsp(t_pdp_mp4live *x, t_signal **sp)
-{
-    dsp_add(pdp_mp4live_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);
-}
-
-static void pdp_mp4live_process(t_pdp_mp4live *x)
-{
-   int encoding;
-   t_pdp *header = 0;
-
-   /* check if image data packets are compatible */
-   if ( (header = pdp_packet_header(x->x_packet0))
-	&& (PDP_BITMAP == header->type)){
-    
-	/* pdp_mp4live_process inputs and write into active inlet */
-	switch(pdp_packet_header(x->x_packet0)->info.image.encoding)
-        {
-
-	  case PDP_BITMAP_YV12:
-            pdp_queue_add(x, (void*) pdp_mp4live_process_yv12, (void*) pdp_mp4live_killpacket, &x->x_queue_id);
-            outlet_float( x->x_outlet_nbframes, x->x_nbframes );
-            outlet_float( x->x_outlet_framerate, x->x_framerate );
-	    break;
-
-	  default:
-	    /* don't know the type, so dont pdp_mp4live_process */
-            post( "pdp_mp4live~ : hey!! i don't know about that type of image : %d", 
-                  pdp_packet_header(x->x_packet0)->info.image.encoding );
-	    break;
-	    
-	}
-    }
-
-}
-
-static void pdp_mp4live_input_0(t_pdp_mp4live *x, t_symbol *s, t_floatarg f)
-{
-
-    /* if this is a register_ro message or register_rw message, register with packet factory */
-
-    if (s== gensym("register_rw"))
-    {
-       x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/yv12/*") );
-    }
-
-    if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped))
-    {
-        /* add the process method and callback to the process queue */
-        pdp_mp4live_process(x);
-    }
-
-}
-
-static void pdp_mp4live_free(t_pdp_mp4live *x)
-{
-  int i;
-
-    pdp_queue_finish(x->x_queue_id);
-    pdp_packet_mark_unused(x->x_packet0);
-}
-
-t_class *pdp_mp4live_class;
-
-void *pdp_mp4live_new(void)
-{
-    int i;
-
-    t_pdp_mp4live *x = (t_pdp_mp4live *)pd_new(pdp_mp4live_class);
-    inlet_new (&x->x_obj, &x->x_obj.ob_pd, gensym ("signal"), gensym ("signal"));
-
-    x->x_outlet_streaming = outlet_new(&x->x_obj, &s_float);
-    x->x_outlet_nbframes = outlet_new(&x->x_obj, &s_float);
-    x->x_outlet_framerate = outlet_new(&x->x_obj, &s_float);
-
-    x->x_packet0 = -1;
-    x->x_queue_id = -1;
-    x->x_nbframes = 0;
-    x->x_framerate = 0;
-    x->x_secondcount = 0;
-    x->x_audioin_position = 0;
-
-    x->x_mp4Config = new CLiveConfig(PdpConfigVariables,
-                     sizeof(PdpConfigVariables) / sizeof(SConfigVariable),
-                     "none");
-    if ( x->x_mp4Config == NULL )
-    {
-       post( "pdp_mp4live~ : couldn't allocate default config" );
-       return NULL;
-    }
-
-    x->x_mp4Config->InitializeIndexes();
-
-    x->x_mp4Config->Update();
-
-    // update sample rate with the actual sample rate
-    x->x_mp4Config->SetIntegerValue( CONFIG_AUDIO_SAMPLE_RATE, (t_int) sys_getsr() );
-
-    x->x_videosource = NULL;
-    x->x_audiosource = NULL;
-
-    x->x_audio_per_frame = AUDIO_PACKET_SIZE;
-
-    return (void *)x;
-}
-
-
-void pdp_mp4live_tilde_setup(void)
-{
-    // post( pdp_mp4live_version );
-    pdp_mp4live_class = class_new(gensym("pdp_mp4live~"), (t_newmethod)pdp_mp4live_new,
-    	(t_method)pdp_mp4live_free, sizeof(t_pdp_mp4live), 0, A_NULL);
-
-    CLASS_MAINSIGNALIN(pdp_mp4live_class, t_pdp_mp4live, x_f );
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_dsp, gensym("dsp"), A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_connect, gensym("connect"), A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_ipaddr, gensym("ipaddr"), A_SYMBOL, A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_aport, gensym("audioport"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_vport, gensym("videoport"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_ttl, gensym("ttl"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_vwidth, gensym("vwidth"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_vheight, gensym("vheight"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_framerate, gensym("framerate"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_vbitrate, gensym("vbitrate"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_samplerate, gensym("samplerate"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_abitrate, gensym("abitrate"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_disconnect, gensym("disconnect"), A_NULL);
-    class_addmethod(pdp_mp4live_class, (t_method)pdp_mp4live_sdp, gensym("sdp"), A_SYMBOL, A_NULL);
-    class_sethelpsymbol( pdp_mp4live_class, gensym("pdp_mp4live~.pd") );
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/externals/pidip/modules/pdp_mp4playermedia.cpp b/externals/pidip/modules/pdp_mp4playermedia.cpp
deleted file mode 100644
index 75235e706160f88fa546e43a8630a5d81d9c3602..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_mp4playermedia.cpp
+++ /dev/null
@@ -1,2029 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *              Bill May        wmay@cisco.com
- *
- * Adapted to PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-/*
- * player_media.cpp - handle generic information about a stream
- */
-#include "mpeg4ip.h"
-#include "pdp_mp4playersession.h"
-#include "pdp_mp4playermedia.h"
-#include "pdp_mp4videosync.h"
-#include "pdp_mp4audiosync.h"
-#include "player_sdp.h"
-#include "player_util.h"
-#include <rtp/memory.h>
-#include "pdp_mp4rtpbytestream.h"
-#include "our_config_file.h"
-#include "media_utils.h"
-#include "ip_port.h"
-#include "codec_plugin.h"
-#include "audio.h"
-#include <time.h>
-#include <rtp/memory.h>
-#include "our_config_file.h"
-#include "rtp_plugin.h"
-#include "media_utils.h"
-#include "rfc3119_bytestream.h"
-#include "mpeg3_rtp_bytestream.h"
-#include "codec/mp3/mp3_rtp_bytestream.h"
-#include "rtp_bytestream_plugin.h"
-#include "codec_plugin_private.h"
-
-static int pdp_recv_thread (void *data)
-{
-  CPlayerMedia *media;
-
-  media = (CPlayerMedia *)data;
-  return (media->recv_thread());
-}
-
-static int pdp_decode_thread (void *data)
-{
-  CPlayerMedia *media;
-  media = (CPlayerMedia *)data;
-  return (media->decode_thread());
-}
-
-static void pdp_rtp_packet_callback (void *data, 
-				   unsigned char interleaved, 
-				   struct rtp_packet *pak, 
-				   int len)
-{
-  ((CPlayerMedia *)data)->rtp_receive_packet(interleaved, pak, len);
-}
-
-static int pdp_init_rtp_tcp (void *data)
-{
-  ((CPlayerMedia *)data)->rtp_init_tcp();
-  return 0;
-}
-
-static int pdp_rtp_start (void *data)
-{
-  ((CPlayerMedia *)data)->rtp_start();
-  return 0;
-}
-
-static int pdp_rtp_periodic (void *data)
-{
-  ((CPlayerMedia *)data)->rtp_periodic();
-  return 0;
-}
-
-static void pdp_recv_callback (struct rtp *session, rtp_event *e)
-{
-  CPlayerMedia *m = (CPlayerMedia *)rtp_get_userdata(session);
-  m->recv_callback(session, e);
-}
-
-static int pdp_rtcp_send_packet (void *ud, uint8_t *buffer, int buflen)
-{
-  return ((CPlayerMedia *)ud)->rtcp_send_packet(buffer, buflen);
-}
-
-CPlayerMedia::CPlayerMedia (CPlayerSession *p)
-{
-  m_plugin = NULL;
-  m_plugin_data = NULL;
-  m_next = NULL;
-  m_parent = p;
-  m_media_info = NULL;
-  m_media_fmt = NULL;
-  m_our_port = 0;
-  m_ports = NULL;
-  m_server_port = 0;
-  m_source_addr = NULL;
-  m_recv_thread = NULL;
-  m_rtptime_tickpersec = 0;
-  m_rtsp_base_seq_received = 0;
-  m_rtsp_base_ts_received = 0;
-
-  m_head = NULL;
-  m_rtp_queue_len = 0;
-
-  m_rtp_ssrc_set = FALSE;
-  
-  m_rtsp_session = NULL;
-  m_decode_thread_waiting = 0;
-  m_sync_time_set = FALSE;
-  m_decode_thread = NULL;
-  m_decode_thread_sem = NULL;
-  m_video_sync = NULL;
-  m_audio_sync = NULL;
-  m_paused = 0;
-  m_byte_stream = NULL;
-  m_rtp_byte_stream = NULL;
-  m_video_info = NULL;
-  m_audio_info = NULL;
-  m_user_data = NULL;
-  m_rtcp_received = 0;
-  m_streaming = 0;
-  m_stream_ondemand = 0;
-  m_rtp_use_rtsp = 0;
-}
-
-CPlayerMedia::~CPlayerMedia()
-{
-  rtsp_decode_t *rtsp_decode;
-
-  media_message(LOG_DEBUG, "closing down media %d", m_is_video);
-  if (m_rtsp_session) {
-    // If control is aggregate, m_rtsp_session will be freed by
-    // CPDPPlayerSession
-    if (m_parent->session_control_is_aggregate() == 0) {
-      rtsp_send_teardown(m_rtsp_session, NULL, &rtsp_decode);
-      free_decode_response(rtsp_decode);
-    }
-    m_rtsp_session = NULL;
-  }
-  
-  if (m_recv_thread) {
-    m_rtp_msg_queue.send_message(MSG_STOP_THREAD);
-    SDL_WaitThread(m_recv_thread, NULL);
-    m_recv_thread = NULL;
-  }
-
-  if (m_decode_thread) {
-    m_decode_msg_queue.send_message(MSG_STOP_THREAD, 
-				    NULL, 
-				    0, 
-				    m_decode_thread_sem);
-    SDL_WaitThread(m_decode_thread, NULL);
-    m_decode_thread = NULL;
-  }
-
-
-    
-  if (m_source_addr != NULL) free(m_source_addr);
-  m_next = NULL;
-  m_parent = NULL;
-
-  if (m_ports) {
-    delete m_ports;
-    m_ports = NULL;
-  }
-  if (m_rtp_byte_stream) {
-    double diff;
-    diff = difftime(time(NULL), m_start_time);
-    media_message(LOG_INFO, "Media %s", m_media_info->media);
-    
-    media_message(LOG_INFO, "Time: %g seconds", diff);
-#if 0
-    double div;
-    player_debug_message("Packets received: %u", m_rtp_packet_received);
-    player_debug_message("Payload received: "LLU" bytes", m_rtp_data_received);
-    div = m_rtp_packet_received / diff;
-    player_debug_message("Packets per sec : %g", div);
-    div = UINT64_TO_DOUBLE(m_rtp_data_received);
-	div *= 8.0;
-	div /= diff;
-    media_message(LOG_INFO, "Bits per sec   : %g", div);
-#endif
-			 
-  }
-  if (m_byte_stream) {
-    delete m_byte_stream;
-    m_byte_stream = NULL;
-    m_rtp_byte_stream = NULL;
-  }
-  if (m_video_info) {
-    free(m_video_info);
-    m_video_info = NULL;
-  }
-  if (m_audio_info) {
-    free(m_audio_info);
-    m_audio_info = NULL;
-  }
-  if (m_user_data) {
-    free((void *)m_user_data);
-    m_user_data = NULL;
-  }
-  if (m_decode_thread_sem) {
-    SDL_DestroySemaphore(m_decode_thread_sem);
-    m_decode_thread_sem = NULL;
-  }
-}
-
-void CPlayerMedia::clear_rtp_packets (void)
-{
-  if (m_head != NULL) {
-    m_tail->rtp_next = NULL;
-    while (m_head != NULL) {
-      rtp_packet *p;
-      p = m_head;
-      m_head = m_head->rtp_next;
-      p->rtp_next = p->rtp_prev = NULL;
-      xfree(p);
-    }
-  }
-  m_tail = NULL;
-  m_rtp_queue_len = 0;
-}
-
-int CPlayerMedia::create_common (int is_video, char *errmsg, uint32_t errlen)
-{
-  m_parent->add_media(this);
-  m_is_video = is_video;
-
-  m_decode_thread_sem = SDL_CreateSemaphore(0);
-  m_decode_thread = SDL_CreateThread(pdp_decode_thread, this);
-  if (m_decode_thread_sem == NULL || m_decode_thread == NULL) {
-    const char *outmedia;
-    if (m_media_info == NULL) {
-      outmedia = m_is_video ? "video" : "audio";
-    } else outmedia = m_media_info->media;
-
-    if (errmsg != NULL)
-      snprintf(errmsg, errlen, "Couldn't start media thread for %s", 
-	       outmedia);
-    media_message(LOG_ERR, "Failed to create decode thread for media %s",
-		  outmedia);
-    return (-1);
-  }
-  return 0;
-}
-/*
- * CPlayerMedia::create - create when we've already got a
- * bytestream
- */
-int CPlayerMedia::create (COurInByteStream *b, 
-			  int is_video,
-			  char *errmsg,
-			  uint32_t errlen,
-			  int streaming)
-{
-  m_byte_stream = b;
-  m_streaming = streaming;
-  return create_common(is_video, errmsg, errlen);
-}
-
-/*
- * CPlayerMedia::create_streaming - create a streaming media session,
- * including setting up rtsp session, rtp and rtp bytestream
- */
-int CPlayerMedia::create_streaming (media_desc_t *sdp_media,
-				    char *errmsg,
-				    uint32_t errlen,
-				    int ondemand,
-				    int use_rtsp,
-				    int media_number_in_session)
-{
-  char buffer[80];
-  rtsp_command_t cmd;
-  rtsp_decode_t *decode;
-  
-  m_streaming = 1;
-  if (sdp_media == NULL) {
-    snprintf(errmsg, errlen, "Internal media error - sdp is NULL");
-    return(-1);
-  }
-
-  if (strncasecmp(sdp_media->proto, "RTP", strlen("RTP")) != 0) {
-    snprintf(errmsg, errlen, "Media %s doesn't use RTP", sdp_media->media);
-    media_message(LOG_ERR, "%s doesn't use RTP", sdp_media->media);
-    return (-1);
-  }
-  if (sdp_media->fmt == NULL) {
-    snprintf(errmsg, errlen, "Media %s doesn't have any usuable formats",
-	     sdp_media->media);
-    media_message(LOG_ERR, "%s doesn't have any formats", 
-		  sdp_media->media);
-    return (-1);
-  }
-
-  m_media_info = sdp_media;
-  m_stream_ondemand = ondemand;
-  if (ondemand != 0) {
-    /*
-     * Get 2 consecutive IP ports.  If we don't have this, don't even
-     * bother
-     */
-    if (use_rtsp == 0) {
-      m_ports = new C2ConsecIpPort(m_parent->get_unused_ip_port_ptr());
-      if (m_ports == NULL || !m_ports->valid()) {
-	snprintf(errmsg, errlen, "Could not find any valid IP ports");
-	media_message(LOG_ERR, "Couldn't get valid IP ports");
-	return (-1);
-      }
-      m_our_port = m_ports->first_port();
-
-      /*
-       * Send RTSP setup message - first create the transport string for that
-       * message
-       */
-      create_rtsp_transport_from_sdp(m_parent->get_sdp_info(),
-				     m_media_info,
-				     m_our_port,
-				     buffer,
-				     sizeof(buffer));
-    } else {
-      m_rtp_use_rtsp = 1;
-      m_rtp_media_number_in_session = media_number_in_session;
-      snprintf(buffer, sizeof(buffer), "RTP/AVP/TCP;unicast;interleaved=%d-%d",
-	       media_number_in_session * 2, (media_number_in_session * 2) + 1);
-    }
-    memset(&cmd, 0, sizeof(rtsp_command_t));
-    cmd.transport = buffer;
-    int err = 
-      rtsp_send_setup(m_parent->get_rtsp_client(),
-		      m_media_info->control_string,
-		      &cmd,
-		      &m_rtsp_session,
-		      &decode,
-		      m_parent->session_control_is_aggregate());
-    if (err != 0) {
-      snprintf(errmsg, errlen, "Couldn't set up session %s", 
-	       m_media_info->control_string);
-      media_message(LOG_ERR, "Can't create session %s - error code %d", 
-		    m_media_info->media, err);
-      if (decode != NULL)
-	free_decode_response(decode);
-      return (-1);
-    }
-    cmd.transport = NULL;
-    media_message(LOG_INFO, "Transport returned is %s", decode->transport);
-
-    /*
-     * process the transport they sent.  They need to send port numbers, 
-     * addresses, rtptime information, that sort of thing
-     */
-    if (m_source_addr == NULL) {
-      m_source_addr = rtsp_get_server_ip_address_string(m_rtsp_session);
-      media_message(LOG_INFO, "setting default source address from rtsp %s", m_source_addr);
-    }
-
-    if (process_rtsp_transport(decode->transport) != 0) {
-      snprintf(errmsg, errlen, "Couldn't process transport information in RTSP response: %s", decode->transport);
-      free_decode_response(decode);
-      return(-1);
-    }
-    free_decode_response(decode);
-  } else {
-    m_server_port = m_our_port = m_media_info->port;
-  }
-  connect_desc_t *cptr;
-  cptr = get_connect_desc_from_media(m_media_info);
-  if (cptr == NULL) {
-    snprintf(errmsg, errlen, "Server did not return address");
-    return (-1);
-  }
-
-  //
-  // okay - here we want to check that the server port is set up, and
-  // go ahead and init rtp, and the associated task
-  //
-  m_start_time = time(NULL);
-
-  if (create_common(strcmp(sdp_media->media, "video") == 0, 
-		    errmsg, errlen) < 0) {
-    return -1;
-  }
-
-  if (ondemand == 0 || use_rtsp == 0) {
-    m_rtp_inited = 0;
-    m_recv_thread = SDL_CreateThread(pdp_recv_thread, this);
-    if (m_recv_thread == NULL) {
-      snprintf(errmsg, errlen, "Couldn't create media %s RTP recv thread",
-	       m_media_info->media);
-      media_message(LOG_ERR, errmsg);
-      return (-1);
-    }
-    while (m_rtp_inited == 0) {
-      SDL_Delay(10);
-    }
-    if (m_rtp_session == NULL) {
-      snprintf(errmsg, errlen, "Could not start RTP - check debug log");
-      media_message(LOG_ERR, errmsg);
-      return (-1);
-    }
-  } else {
-    int ret;
-    ret = rtsp_thread_set_rtp_callback(m_parent->get_rtsp_client(),
-				       pdp_rtp_packet_callback,
-				       pdp_rtp_periodic,
-				       m_rtp_media_number_in_session,
-				       this);
-    if (ret < 0) {
-      snprintf(errmsg, errlen, "Can't setup TCP/RTP callback");
-      return -1;
-    }
-    ret = rtsp_thread_perform_callback(m_parent->get_rtsp_client(),
-				       pdp_init_rtp_tcp,
-				       this);
-    if (ret < 0) {
-      snprintf(errmsg, errlen,  "Can't init RTP in RTSP thread");
-      return -1;
-    }
-  }
-  if (m_rtp_session == NULL) {
-    snprintf(errmsg, errlen, "Couldn't create RTP session for media %s",
-	     m_media_info->media);
-    media_message(LOG_ERR, errmsg);
-    return (-1);
-  }
-  return (0);
-}
-
-int CPlayerMedia::create_video_plugin (const codec_plugin_t *p,
-				       const char *compressor, 
-				       int type, 
-				       int profile, 
-				       format_list_t *sdp_media,
-				       video_info_t *video,
-				       const uint8_t *user_data,
-				       uint32_t userdata_size)
-{
-  if (m_video_sync == NULL) {
-    m_video_sync = m_parent->set_up_video_sync();
-  }
-  if (m_video_sync == NULL) return -1;
-
-  m_plugin = p;
-  m_video_info = video;
-  m_plugin_data = (p->vc_create)(compressor, 
-				 type,
-				 profile, sdp_media,
-				 video,
-				 user_data,
-				 userdata_size,
-				 get_video_vft(),
-				 m_video_sync);
-  if (m_plugin_data == NULL) 
-    return -1;
-
-  if (user_data != NULL) 
-    set_user_data(user_data, userdata_size);
-  return 0;
-}
-
-void CPlayerMedia::set_plugin_data (const codec_plugin_t *p, 
-				    codec_data_t *d, 
-				    video_vft_t *v, 
-				    audio_vft_t *a)
-{
-  m_plugin = p;
-  m_plugin_data = d;
-  if (is_video()) {
-    if (m_video_sync == NULL) {
-      m_video_sync = m_parent->set_up_video_sync();
-    }
-    d->ifptr = m_video_sync;
-    d->v.video_vft = v;
-  } else {
-    if (m_audio_sync == NULL) {
-      m_audio_sync = m_parent->set_up_audio_sync();
-    }
-    d->ifptr = m_audio_sync;
-    d->v.audio_vft = a;
-  }
-    
-}
-
-int CPlayerMedia::get_plugin_status (char *buffer, uint32_t buflen)
-{
-  if (m_plugin == NULL) return -1;
-
-  if (m_plugin->c_print_status == NULL) return -1;
-
-  return ((m_plugin->c_print_status)(m_plugin_data, buffer, buflen));
-}
-
-int CPlayerMedia::create_audio_plugin (const codec_plugin_t *p,
-				       const char *compressor, 
-				       int type, 
-				       int profile,
-				       format_list_t *sdp_media,
-				       audio_info_t *audio,
-				       const uint8_t *user_data,
-				       uint32_t userdata_size)
-{
-  if (m_audio_sync == NULL) {
-    m_audio_sync = m_parent->set_up_audio_sync();
-  }
-  if (m_audio_sync == NULL) return -1;
-
-  m_audio_info = audio;
-  m_plugin = p;
-  m_plugin_data = (p->ac_create)(compressor,
-				 type, 
-				 profile, 
-				 sdp_media,
-				 audio,
-				 user_data,
-				 userdata_size,
-				 get_audio_vft(),
-				 m_audio_sync);
-  if (m_plugin_data == NULL) return -1;
-
-  if (user_data != NULL)
-    set_user_data(user_data, userdata_size);
-  return 0;
-}
-
-/*
- * CPlayerMedia::do_play - get play command
- */
-int CPlayerMedia::do_play (double start_time_offset,
-			   char *errmsg, 
-			   uint32_t errlen)
-{
-
-  if (m_streaming != 0) {
-    if (m_stream_ondemand != 0) {
-      /*
-       * We're streaming - send the RTSP play command
-       */
-      if (m_parent->session_control_is_aggregate() == 0) {
-	char buffer[80];
-	rtsp_command_t cmd;
-	rtsp_decode_t *decode;
-	range_desc_t *range;
-	memset(&cmd, 0, sizeof(rtsp_command_t));
-
-	// only do range if we're not paused
-	range = get_range_from_media(m_media_info);
-	if (range != NULL) {
-	  if (start_time_offset < range->range_start || 
-	      start_time_offset > range->range_end) 
-	    start_time_offset = range->range_start;
-	  // need to check for smpte
-	  sprintf(buffer, "npt=%g-%g", start_time_offset, range->range_end);
-	  cmd.range = buffer;
-	}
-
-	if (rtsp_send_play(m_rtsp_session, &cmd, &decode) != 0) {
-	  media_message(LOG_ERR, "RTSP play command failed");
-	  if (errmsg != NULL) {
-	    snprintf(errmsg, errlen, "RTSP Play Error %s-%s", 
-		     decode->retcode,
-		     decode->retresp != NULL ? decode->retresp : "");
-	  }
-	  free_decode_response(decode);
-	  return (-1);
-	}
-
-	/*
-	 * process the return information
-	 */
-	int ret = pdp_process_rtsp_rtpinfo(decode->rtp_info, m_parent, this);
-	if (ret < 0) {
-	  media_message(LOG_ERR, "rtsp rtpinfo failed");
-	  free_decode_response(decode);
-	  if (errmsg != NULL) {
-	    snprintf(errmsg, errlen, "RTSP aggregate RtpInfo response failure");
-	  }
-	  return (-1);
-	}
-	free_decode_response(decode);
-      }
-      if (m_source_addr == NULL) {
-	// get the ip address of the server from the rtsp stack
-	m_source_addr = rtsp_get_server_ip_address_string(m_rtsp_session);
-	media_message(LOG_INFO, "Setting source address from rtsp - %s", 
-		      m_source_addr);
-      }
-      // ASDF - probably need to do some stuff here for no rtpinfo...
-      /*
-       * set the various play times, and send a message to the recv task
-       * that it needs to start
-       */
-      m_play_start_time = start_time_offset;
-    }
-    if (m_byte_stream != NULL) {
-      m_byte_stream->play((uint64_t)(start_time_offset * 1000.0));
-    }
-    m_paused = 0;
-    if (m_rtp_use_rtsp) {
-      rtsp_thread_perform_callback(m_parent->get_rtsp_client(),
-				   pdp_rtp_start, 
-				   this);
-    } 
-  } else {
-    /*
-     * File (or other) playback.
-     */
-    if (m_paused == 0 || start_time_offset == 0.0) {
-      m_byte_stream->reset();
-    }
-    m_byte_stream->play((uint64_t)(start_time_offset * 1000.0));
-    m_play_start_time = start_time_offset;
-    m_paused = 0;
-    start_decoding();
-  }
-  return (0);
-}
-
-/*
- * CPlayerMedia::do_pause - stop what we're doing
- */
-int CPlayerMedia::do_pause (void)
-{
-
-  if (m_streaming != 0) {
-    if (m_stream_ondemand != 0) {
-      /*
-     * streaming - send RTSP pause
-     */
-      if (m_parent->session_control_is_aggregate() == 0) {
-	rtsp_command_t cmd;
-	rtsp_decode_t *decode;
-	memset(&cmd, 0, sizeof(rtsp_command_t));
-
-	if (rtsp_send_pause(m_rtsp_session, &cmd, &decode) != 0) {
-	  media_message(LOG_ERR, "RTSP play command failed");
-	  free_decode_response(decode);
-	  return (-1);
-	}
-	free_decode_response(decode);
-      }
-    }
-    if (m_recv_thread != NULL) {
-      m_rtp_msg_queue.send_message(MSG_PAUSE_SESSION);
-    }
-  }
-
-  if (m_byte_stream != NULL) 
-    m_byte_stream->pause();
-  /*
-   * Pause the various threads
-   */
-  m_decode_msg_queue.send_message(MSG_PAUSE_SESSION, 
-				  NULL, 
-				  0, 
-				  m_decode_thread_sem);
-  m_paused = 1;
-  return (0);
-}
-
-double CPlayerMedia::get_max_playtime (void) 
-{
-  if (m_byte_stream) {
-    return (m_byte_stream->get_max_playtime());
-  }
-  return (0.0);
-}
-
-/***************************************************************************
- * Transport and RTP-Info RTSP header line parsing.
- ***************************************************************************/
-#define ADV_SPACE(a) {while (isspace(*(a)) && (*(a) != '\0'))(a)++;}
-
-#define TTYPE(a,b) {a, sizeof(a), b}
-
-static char *transport_parse_unicast (char *transport, CPlayerMedia *m)
-{
-  ADV_SPACE(transport);
-  if (*transport == '\0') return (transport);
-
-  if (*transport != ';')
-    return (NULL);
-  transport++;
-  ADV_SPACE(transport);
-  return (transport);
-}
-
-static char *transport_parse_multicast (char *transport, CPlayerMedia *m)
-{
-  media_message(LOG_ERR,"Received multicast indication during SETUP");
-  return (NULL);
-}
-
-static char *convert_number (char *transport, uint32_t &value)
-{
-  value = 0;
-  while (isdigit(*transport)) {
-    value *= 10;
-    value += *transport - '0';
-    transport++;
-  }
-  return (transport);
-}
-
-static char *convert_hex (char *transport, uint32_t &value)
-{
-  value = 0;
-  while (isxdigit(*transport)) {
-    value *= 16;
-    if (isdigit(*transport))
-      value += *transport - '0';
-    else
-      value += tolower(*transport) - 'a' + 10;
-    transport++;
-  }
-  return (transport);
-}
-
-static char *transport_parse_client_port (char *transport, CPlayerMedia *m)
-{
-  uint32_t port;
-  uint16_t our_port, our_port_max;
-  if (*transport++ != '=') {
-    return (NULL);
-  }
-  ADV_SPACE(transport);
-  transport = convert_number(transport, port);
-  ADV_SPACE(transport);
-  our_port = m->get_our_port();
-  our_port_max = our_port + 1;
-
-  if (port != our_port) {
-    media_message(LOG_ERR, "Returned client port %u doesn't match sent %u",
-		  port, our_port);
-    return (NULL);
-  }
-  if (*transport == ';') {
-    transport++;
-    return (transport);
-  }
-  if (*transport == '\0') {
-    return (transport);
-  }
-  if (*transport != '-') {
-    return (NULL);
-  }
-  transport++;
-  ADV_SPACE(transport);
-  transport = convert_number(transport, port);
-  if ((port < our_port) || 
-      (port > our_port_max)) {
-    media_message(LOG_ERR, "Illegal client to port %u, range %u to %u",
-			 port, our_port, our_port_max);
-    return (NULL);
-  }
-  ADV_SPACE(transport);
-  if (*transport == ';') {
-    transport++;
-  }
-  return(transport);
-}
-
-static char *transport_parse_server_port (char *transport, CPlayerMedia *m)
-{
-  uint32_t fromport, toport;
-
-  if (*transport++ != '=') {
-    return (NULL);
-  }
-  ADV_SPACE(transport);
-  transport = convert_number(transport, fromport);
-  ADV_SPACE(transport);
-
-  m->set_server_port((uint16_t)fromport);
-
-  if (*transport == ';') {
-    transport++;
-    return (transport);
-  }
-  if (*transport == '\0') {
-    return (transport);
-  }
-  if (*transport != '-') {
-    return (NULL);
-  }
-  transport++;
-  ADV_SPACE(transport);
-  transport = convert_number(transport, toport);
-  if (toport < fromport || toport > fromport + 1) {
-    media_message(LOG_ERR, "Illegal server to port %u, from is %u",
-			 toport, fromport);
-    return (NULL);
-  }
-  ADV_SPACE(transport);
-  if (*transport == ';') {
-    transport++;
-  }
-  return(transport);
-}
-
-static char *transport_parse_source (char *transport, CPlayerMedia *m)
-{
-  char *ptr, *newone;
-  uint32_t addrlen;
-
-  if (*transport != '=') {
-    return (NULL);
-  }
-  transport++;
-  ADV_SPACE(transport);
-  ptr = transport;
-  while (*transport != ';' && *transport != '\0') transport++;
-  addrlen = transport - ptr;
-  if (addrlen == 0) {
-    return (NULL);
-  }
-  newone = (char *)malloc(addrlen + 1);
-  if (newone == NULL) {
-    media_message(LOG_ERR, "Can't alloc memory for transport source");
-    return (NULL);
-  }
-  strncpy(newone, ptr, addrlen);
-  newone[addrlen] = '\0';
-  m->set_source_addr(newone);
-  if (*transport == ';') transport++;
-  return (transport);
-}
-
-static char *transport_parse_ssrc (char *transport, CPlayerMedia *m)
-{
-  uint32_t ssrc;
-  if (*transport != '=') {
-    return (NULL);
-  }
-  transport++;
-  ADV_SPACE(transport);
-  transport = convert_hex(transport, ssrc);
-  ADV_SPACE(transport);
-  if (*transport != '\0') {
-    if (*transport != ';') {
-      return (NULL);
-    }
-    transport++;
-  }
-  m->set_rtp_ssrc(ssrc);
-  return (transport);
-}
-
-static char *transport_parse_interleave (char *transport, CPlayerMedia *m)
-{
-  uint32_t chan, chan2;
-  if (*transport != '=') {
-    return (NULL);
-  }
-  transport++;
-  ADV_SPACE(transport);
-  transport = convert_number(transport, chan);
-  chan2 = m->get_rtp_media_number() * 2;
-  if (chan != chan2) {
-    media_message(LOG_ERR, "Transport interleave not what was requested %d %d", 
-			 chan, chan2);
-    return NULL;
-  }
-  ADV_SPACE(transport);
-  if (*transport != '\0') {
-    if (*transport != '-') {
-      return (NULL);
-    }
-    transport++;
-    transport = convert_number(transport, chan2);
-    if (chan + 1 != chan2) {
-      media_message(LOG_ERR, "Error in transport interleaved field");
-      return (NULL);
-    }
-    
-    if (*transport == '\0') return (transport);
-  }
-  if (*transport != ';') return (NULL);
-  transport++;
-  return (transport);
-}
-
-static char *rtpinfo_parse_ssrc (char *transport, CPlayerMedia *m, int &end)
-{
-  uint32_t ssrc;
-  if (*transport != '=') {
-    return (NULL);
-  }
-  transport++;
-  ADV_SPACE(transport);
-  transport = convert_hex(transport, ssrc);
-  ADV_SPACE(transport);
-  if (*transport != '\0') {
-    if (*transport == ',') {
-      end = 1;
-    } else if (*transport != ';') {
-      return (NULL);
-    }
-    transport++;
-  }
-  m->set_rtp_ssrc(ssrc);
-  return (transport);
-}
-
-static char *rtpinfo_parse_seq (char *rtpinfo, CPlayerMedia *m, int &endofurl)
-{
-  uint32_t seq;
-  if (*rtpinfo != '=') {
-    return (NULL);
-  }
-  rtpinfo++;
-  ADV_SPACE(rtpinfo);
-  rtpinfo = convert_number(rtpinfo, seq);
-  ADV_SPACE(rtpinfo);
-  if (*rtpinfo != '\0') {
-    if (*rtpinfo == ',') {
-      endofurl = 1;
-    } else if (*rtpinfo != ';') {
-      return (NULL);
-    }
-    rtpinfo++;
-  }
-  m->set_rtp_base_seq(seq);
-  return (rtpinfo);
-}
-
-static char *rtpinfo_parse_rtptime (char *rtpinfo, 
-				    CPlayerMedia *m, 
-				    int &endofurl)
-{
-  uint32_t rtptime;
-  int neg = 0;
-  if (*rtpinfo != '=') {
-    return (NULL);
-  }
-  rtpinfo++;
-  ADV_SPACE(rtpinfo);
-  if (*rtpinfo == '-') {
-    neg = 1;
-    rtpinfo++;
-    ADV_SPACE(rtpinfo);
-  }
-  rtpinfo = convert_number(rtpinfo, rtptime);
-  ADV_SPACE(rtpinfo);
-  if (*rtpinfo != '\0') {
-    if (*rtpinfo == ',') {
-      endofurl = 1;
-    } else if (*rtpinfo != ';') {
-      return (NULL);
-    }
-    rtpinfo++;
-  }
-  if (neg != 0) {
-    player_error_message("Warning - negative time returned in rtpinfo");
-    rtptime = 0 - rtptime;
-  }
-  m->set_rtp_base_ts(rtptime);
-  return (rtpinfo);
-}
-struct {
-  const char *name;
-  uint32_t namelen;
-  char *(*routine)(char *transport, CPlayerMedia *);
-} transport_types[] = 
-{
-  TTYPE("unicast", transport_parse_unicast),
-  TTYPE("multicast", transport_parse_multicast),
-  TTYPE("client_port", transport_parse_client_port),
-  TTYPE("server_port", transport_parse_server_port),
-  TTYPE("source", transport_parse_source),
-  TTYPE("ssrc", transport_parse_ssrc),
-  TTYPE("interleaved", transport_parse_interleave),
-  {NULL, 0, NULL},
-}; 
-
-int CPlayerMedia::process_rtsp_transport (char *transport)
-{
-  uint32_t protolen;
-  int ix;
-
-  if (transport == NULL) 
-    return (-1);
-
-  protolen = strlen(m_media_info->proto);
-  
-  if (strncasecmp(transport, m_media_info->proto, protolen) != 0) {
-    media_message(LOG_ERR, "transport %s doesn't match %s", transport, 
-			 m_media_info->proto);
-    return (-1);
-  }
-  transport += protolen;
-  if (*transport == '/') {
-    transport++;
-    if (m_rtp_use_rtsp) {
-      if (strncasecmp(transport, "TCP", strlen("TCP")) != 0) {
-	media_message(LOG_ERR, "Transport is not TCP");
-	return (-1);
-      }
-      transport += strlen("TCP");
-    } else {
-      if (strncasecmp(transport, "UDP", strlen("UDP")) != 0) {
-	media_message(LOG_ERR, "Transport is not UDP");
-	return (-1);
-      }
-      transport += strlen("UDP");
-    }
-  }
-  if (*transport != ';') {
-    return (-1);
-  }
-  transport++;
-  do {
-    ADV_SPACE(transport);
-    for (ix = 0; transport_types[ix].name != NULL; ix++) {
-      if (strncasecmp(transport, 
-		      transport_types[ix].name, 
-		      transport_types[ix].namelen - 1) == 0) {
-	transport += transport_types[ix].namelen - 1;
-	ADV_SPACE(transport);
-	transport = (transport_types[ix].routine)(transport, this);
-	break;
-      }
-    }
-    if (transport_types[ix].name == NULL) {
-      media_message(LOG_INFO, "Illegal mime type in transport - skipping %s", 
-			   transport);
-      while (*transport != ';' && *transport != '\0') transport++;
-      if (*transport != '\0') transport++;
-    }
-  } while (transport != NULL && *transport != '\0');
-
-  if (transport == NULL) {
-    return (-1);
-  }
-  return (0);
-}
-
-struct {
-  const char *name;
-  uint32_t namelen;
-  char *(*routine)(char *transport, CPlayerMedia *, int &end_for_url);
-} rtpinfo_types[] = 
-{
-  TTYPE("seq", rtpinfo_parse_seq),
-  TTYPE("rtptime", rtpinfo_parse_rtptime),
-  TTYPE("ssrc", rtpinfo_parse_ssrc),
-  {NULL, 0, NULL},
-};
-
-int pdp_process_rtsp_rtpinfo (char *rtpinfo, 
-			  CPlayerSession *session,
-			  CPlayerMedia *media)
-{
-  int ix;
-  CPlayerMedia *newmedia;
-  if (rtpinfo == NULL) 
-    return (0);
-
-  do {
-    int no_mimes = 0;
-    ADV_SPACE(rtpinfo);
-    if (strncasecmp(rtpinfo, "url", strlen("url")) != 0) {
-      media_message(LOG_ERR, "Url not found");
-      return (-1);
-    }
-    rtpinfo += strlen("url");
-    ADV_SPACE(rtpinfo);
-    if (*rtpinfo != '=') {
-      media_message(LOG_ERR, "Can't find = after url");
-      return (-1);
-    }
-    rtpinfo++;
-    ADV_SPACE(rtpinfo);
-    char *url = rtpinfo;
-    while (*rtpinfo != '\0' && *rtpinfo != ';' && *rtpinfo != ',') {
-      rtpinfo++;
-    }
-    if (*rtpinfo == '\0') {
-      no_mimes = 1;
-    } else {
-      if (*rtpinfo == ',') {
-	no_mimes = 1;
-      }
-      *rtpinfo++ = '\0';
-    }
-    char *temp = url;
-    newmedia = session->rtsp_url_to_media(url);
-    if (newmedia == NULL) {
-      media_message(LOG_ERR, "Can't find media from %s", url);
-      return -1;
-    } else if (media != NULL && media != newmedia) {
-      media_message(LOG_ERR, "Url in rtpinfo does not match media %s", url);
-      return -1;
-    }
-    if (temp != url) 
-      free(url);
-
-    if (no_mimes == 0) {
-    int endofurl = 0;
-    do {
-      ADV_SPACE(rtpinfo);
-      for (ix = 0; rtpinfo_types[ix].name != NULL; ix++) {
-	if (strncasecmp(rtpinfo,
-			rtpinfo_types[ix].name, 
-			rtpinfo_types[ix].namelen - 1) == 0) {
-	  rtpinfo += rtpinfo_types[ix].namelen - 1;
-	  ADV_SPACE(rtpinfo);
-	  rtpinfo = (rtpinfo_types[ix].routine)(rtpinfo, newmedia, endofurl);
-	  break;
-	}
-      }
-      if (rtpinfo_types[ix].name == NULL) {
-#if 1
-	media_message(LOG_INFO, "Unknown mime-type in RtpInfo - skipping %s", 
-			     rtpinfo);
-#endif
-	while (*rtpinfo != ';' && *rtpinfo != '\0') rtpinfo++;
-	if (*rtpinfo != '\0') rtpinfo++;
-      }
-    } while (endofurl == 0 && rtpinfo != NULL && *rtpinfo != '\0');
-    } 
-    newmedia = NULL;
-  } while (rtpinfo != NULL && *rtpinfo != '\0');
-
-  if (rtpinfo == NULL) {
-    return (-1);
-  }
-
-  return (1);
-}
-
-int CPlayerMedia::rtp_receive_packet (unsigned char interleaved, 
-				      struct rtp_packet *pak, 
-				      int len)
-{
-  int ret;
-  if ((interleaved & 1) == 0) {
-    ret = rtp_process_recv_data(m_rtp_session, 0, pak, len);
-    if (ret < 0) {
-      xfree(pak);
-    }
-  } else {
-    uint8_t *pakbuf = (uint8_t *)pak;
-    pakbuf += sizeof(rtp_packet_data);
-	    
-    rtp_process_ctrl(m_rtp_session, pakbuf, len);
-    xfree(pak);
-    ret = 0;
-  }
-  return ret;
-}
-
-void CPlayerMedia::rtp_periodic (void)
-{
-  rtp_send_ctrl(m_rtp_session, 
-		m_rtp_byte_stream != NULL ? 
-		m_rtp_byte_stream->get_last_rtp_timestamp() : 0, 
-		NULL);
-  rtp_update(m_rtp_session);
-  if (m_rtp_byte_stream != NULL) {
-    int ret = m_rtp_byte_stream->recv_task(m_decode_thread_waiting);
-    if (ret > 0) {
-      if (m_rtp_buffering == 0) {
-	m_rtp_buffering = 1;
-	start_decoding();
-      } else {
-	bytestream_primed();
-      }
-    }
-    return;
-  }
-  if (m_head != NULL) {
-    /*
-     * Make sure that the payload type is the same
-     */
-    if (m_head->rtp_pak_pt == m_tail->rtp_pak_pt) {
-      if (m_rtp_queue_len > 10) { // 10 packets consecutive proto same
-	if (determine_payload_type_from_rtp() == FALSE) {
-	  clear_rtp_packets(); 
-	}
-      }
-    } else {
-      clear_rtp_packets();
-    }
-  }
-}
-
-void CPlayerMedia::rtp_start (void)
-{
-  if (m_rtp_ssrc_set == TRUE) {
-    rtp_set_my_ssrc(m_rtp_session, m_rtp_ssrc);
-  } else {
-    // For now - we'll set up not to wait for RTCP validation 
-    // before indicating if rtp library should accept.
-    rtp_set_option(m_rtp_session, RTP_OPT_WEAK_VALIDATION, FALSE);
-    rtp_set_option(m_rtp_session, RTP_OPT_PROMISC, TRUE);
-  }
-  if (m_rtp_byte_stream != NULL) {
-    //m_rtp_byte_stream->reset(); - gets called when pausing
-    m_rtp_byte_stream->flush_rtp_packets();
-  }
-  m_rtp_buffering = 0;
-}
-
-void CPlayerMedia::rtp_end(void)
-{
-  if (m_rtp_session != NULL) {
-    rtp_send_bye(m_rtp_session);
-    rtp_done(m_rtp_session);
-  }
-  m_rtp_session = NULL;
-}
-
-int CPlayerMedia::rtcp_send_packet (uint8_t *buffer, int buflen)
-{
-  if (config.get_config_value(CONFIG_SEND_RTCP_IN_RTP_OVER_RTSP) != 0) {
-    return rtsp_thread_send_rtcp(m_parent->get_rtsp_client(),
-				 m_rtp_media_number_in_session,
-				 buffer, 
-				 buflen);
-  }
-  return buflen;
-}
-
-int CPlayerMedia::recv_thread (void)
-{
-  struct timeval timeout;
-  int retcode;
-  CMsg *newmsg;
-  int recv_thread_stop = 0;
-  connect_desc_t *cptr;
-  cptr = get_connect_desc_from_media(m_media_info);
-
-
-  m_rtp_buffering = 0;
-  if (m_stream_ondemand != 0) {
-    /*
-     * We need to free up the ports that we got before RTP tries to set 
-     * them up, so we don't have any re-use conflicts.  There is a small
-     * window here that they might get used...
-     */
-    delete m_ports; // free up the port numbers
-    m_ports = NULL;
-  }
-
-  double bw;
-
-  if (find_rtcp_bandwidth_from_media(m_media_info, &bw) < 0) {
-    bw = 5000.0;
-  } else {
-    media_message(LOG_DEBUG, "Using bw from sdp %g", bw);
-  }
-  m_rtp_session = rtp_init(m_source_addr == NULL ? 
-			   cptr->conn_addr : m_source_addr,
-			   m_our_port,
-			   m_server_port,
-			   cptr == NULL ? 1 : cptr->ttl, // need ttl here
-			   bw, // rtcp bandwidth ?
-			   pdp_recv_callback,
-			   (uint8_t *)this);
-  if (m_rtp_session != NULL) {
-    rtp_set_option(m_rtp_session, RTP_OPT_WEAK_VALIDATION, FALSE);
-    rtp_set_option(m_rtp_session, RTP_OPT_PROMISC, TRUE);
-    rtp_start();
-  }
-  m_rtp_inited = 1;
-  
-  while (recv_thread_stop == 0) {
-    if ((newmsg = m_rtp_msg_queue.get_message()) != NULL) {
-      //player_debug_message("recv thread message %d", newmsg->get_value());
-      switch (newmsg->get_value()) {
-      case MSG_STOP_THREAD:
-	recv_thread_stop = 1;
-	break;
-      case MSG_PAUSE_SESSION:
-	// Indicate that we need to restart the session.
-	// But keep going...
-	rtp_start();
-	break;
-      }
-      delete newmsg;
-      newmsg = NULL;
-    }
-    if (recv_thread_stop == 1) {
-      continue;
-    }
-    if (m_rtp_session == NULL) {
-      SDL_Delay(50); 
-    } else {
-      timeout.tv_sec = 0;
-      timeout.tv_usec = 500000;
-      retcode = rtp_recv(m_rtp_session, &timeout, 0);
-      //      player_debug_message("rtp_recv return %d", retcode);
-      // Run rtp periodic after each packet received or idle time.
-      if (m_paused == 0 || m_stream_ondemand != 0)
-	rtp_periodic();
-    }
-    
-  }
-  /*
-   * When we're done, send a bye, close up rtp, and go home
-   */
-  rtp_end();
-  return (0);
-}
-
-void CPlayerMedia::recv_callback (struct rtp *session, rtp_event *e)
-{
-  if (e == NULL) return;
-  /*
-   * If we're paused, just dump the packet.  Multicast case
-   */
-  if (m_paused != 0) {
-    if (e->type == RX_RTP) {
-      xfree(e->data);
-      return;
-    }
-  }
-#if DROP_PAKS
-    if (e->type == RX_RTP && dropcount >= 50) {
-      xfree((rtp_packet *)e->data);
-      dropcount = 0;
-      return;
-    } else { 
-      dropcount++;
-    }
-#endif
-  if (m_rtp_byte_stream != NULL) {
-    m_rtp_byte_stream->recv_callback(session, e);
-    return;
-  }
-  switch (e->type) {
-  case RX_RTP:
-    /* regular rtp packet - add it to the queue */
-    rtp_packet *rpak;
-
-      
-    rpak = (rtp_packet *)e->data;
-    if (rpak->rtp_data_len == 0) {
-      xfree(rpak);
-    } else {
-      rpak->pd.rtp_pd_timestamp = get_time_of_day();
-      rpak->pd.rtp_pd_have_timestamp = true;
-      add_rtp_packet_to_queue(rpak, &m_head, &m_tail, m_is_video ? "video" : "audio");
-      m_rtp_queue_len++;
-    }
-    break;
-  case RX_SR:
-    rtcp_sr *srpak;
-    srpak = (rtcp_sr *)e->data;
-
-    m_rtcp_ntp_frac = srpak->ntp_frac;
-    m_rtcp_ntp_sec = srpak->ntp_sec;
-    m_rtcp_rtp_ts = srpak->rtp_ts;
-    m_rtcp_received = 1;
-    break;
-  case RX_APP:
-    free(e->data);
-    break;
-  default:
-#if 0
-    media_message(LOG_DEBUG, "Thread %u - Callback from rtp with %d %p", 
-		  SDL_ThreadID(),e->type, e->data);
-#endif
-    break;
-  }
-}
-
-int CPlayerMedia::determine_payload_type_from_rtp(void)
-{
-  uint8_t payload_type = m_head->rtp_pak_pt, temp;
-  format_list_t *fmt;
-  uint64_t tickpersec;
-
-  fmt = m_media_info->fmt;
-  while (fmt != NULL) {
-    // rtp payloads are all numeric
-    temp = atoi(fmt->fmt);
-    if (temp == payload_type) {
-      m_media_fmt = fmt;
-      if (fmt->rtpmap != NULL) {
-	tickpersec = fmt->rtpmap->clock_rate;
-      } else {
-	if (payload_type >= 96) {
-	  media_message(LOG_ERR, "Media %s, rtp payload type of %u, no rtp map",
-			m_media_info->media, payload_type);
-	  return (FALSE);
-	} else {
-	  // generic payload type.  between 0 and 23 are audio - most
-	  // are 8000
-	  // all video (above 25) are 90000
-	  tickpersec = 90000;
-	  // this will handle the >= 0 case as well.
-	  if (payload_type <= 23) {
-	    tickpersec = 8000;
-	    if (payload_type == 6) {
-	      tickpersec = 16000;
-	    } else if (payload_type == 10 || payload_type == 11) {
-	      tickpersec = 44100;
-	    } else if (payload_type == 14) 
-	      tickpersec = 90000;
-	  }
-	}
-      }
-
-      create_rtp_byte_stream(payload_type,
-			     tickpersec,
-			     fmt);
-      m_rtp_byte_stream->play((uint64_t)(m_play_start_time * 1000.0));
-      m_byte_stream = m_rtp_byte_stream;
-      if (!is_video()) {
-	m_rtp_byte_stream->set_sync(m_parent);
-      } else {
-	m_parent->syncronize_rtp_bytestreams(NULL);
-      }
-#if 1
-      media_message(LOG_DEBUG, "media %s - rtp tps %u ntp per rtp ",
-			   m_media_info->media,
-			   m_rtptime_tickpersec);
-#endif
-
-      return (TRUE);
-    }
-    fmt = fmt->next;
-  }
-  media_message(LOG_ERR, "Payload type %d not in format list for media %s", 
-		payload_type, m_is_video ? "video" : "audio");
-  return (FALSE);
-}
-
-/*
- * set up rtptime
- */
-void CPlayerMedia::set_rtp_base_ts (uint32_t time)
-{
-  m_rtsp_base_ts_received = 1;
-  m_rtp_base_ts = time;
-  if (m_rtp_byte_stream != NULL) {
-    m_rtp_byte_stream->set_rtp_base_ts(time);
-  }
-}
-
-void CPlayerMedia::set_rtp_base_seq (uint16_t seq)
-{
-  m_rtsp_base_seq_received = 1; 
-  m_rtp_base_seq = seq;
-  if (m_rtp_byte_stream != NULL) {
-    m_rtp_byte_stream->set_rtp_base_seq(seq);
-  }
-}
-
-void CPlayerMedia::rtp_init_tcp (void) 
-{
-  connect_desc_t *cptr;
-  double bw;
-
-  if (find_rtcp_bandwidth_from_media(m_media_info, &bw) < 0) {
-    bw = 5000.0;
-  } 
-  cptr = get_connect_desc_from_media(m_media_info);
-  m_rtp_session = rtp_init_extern_net(m_source_addr == NULL ? 
-				      cptr->conn_addr : m_source_addr,
-				      m_our_port,
-				      m_server_port,
-				      cptr->ttl,
-				      bw, // rtcp bandwidth ?
-				      pdp_recv_callback,
-				      pdp_rtcp_send_packet,
-				      (uint8_t *)this);
-  rtp_set_option(m_rtp_session, RTP_OPT_WEAK_VALIDATION, FALSE);
-  rtp_set_option(m_rtp_session, RTP_OPT_PROMISC, TRUE);
-  m_rtp_inited = 1;
-
-}
-
-void CPlayerMedia::create_rtp_byte_stream (uint8_t rtp_pt,
-					   uint64_t tps,
-					   format_list_t *fmt)
-{
-  int codec;
-  rtp_check_return_t plugin_ret;
-  rtp_plugin_t *rtp_plugin;
-
-  rtp_plugin = NULL;
-  plugin_ret = check_for_rtp_plugins(fmt, rtp_pt, &rtp_plugin);
-
-  if (plugin_ret != RTP_PLUGIN_NO_MATCH) {
-    switch (plugin_ret) {
-    case RTP_PLUGIN_MATCH:
-      player_debug_message("Starting rtp bytestream %s from plugin", 
-			   rtp_plugin->name);
-      m_rtp_byte_stream = new CPluginRtpByteStream(rtp_plugin,
-						 fmt,
-						 rtp_pt,
-						 m_stream_ondemand,
-						 tps,
-						 &m_head,
-						 &m_tail,
-						 m_rtsp_base_seq_received,
-						 m_rtp_base_seq,
-						 m_rtsp_base_ts_received,
-						 m_rtp_base_ts,
-						 m_rtcp_received,
-						 m_rtcp_ntp_frac,
-						 m_rtcp_ntp_sec,
-						 m_rtcp_rtp_ts);
-      return;
-    case RTP_PLUGIN_MATCH_USE_VIDEO_DEFAULT:
-      // just fall through...
-      break; 
-    case RTP_PLUGIN_MATCH_USE_AUDIO_DEFAULT:
-      m_rtp_byte_stream = 
-	new CAudioRtpByteStream(rtp_pt, 
-				fmt, 
-				m_stream_ondemand,
-				tps,
-				&m_head,
-				&m_tail,
-				m_rtsp_base_seq_received,
-				m_rtp_base_seq,
-				m_rtsp_base_ts_received,
-				m_rtp_base_ts,
-				m_rtcp_received,
-				m_rtcp_ntp_frac,
-				m_rtcp_ntp_sec,
-				m_rtcp_rtp_ts);
-      if (m_rtp_byte_stream != NULL) {
-	player_debug_message("Starting generic audio byte stream");
-	return;
-      }
-
-    default:
-      break;
-    }
-  } else {
-    if (is_video() && (rtp_pt == 32)) {
-      codec = VIDEO_MPEG12;
-      m_rtp_byte_stream = new CMpeg3RtpByteStream(rtp_pt,
-						  fmt, 
-						m_stream_ondemand,
-						tps,
-						&m_head,
-						&m_tail,
-						m_rtsp_base_seq_received,
-						m_rtp_base_seq,
-						m_rtsp_base_ts_received,
-						m_rtp_base_ts,
-						m_rtcp_received,
-						m_rtcp_ntp_frac,
-						m_rtcp_ntp_sec,
-						m_rtcp_rtp_ts);
-      if (m_rtp_byte_stream != NULL) {
-	return;
-      }
-  } else {
-    if (rtp_pt == 14) {
-      codec = MPEG4IP_AUDIO_MP3;
-    } else if (rtp_pt <= 23) {
-      codec = MPEG4IP_AUDIO_GENERIC;
-    }  else {
-      if (fmt->rtpmap == NULL) return;
-
-      codec = lookup_audio_codec_by_name(fmt->rtpmap->encode_name);
-      if (codec < 0) {
-	codec = MPEG4IP_AUDIO_NONE; // fall through everything to generic
-      }
-    }
-    switch (codec) {
-    case MPEG4IP_AUDIO_MP3: {
-      m_rtp_byte_stream = 
-	new CAudioRtpByteStream(rtp_pt, fmt, 
-				m_stream_ondemand,
-				tps,
-				&m_head,
-				&m_tail,
-				m_rtsp_base_seq_received,
-				m_rtp_base_seq,
-				m_rtsp_base_ts_received,
-				m_rtp_base_ts,
-				m_rtcp_received,
-				m_rtcp_ntp_frac,
-				m_rtcp_ntp_sec,
-				m_rtcp_rtp_ts);
-      if (m_rtp_byte_stream != NULL) {
-	m_rtp_byte_stream->set_skip_on_advance(4);
-	player_debug_message("Starting mp3 2250 audio byte stream");
-	return;
-      }
-    }
-      break;
-    case MPEG4IP_AUDIO_MP3_ROBUST:
-      m_rtp_byte_stream = 
-	new CRfc3119RtpByteStream(rtp_pt, fmt, 
-				m_stream_ondemand,
-				tps,
-				&m_head,
-				&m_tail,
-				m_rtsp_base_seq_received,
-				m_rtp_base_seq,
-				m_rtsp_base_ts_received,
-				m_rtp_base_ts,
-				m_rtcp_received,
-				m_rtcp_ntp_frac,
-				m_rtcp_ntp_sec,
-				m_rtcp_rtp_ts);
-      if (m_rtp_byte_stream != NULL) {
-	player_debug_message("Starting mpa robust byte stream");
-	return;
-      }
-      break;
-    case MPEG4IP_AUDIO_GENERIC:
-      m_rtp_byte_stream = 
-	new CAudioRtpByteStream(rtp_pt, fmt, 
-				m_stream_ondemand,
-				tps,
-				&m_head,
-				&m_tail,
-				m_rtsp_base_seq_received,
-				m_rtp_base_seq,
-				m_rtsp_base_ts_received,
-				m_rtp_base_ts,
-				m_rtcp_received,
-				m_rtcp_ntp_frac,
-				m_rtcp_ntp_sec,
-				m_rtcp_rtp_ts);
-      if (m_rtp_byte_stream != NULL) {
-	player_debug_message("Starting generic audio byte stream");
-	return;
-      }
-    default:
-      break;
-    }
-  }
-  m_rtp_byte_stream = new CRtpByteStream(fmt->media->media,
-					 fmt, 
-					 rtp_pt,
-					 m_stream_ondemand,
-					 tps,
-					 &m_head,
-					 &m_tail,
-					 m_rtsp_base_seq_received,
-					 m_rtp_base_seq,
-					 m_rtsp_base_ts_received,
-					 m_rtp_base_ts,
-					 m_rtcp_received,
-					 m_rtcp_ntp_frac,
-					 m_rtcp_ntp_sec,
-					 m_rtcp_rtp_ts);
-  }
-}
-
-void CPlayerMedia::syncronize_rtp_bytestreams (rtcp_sync_t *sync)
-{
-  if (!is_video()) {
-    player_error_message("Attempt to syncronize audio byte stream");
-    return;
-  }
-  if (m_rtp_byte_stream != NULL) 
-    m_rtp_byte_stream->syncronize(sync);
-}
-
-void CPlayerMedia::start_decoding (void)
-{
-  m_decode_msg_queue.send_message(MSG_START_DECODING, 
-				  NULL, 
-				  0, 
-				  m_decode_thread_sem);
-}
-
-void CPlayerMedia::bytestream_primed (void)
-{
-  if (m_decode_thread_waiting != 0) {
-    m_decode_thread_waiting = 0;
-    SDL_SemPost(m_decode_thread_sem);
-  }
-}
-
-void CPlayerMedia::wait_on_bytestream (void)
-{
-  m_decode_thread_waiting = 1;
-#ifdef DEBUG_DECODE
-  if (m_media_info)
-    media_message(LOG_INFO, "decode thread %s waiting", m_media_info->media);
-  else
-    media_message(LOG_INFO, "decode thread waiting");
-#endif
-  SDL_SemWait(m_decode_thread_sem);
-  m_decode_thread_waiting = 0;
-} 
-
-void CPlayerMedia::parse_decode_message (int &thread_stop, int &decoding)
-{
-  CMsg *newmsg;
-
-  if ((newmsg = m_decode_msg_queue.get_message()) != NULL) {
-#ifdef DEBUG_DECODE_MSGS
-    media_message(LOG_DEBUG, "decode thread message %d",newmsg->get_value());
-#endif
-    switch (newmsg->get_value()) {
-    case MSG_STOP_THREAD:
-      thread_stop = 1;
-      break;
-    case MSG_PAUSE_SESSION:
-      decoding = 0;
-      if (m_video_sync != NULL) {
-	m_video_sync->flush_decode_buffers();
-      }
-      if (m_audio_sync != NULL) {
-	m_audio_sync->flush_decode_buffers();
-      }
-      break;
-    case MSG_START_DECODING:
-      if (m_video_sync != NULL) {
-	m_video_sync->flush_decode_buffers();
-      }
-      if (m_audio_sync != NULL) {
-	m_audio_sync->flush_decode_buffers();
-      }
-      decoding = 1;
-      break;
-    }
-    delete newmsg;
-  }
-}
-
-int CPlayerMedia::decode_thread (void) 
-{
-  //  uint32_t msec_per_frame = 0;
-  int ret = 0;
-  int thread_stop = 0, decoding = 0;
-  uint32_t decode_skipped_frames = 0;
-  uint64_t ourtime;
-      // Tell bytestream we're starting the next frame - they'll give us
-      // the time.
-  uint8_t *frame_buffer;
-  uint32_t frame_len;
-  void *ud = NULL;
-  
-  uint32_t frames_decoded;
-  uint64_t bytes_decoded;
-  uint32_t frames_decoded_last_sec;
-  uint64_t bytes_decoded_last_sec;
-  uint64_t current_second;
-  uint32_t total_secs;
-  uint32_t last_div = 0;
-
-  total_secs = 0;
-  frames_decoded = 0;
-  bytes_decoded = 0;
-  frames_decoded_last_sec = 0;
-  bytes_decoded_last_sec = 0;
-  current_second = 0;
-
-  while (thread_stop == 0) {
-    // waiting here for decoding or thread stop
-    ret = SDL_SemWait(m_decode_thread_sem);
-#ifdef DEBUG_DECODE
-    media_message(LOG_DEBUG, "%s Decode thread awake",
-		  is_video() ? "video" : "audio");
-#endif
-    parse_decode_message(thread_stop, decoding);
-
-    if (decoding == 1) {
-      // We've been told to start decoding - if we don't have a codec, 
-      // create one
-      if (is_video()) {
-	if (m_video_sync == NULL) {
-	  m_video_sync = m_parent->set_up_video_sync();
-	}
-	m_video_sync->set_wait_sem(m_decode_thread_sem);
-      } else {
-	if (m_audio_sync == NULL) {
-	  m_audio_sync = m_parent->set_up_audio_sync();
-	}
-	m_audio_sync->set_wait_sem(m_decode_thread_sem);
-      }
-      if (m_plugin == NULL) {
-	if (is_video()) {
-	  m_plugin = check_for_video_codec(NULL,
-					   m_media_fmt,
-					   -1,
-					   -1,
-					   m_user_data,
-					   m_user_data_size);
-	  if (m_plugin != NULL) {
-	    m_plugin_data = (m_plugin->vc_create)(NULL, // must figure from sdp
-						  -1,
-						  -1,
-						  m_media_fmt,
-						  m_video_info,
-						  m_user_data,
-						  m_user_data_size,
-						  get_video_vft(),
-						  m_video_sync);
-	    if (m_plugin_data == NULL) {
-	      m_plugin = NULL;
-	    } else {
-	      media_message(LOG_DEBUG, "Starting %s codec from decode thread",
-			    m_plugin->c_name);
-	    }
-	  }
-	} else {
-	  m_plugin = check_for_audio_codec(NULL,
-					   m_media_fmt,
-					   -1, 
-					   -1, 
-					   m_user_data,
-					   m_user_data_size);
-	  if (m_plugin != NULL) {
-	    m_plugin_data = (m_plugin->ac_create)(NULL, 
-						  -1,
-						  -1,
-						  m_media_fmt,
-						  m_audio_info,
-						  m_user_data,
-						  m_user_data_size,
-						  get_audio_vft(),
-						  m_audio_sync);
-	    if (m_plugin_data == NULL) {
-	      m_plugin = NULL;
-	    } else {
-	      media_message(LOG_DEBUG, "Starting %s codec from decode thread",
-			    m_plugin->c_name);
-	    }
-	  }
-	}
-      }
-      if (m_plugin != NULL) {
-	m_plugin->c_do_pause(m_plugin_data);
-      } else {
-	while (thread_stop == 0 && decoding) {
-	  SDL_Delay(100);
-	  if (m_rtp_byte_stream) {
-	    m_rtp_byte_stream->flush_rtp_packets();
-	  }
-	  parse_decode_message(thread_stop, decoding);
-	}
-      }
-    }
-    /*
-     * this is our main decode loop
-     */
-#ifdef DEBUG_DECODE
-    media_message(LOG_DEBUG, "%s Into decode loop",
-		  is_video() ? "video" : "audio");
-#endif
-    frames_decoded_last_sec = 0;
-    bytes_decoded_last_sec = 0;
-    current_second = 0;
-    while ((thread_stop == 0) && decoding) {
-      parse_decode_message(thread_stop, decoding);
-      if (thread_stop != 0)
-	continue;
-      if (decoding == 0) {
-	m_plugin->c_do_pause(m_plugin_data);
-	continue;
-      }
-      if (m_byte_stream->eof()) {
-	media_message(LOG_INFO, "%s hit eof", m_is_video ? "video" : "audio");
-	if (m_audio_sync) m_audio_sync->set_eof();
-	if (m_video_sync) m_video_sync->set_eof();
-	decoding = 0;
-	continue;
-      }
-      if (m_byte_stream->have_no_data()) {
-	// Indicate that we're waiting, and wait for a message from RTP
-	// task.
-	wait_on_bytestream();
-	continue;
-      }
-
-      frame_buffer = NULL;
-      ourtime = m_byte_stream->start_next_frame(&frame_buffer, 
-						&frame_len,
-						&ud);
-      /*
-       * If we're decoding video, see if we're playing - if so, check
-       * if we've fallen significantly behind the audio
-       */
-      if (is_video() &&
-	  (m_parent->get_session_state() == SESSION_PLAYING)) {
-	uint64_t current_time = m_parent->get_playing_time();
-	if (current_time >= ourtime) {
-#if 1
-	  media_message(LOG_INFO, "Candidate for skip decode "U64" our "U64, 
-			       current_time, ourtime);
-#endif
-	  // If the bytestream can skip ahead, let's do so
-	  if (m_byte_stream->can_skip_frame() != 0) {
-	    int ret;
-	    int hassync;
-	    int count;
-	    current_time += 200; 
-	    count = 0;
-	    // Skip up to the current time + 200 msec
-	    ud = NULL;
-	    do {
-	      if (ud != NULL) free(ud);
-	      ret = m_byte_stream->skip_next_frame(&ourtime, &hassync,
-						   &frame_buffer, &frame_len,
-						   &ud);
-	      decode_skipped_frames++;
-	    } while (ret != 0 &&
-		     !m_byte_stream->eof() && 
-		     current_time > ourtime);
-	    if (m_byte_stream->eof() || ret == 0) continue;
-#if 1
-	    media_message(LOG_INFO, "Skipped ahead "U64 " to "U64, 
-			  current_time - 200, ourtime);
-#endif
-	    /*
-	     * Ooh - fun - try to match to the next sync value - if not, 
-	     * 15 frames
-	     */
-	    do {
-	      if (ud != NULL) free(ud);
-	      ret = m_byte_stream->skip_next_frame(&ourtime, &hassync,
-						   &frame_buffer, &frame_len,
-						   &ud);
-	      if (hassync < 0) {
-		uint64_t diff = ourtime - current_time;
-		if (diff > (2 * C_64)) {
-		  hassync = 1;
-		}
-	      }
-	      decode_skipped_frames++;
-	      count++;
-	    } while (ret != 0 &&
-		     hassync <= 0 &&
-		     count < 30 &&
-		     !m_byte_stream->eof());
-	    if (m_byte_stream->eof() || ret == 0) continue;
-#ifdef DEBUG_DECODE
-	    media_message(LOG_INFO, "Matched ahead - count %d, sync %d time "U64,
-				 count, hassync, ourtime);
-#endif
-	  }
-	}
-      }
-#ifdef DEBUG_DECODE
-      media_message(LOG_DEBUG, "Decoding %c frame " U64, 
-		    m_is_video ? 'v' : 'a', ourtime);
-#endif
-      if (frame_buffer != NULL && frame_len != 0) {
-	int sync_frame;
-	ret = m_plugin->c_decode_frame(m_plugin_data,
-				       ourtime,
-				       m_streaming != 0,
-				       &sync_frame,
-				       frame_buffer, 
-				       frame_len,
-				       ud);
-#ifdef DEBUG_DECODE
-	media_message(LOG_DEBUG, "Decoding %c frame return %d", 
-		      m_is_video ? 'v' : 'a', ret);
-#endif
-	if (ret > 0) {
-	  frames_decoded++;
-	  m_byte_stream->used_bytes_for_frame(ret);
-	  bytes_decoded += ret;
-	  last_div = ourtime % 1000;
-	  if ((ourtime / 1000) > current_second) {
-	    if (frames_decoded_last_sec != 0) {
-#if 0
-	      media_message(LOG_DEBUG, "%s - Second "U64", frames %d bytes "U64,
-			    m_is_video ? "video" : "audio", 
-			    current_second,
-			    frames_decoded_last_sec,
-			    bytes_decoded_last_sec);
-#endif
-	    }
-	    current_second = ourtime / 1000;
-	    total_secs++;
-	    frames_decoded_last_sec = 1;
-	    bytes_decoded_last_sec = ret;
-	  } else {
-	    frames_decoded_last_sec++;
-	    bytes_decoded_last_sec += ret;
-	  }
-	} else {
-	  m_byte_stream->used_bytes_for_frame(frame_len);
-	}
-
-      }
-    }
-    // calculate frame rate for session
-  }
-  if (m_is_video)
-    media_message(LOG_NOTICE, "Video decoder skipped %u frames", 
-		  decode_skipped_frames);
-  if (total_secs != 0) {
-    double fps, bps;
-    double secs;
-    secs = last_div;
-    secs /= 1000.0;
-    secs += total_secs;
-
-    fps = frames_decoded;
-    fps /= secs;
-    bps = UINT64_TO_DOUBLE(bytes_decoded);
-    bps *= 8.0 / secs;
-    media_message(LOG_NOTICE, "%s - bytes "U64", seconds %g, fps %g bps "U64,
-		  m_is_video ? "video" : "audio", 
-		  bytes_decoded, secs, 
-		  fps, bytes_decoded * 8 / total_secs);
-  }
-  if (m_plugin) {
-    m_plugin->c_close(m_plugin_data);
-    m_plugin_data = NULL;
-  }
-  return (0);
-}
diff --git a/externals/pidip/modules/pdp_mp4playersession.cpp b/externals/pidip/modules/pdp_mp4playersession.cpp
deleted file mode 100644
index 3bd9486206cc96c9b0b7aaae4da6d805a555be73..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_mp4playersession.cpp
+++ /dev/null
@@ -1,1045 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *              Bill May        wmay@cisco.com
- *              video aspect ratio by:
- *              Peter Maersk-Moller peter @maersk-moller.net
- *
- * Adapted for PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-/* 
- * pdp_mp4playersession.cpp - describes player session class, which is the
- * main access point for the player
- */
-
-#include "mpeg4ip.h"
-#include "pdp_mp4playersession.h"
-#include "pdp_mp4playermedia.h"
-#include "pdp_mp4audiosync.h"
-#include "pdp_mp4videosync.h"
-#include "pdp_mp4player~.h"
-#include "player_sdp.h"
-#include "player_util.h"
-#include <stdlib.h>
-#include <SDL.h>
-#include <SDL_thread.h>
-#include "player_util.h"
-#include "m_pd.h"
-
-#define sync_message(loglevel, fmt...) message(loglevel, "avsync", fmt)
-
-enum {
-  SYNC_STATE_INIT = 0,
-  SYNC_STATE_WAIT_SYNC = 1,
-  SYNC_STATE_WAIT_AUDIO = 2,
-  SYNC_STATE_PLAYING = 3,
-  SYNC_STATE_PAUSED = 4,
-  SYNC_STATE_DONE = 5,
-  SYNC_STATE_EXIT = 6,
-};
-
-#ifdef DEBUG_SYNC_STATE
-const char *sync_state[] = {
-  "Init",
-  "Wait Sync",
-  "Wait Audio",
-  "Playing",
-  "Paused",
-  "Done",
-  "Exit"
-};
-#endif
-
-CPlayerSession::CPlayerSession (CMsgQueue *master_mq, 
-				SDL_sem *master_sem,
-				const char *name,
-                                t_pdp_mp4player *pdp_father)
-{
-  m_sdp_info = NULL;
-  m_my_media = NULL;
-  m_rtsp_client = NULL;
-  m_video_sync = NULL;
-  m_audio_sync = NULL;
-  m_sync_thread = NULL;
-  m_sync_sem = NULL;
-  m_content_base = NULL;
-  m_master_msg_queue = master_mq;
-  m_master_msg_queue_sem = master_sem;
-  m_paused = 0;
-  m_streaming = 0;
-  m_session_name = strdup(name);
-  m_audio_volume = 75;
-  m_current_time = 0;
-  m_seekable = 0;
-  m_session_state = SESSION_PAUSED;
-  m_clock_wrapped = -1;
-  m_hardware_error = 0;
-  m_pixel_height = -1;
-  m_pixel_width = -1;
-  m_session_control_is_aggregate = 0;
-  for (int ix = 0; ix < SESSION_DESC_COUNT; ix++) {
-    m_session_desc[ix] = NULL;
-  }
-  m_media_close_callback = NULL;
-  m_media_close_callback_data = NULL;
-  m_streaming_media_set_up = 0;
-  m_unused_ports = NULL;
-  m_first_time_played = 0;
-  m_latency = 0;
-  m_have_audio_rtcp_sync = false;
-  m_father = pdp_father;
-}
-
-CPlayerSession::~CPlayerSession ()
-{
-  int hadthread = 0;
-#ifndef NEED_SDL_VIDEO_IN_MAIN_THREAD
-  if (m_sync_thread) {
-    send_sync_thread_a_message(MSG_STOP_THREAD);
-    SDL_WaitThread(m_sync_thread, NULL);
-    m_sync_thread = NULL;
-    hadthread = 1;
-  }
-#else
-  send_sync_thread_a_message(MSG_STOP_THREAD);
-  hadthread = 1;
-#endif
-
-
-
-  if (m_streaming_media_set_up != 0 &&
-      session_control_is_aggregate()) {
-    rtsp_command_t cmd;
-    rtsp_decode_t *decode;
-    memset(&cmd, 0, sizeof(rtsp_command_t));
-    rtsp_send_aggregate_teardown(m_rtsp_client,
-				 m_sdp_info->control_string,
-				 &cmd,
-				 &decode);
-    free_decode_response(decode);
-  }
-
-
-  if (m_rtsp_client) {
-    free_rtsp_client(m_rtsp_client);
-    m_rtsp_client = NULL;
-  }
-
-  while (m_my_media != NULL) {
-    CPlayerMedia *p;
-    p = m_my_media;
-    m_my_media = p->get_next();
-    delete p;
-  }  
-
-  if (m_sdp_info) {
-    sdp_free_session_desc(m_sdp_info);
-    m_sdp_info = NULL;
-  }
-
-  if (m_sync_sem) {
-    SDL_DestroySemaphore(m_sync_sem);
-    m_sync_sem = NULL;
-  }
-  
-  if (m_video_sync != NULL) {
-    delete m_video_sync;
-    m_video_sync = NULL;
-  }
-
-  if (m_audio_sync != NULL) {
-    delete m_audio_sync;
-    m_audio_sync = NULL;
-  }
-  if (m_session_name) {
-    free((void *)m_session_name);
-    m_session_name = NULL;
-  }
-  if (m_content_base) {
-    free((void *) m_content_base);
-    m_content_base = NULL;
-  }
-  for (int ix = 0; ix < SESSION_DESC_COUNT; ix++) {
-    if (m_session_desc[ix] != NULL) 
-      free((void *)m_session_desc[ix]);
-    m_session_desc[ix] = NULL;
-  }
-  
-  if (m_media_close_callback != NULL) {
-    m_media_close_callback(m_media_close_callback_data);
-  }
-
-  while (m_unused_ports != NULL) {
-    CIpPort *first;
-    first = m_unused_ports;
-    m_unused_ports = first->get_next();
-    delete first;
-  }
-  if (hadthread != 0) {
-    SDL_Quit();
-  }
-}
-
-int CPlayerSession::create_streaming_broadcast (session_desc_t *sdp,
-						char *ermsg,
-						uint32_t errlen)
-{
-  session_set_seekable(0);
-  m_sdp_info = sdp;
-  m_streaming = 1;
-  m_rtp_over_rtsp = 0;
-  return (0);
-}
-
-/*
- * create_streaming - create a session for streaming.  Create an
- * RTSP session with the server, get the SDP information from it.
- */
-int CPlayerSession::create_streaming_ondemand (const char *url, 
-					       char *errmsg,
-					       uint32_t errlen, 
-					       int use_tcp)
-{
-  rtsp_command_t cmd;
-  rtsp_decode_t *decode;
-  sdp_decode_info_t *sdpdecode;
-  int dummy;
-  int err;
-
-  // streaming has seek capability (at least on demand)
-  session_set_seekable(1);
-  post("pdp_mp4playersession : creating streaming %s (use_tcp=%d)", url, use_tcp);
-  memset(&cmd, 0, sizeof(rtsp_command_t));
-
-  /*
-   * create RTSP session
-   */
-  if (use_tcp != 0) {
-    m_rtsp_client = rtsp_create_client_for_rtp_tcp(url, &err);
-  } else {
-    m_rtsp_client = rtsp_create_client(url, &err);
-  }
-  if (m_rtsp_client == NULL) {
-    snprintf(errmsg, errlen, "Failed to create RTSP client");
-    player_error_message("Failed to create rtsp client - error %d", err);
-    return (err);
-  }
-  m_rtp_over_rtsp = use_tcp;
-
-  cmd.accept = "application/sdp";
-
-  /*
-   * Send the RTSP describe.  This should return SDP information about
-   * the session.
-   */
-  int rtsp_resp;
-
-  rtsp_resp = rtsp_send_describe(m_rtsp_client, &cmd, &decode);
-  if (rtsp_resp != RTSP_RESPONSE_GOOD) {
-    int retval;
-    if (decode != NULL) {
-      retval = (((decode->retcode[0] - '0') * 100) +
-		((decode->retcode[1] - '0') * 10) +
-		(decode->retcode[2] - '0'));
-      snprintf(errmsg, errlen, "RTSP describe error %d %s", retval,
-	       decode->retresp != NULL ? decode->retresp : "");
-      free_decode_response(decode);
-    } else {
-      retval = -1;
-      snprintf(errmsg, errlen, "RTSP return invalid %d", rtsp_resp);
-    }
-    player_error_message("Describe response not good (error=%s)\n", errmsg);
-    return (retval);
-  }
-
-  sdpdecode = set_sdp_decode_from_memory(decode->body);
-  if (sdpdecode == NULL) {
-    snprintf(errmsg, errlen, "Memory failure");
-    player_error_message("Couldn't get sdp decode\n");
-    free_decode_response(decode);
-    return (-1);
-  }
-
-  /*
-   * Decode the SDP information into structures we can use.
-   */
-  err = sdp_decode(sdpdecode, &m_sdp_info, &dummy);
-  free(sdpdecode);
-  if (err != 0) {
-    snprintf(errmsg, errlen, "Couldn't decode session description %s",
-	     decode->body);
-    player_error_message("Couldn't decode sdp %s", decode->body);
-    free_decode_response(decode);
-    return (-1);
-  }
-  if (dummy != 1) {
-    snprintf(errmsg, errlen, "Incorrect number of sessions in sdp decode %d",
-	     dummy);
-    player_error_message(errmsg);
-    free_decode_response(decode);
-    return (-1);
-  }
-
-  if (m_sdp_info->control_string != NULL) {
-    set_session_control(1);
-  }
-  /*
-   * Make sure we can use the urls in the sdp info
-   */
-  if (decode->content_location != NULL) {
-    // Note - we may have problems if the content location is not absolute.
-    m_content_base = strdup(decode->content_location);
-  } else if (decode->content_base != NULL) {
-    m_content_base = strdup(decode->content_base);
-  } else {
-    int urllen = strlen(url);
-    if (url[urllen] != '/') {
-      char *temp;
-      temp = (char *)malloc(urllen + 2);
-      strcpy(temp, url);
-      strcat(temp, "/");
-      m_content_base = temp;
-    } else {
-      m_content_base = strdup(url);
-    }
-  }
-
-  convert_relative_urls_to_absolute(m_sdp_info,
-				    m_content_base);
-
-  free_decode_response(decode);
-  m_streaming = 1;
-  return (0);
-}
-
-CPDPVideoSync * CPlayerSession::set_up_video_sync (void)
-{
-  if (m_video_sync == NULL) {
-    m_video_sync = pdp_create_video_sync(this, m_father);
-  }
-  return m_video_sync;
-}
-
-CPDPAudioSync *CPlayerSession::set_up_audio_sync (void)
-{
-  if (m_audio_sync == NULL) {
-    m_audio_sync = pdp_create_audio_sync(this, m_father);
-  }
-  return m_audio_sync;
-}
-/*
- * set_up_sync_thread.  Creates the sync thread, and a sync class
- * for each media
- */
-void CPlayerSession::set_up_sync_thread(void) 
-{
-  CPlayerMedia *media;
-
-  media = m_my_media;
-  while (media != NULL) {
-    if (media->is_video()) {
-      media->set_video_sync(set_up_video_sync());
-    } else {
-      media->set_audio_sync(set_up_audio_sync());
-    }
-    media= media->get_next();
-  }
-  m_sync_sem = SDL_CreateSemaphore(0);
-}
-
-/*
- * play_all_media - get all media to play
- */
-int CPlayerSession::play_all_media (int start_from_begin, 
-				    double start_time,
-				    char *errmsg, 
-				    uint32_t errlen)
-{
-  int ret;
-  CPlayerMedia *p;
-  range_desc_t *range;
-
-  if (m_sdp_info && m_sdp_info->session_range.have_range != FALSE) {
-    range = &m_sdp_info->session_range;
-  } else {
-    range = NULL;
-    p = m_my_media;
-    while (range == NULL && p != NULL) {
-      media_desc_t *media;
-      media = p->get_sdp_media_desc();
-      if (media && media->media_range.have_range) {
-	range = &media->media_range;
-      }
-      p = p->get_next();
-    }
-  }
-  p = m_my_media;
-  m_session_state = SESSION_BUFFERING;
-  if (m_paused == 1 && start_time == 0.0 && start_from_begin == FALSE) {
-    /*
-     * we were paused.  Continue.
-     */
-    m_play_start_time = m_current_time;
-    start_time = UINT64_TO_DOUBLE(m_current_time);
-    start_time /= 1000.0;
-    player_debug_message("Restarting at " U64 ", %g", m_current_time, start_time);
-  } else {
-    /*
-     * We might have been paused, but we're told to seek
-     */
-    // Indicate what time we're starting at for sync task.
-    m_play_start_time = (uint64_t)(start_time * 1000.0);
-  }
-  m_paused = 0;
-
-  send_sync_thread_a_message(MSG_START_SESSION);
-  // If we're doing aggregate rtsp, send the play command...
-
-  if (session_control_is_aggregate()) {
-    char buffer[80];
-    rtsp_command_t cmd;
-    rtsp_decode_t *decode;
-
-    memset(&cmd, 0, sizeof(rtsp_command_t));
-    if (range != NULL) {
-      uint64_t stime = (uint64_t)(start_time * 1000.0);
-      uint64_t etime = (uint64_t)(range->range_end * 1000.0);
-      sprintf(buffer, "npt="U64"."U64"-"U64"."U64, 
-	      stime / 1000, stime % 1000, etime / 1000, etime % 1000);
-      cmd.range = buffer;
-    }
-    if (rtsp_send_aggregate_play(m_rtsp_client,
-				 m_sdp_info->control_string,
-				 &cmd,
-				 &decode) != 0) {
-      if (errmsg != NULL) {
-	snprintf(errmsg, errlen, "RTSP Aggregate Play Error %s-%s", 
-		 decode->retcode,
-		 decode->retresp != NULL ? decode->retresp : "");
-      }
-      player_debug_message("RTSP aggregate play command failed");
-      free_decode_response(decode);
-      return (-1);
-    }
-    if (decode->rtp_info == NULL) {
-      player_error_message("No rtp info field");
-    } else {
-      player_debug_message("rtp info is \'%s\'", decode->rtp_info);
-    }
-    int ret = pdp_process_rtsp_rtpinfo(decode->rtp_info, this, NULL);
-    free_decode_response(decode);
-    if (ret < 0) {
-      if (errmsg != NULL) {
-	snprintf(errmsg, errlen, "RTSP aggregate RtpInfo response failure");
-      }
-      player_debug_message("rtsp aggregate rtpinfo failed");
-      return (-1);
-    }
-  }
-
-  while (p != NULL) {
-    ret = p->do_play(start_time, errmsg, errlen);
-    if (ret != 0) return (ret);
-    p = p->get_next();
-  }
-  return (0);
-}
-
-/*
- * pause_all_media - do a spin loop until the sync thread indicates it's
- * paused.
- */
-int CPlayerSession::pause_all_media (void) 
-{
-  int ret;
-  CPlayerMedia *p;
-  m_session_state = SESSION_PAUSED;
-  if (session_control_is_aggregate()) {
-    rtsp_command_t cmd;
-    rtsp_decode_t *decode;
-
-    memset(&cmd, 0, sizeof(rtsp_command_t));
-    if (rtsp_send_aggregate_pause(m_rtsp_client,
-				  m_sdp_info->control_string,
-				  &cmd,
-				  &decode) != 0) {
-      player_debug_message("RTSP aggregate pause command failed");
-      free_decode_response(decode);
-      return (-1);
-    }
-    free_decode_response(decode);
-  }
-  p = m_my_media;
-  while (p != NULL) {
-    ret = p->do_pause();
-    if (ret != 0) return (ret);
-    p = p->get_next();
-  }
-  m_sync_pause_done = 0;
-  send_sync_thread_a_message(MSG_PAUSE_SESSION);
-#ifndef NEED_SDL_VIDEO_IN_MAIN_THREAD
-  do {
-#endif
-    SDL_Delay(100);
-#ifndef NEED_SDL_VIDEO_IN_MAIN_THREAD
-  } while (m_sync_pause_done == 0);
-#endif
-  m_paused = 1;
-  return (0);
-}
-void CPlayerSession::add_media (CPlayerMedia *m) 
-{
-  CPlayerMedia *p;
-  if (m_my_media == NULL) {
-    m_my_media = m;
-  } else {
-    p = m_my_media;
-    while (p->get_next() != NULL) {
-      if (p == m) return;
-      p = p->get_next();
-    }
-    p->set_next(m);
-  }
-}
-
-int CPlayerSession::session_has_audio (void)
-{
-  CPlayerMedia *p;
-  p = m_my_media;
-  while (p != NULL) {
-    if (p->is_video() == FALSE) {
-      return (1);
-    }
-    p = p->get_next();
-  }
-  return (0);
-}
-
-int CPlayerSession::session_has_video (void)
-{
-  CPlayerMedia *p;
-  p = m_my_media;
-  while (p != NULL) {
-    if (p->is_video() != FALSE) {
-      return (1);
-    }
-    p = p->get_next();
-  }
-  return (0);
-}
-
-void CPlayerSession::set_audio_volume (int volume)
-{
-  m_audio_volume = volume;
-  if (m_audio_sync) {
-    m_audio_sync->set_volume(m_audio_volume);
-  }
-}
-
-double CPlayerSession::get_max_time (void)
-{
-  CPlayerMedia *p;
-  double max = 0.0;
-  p = m_my_media;
-  while (p != NULL) {
-    double temp = p->get_max_playtime();
-    if (temp > max) max = temp;
-    p = p->get_next();
-  }
-  return (max);
-}
-
-/*
- * Matches a url with the corresponding media. 
- * Return the media, or NULL if no match. 
- */
-CPlayerMedia *CPlayerSession::rtsp_url_to_media (const char *url)
-{
-  CPlayerMedia *p = m_my_media;
-  while (p != NULL) {
-	rtsp_session_t *session = p->get_rtsp_session();
-	if (rtsp_is_url_my_stream(session, url, m_content_base, 
-							  m_session_name) == 1) 
-	  return p;
-    p = p->get_next();
-  }
-  return (NULL);
-}
-
-int CPlayerSession::set_session_desc (int line, const char *desc)
-{
-  if (line >= SESSION_DESC_COUNT) {
-    return -1;
-  }
-  if (m_session_desc[line] != NULL) free((void *)m_session_desc[line]);
-  m_session_desc[line] = strdup(desc);
-  if (m_session_desc[line] == NULL) 
-    return -1;
-  return (0);
-}
-
-const char *CPlayerSession::get_session_desc (int line)
-{
-  return m_session_desc[line];
-}
-/*
- * audio_is_ready - when the audio indicates that it's ready, it will
- * send a latency number, and a play time
- */
-void CPlayerSession::audio_is_ready (uint64_t latency, uint64_t time)
-{
-  m_start = get_time_of_day();
-  sync_message(LOG_DEBUG, "Aisready "U64, m_start);
-  m_start -= time;
-  m_latency = latency;
-  if (latency != 0) {
-    m_clock_wrapped = -1;
-  }
-  sync_message(LOG_DEBUG, "Audio is ready "U64" - latency "U64, time, latency);
-  sync_message(LOG_DEBUG, "m_start is "X64, m_start);
-  m_waiting_for_audio = 0;
-  SDL_SemPost(m_sync_sem);
-}
-
-void CPlayerSession::adjust_start_time (int64_t time)
-{
-  m_start -= time;
-  m_clock_wrapped = -1;
-#if 0
-  sync_message(LOG_INFO, "Adjusting start time "LLD " to " LLU, time,
-	       get_current_time());
-#endif
-  SDL_SemPost(m_sync_sem);
-}
-
-/*
- * get_current_time.  Gets the time of day, subtracts off the start time
- * to get the current play time.
- */
-uint64_t CPlayerSession::get_current_time (void)
-{
-  uint64_t current_time;
-
-  if (m_waiting_for_audio != 0) {
-    return 0;
-  }
-  current_time = get_time_of_day();
-#if 0
-  sync_message(LOG_DEBUG, "current time %llx m_start %llx", 
-	       current_time, m_start);
-  if (current_time < m_start) {
-    if (m_clock_wrapped == -1) {
-      return (0);
-    } else {
-      m_clock_wrapped = 1;
-    }
-  } else{
-    if (m_clock_wrapped > 0) {
-      uint64_t temp;
-      temp = 1;
-      temp <<= 32;
-      temp /= 1000;
-      current_time += temp;
-    } else {
-      m_clock_wrapped = 0;
-    }
-  }
-#endif
-  //if (current_time < m_start) return 0;
-  m_current_time = current_time - m_start;
-  if (m_current_time >= m_latency) m_current_time -= m_latency;
-  return(m_current_time);
-}
-
-void CPlayerSession::syncronize_rtp_bytestreams (rtcp_sync_t *sync)
-{
-  if (sync != NULL) {
-    m_audio_rtcp_sync = *sync;
-    m_have_audio_rtcp_sync = true;
-  } else {
-    if (!m_have_audio_rtcp_sync) 
-      return;
-  }
-  CPlayerMedia *mptr = m_my_media;
-  while (mptr != NULL) {
-    if (mptr->is_video()) {
-      mptr->syncronize_rtp_bytestreams(&m_audio_rtcp_sync);
-    }
-    mptr = mptr->get_next();
-  }
-}
-
-int CPlayerSession::process_msg_queue (int state) 
-{
-  CMsg *newmsg;
-  while ((newmsg = m_sync_thread_msg_queue.get_message()) != NULL) {
-#ifdef DEBUG_SYNC_MSGS
-    sync_message(LOG_DEBUG, "Sync thread msg %d", newmsg->get_value());
-#endif
-    switch (newmsg->get_value()) {
-    case MSG_PAUSE_SESSION:
-      state = SYNC_STATE_PAUSED;
-      break;
-    case MSG_START_SESSION:
-      state = SYNC_STATE_WAIT_SYNC;
-      break;
-    case MSG_STOP_THREAD:
-      state = SYNC_STATE_EXIT;
-      break;
-    default:
-      sync_message(LOG_ERR, "Sync thread received message %d", 
-		   newmsg->get_value());
-      break;
-    }
-    delete newmsg;
-    newmsg = NULL;
-  }
-  return (state);
-}
-
-/***************************************************************************
- * Sync thread state handlers
- ***************************************************************************/
-
-/*
- * sync_thread_init - wait until all the sync routines are initialized.
- */
-int CPlayerSession::sync_thread_init (void)
-{
-  int ret = 1;
-  for (CPlayerMedia *mptr = m_my_media;
-       mptr != NULL && ret == 1;
-       mptr = mptr->get_next()) {
-    if (mptr->is_video()) {
-      ret = m_video_sync->initialize_video(m_session_name);
-    } else {
-      ret = m_audio_sync->initialize_audio(m_video_sync != NULL);
-    }
-  }
-  if (ret == -1) {
-    sync_message(LOG_CRIT, "Fatal error while initializing hardware");
-    if (m_video_sync != NULL) {
-      m_video_sync->flush_sync_buffers();
-    }
-    if (m_audio_sync != NULL) {
-      m_audio_sync->flush_sync_buffers();
-    }
-    m_master_msg_queue->send_message(MSG_RECEIVED_QUIT, 
-				     NULL, 
-				     0, 
-				     m_master_msg_queue_sem);
-    m_hardware_error = 1;
-    return (SYNC_STATE_DONE);
-  }
-	
-  if (ret == 1) {
-    return (SYNC_STATE_WAIT_SYNC); 
-  } 
-  CMsg *newmsg;
-
-  newmsg = m_sync_thread_msg_queue.get_message();
-  if (newmsg != NULL) {
-    int value = newmsg->get_value();
-    delete newmsg;
-
-    if (value == MSG_STOP_THREAD) {
-      return (SYNC_STATE_EXIT);
-    }
-    if (value == MSG_PAUSE_SESSION) {
-      m_sync_pause_done = 1;
-    }
-  }
-
-  SDL_Delay(100);
-	
-  return (SYNC_STATE_INIT);
-}
-
-/*
- * sync_thread_wait_sync - wait until all decoding threads have put
- * data into the sync classes.
- */
-int CPlayerSession::sync_thread_wait_sync (void)
-{
-  int state;
-
-  state = process_msg_queue(SYNC_STATE_WAIT_SYNC);
-  if (state == SYNC_STATE_WAIT_SYNC) {
-      
-      // We're not synced.  See if the video is ready, and if the audio
-      // is ready.  Then start them going...
-      int vsynced = 1, asynced = 1;
-      uint64_t astart, vstart;
-
-      if (m_video_sync) {
-	vsynced = m_video_sync->is_video_ready(vstart);
-      } 
-
-      if (m_audio_sync) {
-	asynced = m_audio_sync->is_audio_ready(astart); 
-      }
-      if (vsynced == 1 && asynced == 1) {
-	/*
-	 * Audio and video are synced. 
-	 */
-	if (m_audio_sync) {
-	  /* 
-	   * If we have audio, we use that for syncing.  Start it up
-	   */
-	  m_first_time_played = astart;
-	  m_current_time = astart;
-	  sync_message(LOG_DEBUG, "Astart is %llu", astart);
-	  m_waiting_for_audio = 1;
-	  state = SYNC_STATE_WAIT_AUDIO;
-	  m_audio_sync->play_audio();
-	} else 	if (m_video_sync) {
-	  /*
-	   * Video only - set up the start time based on the video time
-	   * returned
-	   */
-	  m_first_time_played = vstart;
-	  m_current_time = vstart;
-	  m_waiting_for_audio = 0;
-	  m_start = get_time_of_day();
-	  m_start -= m_current_time;
-	  state = SYNC_STATE_PLAYING;
-	}
-	sync_message(LOG_DEBUG, 
-		     "Resynced at time "U64 " "U64, m_current_time, vstart);
-      } else {
-	SDL_Delay(10);
-      }
-    }
-  return (state);
-}
-
-/*
- * sync_thread_wait_audio - wait until the audio thread starts and signals
- * us.
- */
-int CPlayerSession::sync_thread_wait_audio (void)
-{
-  int state;
-
-  state = process_msg_queue(SYNC_STATE_WAIT_AUDIO);
-  if (state == SYNC_STATE_WAIT_AUDIO) {
-    if (m_waiting_for_audio != 0) {
-      SDL_SemWaitTimeout(m_sync_sem, 10);
-    } else {
-      // make sure we set the current time
-      get_current_time();
-      sync_message(LOG_DEBUG, "Current time is %llu", m_current_time);
-      return (SYNC_STATE_PLAYING);
-    }
-  }
-  return (state);
-}
-
-/*
- * sync_thread_playing - do the work of displaying the video and making
- * sure we're in sync.
- */
-int CPlayerSession::sync_thread_playing (void) 
-{
-  int state;
-  uint64_t audio_resync_time = 0;
-  int64_t video_status = 0;
-  int have_audio_eof = 0, have_video_eof = 0;
-
-  state = process_msg_queue(SYNC_STATE_PLAYING);
-  if (state == SYNC_STATE_PLAYING) {
-    get_current_time();
-    if (m_audio_sync) {
-      audio_resync_time = m_audio_sync->check_audio_sync(m_current_time, 
-							 have_audio_eof);
-    }
-    if (m_video_sync) {
-      video_status = m_video_sync->play_video_at(m_current_time, 
-						 have_video_eof);
-    }
-
-    int delay = 9;
-    int wait_for_signal = 0;
-
-    if (m_video_sync && m_audio_sync) {
-      if (have_video_eof && have_audio_eof) {
-	return (SYNC_STATE_DONE);
-      }
-      if (video_status > 0 || audio_resync_time != 0) {
-	if (audio_resync_time != 0) {
-	  int64_t diff = audio_resync_time - m_current_time;
-	  delay = (int)MIN(diff, video_status);
-	} else {
-	  if (video_status < 9) {
-	    delay = 0;
-	  }
-	}
-	if (delay < 9) {
-	  wait_for_signal = 0;
-	} else {
-	  wait_for_signal = 1;
-	}
-      } else {
-	wait_for_signal = 0;
-      }
-    } else if (m_video_sync) {
-      if (have_video_eof == 1) {
-	return (SYNC_STATE_DONE);
-      } 
-      if (video_status >= 9) {
-	wait_for_signal = 1;
-	delay = (int)video_status;
-      } else {
-	wait_for_signal = 0;
-      }
-    } else {
-      // audio only
-      if (have_audio_eof == 1) {
-	return (SYNC_STATE_DONE);
-      }
-      if (audio_resync_time != 0) {
-	if (audio_resync_time - m_current_time > 10) {
-	  wait_for_signal = 1;
-	  delay = (int)(audio_resync_time - m_current_time);
-	} else {
-	  wait_for_signal = 0;
-	}
-      } else {
-	wait_for_signal = 1;
-      }
-    }
-    //player_debug_message("w %d d %d", wait_for_signal, delay);
-    if (wait_for_signal) {
-      if (delay > 9) {
-	delay = 9;
-      }
-      //player_debug_message("sw %d", delay);
-
-      SDL_SemWaitTimeout(m_sync_sem, delay);
-    }
-  }
-  return (state);
-}
-
-/*
- * sync_thread_pause - wait for messages to continue or finish
- */
-int CPlayerSession::sync_thread_paused (void)
-{
-  int state;
-  state = process_msg_queue(SYNC_STATE_PAUSED);
-  if (state == SYNC_STATE_PAUSED) {
-    SDL_SemWaitTimeout(m_sync_sem, 10);
-  }
-  return (state);
-}
-
-/*
- * sync_thread_pause - wait for messages to exit, pretty much.
- */
-int CPlayerSession::sync_thread_done (void)
-{
-  int state;
-  state = process_msg_queue(SYNC_STATE_DONE);
-  if (state == SYNC_STATE_DONE) {
-    SDL_SemWaitTimeout(m_sync_sem, 10);
-  } 
-  return (state);
-}
-
-/*
- * sync_thread - call the correct handler, and wait for the state changes.
- * Each handler should only return the new state...
- */  
-int CPlayerSession::sync_thread (int state)
-{
-  int newstate = 0;
-  switch (state) {
-  case SYNC_STATE_INIT:
-    m_session_state = SESSION_BUFFERING;
-    newstate = sync_thread_init();
-    break;
-  case SYNC_STATE_WAIT_SYNC:
-    newstate = sync_thread_wait_sync();
-    break;
-  case SYNC_STATE_WAIT_AUDIO:
-    newstate = sync_thread_wait_audio();
-    break;
-  case SYNC_STATE_PLAYING:
-    newstate = sync_thread_playing();
-    break;
-  case SYNC_STATE_PAUSED:
-    newstate = sync_thread_paused();
-    break;
-  case SYNC_STATE_DONE:
-    newstate = sync_thread_done();
-    break;
-  }
-#ifdef DEBUG_SYNC_STATE
-  if (state != newstate)
-    sync_message(LOG_INFO, "sync changed state %s to %s", 
-		 sync_state[state], sync_state[newstate]);
-#endif
-  if (state != newstate) {
-    state = newstate;
-    switch (state) {
-    case SYNC_STATE_WAIT_SYNC:
-      m_session_state = SESSION_BUFFERING;
-      break;
-    case SYNC_STATE_WAIT_AUDIO:
-      break;
-    case SYNC_STATE_PLAYING:
-      m_session_state = SESSION_PLAYING;
-      break;
-    case SYNC_STATE_PAUSED:
-      if (m_video_sync != NULL) 
-	m_video_sync->flush_sync_buffers();
-      if (m_audio_sync != NULL) 
-	m_audio_sync->flush_sync_buffers();
-      m_session_state = SESSION_PAUSED;
-      m_sync_pause_done = 1;
-      break;
-    case SYNC_STATE_DONE:
-      m_master_msg_queue->send_message(MSG_SESSION_FINISHED, 
-				       NULL, 
-				       0, 
-				       m_master_msg_queue_sem);
-      m_session_state = SESSION_DONE;
-      break;
-    case SYNC_STATE_EXIT:
-      if (m_video_sync != NULL) 
-	m_video_sync->flush_sync_buffers();
-      if (m_audio_sync != NULL) 
-	m_audio_sync->flush_sync_buffers();
-      break;
-    }
-  }
-  return (state);
-}
-
-int pdp_sync_thread (void *data)
-{
-  CPlayerSession *p;
-  int state = SYNC_STATE_INIT;
-  p = (CPlayerSession *)data;
-  do {
-   state = p->sync_thread(state);
-  } while (state != SYNC_STATE_EXIT);
-  return (0);
-}
diff --git a/externals/pidip/modules/pdp_mp4player~.cpp b/externals/pidip/modules/pdp_mp4player~.cpp
deleted file mode 100644
index afb763489cb25bf03d7c644618dd4b3377905ff7..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_mp4player~.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- *   PiDiP module.
- *   Copyright (c) by Yves Degoyon (ydegoyon@free.fr)
- *
- *   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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*  This object is a quicktime stream picker object
- *  A lot of this object code is inspired by the code from mpeg4ip
- *  Copyright (c) 2000, 2001, 2002 Dave Mackie, Bill May & others
- *  The rest is written by Yves Degoyon ( ydegoyon@free.fr )
- */
-
-
-#include "pdp_mp4player~.h"
-
-static char   *pdp_mp4player_version = "pdp_mp4player~: version 0.1, a mpeg4ip stream decoder ( ydegoyon@free.fr).";
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-static void pdp_mp4player_audio(t_pdp_mp4player *x, t_floatarg faudio )
-{
-   if ( ( faudio == 0. ) || ( faudio == 1. ) )
-   {
-      x->x_audio = (int)faudio;
-   }
-}
-
-static void pdp_mp4player_overtcp(t_pdp_mp4player *x, t_floatarg fovertcp )
-{
-   if ( ( fovertcp == 0. ) || ( fovertcp == 1. ) )
-   {
-     x->x_rtpovertcp = (t_int)fovertcp;
-     config.set_config_value(CONFIG_USE_RTP_OVER_RTSP, x->x_rtpovertcp);
-     if ( x->x_rtpovertcp )
-     {
-        post("pdp_mp4player~ : using rtp over rtsp (tcp)" );
-     }
-     else
-     {
-        post("pdp_mp4player~ : using rtp mode (udp)" );
-     }
-   }
-} 
-
-static void pdp_mp4player_priority(t_pdp_mp4player *x, t_floatarg fpriority )
-{
-   if ( ( x->x_priority >= MIN_PRIORITY ) && ( x->x_priority <= MAX_PRIORITY ) )
-   {
-     x->x_priority = (int)fpriority;
-   }
-}
-
-static void pdp_mp4player_vwidth(t_pdp_mp4player *x, t_floatarg fWidth )
-{
-   if ( ( (t_int) fWidth <= 0 ) )
-   {
-     post("pdp_mp4player~ : wrong width : %d", fWidth );
-     return;
-   }
-
-   post( "pdp_mp4player~ : setting width : %d", (t_int) fWidth );
-   config.set_config_value( CONFIG_VIDEO_RAW_WIDTH, (t_int) fWidth );
-
-}
-
-static void pdp_mp4player_vheight(t_pdp_mp4player *x, t_floatarg fHeight )
-{
-   if ( ( (t_int) fHeight <= 0 ) )
-   {
-     post("pdp_mp4player~ : wrong height : %d", fHeight );
-     return;
-   }
-
-   post( "pdp_mp4player~ : setting height : %d", (t_int) fHeight );
-   config.set_config_value( CONFIG_VIDEO_RAW_HEIGHT, (t_int) fHeight );
-
-}
-
-static void pdp_mp4player_disconnect(t_pdp_mp4player *x)
-{
-   if (!x->x_streaming)
-   {
-     post("pdp_mp4player~ : close request but no stream is played ... ignored" );
-     return;
-   }
-
-   x->x_streaming = 0;
-   x->x_newpicture = 0;
-
-   outlet_float( x->x_outlet_streaming, x->x_streaming );
-   x->x_nbframes = 0;
-   outlet_float( x->x_outlet_nbframes, x->x_nbframes );
-   x->x_framerate = 0;
-   outlet_float( x->x_outlet_framerate, x->x_framerate );
-
-   post( "pdp_mp4player~ : deleting session" );
-   delete x->x_psession;
-   post( "pdp_mp4player~ : deleting semaphore" );
-   SDL_DestroySemaphore(x->x_psem);
-}
-
-static void *pdp_mp4player_decode(void *tdata)
-{
-  t_pdp_mp4player *x = (t_pdp_mp4player*)tdata;
-  struct sched_param schedprio;
-  t_int pmin, pmax;
-  struct timespec twait, mwait;
-
-    twait.tv_sec = 0;
-    twait.tv_nsec = 10000000; // 10 ms
-
-    schedprio.sched_priority = 0;
-#ifdef __gnu_linux__
-    if ( sched_setscheduler(0, SCHED_OTHER, &schedprio) == -1)
-    {
-       post("pdp_mp4player~ : couldn't set scheduler for decoding thread.\n");
-    }
-#endif
-    if ( setpriority( PRIO_PROCESS, 0, x->x_priority ) < 0 )
-    {
-       post("pdp_mp4player~ : couldn't set priority to %d for decoding thread.\n", x->x_priority );
-    }
-    else
-    {
-       post("pdp_mp4player~ : priority set to %d for thread %d.\n", x->x_priority, x->x_decodechild );
-    }
-
-    while ( x->x_streaming )
-    {
-      x->x_decodingstate = x->x_psession->sync_thread(x->x_decodingstate);
-      nanosleep( &twait, NULL ); // nothing to read, just wait
-    }
-
-    post( "pdp_mp4player~ : decoding thread %d exiting....", x->x_decodechild );
-    x->x_decodechild = 0;
-    pthread_exit(NULL);
-}
-
-
-static void pdp_mp4player_connect(t_pdp_mp4player *x, t_symbol *s)
-{
-  t_int ret, i;
-  char buffer[1024];
-  char errmsg[512]; 
-  pthread_attr_t decode_child_attr;
-
-   if ( x->x_streaming ) 
-   {
-     post("pdp_mp4player~ : connection request but a connection is pending ... disconnecting" );
-     pdp_mp4player_disconnect(x);
-   }
-
-   if ( x->x_url ) free( x->x_url );
-   x->x_url = (char*) malloc( strlen( s->s_name ) + 1 );
-   strcpy( x->x_url, s->s_name );
-
-   x->x_psem = SDL_CreateSemaphore(0);
-   snprintf(buffer, sizeof(buffer), "pdp_mp4player~ - %s", x->x_url);
-   x->x_psession = new CPlayerSession(&x->x_queue, x->x_psem, buffer, x);
-   if (x->x_psession == NULL) 
-   {
-     post("pdp_mp4player~ : FATAL : could not create session" );
-     return;
-   }
-   
-   ret = parse_name_for_session(x->x_psession, x->x_url, errmsg, sizeof(errmsg), NULL);
-   if (ret < 0) 
-   {
-     post("pdp_mp4player~ : FATAL : wrong url : %s : reason : %s", x->x_url, errmsg );
-     delete x->x_psession;
-     return;
-   }
-
-   if (ret > 0) 
-   {
-     post("pdp_mp4player~ : %s", errmsg );
-   }
-
-   x->x_psession->set_up_sync_thread();
-
-   if (x->x_psession->play_all_media(TRUE) != 0) {
-      post("pdp_mp4player~ : FATAL : couldn't play all medias" );
-      delete x->x_psession;
-      return;
-   } 
-   
-   // launch decoding thread
-   if ( pthread_attr_init( &decode_child_attr ) < 0 )
-   {
-      post( "pdp_mp4player~ : could not launch decoding thread" );
-      perror( "pthread_attr_init" );
-      return;
-   }
-   if ( pthread_create( &x->x_decodechild, &decode_child_attr, pdp_mp4player_decode, x ) < 0 )
-   {
-      post( "pdp_mp4player~ : could not launch decoding thread" );
-      perror( "pthread_create" );
-      return;
-   }
-
-   post("pdp_mp4player~ : session started" );
-   x->x_streaming = 1;
-
-   return;
-}
-
-    /* decode the stream to fill up buffers */
-static t_int *pdp_mp4player_perform(t_int *w)
-{
-  t_float *out1   = (t_float *)(w[1]);       // left audio inlet
-  t_float *out2   = (t_float *)(w[2]);       // right audio inlet 
-  t_pdp_mp4player *x = (t_pdp_mp4player *)(w[3]);
-  int n = (int)(w[4]);                      // number of samples 
-  short sampleL, sampleR;
-  struct timeval etime;
-  t_int sn;
-
-    x->x_blocksize = n;
-
-    // just read the buffer
-    if ( x->x_audioon )
-    {
-      sn=0;
-      while (n--) 
-      {
-        sampleL=x->x_audio_in[ sn++ ];
-        *(out1) = ((t_float)sampleL)/32768.0;
-        if ( DEFAULT_CHANNELS == 1 )
-        {
-          *(out2) = *(out1);
-        }
-        if ( DEFAULT_CHANNELS == 2 )
-        {
-          sampleR=x->x_audio_in[ sn++ ];
-          *(out2) = ((t_float)sampleR)/32768.0;
-        }
-        out1++;
-        out2++;
-      }
-      x->x_audioin_position-=sn;
-      memcpy( &x->x_audio_in[0], &x->x_audio_in[sn], (4*MAX_AUDIO_PACKET_SIZE-sn-1)*sizeof(short) );
-      // post( "pdp_mp4player~ : audio in position : %d", x->x_audioin_position );
-      if ( x->x_audioin_position <= sn )
-      {
-         x->x_audioon = 0;
-         // post( "pdp_mp4player~ : audio off" );
-      }
-    }
-    else
-    {
-      // post("pdp_mp4player~ : no available audio" );
-      while (n--)
-      {
-        *(out1++) = 0.0;
-        *(out2++) = 0.0;
-      }
-    }	
-
-    // check if the framerate has been exceeded
-    if ( gettimeofday(&etime, NULL) == -1)
-    {
-       post("pdp_mp4player~ : could not read time" );
-    }
-    if ( etime.tv_sec != x->x_cursec )
-    {
-       x->x_cursec = etime.tv_sec;
-       outlet_float( x->x_outlet_framerate, x->x_secondcount );
-       x->x_secondcount = 0;
-    }
-
-    if ( x->x_newpicture )
-    {
-      x->x_packet = pdp_packet_new_image_YCrCb( x->x_vwidth, x->x_vheight );
-      x->x_data = (short int *)pdp_packet_data(x->x_packet);
-      memcpy( x->x_data, x->x_datav, (x->x_vsize + (x->x_vsize>>1))<<1 );
-      pdp_packet_pass_if_valid(x->x_pdp_out, &x->x_packet);
-
-      // update streaming status
-      outlet_float( x->x_outlet_streaming, x->x_streaming );
-      x->x_nbframes++;
-      x->x_secondcount++;
-      outlet_float( x->x_outlet_nbframes, x->x_nbframes );
-      x->x_newpicture = 0;
-    }
-
-    return (w+5);
-}
-
-static void pdp_mp4player_dsp(t_pdp_mp4player *x, t_signal **sp)
-{
-    dsp_add(pdp_mp4player_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);
-}
-
-static void pdp_mp4player_free(t_pdp_mp4player *x)
-{
-  int i;
-
-    if ( x->x_streaming )
-    {
-       pdp_mp4player_disconnect(x);
-    }
-    post( "pdp_mp4player~ : freeing object" );
-    pdp_packet_mark_unused(x->x_packet);
-
-    // remove invalid global ports
-    close_plugins();
-}
-
-t_class *pdp_mp4player_class;
-
-void *pdp_mp4player_new(void)
-{
-    int i;
-
-    t_pdp_mp4player *x = (t_pdp_mp4player *)pd_new(pdp_mp4player_class);
-
-    x->x_pdp_out = outlet_new(&x->x_obj, &s_anything);
-
-    x->x_outlet_left = outlet_new(&x->x_obj, &s_signal);
-    x->x_outlet_right = outlet_new(&x->x_obj, &s_signal);
-
-    x->x_outlet_streaming = outlet_new(&x->x_obj, &s_float);
-    x->x_outlet_nbframes = outlet_new(&x->x_obj, &s_float);
-    x->x_outlet_framerate = outlet_new(&x->x_obj, &s_float);
-
-    x->x_packet = -1;
-    x->x_nbframes = 0;
-    x->x_cursec = 0;
-    x->x_secondcount = 0;
-    x->x_audioin_position = 0;
-    x->x_blocksize = MIN_AUDIO_SIZE;
-    x->x_priority = DEFAULT_PRIORITY;
-    x->x_decodechild = 0;
-    x->x_newpicture = 0;
-
-    x->x_vwidth = -1;
-    x->x_vheight = -1;
-    x->x_datav = NULL;
-
-    memset( &x->x_audio_in[0], 0x0, 4*MAX_AUDIO_PACKET_SIZE*sizeof(short) );
-
-    // initialize mpeg4hippies
-    initialize_plugins();
-    config.read_config_file();
-    rtsp_set_error_func(player_library_message);
-    rtsp_set_loglevel(config.get_config_value(CONFIG_RTSP_DEBUG));
-    rtp_set_error_msg_func(player_library_message);
-    rtp_set_loglevel(config.get_config_value(CONFIG_RTP_DEBUG));
-    sdp_set_error_func(player_library_message);
-    sdp_set_loglevel(config.get_config_value(CONFIG_SDP_DEBUG));
-    http_set_error_func(player_library_message);
-    http_set_loglevel(config.get_config_value(CONFIG_HTTP_DEBUG));
-
-    x->x_rtpovertcp = 0;
-    config.set_config_value(CONFIG_USE_RTP_OVER_RTSP, x->x_rtpovertcp);
-
-    return (void *)x;
-}
-
-
-void pdp_mp4player_tilde_setup(void)
-{
-    // post( pdp_mp4player_version );
-    pdp_mp4player_class = class_new(gensym("pdp_mp4player~"), (t_newmethod)pdp_mp4player_new,
-    	(t_method)pdp_mp4player_free, sizeof(t_pdp_mp4player), 0, A_NULL);
-
-    class_addmethod(pdp_mp4player_class, (t_method)pdp_mp4player_dsp, gensym("dsp"), A_NULL);
-    class_addmethod(pdp_mp4player_class, (t_method)pdp_mp4player_connect, gensym("connect"), A_SYMBOL, A_NULL);
-    class_addmethod(pdp_mp4player_class, (t_method)pdp_mp4player_disconnect, gensym("disconnect"), A_NULL);
-    class_addmethod(pdp_mp4player_class, (t_method)pdp_mp4player_audio, gensym("audio"), A_FLOAT, A_NULL);
-    class_addmethod(pdp_mp4player_class, (t_method)pdp_mp4player_overtcp, gensym("overtcp"), A_FLOAT, A_NULL);
-    class_addmethod(pdp_mp4player_class, (t_method)pdp_mp4player_priority, gensym("priority"), A_FLOAT, A_NULL);
-    class_addmethod(pdp_mp4player_class, (t_method)pdp_mp4player_vwidth, gensym("vwidth"), A_DEFFLOAT, A_NULL);
-    class_addmethod(pdp_mp4player_class, (t_method)pdp_mp4player_vheight, gensym("vheight"), A_DEFFLOAT, A_NULL);
-    class_sethelpsymbol( pdp_mp4player_class, gensym("pdp_mp4player~.pd") );
-
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/externals/pidip/modules/pdp_mp4videosource.cpp b/externals/pidip/modules/pdp_mp4videosource.cpp
deleted file mode 100644
index 5e5ef911774796facc491b4c56ff2e205da16350..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_mp4videosource.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *        Dave Mackie        dmackie@cisco.com
- *        Bill May         wmay@cisco.com
- *
- * Adapted for PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-#ifndef debug_message
-#define debug_message post 
-#endif
-
-#include <sys/mman.h>
-
-#include "m_pd.h"
-#include "pdp_mp4videosource.h"
-#include "video_util_rgb.h"
-
-//#define DEBUG_TIMESTAMPS 1
-
-int CPDPVideoSource::ThreadMain(void)
-{
-   // just a stub, the threaded mode is not used ( never called )
-   return 0;
-}
-
-void CPDPVideoSource::DoStart(void)
-{
-  if (m_source) return;
-  if (!Init()) return;
-  m_source = true;
-}
-
-void CPDPVideoSource::DoStop(void)
-{
-  if (!m_source) return;
-  DoStopVideo();
-  m_source = false;
-}
-
-bool CPDPVideoSource::Init(void)
-{
-
-    if (m_pConfig->GetIntegerValue(CONFIG_VIDEO_SIGNAL) == VIDEO_SIGNAL_NTSC) 
-    {
-      m_videoSrcFrameRate = VIDEO_NTSC_FRAME_RATE;
-    } 
-    else 
-    {
-      m_videoSrcFrameRate = VIDEO_PAL_FRAME_RATE;
-    }
-
-    m_videoMbuf.frames = 2;
-    m_cacheTimestamp = false;
-    m_videoFrameMap = (struct video_mmap*) malloc(m_videoMbuf.frames * sizeof(struct video_mmap));
-    if ( !m_videoFrameMap ) 
-    {
-      post("pdp_mp4live~ : video source init : failed to allocate enough memory");
-      return false;
-    }
-
-    m_videoFrameMapFrame = (uint64_t *)malloc(m_videoMbuf.frames * sizeof(uint64_t));
-    m_videoFrameMapTimestamp = (uint64_t *)malloc(m_videoMbuf.frames * sizeof(Timestamp));
-    m_captureHead = 0;
-    m_encodeHead = -1;
-
-    m_videoFrames = 0;
-    m_videoSrcFrameDuration = (Duration)(((float)TimestampTicks / m_videoSrcFrameRate) + 0.5);
-    for (int i = 0; i < m_videoMbuf.frames; i++) 
-    {
-       // initialize frame map
-       m_videoFrameMap[i].frame = i;
-       m_videoFrameMap[i].width = m_pConfig->GetIntegerValue(CONFIG_VIDEO_RAW_WIDTH);
-       m_videoFrameMap[i].height = m_pConfig->GetIntegerValue(CONFIG_VIDEO_RAW_HEIGHT);
-       m_videoFrameMap[i].format = VIDEO_PALETTE_YUV420P;
-
-       if (i == 0) 
-       {
-         m_videoCaptureStartTimestamp = GetTimestamp();
-       }
-       m_lastVideoFrameMapFrameLoaded = m_videoFrameMapFrame[i] = i;
-       m_lastVideoFrameMapTimestampLoaded =
-       m_videoFrameMapTimestamp[i] = CalculateVideoTimestampFromFrames(i);
-    }
-
-    m_pConfig->CalculateVideoFrameSize();
-
-    InitVideo(
-        (m_pConfig->m_videoNeedRgbToYuv ?
-            RGBVIDEOFRAME :
-            YUVVIDEOFRAME),
-        true);
-
-    SetVideoSrcSize(
-        m_pConfig->GetIntegerValue(CONFIG_VIDEO_RAW_WIDTH),
-        m_pConfig->GetIntegerValue(CONFIG_VIDEO_RAW_HEIGHT),
-        m_pConfig->GetIntegerValue(CONFIG_VIDEO_RAW_WIDTH),
-        true);
-
-    m_maxPasses = (u_int8_t)(m_videoSrcFrameRate + 0.5);
-
-    return true;
-}
-
-int8_t CPDPVideoSource::StartTimeStamp(Timestamp &frameTimestamp)
-{
-    if (m_cacheTimestamp)
-      frameTimestamp = m_videoFrameMapTimestamp[m_captureHead];
-    else
-      frameTimestamp = GetTimestamp();
-
-    int8_t capturedFrame = m_captureHead;
-    m_captureHead = (m_captureHead + 1) % m_videoMbuf.frames;
-
-    return capturedFrame;
-}
-
-bool CPDPVideoSource::EndTimeStamp(int8_t frameNumber)
-{
-  Timestamp calc = GetTimestamp();
-
-  if (calc > m_videoSrcFrameDuration + m_lastVideoFrameMapTimestampLoaded) {
-#ifdef DEBUG_TIMESTAMPS
-    debug_message("pdp_mp4live~ : video frame delay past end of buffer - time is %llu should be %llu",
-          calc,
-          m_videoSrcFrameDuration + m_lastVideoFrameMapTimestampLoaded);
-#endif
-    m_videoCaptureStartTimestamp = calc;
-    m_videoFrameMapFrame[frameNumber] = 0;
-    m_videoFrameMapTimestamp[frameNumber] = calc;
-  } else {
-    m_videoFrameMapFrame[frameNumber] = m_lastVideoFrameMapFrameLoaded + 1;
-    m_videoFrameMapTimestamp[frameNumber] =
-      CalculateVideoTimestampFromFrames(m_videoFrameMapFrame[frameNumber]);
-  }
-
-  m_lastVideoFrameMapFrameLoaded = m_videoFrameMapFrame[frameNumber];
-  m_lastVideoFrameMapTimestampLoaded = m_videoFrameMapTimestamp[frameNumber];
-  return true;
-}
-
-void CPDPVideoSource::ProcessVideo(u_int8_t *pY, u_int8_t *pU, u_int8_t *pV)
-{
-    // for efficiency, process ~1 second before returning to check for commands
-  Timestamp frameTimestamp;
-    for (int pass = 0; pass < m_maxPasses; pass++) {
-
-        // get next frame from video capture device
-        m_encodeHead = StartTimeStamp(frameTimestamp);
-        if (m_encodeHead == -1) {
-            continue;
-        }
-
-        ProcessVideoYUVFrame(
-            pY, 
-            pU, 
-            pV,
-            m_videoSrcWidth,
-            m_videoSrcWidth >> 1,
-            frameTimestamp);
-
-        // release video frame buffer back to video capture device
-        if (EndTimeStamp(m_encodeHead)) {
-            m_encodeHead = (m_encodeHead + 1) % m_videoMbuf.frames;
-        } else {
-            debug_message("pdp_mp4live~ : couldn't release capture buffer!");
-        }
-    }
-}
diff --git a/externals/pidip/modules/pdp_mp4videosync.cpp b/externals/pidip/modules/pdp_mp4videosync.cpp
deleted file mode 100644
index 76a874b78ab0d26ed0f6c69ed7cd48cafa803591..0000000000000000000000000000000000000000
--- a/externals/pidip/modules/pdp_mp4videosync.cpp
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- * 
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- * 
- * The Original Code is MPEG4IP.
- * 
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001.  All Rights Reserved.
- * 
- * Contributor(s): 
- *              Bill May        wmay@cisco.com
- *              video aspect ratio by:
- *              Peter Maersk-Moller peter@maersk-moller.net
- *
- * Adapted to PD/PDP by Yves Degoyon (ydegoyon@free.fr)
- */
-
-/*
- * video.cpp - provides codec to video hardware class
- */
-
-#include <string.h>
-#include "pdp_mp4videosync.h"
-#include "pdp_mp4playersession.h"
-#include "player_util.h"
-#include "m_pd.h"
-
-#define video_message(loglevel, fmt...) message(loglevel, "videosync", fmt)
-
-CPDPVideoSync::CPDPVideoSync (CPlayerSession *psptr, t_pdp_mp4player *pdp_father) : CVideoSync(psptr)
-{
-  char buf[32];
-
-  m_screen = NULL;
-  m_image = NULL;
-  m_video_initialized = 0;
-  m_config_set = 0;
-  m_have_data = 0;
-  m_y_buffer[0] = NULL;
-  m_u_buffer[0] = NULL;
-  m_v_buffer[0] = NULL;
-  m_buffer_filled[0] = 0;
-  m_play_index = m_fill_index = 0;
-  m_decode_waiting = 0;
-  m_dont_fill = 0;
-  m_paused = 1;
-  m_behind_frames = 0;
-  m_total_frames = 0;
-  m_behind_time = 0;
-  m_behind_time_max = 0;
-  m_skipped_render = 0;
-  m_video_scale = 2;
-  m_msec_per_frame = 0;
-  m_consec_skipped = 0;
-  m_fullscreen = 0;
-  m_filled_frames = 0;
-  m_double_width = 0;
-  m_pixel_width = 0;
-  m_pixel_height = 0;
-  m_max_width = 0;
-  m_max_height = 0;
-  m_father = pdp_father;
-}
-
-CPDPVideoSync::~CPDPVideoSync (void)
-{
-  if (m_fullscreen != 0) {
-    m_fullscreen = 0;
-    do_video_resize();
-  }
-  if (m_image) {
-    m_image = NULL;
-  }
-  if (m_screen) {
-    m_screen = NULL;
-  }
-  if (m_y_buffer[0] != NULL) {
-    free(m_y_buffer[0]);
-    m_y_buffer[0] = NULL;
-  }
-  if (m_u_buffer[0] != NULL) {
-    free(m_u_buffer[0]);
-    m_u_buffer[0] = NULL;
-  }
-  if (m_v_buffer[0] != NULL) {
-    free(m_v_buffer[0]);
-    m_v_buffer[0] = NULL;
-  }
-}
-
-void CPDPVideoSync::config (int w, int h)
-{
-  m_width = w;
-  m_height = h;
-  m_y_buffer[0] = (uint8_t *)malloc(w * h * sizeof(uint8_t));
-  m_u_buffer[0] = (uint8_t *)malloc(w/2 * h/2 * sizeof(uint8_t));
-  m_v_buffer[0] = (uint8_t *)malloc(w/2 * h/2 * sizeof(uint8_t));
-  m_buffer_filled[0] = 0;
-  m_config_set = 1;
-  post( "pdp_mp4videosync : configuration done : %dx%d", m_width, m_height );
-}
-
-int CPDPVideoSync::initialize_video (const char *name)
-{
-  if (m_video_initialized == 0) {
-    if (m_config_set) {
-      int ret;
-      int video_scale = m_video_scale;
-
-      int w = m_width * video_scale / 2;
-      if (m_double_width) w *= 2;
-      int h = m_height * video_scale / 2;
-      m_video_initialized = 1;
-      post( "pdp_mp4videosync : video initialized : %dx%d", m_width, m_height );
-      return (1);
-    } else {
-     return (0);
-    }
-  }
-  return (1);
-}
-
-int CPDPVideoSync::is_video_ready (uint64_t &disptime)
-{
-  return 1;
-}
-
-void CPDPVideoSync::play_video (void) 
-{
-
-}
-
-int64_t CPDPVideoSync::play_video_at (uint64_t current_time, int &have_eof)
-{
-  uint64_t play_this_at;
-  unsigned int ix;
-  uint8_t *to, *from;
-
-  post( "pdp_mp4videosync : play video at  : %ld", current_time );
-  
-  return (10);
-}
-
-int CPDPVideoSync::get_video_buffer(uint8_t **y,
-				 uint8_t **u,
-				 uint8_t **v)
-{
-  
-  post( "pdp_mp4videosync : get video buffer" );
-  *y = m_y_buffer[m_fill_index];
-  *u = m_u_buffer[m_fill_index];
-  *v = m_v_buffer[m_fill_index];
-  return (1);
-}
-
-void CPDPVideoSync::filled_video_buffers (uint64_t time)
-{
-  int ix;
-  // post( "pdp_mp4videosync : filled video buffer : %ld", time );
-  m_psptr->wake_sync_thread();
-}
-
-void CPDPVideoSync::set_video_frame(const uint8_t *y, 
-				    const uint8_t *u, 
-				    const uint8_t *v,
-				    int pixelw_y, 
-				    int pixelw_uv, 
-				    uint64_t time)
-{
- short int *pY, *pU, *pV;
- t_int px, py;
-
-  m_psptr->wake_sync_thread();
-
-  if ( !m_father->x_streaming )
-  {
-    return;
-  }
-
-  // transforming into a image for pdp 
-  if ( ( (t_int)m_father->x_vheight != (t_int)m_height ) ||
-       ( (t_int)m_father->x_vwidth != (t_int)m_width ) )
-  {
-    m_father->x_vheight = m_height;
-    m_father->x_vwidth = m_width;
-    m_father->x_vsize = m_father->x_vheight*m_father->x_vwidth;
-    post( "pdp_mp4videosync : allocating video data : %dx%d", m_width, m_height ); 
-
-    // allocate video data
-    m_father->x_datav = ( short int* ) malloc( (m_father->x_vsize+(m_father->x_vsize>>1))<<1 );
-  }
-
-  // post( "pdp_mp4videosync : set video frame : width : y:%d, uv:%d", pixelw_y, pixelw_uv );
-
-  pY = m_father->x_datav;
-  pV = m_father->x_datav+m_father->x_vsize;
-  pU = m_father->x_datav+m_father->x_vsize+(m_father->x_vsize>>2);
-  for(py=0; py<m_father->x_vheight; py++) 
-  {
-    for(px=0; px<m_father->x_vwidth; px++)
-    {
-       *(pY+py*m_father->x_vwidth+px) = *(y+py*pixelw_y+px)<<7;
-       if ( ( px%2 == 0 ) && ( py%2 == 0 ) )
-       {
-         *(pU+(py>>1)*(m_father->x_vwidth>>1)+(px>>1)) = ((*(u+(py>>1)*pixelw_uv+(px>>1)))-128)<<8;
-         *(pV+(py>>1)*(m_father->x_vwidth>>1)+(px>>1)) = ((*(v+(py>>1)*pixelw_uv+(px>>1)))-128)<<8;
-       }
-    }
-  }
-
-  // pass the data to the pdp object
-  m_father->x_newpicture = 1;
-  return;
-}
-
-void CPDPVideoSync::flush_sync_buffers (void)
-{
-  post( "pdp_mp4videosync : flush sync buffer" );
-}
-
-void CPDPVideoSync::flush_decode_buffers (void)
-{
-  post( "pdp_mp4videosync : flush decode buffer" );
-}
-
-static void pdp_video_configure (void *ifptr,
-			      int w,
-			      int h,
-			      int format,
-                              double aspect_ratio )
-{
-  ((CPDPVideoSync *)ifptr)->config(w, h);
-}
-
-static int pdp_video_get_buffer (void *ifptr, 
-			       uint8_t **y,
-			       uint8_t **u,
-			       uint8_t **v)
-{
-  return (((CPDPVideoSync *)ifptr)->get_video_buffer(y, u, v));
-}
-
-static void pdp_video_filled_buffer(void *ifptr, uint64_t time)
-{
-  ((CPDPVideoSync *)ifptr)->filled_video_buffers(time);
-}
-
-static void pdp_video_have_frame (void *ifptr,
-			       const uint8_t *y,
-			       const uint8_t *u,
-			       const uint8_t *v,
-			       int m_pixelw_y,
-			       int m_pixelw_uv,
-			       uint64_t time)
-{
-  CPDPVideoSync *foo = (CPDPVideoSync *)ifptr;
-
-  foo->set_video_frame(y, u, v, m_pixelw_y, m_pixelw_uv, time);
-}
-
-video_vft_t video_vft = 
-{
-  message,
-  pdp_video_configure,
-  pdp_video_get_buffer,
-  pdp_video_filled_buffer,
-  pdp_video_have_frame,
-};
-
-video_vft_t *get_video_vft (void)
-{
-  return (&video_vft);
-}
-
-CPDPVideoSync *pdp_create_video_sync (CPlayerSession *psptr, t_pdp_mp4player *pdp_father) 
-{
-  return new CPDPVideoSync(psptr, pdp_father);
-}
diff --git a/externals/pidip/modules/pdp_nervous.c b/externals/pidip/modules/pdp_nervous.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_noquark.c b/externals/pidip/modules/pdp_noquark.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_o.c b/externals/pidip/modules/pdp_o.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_ocanvas.c b/externals/pidip/modules/pdp_ocanvas.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_pen.c b/externals/pidip/modules/pdp_pen.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_puzzle.c b/externals/pidip/modules/pdp_puzzle.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_qtext.c b/externals/pidip/modules/pdp_qtext.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_quark.c b/externals/pidip/modules/pdp_quark.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_radioactiv.c b/externals/pidip/modules/pdp_radioactiv.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_rec~.c b/externals/pidip/modules/pdp_rec~.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_rev.c b/externals/pidip/modules/pdp_rev.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_ripple.c b/externals/pidip/modules/pdp_ripple.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_segsnd~.c b/externals/pidip/modules/pdp_segsnd~.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_shagadelic.c b/externals/pidip/modules/pdp_shagadelic.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_shape.c b/externals/pidip/modules/pdp_shape.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_simura.c b/externals/pidip/modules/pdp_simura.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_smuck.c b/externals/pidip/modules/pdp_smuck.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_spigot.c b/externals/pidip/modules/pdp_spigot.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_spiral.c b/externals/pidip/modules/pdp_spiral.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_spotlight.c b/externals/pidip/modules/pdp_spotlight.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_text.c b/externals/pidip/modules/pdp_text.c
old mode 100644
new mode 100755
index d586c21ceb637a02144efe66e2280ce0b19c8c3e..d96d9b41b712a18fac82d2ee5ca4e16044f03f05
--- a/externals/pidip/modules/pdp_text.c
+++ b/externals/pidip/modules/pdp_text.c
@@ -678,7 +678,7 @@ void pdp_text_setup(void)
     class_addmethod(pdp_text_class, (t_method)pdp_text_blend, gensym("blend"),  A_DEFFLOAT, A_NULL);
     class_addmethod(pdp_text_class, (t_method)pdp_text_antialias, gensym("antialias"),  A_DEFFLOAT, A_NULL);
 
-    imlib_add_path_to_font_path("/usr/X11R6/lib/X11/fonts/TTF");
+    imlib_add_path_to_font_path("/usr/share/fonts/X11/TTF");
 #ifdef __APPLE__
     imlib_add_path_to_font_path("/System/Library/Fonts");
     imlib_add_path_to_font_path("/Library/Fonts");
diff --git a/externals/pidip/modules/pdp_theonice~.c b/externals/pidip/modules/pdp_theonice~.c
old mode 100644
new mode 100755
index c46c98da715f3f547d61171cb93efba4a82372ff..6f5045d276c0e27d64143177d3af625b9febe0b5
--- a/externals/pidip/modules/pdp_theonice~.c
+++ b/externals/pidip/modules/pdp_theonice~.c
@@ -36,12 +36,14 @@
 #include <vorbis/codec.h>
 #include <vorbis/vorbisenc.h>
 
+#define MAX_PACKETS_STACK 1
+
 #define MIN_FRAMERATE 1
 #define MAX_FRAMERATE 100
-#define DEFAULT_FRAME_RATE 7
+#define DEFAULT_FRAME_RATE 12
 #define MIN_VIDEO_QUALITY 0
 #define MAX_VIDEO_QUALITY 63
-#define DEFAULT_VIDEO_QUALITY 2
+#define DEFAULT_VIDEO_QUALITY 16
 #define MIN_VIDEO_BITRATE 45
 #define MAX_VIDEO_BITRATE 2000
 #define DEFAULT_VIDEO_BITRATE 48
@@ -50,15 +52,11 @@
 #define DEFAULT_AUDIO_QUALITY 0.5
 #define MIN_AUDIO_BITRATE 8
 #define MAX_AUDIO_BITRATE 2000
-#define DEFAULT_AUDIO_BITRATE 32
+#define DEFAULT_AUDIO_BITRATE 64
 
 #define DEFAULT_CHANNELS 2
-#define DEFAULT_DRIFT 100
 #define DEFAULT_BITS 8
 #define MAX_AUDIO_PACKET_SIZE (128 * 1024)
-// streams hard-coded serial numbers
-#define STREAMV_SNO 0x987654
-#define STREAMA_SNO 0x456789
 
 #define MAX_COMMENT_LENGTH 1024
 #define STRBUF_SIZE 1024
@@ -75,7 +73,7 @@ static char base64table[65] = {
     'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/',
 };
 
-static char   *pdp_theonice_version = "pdp_theonice~: version 0.1, a theora a/v streaming object, written by ydegoyon@free.fr";
+static char   *pdp_theonice_version = "pdp_theonice~: version 1.5, a theora a/v streaming object, written by ydegoyon@free.fr";
 
 typedef struct pdp_theonice_struct
 {
@@ -97,16 +95,16 @@ typedef struct pdp_theonice_struct
     int x_socketfd;                // connection socket
     int x_streaming;             // streaming on : connected and all 
     int x_pstreaming;            // previous state
-    char  *x_passwd;               // password
-    char  x_title[MAX_COMMENT_LENGTH];         // title of the stream 
-    char  x_url[MAX_COMMENT_LENGTH];           // url of the stream 
-    char  x_genre[MAX_COMMENT_LENGTH];         // genre of the stream 
-    char  x_description[MAX_COMMENT_LENGTH];   // description 
-    char  x_artist[MAX_COMMENT_LENGTH];        // artist
-    char  x_copyright[MAX_COMMENT_LENGTH];
-    char  x_date[MAX_COMMENT_LENGTH];          // starting system date 
-    char  x_hostname[MAX_COMMENT_LENGTH];      // name or IP of host to connect to 
-    char  x_mountpoint[MAX_COMMENT_LENGTH];    // mountpoint
+    char *x_passwd;               // password
+    char x_title[MAX_COMMENT_LENGTH];         // title of the stream 
+    char x_url[MAX_COMMENT_LENGTH];           // url of the stream 
+    char x_genre[MAX_COMMENT_LENGTH];         // genre of the stream 
+    char x_description[MAX_COMMENT_LENGTH];   // description 
+    char x_artist[MAX_COMMENT_LENGTH];        // artist
+    char x_copyright[MAX_COMMENT_LENGTH];
+    char x_date[MAX_COMMENT_LENGTH];          // starting system date 
+    char x_hostname[MAX_COMMENT_LENGTH];      // name or IP of host to connect to 
+    char x_mountpoint[MAX_COMMENT_LENGTH];    // mountpoint
     int x_port;                     // port number
     int x_public;                   // publish on www.oggcast.com 
     int x_framerate;
@@ -119,7 +117,8 @@ typedef struct pdp_theonice_struct
     int x_nbframes_dropped;
     int x_pnbframes_dropped;
     int x_frames;
-    t_float x_maxdrift;     /* maximum delay between audio and video */
+    int x_apkg;
+    int x_vpkg;
     struct timeval x_tstart;
     struct timeval x_tzero;
     struct timeval x_tcurrent;
@@ -131,7 +130,8 @@ typedef struct pdp_theonice_struct
     ogg_page         x_ogg_page;       // ogg page for headers
     ogg_page         x_apage;          // ogg audio page
     ogg_page         x_vpage;          // ogg video page
-    ogg_packet       x_ogg_packet;     // ogg packet
+    ogg_packet       x_ogg_apacket;    // ogg packet
+    ogg_packet       x_ogg_vpacket;    // ogg packet
     ogg_stream_state x_statev;         // vorbis stream state
     ogg_stream_state x_statet;         // theora stream state
     theora_info      x_theora_info;    // theora info
@@ -206,8 +206,9 @@ static void pdp_theonice_init_encoder(t_pdp_theonice *x)
     x->x_einit=0;
 
     // init streams
-    ogg_stream_init(&x->x_statet, STREAMA_SNO);
-    ogg_stream_init(&x->x_statev, STREAMV_SNO);
+    srand(time(NULL));
+    ogg_stream_init(&x->x_statet, rand());
+    ogg_stream_init(&x->x_statev, rand());
 
     theora_info_init(&x->x_theora_info);
     x->x_theora_info.width=x->x_tvwidth;
@@ -220,19 +221,20 @@ static void pdp_theonice_init_encoder(t_pdp_theonice *x)
     x->x_theora_info.fps_denominator=1;
     x->x_theora_info.aspect_numerator=1;
     x->x_theora_info.aspect_denominator=1;
-    x->x_theora_info.colorspace=OC_CS_UNSPECIFIED;
+    x->x_theora_info.colorspace=OC_CS_ITU_REC_470BG;
     x->x_theora_info.target_bitrate=x->x_vkbps;
     x->x_theora_info.quality=x->x_vquality;
 
     x->x_theora_info.dropframes_p=0;
     x->x_theora_info.quick_p=1;
     x->x_theora_info.keyframe_auto_p=1;
-    x->x_theora_info.keyframe_frequency=64;
-    x->x_theora_info.keyframe_frequency_force=64;
-    x->x_theora_info.keyframe_data_target_bitrate=x->x_vkbps*1.5;
+    x->x_theora_info.keyframe_frequency=10;
+    x->x_theora_info.keyframe_frequency_force=10;
+    x->x_theora_info.keyframe_data_target_bitrate=x->x_vkbps*5;
     x->x_theora_info.keyframe_auto_threshold=80;
     x->x_theora_info.keyframe_mindistance=8;
     x->x_theora_info.noise_sensitivity=1; 
+    x->x_theora_info.sharpness=0; 
 
     theora_encode_init(&x->x_theora_state,&x->x_theora_info);
 
@@ -263,13 +265,12 @@ static void pdp_theonice_init_encoder(t_pdp_theonice *x)
     vorbis_comment_add_tag(&(x->x_vorbis_comment),"PERFORMER",x->x_artist);
     vorbis_comment_add_tag(&(x->x_vorbis_comment),"COPYRIGHT",x->x_copyright);
     vorbis_comment_add_tag(&(x->x_vorbis_comment),"DATE",x->x_date);
-    vorbis_comment_add_tag(&(x->x_vorbis_comment),"ENCODER","pdp_theonice~ v0.1");
+    vorbis_comment_add_tag(&(x->x_vorbis_comment),"ENCODER","pdp_theonice~ v1.5");
     vorbis_analysis_init(&x->x_dsp_state,&x->x_vorbis_info);
     vorbis_block_init(&x->x_dsp_state,&x->x_vorbis_block);
     
     post( "pdp_theonice~ : encoder initialized." );
     x->x_einit=1;
-
 }
 
     /* terminate the encoding process */
@@ -287,16 +288,22 @@ static void pdp_theonice_shutdown_encoder(t_pdp_theonice *x)
          vorbis_analysis( &x->x_vorbis_block, NULL );
          vorbis_bitrate_addblock( &x->x_vorbis_block );
   
-         while(vorbis_bitrate_flushpacket(  &x->x_dsp_state, &x->x_ogg_packet ))
+         while(vorbis_bitrate_flushpacket( &x->x_dsp_state, &x->x_ogg_apacket ))
          {
-            ogg_stream_packetin( &x->x_statev, &x->x_ogg_packet );
+            ogg_stream_packetin( &x->x_statev, &x->x_ogg_apacket );
+            x->x_apkg++;
+            // post( "pdp_theonice~ : audio packets :%d", x->x_apkg);
          }
       }
-      while( ( ret = ogg_stream_pageout( &x->x_statev, &x->x_apage) ) > 0 )
+
+      while(1)
       {
-        x->x_audiotime = vorbis_granule_time(&x->x_dsp_state, ogg_page_granulepos(&x->x_apage));
-  
-        // post("pdp_theonice~ : writing audio : %d samples, header : %d, body : %d", nbsamples, x->x_apage.header_len, x->x_apage.body_len);
+        ret = ogg_stream_flush(&x->x_statev, &x->x_apage);
+        if(ret<0){
+          post( "pdp_theonice~ : ogg encoding error." );
+          return;
+        }
+        if(ret==0)break;
         if ( ( ret = send(x->x_socketfd, (void*)x->x_apage.header, x->x_apage.header_len, MSG_NOSIGNAL) ) < 0 )
         {
           post( "pdp_theonice~ : could not write audio packet (ret=%d).", ret );
@@ -307,6 +314,8 @@ static void pdp_theonice_shutdown_encoder(t_pdp_theonice *x)
           post( "pdp_theonice~ : could not write audio packet (ret=%d).", ret );
           perror( "send" );
         }
+        x->x_apkg -= ogg_page_packets((ogg_page *)&x->x_apage);
+        x->x_audiotime = vorbis_granule_time(&x->x_dsp_state, ogg_page_granulepos(&x->x_apage));
       }
   
       ogg_stream_clear(&x->x_statev);
@@ -349,8 +358,8 @@ static int pdp_theonice_write_headers(t_pdp_theonice *x)
       return -1;
     }
 
-    theora_encode_header(&x->x_theora_state, &x->x_ogg_packet);
-    ogg_stream_packetin(&x->x_statet, &x->x_ogg_packet);
+    theora_encode_header(&x->x_theora_state, &x->x_ogg_vpacket);
+    ogg_stream_packetin(&x->x_statet, &x->x_ogg_vpacket);
     if(ogg_stream_pageout(&x->x_statet, &x->x_ogg_page)!=1)
     {
       post( "pdp_theonice~ : ogg encoding error." );
@@ -380,11 +389,11 @@ static int pdp_theonice_write_headers(t_pdp_theonice *x)
     theora_comment_add_tag(&(x->x_theora_comment),"PERFORMER",x->x_artist);
     theora_comment_add_tag(&(x->x_theora_comment),"COPYRIGHT",x->x_copyright);
     theora_comment_add_tag(&(x->x_theora_comment),"DATE",x->x_date);
-    theora_comment_add_tag(&(x->x_theora_comment),"ENCODER","pdp_theonice~ v0.1");
-    theora_encode_comment(&x->x_theora_comment, &x->x_ogg_packet);
-    ogg_stream_packetin(&x->x_statet, &x->x_ogg_packet);
-    theora_encode_tables(&x->x_theora_state, &x->x_ogg_packet);
-    ogg_stream_packetin(&x->x_statet, &x->x_ogg_packet);
+    theora_comment_add_tag(&(x->x_theora_comment),"ENCODER","pdp_theonice~ v1.5");
+    theora_encode_comment(&x->x_theora_comment, &x->x_ogg_vpacket);
+    ogg_stream_packetin(&x->x_statet, &x->x_ogg_vpacket);
+    theora_encode_tables(&x->x_theora_state, &x->x_ogg_vpacket);
+    ogg_stream_packetin(&x->x_statet, &x->x_ogg_vpacket);
 
     vorbis_analysis_headerout(&x->x_dsp_state, &x->x_vorbis_comment, 
                               &aheader,&aheadercomm,&aheadercode);
@@ -925,15 +934,15 @@ static t_int *pdp_theonice_perform(t_int *w)
     while (n--)
     {
        fsample=*(in1++);
-       if (fsample > 1.0) { fsample = 1.0; }
-       if (fsample < -1.0) { fsample = -1.0; }
+       // if (fsample > 1.0) { fsample = 1.0; }
+       // if (fsample < -1.0) { fsample = -1.0; }
        x->x_audio_buf[0][x->x_audioin_position]=fsample;
        fsample=*(in2++);
-       if (fsample > 1.0) { fsample = 1.0; }
-       if (fsample < -1.0) { fsample = -1.0; }
+       // if (fsample > 1.0) { fsample = 1.0; }
+       // if (fsample < -1.0) { fsample = -1.0; }
        x->x_audio_buf[1][x->x_audioin_position]=fsample;
        x->x_audioin_position=(x->x_audioin_position+1)%(MAX_AUDIO_PACKET_SIZE);
-       if ( x->x_audioin_position >= MAX_AUDIO_PACKET_SIZE-1 )
+       if ( x->x_audioin_position > MAX_AUDIO_PACKET_SIZE-1 )
        {
           post( "pdp_theonice~ : audio x-run" );
        }
@@ -971,8 +980,6 @@ static t_int *pdp_theonice_perform(t_int *w)
     if ( x->x_videotime >= 0. ) outlet_float(x->x_outlet_vtime, x->x_videotime);
   }
 
-  pdp_theonice_send_audio(x);
-
   return (w+5);
 }
 
@@ -1019,6 +1026,8 @@ static void pdp_theonice_process_yv12(t_pdp_theonice *x)
    x->x_frames++;
 
    pdp_theonice_send_video(x);
+   pdp_theonice_send_audio(x);
+
 }
 
 static void pdp_theonice_send_video(t_pdp_theonice *x)
@@ -1067,16 +1076,30 @@ static void pdp_theonice_send_video(t_pdp_theonice *x)
       }  
       else
       {
-         // stream one packet
-         theora_encode_packetout(&x->x_theora_state, 0, &x->x_ogg_packet);
-         ogg_stream_packetin(&x->x_statet, &x->x_ogg_packet);
+         x->x_frameswritten++;
+         if ( x->x_frameslate > 0 ) x->x_frameslate--;
+         x->x_secondcount++;
+
+         // weld packets into the bitstream 
+         while(theora_encode_packetout(&x->x_theora_state, 0, &x->x_ogg_vpacket))
+         {
+           ogg_stream_packetin( &x->x_statet, &x->x_ogg_vpacket);
+           x->x_vpkg++;
+           // post("pdp_theonice~ : video packets : %d", x->x_vpkg);
+         }
+
          // post( "pdp_theonice~ : new (theora) ogg packet : bytes:%ld, bos:%ld, eos:%ld, no:%lld",
-         //                        x->x_ogg_packet.bytes, x->x_ogg_packet.b_o_s, 
-         //                        x->x_ogg_packet.e_o_s, x->x_ogg_packet.packetno );
+         //                        x->x_ogg_vpacket.bytes, x->x_ogg_vpacket.b_o_s, 
+         //                        x->x_ogg_vpacket.e_o_s, x->x_ogg_vpacket.packetno );
 
-         while( ( ret = ogg_stream_pageout(&x->x_statet, &x->x_vpage) ) >0 )
+         while(1)
          {
-           x->x_videotime = theora_granule_time(&x->x_theora_state, ogg_page_granulepos(&x->x_vpage));
+           ret = ogg_stream_flush(&x->x_statet, &x->x_vpage);
+           if(ret<0){
+              post( "pdp_theonice~ : ogg encoding error." );
+              return;
+           }
+           if(ret==0)break;
            // post("pdp_theonice~ : writing video : header : %d, body : %d", x->x_vpage.header_len, x->x_vpage.body_len); 
            if ( ( ret = send(x->x_socketfd, (void*)x->x_vpage.header, x->x_vpage.header_len, MSG_NOSIGNAL) ) < 0 )
            {
@@ -1092,10 +1115,10 @@ static void pdp_theonice_send_video(t_pdp_theonice *x)
              pdp_theonice_disconnect(x);
              return;
            }
+           x->x_vpkg -= ogg_page_packets((ogg_page *)&x->x_vpage);
+           x->x_videotime = theora_granule_time(&x->x_theora_state, ogg_page_granulepos(&x->x_vpage));
+           // post( "pdp_theonice~ : sent %d bytes (%d video frames)", x->x_vpage.header_len+x->x_vpage.body_len, ogg_page_packets((ogg_page *)&x->x_vpage ) );
          }
-         x->x_frameswritten++;
-         if ( x->x_frameslate > 0 ) x->x_frameslate--;
-         x->x_secondcount++;
       }
 
     }
@@ -1103,35 +1126,38 @@ static void pdp_theonice_send_video(t_pdp_theonice *x)
 
 static void pdp_theonice_send_audio(t_pdp_theonice *x)
 {
-  int    nbaudiosamples, nbusecs, nbsamples, ret;
+  int    nbaudiosamples, nbsamples, ret, send_page;
+  float  nbusecs;
   struct timeval tstream;
 
     // calculate the number of audio samples to output
     if ( gettimeofday(&tstream, NULL) == -1)
     {
-       post("pdp_theonice~ : could set stop time" );
+       post("pdp_theonice~ : could get time" );
     }
     // calculate time diff in micro seconds
-    nbusecs = ( tstream.tv_usec - x->x_tprevstream.tv_usec ) + 
-              ( tstream.tv_sec - x->x_tprevstream.tv_sec )*1000000;
-    nbaudiosamples = (sys_getsr()*1000000)/nbusecs;
+    // nbusecs = ( tstream.tv_usec - x->x_tprevstream.tv_usec ) + 
+    //           ( tstream.tv_sec - x->x_tprevstream.tv_sec )*1000000;
+    // nbaudiosamples = sys_getsr()*(nbusecs/1000000);
+
     memcpy( &x->x_tprevstream, &tstream, sizeof( struct timeval) );
       
-    if ( x->x_audioin_position > nbaudiosamples )
-    {
-       nbsamples = nbaudiosamples;
-    }
-    else
-    {
-       nbsamples = x->x_audioin_position;
-    }
+    nbsamples = x->x_audioin_position;
+    if( nbsamples <= 0 ) return;
+
     // audio is ahead of video, do not send audio
     if ( x->x_audiotime > x->x_videotime ) return;
 
+    // post("pdp_theonice~ : writing audio : %d samples, audioin : %d", nbsamples, x->x_audioin_position ); 
+
     if ( x->x_socketfd > 0 && x->x_streaming )
     {
       x->x_vbuffer=vorbis_analysis_buffer( &x->x_dsp_state, nbsamples );
-      if ( !x->x_vbuffer ) return;
+      if ( !x->x_vbuffer ) 
+      {
+         post( "pdp_theonice~ : error getting audio buffers" );
+         return;
+      }
  
       memcpy( (void*)&x->x_vbuffer[0][0], (void*)&x->x_audio_buf[0][0], nbsamples*sizeof( t_float ) );
       memcpy( (void*)&x->x_vbuffer[1][0], (void*)&x->x_audio_buf[1][0], nbsamples*sizeof( t_float ) );
@@ -1146,21 +1172,23 @@ static void pdp_theonice_send_audio(t_pdp_theonice *x)
         vorbis_bitrate_addblock( &x->x_vorbis_block );
 
         // weld packets into the bitstream 
-        while(vorbis_bitrate_flushpacket( &x->x_dsp_state, &x->x_ogg_packet ))
+        while( vorbis_bitrate_flushpacket( &x->x_dsp_state, &x->x_ogg_apacket ) > 0 )
         {
-          ogg_stream_packetin( &x->x_statev, &x->x_ogg_packet);
+          ogg_stream_packetin( &x->x_statev, &x->x_ogg_apacket);
+          x->x_apkg++;
+          // post( "pdp_theonice~ : audio packets :%d", x->x_apkg);
         }
 
       }
 
-      x->x_eos=0;
-      while( !x->x_eos )
+      while(1)
       {
-        ret = ogg_stream_pageout( &x->x_statev, &x->x_apage);
-        if ( ret == 0 ) break;
-        x->x_audiotime = vorbis_granule_time(&x->x_dsp_state, ogg_page_granulepos(&x->x_apage));
-
-        // post("pdp_theonice~ : writing audio : %d samples, header : %d, body : %d", nbsamples, x->x_apage.header_len, x->x_apage.body_len); 
+        ret = ogg_stream_flush(&x->x_statev, &x->x_apage);
+        if(ret<0){
+           post( "pdp_theonice~ : ogg encoding error." );
+           return;
+        }
+        if(ret==0)break;
         if ( ( ret = send(x->x_socketfd, (void*)x->x_apage.header, x->x_apage.header_len, MSG_NOSIGNAL) ) < 0 )
         {
           post( "pdp_theonice~ : could not write audio packet (ret=%d).", ret );
@@ -1175,7 +1203,9 @@ static void pdp_theonice_send_audio(t_pdp_theonice *x)
           pdp_theonice_disconnect(x);
           return;
         }
-        if (ogg_page_eos(&x->x_apage)) x->x_eos=1;
+        x->x_apkg -= ogg_page_packets((ogg_page *)&x->x_apage);
+        x->x_audiotime = vorbis_granule_time(&x->x_dsp_state, ogg_page_granulepos(&x->x_apage));
+        // post( "pdp_theonice~ : sent %d bytes (%d audio blocks)", x->x_apage.header_len+x->x_apage.body_len, ogg_page_packets((ogg_page *)&x->x_apage) );
       }
 
       memcpy( &x->x_audio_buf[0][0], &x->x_audio_buf[0][nbsamples], 
@@ -1282,7 +1312,6 @@ void *pdp_theonice_new(void)
     x->x_vquality = DEFAULT_VIDEO_QUALITY;
     x->x_akbps = DEFAULT_AUDIO_BITRATE;
     x->x_aquality = DEFAULT_AUDIO_QUALITY;
-    x->x_maxdrift = DEFAULT_DRIFT/1000;
 
     x->x_socketfd = -1;
     x->x_passwd = "letmein";
@@ -1306,6 +1335,8 @@ void *pdp_theonice_new(void)
     x->x_pmframerate = 0;
     x->x_nbframes_dropped = 0;
     x->x_pnbframes_dropped = 0;
+    x->x_apkg = 0;
+    x->x_vpkg = 0;
 
     x->x_tzero.tv_sec = 0;
     x->x_tzero.tv_usec = 0;
diff --git a/externals/pidip/modules/pdp_theorin~.c b/externals/pidip/modules/pdp_theorin~.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_theorout~.c b/externals/pidip/modules/pdp_theorout~.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_transform.c b/externals/pidip/modules/pdp_transform.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_transition.c b/externals/pidip/modules/pdp_transition.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_underwatch.c b/externals/pidip/modules/pdp_underwatch.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_v4l2.c b/externals/pidip/modules/pdp_v4l2.c
index 5e65b47ed9d4aabb5d2eb124751ba886184b9588..537624e2fe2943632ef18625bf09b02be52d4239 100755
--- a/externals/pidip/modules/pdp_v4l2.c
+++ b/externals/pidip/modules/pdp_v4l2.c
@@ -40,7 +40,6 @@
 #include <sys/types.h>
 #include <sys/time.h>
 #include <linux/types.h>
-#include <linux/videodev.h>
 #include <linux/videodev2.h>
 #include <sys/mman.h>
 #include <sched.h>
diff --git a/externals/pidip/modules/pdp_vertigo.c b/externals/pidip/modules/pdp_vertigo.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_vloopback.c b/externals/pidip/modules/pdp_vloopback.c
index c475d6fb8d22456b904ccadf449b56ebec86f5d8..a78342756c621b1ca62a5f14b6d62b88c9959e47 100755
--- a/externals/pidip/modules/pdp_vloopback.c
+++ b/externals/pidip/modules/pdp_vloopback.c
@@ -40,7 +40,7 @@
 #include <sys/types.h>
 #include <sys/time.h>
 #include <linux/types.h>
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
 
 typedef struct pdp_vloopback_struct
 {
diff --git a/externals/pidip/modules/pdp_warhol.c b/externals/pidip/modules/pdp_warhol.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_warp.c b/externals/pidip/modules/pdp_warp.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_xcanvas.c b/externals/pidip/modules/pdp_xcanvas.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_yqt.c b/externals/pidip/modules/pdp_yqt.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/modules/pdp_yvu2rgb.c b/externals/pidip/modules/pdp_yvu2rgb.c
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/collage.pd b/externals/pidip/patches/collage.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/cutandpaste.pd b/externals/pidip/patches/cutandpaste.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/giss-audio-mp3.pd b/externals/pidip/patches/giss-audio-mp3.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/giss-audio-ogg.pd b/externals/pidip/patches/giss-audio-ogg.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/giss-gem.pd b/externals/pidip/patches/giss-gem.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/giss-pdp-dv.pd b/externals/pidip/patches/giss-pdp-dv.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/giss-pdp-osx.pd b/externals/pidip/patches/giss-pdp-osx.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/giss-pdp-v4l.pd b/externals/pidip/patches/giss-pdp-v4l.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/giss-pdp-v4l2.pd b/externals/pidip/patches/giss-pdp-v4l2.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/help_emboss.pd b/externals/pidip/patches/help_emboss.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/help_invert.pd b/externals/pidip/patches/help_invert.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/help_pdp-tatiana.pd b/externals/pidip/patches/help_pdp-tatiana.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/help_pdp_effects_rack.pd b/externals/pidip/patches/help_pdp_effects_rack.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/help_sobel_edge.pd b/externals/pidip/patches/help_sobel_edge.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/images/colorgrid.pnm b/externals/pidip/patches/images/colorgrid.pnm
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/images/eve.jpg b/externals/pidip/patches/images/eve.jpg
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/images/live.jpg b/externals/pidip/patches/images/live.jpg
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/images/logo1.jpg b/externals/pidip/patches/images/logo1.jpg
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/images/logo2.jpg b/externals/pidip/patches/images/logo2.jpg
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/images/love.jpg b/externals/pidip/patches/images/love.jpg
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/images/stations.jpg b/externals/pidip/patches/images/stations.jpg
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/images/wealth.jpg b/externals/pidip/patches/images/wealth.jpg
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/images/wealth2.jpg b/externals/pidip/patches/images/wealth2.jpg
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/morphology/help-closing.pd b/externals/pidip/patches/morphology/help-closing.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/morphology/help-opening.pd b/externals/pidip/patches/morphology/help-opening.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/morphology/help-skeletization.pd b/externals/pidip/patches/morphology/help-skeletization.pd
old mode 100644
new mode 100755
index 342f6cb5fb1b53a3550eab8bc932fdc1d545e932..72ce5810ff7eda7dc1419bae7ff92567aaf4f2e9
--- a/externals/pidip/patches/morphology/help-skeletization.pd
+++ b/externals/pidip/patches/morphology/help-skeletization.pd
@@ -2,7 +2,7 @@
 #X obj 341 20 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
 #X msg 196 92 loop \$1;
-#X obj 197 70 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 1
+#X obj 197 70 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1
 ;
 #X msg 453 93 open \$1;
 #X obj 452 69 openpanel;
@@ -14,7 +14,6 @@
 -1 -1 0 1;
 #X obj 330 91 metro 70;
 #X obj 325 123 pdp_yqt;
-#X obj 25 193 pdp_v4l;
 #X obj 34 162 metro 70;
 #X obj 79 128 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
@@ -57,8 +56,9 @@
 #X floatatom 189 317 5 0 0 0 - - -;
 #X floatatom 236 317 5 0 0 0 - - -;
 #X obj 287 315 route press drag release;
-#X msg 227 232 cursor 1;
+#X msg 285 161 cursor 1;
 #X obj 344 161 pdp_glx;
+#X obj 25 193 pdp_v4l2;
 #X connect 0 0 9 0;
 #X connect 1 0 10 0;
 #X connect 2 0 1 0;
@@ -69,45 +69,45 @@
 #X connect 7 0 9 0;
 #X connect 8 0 6 0;
 #X connect 9 0 10 0;
-#X connect 10 0 35 0;
+#X connect 10 0 34 0;
+#X connect 10 0 51 0;
 #X connect 10 0 52 0;
-#X connect 10 0 53 0;
-#X connect 11 0 35 0;
+#X connect 11 0 53 0;
 #X connect 12 0 11 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 0;
-#X connect 15 0 11 0;
-#X connect 16 0 18 0;
-#X connect 17 0 20 0;
-#X connect 18 0 17 0;
-#X connect 20 0 19 0;
-#X connect 21 0 39 0;
-#X connect 22 0 51 0;
-#X connect 25 0 30 6;
-#X connect 30 0 38 0;
-#X connect 30 1 26 0;
-#X connect 30 2 27 0;
-#X connect 30 3 28 0;
-#X connect 31 0 30 1;
-#X connect 34 0 45 0;
-#X connect 35 0 22 0;
-#X connect 35 0 21 0;
-#X connect 35 1 48 0;
-#X connect 35 2 49 0;
-#X connect 35 3 50 0;
-#X connect 36 0 35 6;
-#X connect 39 0 33 0;
-#X connect 39 0 30 0;
-#X connect 40 0 39 1;
+#X connect 13 0 11 0;
+#X connect 14 0 53 0;
+#X connect 15 0 17 0;
+#X connect 16 0 19 0;
+#X connect 17 0 16 0;
+#X connect 19 0 18 0;
+#X connect 20 0 38 0;
+#X connect 21 0 50 0;
+#X connect 24 0 29 6;
+#X connect 29 0 37 0;
+#X connect 29 1 25 0;
+#X connect 29 2 26 0;
+#X connect 29 3 27 0;
+#X connect 30 0 29 1;
+#X connect 33 0 44 0;
+#X connect 34 0 21 0;
+#X connect 34 0 20 0;
+#X connect 34 1 47 0;
+#X connect 34 2 48 0;
+#X connect 34 3 49 0;
+#X connect 35 0 34 6;
+#X connect 38 0 32 0;
+#X connect 38 0 29 0;
+#X connect 39 0 38 1;
+#X connect 40 0 39 0;
 #X connect 41 0 40 0;
-#X connect 42 0 41 0;
-#X connect 43 0 44 0;
-#X connect 44 0 31 0;
-#X connect 45 0 25 0;
-#X connect 46 0 35 0;
-#X connect 47 0 46 0;
-#X connect 47 0 35 0;
-#X connect 51 0 47 0;
-#X connect 52 0 22 0;
-#X connect 52 0 53 0;
-#X connect 53 0 51 0;
+#X connect 42 0 43 0;
+#X connect 43 0 30 0;
+#X connect 44 0 24 0;
+#X connect 45 0 34 0;
+#X connect 46 0 45 0;
+#X connect 46 0 34 0;
+#X connect 50 0 46 0;
+#X connect 51 0 21 0;
+#X connect 51 0 52 0;
+#X connect 52 0 50 0;
+#X connect 53 0 34 0;
diff --git a/externals/pidip/patches/morphology/help-thickening.pd b/externals/pidip/patches/morphology/help-thickening.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/morphology/help-thinning.pd b/externals/pidip/patches/morphology/help-thinning.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/pdp_cabaret.pd b/externals/pidip/patches/pdp_cabaret.pd
old mode 100644
new mode 100755
diff --git a/externals/pidip/patches/pdp_charcoal.pd b/externals/pidip/patches/pdp_charcoal.pd
old mode 100644
new mode 100755
index 79b9df6b33885b78b552d42a8b6baa6f1807df3a..99bd328c7dbdb4c22bb8f8081cf046d0b5021541
--- a/externals/pidip/patches/pdp_charcoal.pd
+++ b/externals/pidip/patches/pdp_charcoal.pd
@@ -14,7 +14,6 @@
 -1 -1 0 1;
 #X obj 257 135 metro 70;
 #X obj 252 167 pdp_yqt;
-#X obj 421 166 pdp_v4l;
 #X obj 430 135 metro 70;
 #X obj 475 101 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
 -1;
@@ -255,6 +254,7 @@
 #X obj 215 556 outlet;
 #X obj 276 467 inlet;
 #X obj 216 237 pdp_spigot;
+#X obj 421 166 pdp_v4l2;
 #X connect 0 0 9 0;
 #X connect 1 0 10 0;
 #X connect 2 0 1 0;
@@ -265,38 +265,38 @@
 #X connect 7 0 9 0;
 #X connect 8 0 6 0;
 #X connect 9 0 10 0;
-#X connect 10 0 51 0;
+#X connect 10 0 50 0;
 #X connect 11 0 51 0;
 #X connect 12 0 11 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 0;
-#X connect 15 0 11 0;
-#X connect 16 0 18 0;
-#X connect 17 0 20 0;
-#X connect 18 0 17 0;
-#X connect 20 0 19 0;
-#X connect 21 0 25 1;
-#X connect 23 0 28 0;
-#X connect 24 0 23 1;
-#X connect 25 0 42 0;
-#X connect 26 0 49 0;
-#X connect 28 0 25 0;
-#X connect 28 1 30 0;
-#X connect 29 0 28 1;
-#X connect 30 0 26 0;
-#X connect 30 1 49 0;
-#X connect 31 0 30 1;
-#X connect 32 0 23 0;
-#X connect 32 1 28 0;
-#X connect 33 0 32 1;
-#X connect 34 0 32 0;
-#X connect 35 0 51 1;
-#X connect 42 0 45 0;
-#X connect 42 1 30 0;
-#X connect 43 0 42 1;
-#X connect 45 0 30 0;
-#X connect 46 0 45 1;
-#X connect 48 0 51 0;
-#X connect 50 0 46 0;
-#X connect 51 0 34 0;
-#X connect 51 1 32 0;
+#X connect 13 0 11 0;
+#X connect 14 0 51 0;
+#X connect 15 0 17 0;
+#X connect 16 0 19 0;
+#X connect 17 0 16 0;
+#X connect 19 0 18 0;
+#X connect 20 0 24 1;
+#X connect 22 0 27 0;
+#X connect 23 0 22 1;
+#X connect 24 0 41 0;
+#X connect 25 0 48 0;
+#X connect 27 0 24 0;
+#X connect 27 1 29 0;
+#X connect 28 0 27 1;
+#X connect 29 0 25 0;
+#X connect 29 1 48 0;
+#X connect 30 0 29 1;
+#X connect 31 0 22 0;
+#X connect 31 1 27 0;
+#X connect 32 0 31 1;
+#X connect 33 0 31 0;
+#X connect 34 0 50 1;
+#X connect 41 0 44 0;
+#X connect 41 1 29 0;
+#X connect 42 0 41 1;
+#X connect 44 0 29 0;
+#X connect 45 0 44 1;
+#X connect 47 0 50 0;
+#X connect 49 0 45 0;
+#X connect 50 0 33 0;
+#X connect 50 1 31 0;
+#X connect 51 0 50 0;
diff --git a/externals/pidip/system/Makefile.in b/externals/pidip/system/Makefile.in
old mode 100644
new mode 100755
diff --git a/externals/pidip/system/pidip.c b/externals/pidip/system/pidip.c
old mode 100644
new mode 100755
index 5e6a181a1246d98d6a368987eef9ff5d08eff839..7b07322f40de6151f255b13a2a1f94e64f6874a9
--- a/externals/pidip/system/pidip.c
+++ b/externals/pidip/system/pidip.c
@@ -74,21 +74,40 @@ extern "C"
     void pdp_theorout_tilde_setup(void);
     void pdp_cropper_setup(void);
     void pdp_background_setup(void);
+    void pdp_backgroundyuv_setup(void);
     void pdp_mapper_setup(void);
     void pdp_theonice_tilde_setup(void);
     void pdp_icedthe_tilde_setup(void);
     void pdp_fdiff_setup(void);
     void pdp_hue_setup(void);
     void pdp_dot_setup(void);
+    void pdp_skeleton_setup(void);
+    void pdp_cluster_setup(void);
+    void pdp_ycfilter_setup(void);
+
+#ifdef HAVE_OPENCV
+    void pdp_joint_setup(void);
+    void pdp_shapes_setup(void);
+#endif
 
 #ifdef HAVE_DC1394
     void pdp_dc1394_setup(void);
 #endif
 
+#ifdef HAVE_FREENECT
+    void pdp_freenect_setup(void);
+#endif
+
+#ifdef HAVE_ARTKP
+    void pdp_artkp_setup(void);
+#endif
+
+#ifdef HAVE_V4L
+    void pdp_vloopback_setup(void);
+#endif
 
 #ifdef HAVE_V4L2
     void pdp_v4l2_setup(void);
-    void pdp_vloopback_setup(void);
 #endif
 
 #ifdef HAVE_LIBDV
@@ -103,20 +122,10 @@ extern "C"
     void pdp_capture_setup(void);
 #endif
 
-#ifdef HAVE_PIDIP_FFMPEG
-    void pdp_ffmpeg_tilde_setup(void);
-    void pdp_live_tilde_setup(void);
-#endif
-
-#ifdef HAVE_PIDIP_MPEG4IP
-    void pdp_mp4live_tilde_setup(void);
-    void pdp_mp4player_tilde_setup(void);
-#endif
-
 /* library setup routine */
 void pidip_setup(void){
     
-    post("PiDiP : additional video processing objects for PDP\n\tversion " PDP_PIDIP_VERSION "\n\tby Yves Degoyon and Lluis Gomez i Bigorda");
+    post("PiDiP : additional video processing objects for PDP\n\tversion " PDP_PIDIP_VERSION "\n\tby Yves Degoyon and Lluis Gomez i Bigorda\n\tNot for repressive, military or commercial use!");
 
     pdp_intrusion_setup();
     pdp_yqt_setup();
@@ -183,20 +192,40 @@ void pidip_setup(void){
     pdp_theorout_tilde_setup();
     pdp_cropper_setup();
     pdp_background_setup();
+    pdp_backgroundyuv_setup();
     pdp_mapper_setup();
     pdp_theonice_tilde_setup();
     pdp_icedthe_tilde_setup();
     pdp_fdiff_setup();
     pdp_hue_setup();
     pdp_dot_setup();
+    pdp_skeleton_setup();
+    pdp_cluster_setup();
+    pdp_ycfilter_setup();
+
+#ifdef HAVE_OPENCV
+    pdp_joint_setup();
+    pdp_shapes_setup();
+#endif
 
 #ifdef HAVE_DC1394
     pdp_dc1394_setup();
 #endif
 
+#ifdef HAVE_FREENECT
+    pdp_freenect_setup();
+#endif
+
+#ifdef HAVE_ARTKP
+    pdp_artkp_setup();
+#endif
+
+#ifdef HAVE_V4L
+    pdp_vloopback_setup();
+#endif
+
 #ifdef HAVE_V4L2
     pdp_v4l2_setup();
-    pdp_vloopback_setup();
 #endif
 
 #ifdef HAVE_LIBDV
@@ -210,16 +239,6 @@ void pidip_setup(void){
 #ifdef HAVE_IMAGE_MAGICK
     pdp_capture_setup();
 #endif
-
-#ifdef HAVE_PIDIP_FFMPEG
-    pdp_ffmpeg_tilde_setup();
-    pdp_live_tilde_setup();
-#endif
-
-#ifdef HAVE_PIDIP_MPEG4IP
-    pdp_mp4live_tilde_setup();
-    pdp_mp4player_tilde_setup();
-#endif
 }
 
 #ifdef __cplusplus
diff --git a/externals/pidip/system/yuv.c b/externals/pidip/system/yuv.c
old mode 100644
new mode 100755