[PD-cvs] externals/pidip/modules Makefile, 1.14, 1.15 Makefile.in, 1.14, 1.15 pdp_capture.c, 1.2, 1.3 pdp_icedthe~.c, 1.1, 1.2 pdp_shape.c, 1.4, 1.5

Yves Degoyon sevyves at users.sourceforge.net
Sat Jul 9 21:35:42 CEST 2005


Update of /cvsroot/pure-data/externals/pidip/modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26169/modules

Modified Files:
	Makefile Makefile.in pdp_capture.c pdp_icedthe~.c pdp_shape.c 
Log Message:
PiDiP 0.12.19



Index: Makefile.in
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/Makefile.in,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Makefile.in	2 Jan 2005 06:02:48 -0000	1.14
--- Makefile.in	9 Jul 2005 19:35:40 -0000	1.15
***************
*** 21,24 ****
--- 21,25 ----
            pdp_theorout~.o pdp_cropper.o pdp_background.o \
            pdp_mapper.o pdp_theonice~.o pdp_icedthe~.o\
+           pdp_fdiff.o pdp_hue.o \
            @PDP_STREAMING_OBJECTS@ # pdp_xcanvas.o pdp_aa.o
  

Index: Makefile
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/Makefile,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Makefile	2 Jan 2005 06:02:48 -0000	1.14
--- Makefile	9 Jul 2005 19:35:40 -0000	1.15
***************
*** 21,25 ****
            pdp_theorout~.o pdp_cropper.o pdp_background.o \
            pdp_mapper.o pdp_theonice~.o pdp_icedthe~.o\
!           pdp_live~.o pdp_ffmpeg~.o # pdp_xcanvas.o pdp_aa.o
  
  all_modules: $(OBJECTS) 
--- 21,26 ----
            pdp_theorout~.o pdp_cropper.o pdp_background.o \
            pdp_mapper.o pdp_theonice~.o pdp_icedthe~.o\
!           pdp_fdiff.o pdp_hue.o \
!            # pdp_xcanvas.o pdp_aa.o
  
  all_modules: $(OBJECTS) 

Index: pdp_shape.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_shape.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pdp_shape.c	14 Nov 2004 22:52:22 -0000	1.4
--- pdp_shape.c	9 Jul 2005 19:35:40 -0000	1.5
***************
*** 55,61 ****
      t_int x_colorV;
  
!     t_int x_tolerance; // tolerance
!     t_int x_paint;     // paint option
!     t_int x_shape;     // drawing shape option
      t_int x_luminosity; // use luminosity or not
  
--- 55,62 ----
      t_int x_colorV;
  
!     t_int x_tolerance;  // tolerance
!     t_int x_paint;      // paint option
!     t_int x_isolate;    // isolate option
!     t_int x_shape;      // drawing shape option
      t_int x_luminosity; // use luminosity or not
  
***************
*** 107,110 ****
--- 108,119 ----
  }
  
+ static void pdp_shape_isolate(t_pdp_shape *x, t_floatarg fisolate )
+ {
+    if ( ( fisolate == 0 ) || ( fisolate == 1 ) )
+    {
+       x->x_isolate = (int)fisolate;
+    }
+ }
+ 
  static void pdp_shape_paint(t_pdp_shape *x, t_floatarg fpaint )
  {
***************
*** 301,304 ****
--- 310,319 ----
    else
    {
+      if ( x->x_isolate )
+      {
+        *(pbbY+nY*x->x_vwidth+nX) = *(pbY+nY*x->x_vwidth+nX);
+        *(pbbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1));
+        *(pbbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1));
+      }
       if ( x->x_paint )
       {
***************
*** 447,456 ****
  
      memcpy( x->x_bdata, data, (x->x_vsize+(x->x_vsize>>1))<<1 );
!     memcpy( x->x_bbdata, data, (x->x_vsize+(x->x_vsize>>1))<<1 );
  
      if ( x->x_cursX != -1 ) pdp_shape_frame_detect( x, x->x_cursX, x->x_cursY );
    
      // paint cursor in red for debug purpose
!     if ( x->x_cursX != -1 )
      {
        pbbY = x->x_bbdata;
--- 462,478 ----
  
      memcpy( x->x_bdata, data, (x->x_vsize+(x->x_vsize>>1))<<1 );
!     if ( !x->x_isolate )
!     {
!       memcpy( x->x_bbdata, data, (x->x_vsize+(x->x_vsize>>1))<<1 );
!     }
!     else
!     {
!       memset( x->x_bbdata, 0x0, (x->x_vsize+(x->x_vsize>>1))<<1 );
!     }
  
      if ( x->x_cursX != -1 ) pdp_shape_frame_detect( x, x->x_cursX, x->x_cursY );
    
      // paint cursor in red for debug purpose
!     if ( ( x->x_cursX != -1 ) && ( x->x_shape ) )
      {
        pbbY = x->x_bbdata;
***************
*** 558,561 ****
--- 580,584 ----
      x->x_tolerance = 20;
      x->x_paint = 0;
+     x->x_isolate = 0;
      x->x_shape = 1;
      x->x_luminosity = 1;
***************
*** 590,593 ****
--- 613,617 ----
      class_addmethod(pdp_shape_class, (t_method)pdp_shape_rgb, gensym("rgb"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_NULL);
      class_addmethod(pdp_shape_class, (t_method)pdp_shape_tolerance, gensym("tolerance"), A_FLOAT, A_NULL);
+     class_addmethod(pdp_shape_class, (t_method)pdp_shape_isolate, gensym("isolate"), A_FLOAT, A_NULL);
      class_addmethod(pdp_shape_class, (t_method)pdp_shape_paint, gensym("paint"), A_FLOAT, A_NULL);
      class_addmethod(pdp_shape_class, (t_method)pdp_shape_shape, gensym("shape"), A_FLOAT, A_NULL);

Index: pdp_icedthe~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_icedthe~.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** pdp_icedthe~.c	2 Jan 2005 06:02:48 -0000	1.1
--- pdp_icedthe~.c	9 Jul 2005 19:35:40 -0000	1.2
***************
*** 113,116 ****
--- 113,117 ----
      t_int x_nbframes;       // number of frames emitted
      t_float x_framerate;    // framerate
+     t_int x_forcedframerate;// the framerate we want to receive
      t_int x_samplerate;     // audio sample rate
      t_int x_audiochannels;  // audio channels
***************
*** 153,157 ****
  static void pdp_icedthe_priority(t_pdp_icedthe *x, t_floatarg fpriority )
  {
!    if ( ( x->x_priority >= MIN_PRIORITY ) && ( x->x_priority <= MAX_PRIORITY ) )
     {
       x->x_priority = (int)fpriority;
--- 154,158 ----
  static void pdp_icedthe_priority(t_pdp_icedthe *x, t_floatarg fpriority )
  {
!    if ( ( (t_int)fpriority >= MIN_PRIORITY ) && ( (t_int)fpriority <= MAX_PRIORITY ) )
     {
       x->x_priority = (int)fpriority;
***************
*** 159,162 ****
--- 160,171 ----
  }
  
+ static void pdp_icedthe_framerate(t_pdp_icedthe *x, t_floatarg fframerate )
+ {
+    if ( fframerate > 0. )
+    {
+      x->x_forcedframerate = (int)fframerate;
+    }
+ }
+ 
  static void pdp_icedthe_audio(t_pdp_icedthe *x, t_floatarg faudio )
  {
***************
*** 393,433 ****
         theora_decode_YUVout(&x->x_theora_state, &x->x_yuvbuffer); 
  
!        // create a new pdp packet from PIX_FMT_YUV420P image format
!        x->x_vwidth = x->x_yuvbuffer.y_width;
!        x->x_vheight = x->x_yuvbuffer.y_height;
!        x->x_vsize = x->x_vwidth*x->x_vheight;
!        x->x_packet0 = pdp_packet_new_bitmap_yv12( x->x_vwidth, x->x_vheight );
!        // post( "pdp_icedthe~ : allocated packet %d", x->x_packet0 );
!        x->x_header = pdp_packet_header(x->x_packet0);
!        x->x_data = (unsigned char*) pdp_packet_data(x->x_packet0);
  
!        x->x_header->info.image.encoding = PDP_BITMAP_YV12;
!        x->x_header->info.image.width = x->x_vwidth;
!        x->x_header->info.image.height = x->x_vheight;
  
!        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_yuvbuffer.y;
!        psU = x->x_yuvbuffer.u;
!        psV = x->x_yuvbuffer.v;
  
!        for ( py=0; py<x->x_vheight; py++)
!        {
!           memcpy( (void*)pY, (void*)psY, x->x_vwidth );
!           pY += x->x_vwidth;
!           psY += x->x_yuvbuffer.y_stride;
!           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_yuvbuffer.uv_stride;
!             psV += x->x_yuvbuffer.uv_stride;
!           }
         }
!        x->x_newpicture = 1;
         // post( "pdp_icedthe~ : new picture decoded" );
         if ( pthread_mutex_unlock( &x->x_videolock ) < 0 )
--- 402,446 ----
         theora_decode_YUVout(&x->x_theora_state, &x->x_yuvbuffer); 
  
!        if ( x->x_secondcount < x->x_forcedframerate )
!        { 
!          // create a new pdp packet from PIX_FMT_YUV420P image format
!          x->x_vwidth = x->x_yuvbuffer.y_width;
!          x->x_vheight = x->x_yuvbuffer.y_height;
!          x->x_vsize = x->x_vwidth*x->x_vheight;
!          x->x_packet0 = pdp_packet_new_bitmap_yv12( x->x_vwidth, x->x_vheight );
!          // post( "pdp_icedthe~ : allocated packet %d", x->x_packet0 );
!          x->x_header = pdp_packet_header(x->x_packet0);
!          x->x_data = (unsigned char*) pdp_packet_data(x->x_packet0);
  
!          x->x_header->info.image.encoding = PDP_BITMAP_YV12;
!          x->x_header->info.image.width = x->x_vwidth;
!          x->x_header->info.image.height = x->x_vheight;
  
!          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_yuvbuffer.y;
!          psU = x->x_yuvbuffer.u;
!          psV = x->x_yuvbuffer.v;
  
!          for ( py=0; py<x->x_vheight; py++)
!          {
!             memcpy( (void*)pY, (void*)psY, x->x_vwidth );
!             pY += x->x_vwidth;
!             psY += x->x_yuvbuffer.y_stride;
!             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_yuvbuffer.uv_stride;
!               psV += x->x_yuvbuffer.uv_stride;
!             }
!          }
!          x->x_newpicture = 1;
         }
!  
         // post( "pdp_icedthe~ : new picture decoded" );
         if ( pthread_mutex_unlock( &x->x_videolock ) < 0 )
***************
*** 506,509 ****
--- 519,574 ----
  }
  
+ static void pdp_icedthe_split_url(t_pdp_icedthe *x)
+ {
+   char *hostptr = NULL, *p, *endhost = NULL, *pathptr = NULL;
+   t_int length;
+ 
+      /* strip http:// or ftp:// */
+    p = x->x_url;
+    if (strncmp(p, "http://", 7) == 0) p+=7;
+ 
+    hostptr = p;
+    while (*p && *p != '/' && *p != ':')  /* look for end of hostname: */ p++;
+ 
+    endhost = p;
+    switch ( *p )
+    {
+       case ':' :
+          x->x_portnum = atoi( p+1 );
+          while (*p && *p != '/') p++;
+          pathptr = p+1;
+          break;
+       case '/' :
+          x->x_portnum = 8000;
+          pathptr = p+1;
+          break;
+       default :
+          if ( ( p - x->x_url ) != (int)strlen( x->x_url ) )
+          {
+             post( "pdp_icedthe~ : wrong url : %s", hostptr );
+             return;
+          }
+          pathptr = "";
+          break;
+    }
+ 
+    length = (t_int)(endhost - hostptr);
+    if ( x->x_hostname ) 
+    {
+      post ("pdp_icedthe~ : freeing hostname" );
+      free( x->x_hostname );
+    }
+    x->x_hostname=(char*)malloc( length + 1);
+    strncpy( x->x_hostname, hostptr, length );
+    x->x_hostname[ length ] = '\0';
+ 
+    if ( x->x_mountpoint ) free( x->x_mountpoint );
+    x->x_mountpoint=(char*)malloc( strlen( pathptr ) + 1);
+    strncpy( x->x_mountpoint, pathptr, strlen( pathptr ) );
+    x->x_mountpoint[ strlen( pathptr ) ] = '\0';
+ 
+    post ("pdp_icedthe~ : connecting to host=>%s< port=>%d< mountpoint=>%s<", x->x_hostname, x->x_portnum, x->x_mountpoint );
+ }
+ 
  static void pdp_icedthe_connect(t_pdp_icedthe *x, t_symbol *s);
  
***************
*** 523,527 ****
    t_int         offset = 0, endofheaders = 0, wpackets = 0;
    char          *sptr = NULL;
-   char          *url;                     /* used for relocation */
     
     if ( x->x_insock != -1 )
--- 588,591 ----
***************
*** 531,535 ****
     }
  
-    sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     if ( ( sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) ) <= 0 )
     {
--- 595,598 ----
***************
*** 625,629 ****
     }
  
!    // post( "pdp_icedthe~ : read HTTP headers : %s", x->x_request );
     post( "pdp_icedthe~ : got HTTP answer" );
  
--- 688,692 ----
     }
  
!    post( "pdp_icedthe~ : read HTTP headers : %s", x->x_request );
     post( "pdp_icedthe~ : got HTTP answer" );
  
***************
*** 640,648 ****
            return NULL;
         }
!        url = strdup(cpoint + 10);
!        post("pdp_icedthe~: relocating to %s", url);
!        if ( close(sockfd) < 0 ) post("pdp_icedthe~: could not close socket" );
!        x->x_connectchild = 0;
!        pdp_icedthe_connect(x, gensym(url));
         return NULL;
     }
--- 703,712 ----
            return NULL;
         }
!        if ( x->x_url ) free( x->x_url );
!        x->x_url = strdup(cpoint + 10);
!        post("pdp_icedthe~: relocating to %s", x->x_url);
!        pdp_icedthe_split_url(x);
!        x->x_connected = 0;
!        pdp_icedthe_do_connect(x);
         return NULL;
     }
***************
*** 1050,1056 ****
  static void pdp_icedthe_connect(t_pdp_icedthe *x, t_symbol *s)
  {
!   t_int ret, i, length;
    pthread_attr_t connect_child_attr;
-   char *hostptr = NULL, *p, *endhost = NULL, *pathptr = NULL;
  
     if ( x->x_connectchild != 0 )
--- 1114,1119 ----
  static void pdp_icedthe_connect(t_pdp_icedthe *x, t_symbol *s)
  {
!   t_int ret, i;
    pthread_attr_t connect_child_attr;
  
     if ( x->x_connectchild != 0 )
***************
*** 1072,1120 ****
     post ("pdp_icedthe~ : connecting to url=%s", x->x_url );
  
!      /* strip http:// or ftp:// */
!    p = x->x_url;
!    if (strncmp(p, "http://", 7) == 0) p+=7;
! 
!    hostptr = p;
!    while (*p && *p != '/' && *p != ':')  /* look for end of hostname: */ p++;
! 
!    endhost = p;
!    switch ( *p )
!    {
!       case ':' :
!          x->x_portnum = atoi( p+1 );
!          while (*p && *p != '/') p++;
!          pathptr = p+1;
!          break;
!       case '/' :
!          x->x_portnum = 8000;
!          pathptr = p+1;
!          break;
!       default :
!          if ( ( p - x->x_url ) != (int)strlen( x->x_url ) )
!          {
!             post( "pdp_icedthe~ : wrong url : %s", hostptr );
!             return;
!          }
!          pathptr = "";
!          break;
!    }
! 
!    length = (t_int)(endhost - hostptr);
!    if ( x->x_hostname ) 
!    {
!      post ("pdp_icedthe~ : freeing hostname" );
!      free( x->x_hostname );
!    }
!    x->x_hostname=(char*)malloc( length + 1);
!    strncpy( x->x_hostname, hostptr, length );
!    x->x_hostname[ length ] = '\0';
! 
!    if ( x->x_mountpoint ) free( x->x_mountpoint );
!    x->x_mountpoint=(char*)malloc( strlen( pathptr ) + 1);
!    strncpy( x->x_mountpoint, pathptr, strlen( pathptr ) );
!    x->x_mountpoint[ strlen( pathptr ) ] = '\0';
! 
!    post ("pdp_icedthe~ : connecting to host=%s port=%d mountpoint=%s", x->x_hostname, x->x_portnum, x->x_mountpoint );
  
     // launch connection thread
--- 1135,1139 ----
     post ("pdp_icedthe~ : connecting to url=%s", x->x_url );
  
!    pdp_icedthe_split_url(x);
  
     // launch connection thread
***************
*** 1314,1317 ****
--- 1333,1337 ----
      x->x_priority = DEFAULT_PRIORITY;
      x->x_framerate = DEFAULT_FRAME_RATE;
+     x->x_forcedframerate = 1024; // think it will not occur or maybe in 2156
      x->x_nbframes = 0;
      x->x_samplerate = 0;
***************
*** 1360,1363 ****
--- 1380,1384 ----
      class_addmethod(pdp_icedthe_class, (t_method)pdp_icedthe_disconnect, gensym("disconnect"), A_NULL);
      class_addmethod(pdp_icedthe_class, (t_method)pdp_icedthe_priority, gensym("priority"), A_FLOAT, A_NULL);
+     class_addmethod(pdp_icedthe_class, (t_method)pdp_icedthe_framerate, gensym("framerate"), A_FLOAT, A_NULL);
      class_addmethod(pdp_icedthe_class, (t_method)pdp_icedthe_audio, gensym("audio"), A_FLOAT, A_NULL);
      class_sethelpsymbol( pdp_icedthe_class, gensym("pdp_icedthe~.pd") );

Index: pdp_capture.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_capture.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_capture.c	17 Sep 2003 20:02:37 -0000	1.2
--- pdp_capture.c	9 Jul 2005 19:35:40 -0000	1.3
***************
*** 30,33 ****
--- 30,34 ----
  #include <X11/Xlib.h>
  #include <X11/Xatom.h>
+ #include <magick/methods.h>
  #include <magick/api.h>
  #include <magick/magick.h>
***************
*** 36,39 ****
--- 37,45 ----
  #define PDP_DISPLAY_LENGTH 1024
  
+ // trick to handle Image Magick compatibility
+ #if MagickLibVersion >= 0x619
+ #include "../include/xwindow-private.h"
+ #endif
+ 
  static char   *pdp_capture_version = "pdp_capture: version 0.1, capture of screen written by Yves Degoyon (ydegoyon at free.fr)";
  





More information about the Pd-cvs mailing list