Update of /cvsroot/pure-data/externals/pidip/modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10577/modules
Modified Files:
Makefile Makefile.in pdp_cmap.c pdp_compose.c pdp_ctrack.c
pdp_ffmpeg~.c pdp_imgloader.c pdp_live~.c pdp_shape.c
pdp_simura.c pdp_spigot.c pdp_xcanvas.c pdp_yqt.c
pdp_yvu2rgb.c
Log Message:
PiDiP 0.12.13
Index: pdp_xcanvas.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_xcanvas.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_xcanvas.c 8 Dec 2003 22:45:54 -0000 1.2
--- pdp_xcanvas.c 30 Mar 2004 01:56:16 -0000 1.3
***************
*** 19,23 ****
*/
! /* This object is an object allowing juxtaposition of frames from two inlets
* Written by Yves Degoyon
*/
--- 19,24 ----
*/
! /* This object is a video canvas which is also handling the graphical operations
! * ( no need to plug it in pdp_xv )
* Written by Yves Degoyon
*/
Index: Makefile.in
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/Makefile.in,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Makefile.in 8 Dec 2003 22:45:54 -0000 1.10
--- Makefile.in 30 Mar 2004 01:56:16 -0000 1.11
***************
*** 12,20 ****
pdp_dice.o pdp_puzzle.o pdp_text.o pdp_form.o \
pdp_compose.o pdp_cmap.o pdp_ascii.o \
! pdp_ffmpeg~.o pdp_live~.o pdp_segsnd~.o pdp_noquark.o \
! pdp_juxta.o pdp_capture.o pdp_smuck.o pdp_lumafilt.o \
pdp_transition.o pdp_imgloader.o pdp_imgsaver.o pdp_cache.o \
pdp_canvas.o pdp_pen.o pdp_shape.o pdp_fqt.o pdp_fcqt.o \
! pdp_ocanvas.o # pdp_xcanvas.o pdp_aa.o
all_modules: $(OBJECTS)
--- 12,21 ----
pdp_dice.o pdp_puzzle.o pdp_text.o pdp_form.o \
pdp_compose.o pdp_cmap.o pdp_ascii.o \
! pdp_segsnd~.o pdp_noquark.o pdp_juxta.o \
! pdp_capture.o pdp_smuck.o pdp_lumafilt.o \
pdp_transition.o pdp_imgloader.o pdp_imgsaver.o pdp_cache.o \
pdp_canvas.o pdp_pen.o pdp_shape.o pdp_fqt.o pdp_fcqt.o \
! pdp_ocanvas.o pdp_spotlight.o @PDP_STREAMING_OBJECTS@
! # pdp_xcanvas.o pdp_aa.o
all_modules: $(OBJECTS)
Index: pdp_ctrack.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_ctrack.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_ctrack.c 17 Sep 2003 20:03:44 -0000 1.2
--- pdp_ctrack.c 30 Mar 2004 01:56:16 -0000 1.3
***************
*** 23,26 ****
--- 23,27 ----
#include "pdp.h"
+ #include "g_canvas.h"
#include "yuv.h"
#include <math.h>
***************
*** 125,129 ****
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! pdp_ctrack_draw_color( x );
outlet_float( x->x_R, x->x_colorR );
}
--- 126,130 ----
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! if (glist_isvisible(x->x_canvas)) pdp_ctrack_draw_color( x );
outlet_float( x->x_R, x->x_colorR );
}
***************
*** 138,142 ****
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! pdp_ctrack_draw_color( x );
outlet_float( x->x_G, x->x_colorG );
}
--- 139,143 ----
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! if (glist_isvisible(x->x_canvas)) pdp_ctrack_draw_color( x );
outlet_float( x->x_G, x->x_colorG );
}
***************
*** 151,155 ****
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! pdp_ctrack_draw_color( x );
outlet_float( x->x_B, x->x_colorB );
}
--- 152,156 ----
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! if (glist_isvisible(x->x_canvas)) pdp_ctrack_draw_color( x );
outlet_float( x->x_B, x->x_colorB );
}
***************
*** 219,222 ****
--- 220,224 ----
&& ( x->x_cursY > 0 ) && ( x->x_cursY < x->x_vheight ) )
{
+ // post( "pdp_ctrack : picking up color : x=%d y=%d", x->x_cursX, x->x_cursY );
x->x_colorY = x->x_frame[ x->x_cursY*x->x_vwidth+x->x_cursX ];
x->x_colorV = x->x_frame[ x->x_vsize + (x->x_cursY>>1)*(x->x_vwidth>>1)+(x->x_cursX>>1) ];
***************
*** 231,235 ****
x->x_colorB = yuv_YUVtoB( y, u, v );
outlet_float( x->x_B, x->x_colorB );
! pdp_ctrack_draw_color( x );
}
}
--- 233,237 ----
x->x_colorB = yuv_YUVtoB( y, u, v );
outlet_float( x->x_B, x->x_colorB );
! if (glist_isvisible(x->x_canvas)) pdp_ctrack_draw_color( x );
}
}
Index: pdp_yvu2rgb.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_yvu2rgb.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_yvu2rgb.c 17 Sep 2003 20:10:29 -0000 1.2
--- pdp_yvu2rgb.c 30 Mar 2004 01:56:16 -0000 1.3
***************
*** 1,5 ****
/*
! * Pure Data Packet module.
! * Copyright (c) by Tom Schouten <pdp(a)zzz.kotnet.org>
*
* This program is free software; you can redistribute it and/or modify
--- 1,5 ----
/*
! * PiDiP module.
! * Copyright (c) by Yves Degoyon (ydegoyon(a)free.fr)
*
* This program is free software; you can redistribute it and/or modify
Index: pdp_live~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_live~.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_live~.c 17 Sep 2003 20:05:50 -0000 1.2
--- pdp_live~.c 30 Mar 2004 01:56:16 -0000 1.3
***************
*** 1,5 ****
/*
! * Pure Data Packet module.
! * Copyright (c) by Tom Schouten <pdp(a)zzz.kotnet.org>
*
* This program is free software; you can redistribute it and/or modify
--- 1,5 ----
/*
! * PiDiP module.
! * Copyright (c) by Yves Degoyon (ydegoyon(a)free.fr)
*
* This program is free software; you can redistribute it and/or modify
***************
*** 39,50 ****
#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)
#define DEFAULT_CHANNELS 1
- #define DEFAULT_FRAME_RATE 25
#define DEFAULT_WIDTH 320
#define DEFAULT_HEIGHT 240
#define DEFAULT_PRIORITY 0
static char *pdp_live_version = "pdp_live~: version 0.1, a video stream decoder ( ydegoyon(a)free.fr).";
--- 39,58 ----
#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 -20
#define DEFAULT_PRIORITY 0
+ #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(a)free.fr).";
***************
*** 69,72 ****
--- 77,82 ----
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
***************
*** 77,80 ****
--- 87,92 ----
char *x_url;
t_int x_streaming; // streaming flag
+ t_int x_nopackets; // no packet to decode
+ t_int x_endofstream; // end of the stream reached
t_int x_nbframes; // number of frames emitted
t_int x_framerate; // framerate
***************
*** 82,85 ****
--- 94,98 ----
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
***************
*** 87,90 ****
--- 100,104 ----
t_int x_nbvideostreams; // number of video streams
t_int x_nbaudiostreams; // number of audio streams
+ t_int x_videoindex; // index of the first video stream
/* AV data structures */
***************
*** 93,96 ****
--- 107,112 ----
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
t_int x_newpicture;
***************
*** 106,110 ****
static void pdp_live_priority(t_pdp_live *x, t_floatarg fpriority )
{
! x->x_priority = (int)fpriority;
}
--- 122,129 ----
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;
! }
}
***************
*** 132,135 ****
--- 151,155 ----
uint8_t *pcktptr;
struct timeval etime;
+ struct timespec mwait;
if ( !x->x_streaming )
***************
*** 138,153 ****
}
// read new packet on the stream
if (av_read_packet(x->x_avcontext, &x->x_pkt) < 0)
{
! // post( "pdp_live~ : decoding thread : nothing to decode" );
return -1;
}
// post( "pdp_live~ : read packet ( size=%d )", x->x_pkt.size );
if (x->x_pkt.stream_index >= x->x_avcontext->nb_streams)
{
post("pdp_live~ : stream received out of range !! ");
! return 0;
}
--- 158,180 ----
}
+ // post( "pdp_live~ : trying to read packet" );
// read new packet on the stream
if (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;
! }
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;
}
***************
*** 212,217 ****
{
post( "pdp_live~ : audio overflow : packet ignored...");
}
! if ( ( x->x_audioin_position > MIN_AUDIO_SIZE ) && (!x->x_audioon) )
{
x->x_audioon = 1;
--- 239,245 ----
{
post( "pdp_live~ : audio overflow : packet ignored...");
+ x->x_audioin_position = 0;
}
! if ( ( x->x_audioin_position > x->x_blocksize ) && (!x->x_audioon) )
{
x->x_audioon = 1;
***************
*** 225,241 ****
x->x_avcontext->streams[x->x_pkt.stream_index]->codec.height * 3) / 2; // yuv planar
! // do not believe the declared framerate
! // x->x_framerate = x->x_avcontext->streams[x->x_pkt.stream_index]->codec.frame_rate / 10000;
// calculate actual frame rate
! if ( gettimeofday(&etime, NULL) == -1)
! {
! post("pdp_live~ : could not read time" );
! }
! if ( ( etime.tv_sec - x->x_starttime.tv_sec ) > 0 )
! {
! x->x_framerate = x->x_nbframes / ( etime.tv_sec - x->x_starttime.tv_sec );
! }
! if ( x->x_framerate == 0 ) x->x_framerate = 1;
// post ("pdp_live~ : frame rate is %d", x->x_framerate );
--- 253,269 ----
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;
! x->x_videoindex = x->x_pkt.stream_index;
// calculate actual frame rate
! // if ( gettimeofday(&etime, NULL) == -1)
! // {
! // post("pdp_live~ : could not read time" );
! // }
! // if ( ( etime.tv_sec - x->x_starttime.tv_sec ) > 0 )
! // {
! // x->x_framerate = x->x_nbframes / ( etime.tv_sec - x->x_starttime.tv_sec );
! // }
! // if ( x->x_framerate == 0 ) x->x_framerate = 1;
// post ("pdp_live~ : frame rate is %d", x->x_framerate );
***************
*** 277,283 ****
--- 305,333 ----
{
x->x_newpicture=1;
+ x->x_previouspts = x->x_pts;
+ x->x_pts = frame.pts;
+ // post( "pdp_live : frame pts : %ld", x->x_pts );
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;
x->x_vsize = x->x_vwidth*x->x_vheight;
+
+ if ( x->x_previouspts != -1 )
+ {
+ mwait.tv_sec = 0;
+ mwait.tv_nsec = (x->x_pts - x->x_previouspts)*1000;
+
+ if ( ( x->x_pts == 0 ) )
+ {
+ // post("pdp_live~ : no presentation time stamp, using framerate :%d",
+ // x->x_framerate );
+ mwait.tv_sec = 0;
+ mwait.tv_nsec = 1000000000/((x->x_framerate+5)); // the +5 is experimental
+ // it comes from the time used in decoding
+ }
+
+ nanosleep( &mwait, NULL ); // wait between the two successive frames
+ // i know, cheap flow control
+ }
+
}
break;
***************
*** 336,339 ****
--- 386,390 ----
nanosleep( &twait, NULL ); // nothing to read, just wait
}
+
}
***************
*** 354,357 ****
--- 405,409 ----
x->x_avparameters.frame_rate = DEFAULT_FRAME_RATE;
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;
***************
*** 453,456 ****
--- 505,510 ----
}
x->x_streaming = 1;
+ x->x_nopackets = 0;
+ x->x_endofstream = 0;
x->x_nbframes = 0;
***************
*** 491,495 ****
twait.tv_sec = 0;
! twait.tv_nsec = 100000000; // 100 ms
if (!x->x_streaming)
--- 545,549 ----
twait.tv_sec = 0;
! twait.tv_nsec = 10000000; // 10 ms
if (!x->x_streaming)
***************
*** 521,524 ****
--- 575,580 ----
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)
***************
*** 584,592 ****
// decode a packet if not in thread mode
! if ( !x->x_usethread )
{
pdp_live_decode_packet( x );
}
// just read the buffer
if ( x->x_audioon )
--- 640,650 ----
// 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 )
***************
*** 610,615 ****
out2++;
}
- x->x_audioin_position-=sn;
memcpy( &x->x_audio_in[0], &x->x_audio_in[sn], 4*MAX_AUDIO_PACKET_SIZE-sn );
// post( "pdp_live~ : audio in position : %d", x->x_audioin_position );
if ( x->x_audioin_position <= sn )
--- 668,673 ----
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 <= sn )
***************
*** 637,640 ****
--- 695,699 ----
{
x->x_cursec = etime.tv_sec;
+ if (x->x_streaming) outlet_float( x->x_outlet_framerate, x->x_framerate );
x->x_secondcount = 0;
}
***************
*** 681,685 ****
// update streaming status
- outlet_float( x->x_outlet_streaming, x->x_streaming );
x->x_nbframes++;
x->x_secondcount++;
--- 740,743 ----
***************
*** 688,691 ****
--- 746,751 ----
x->x_newpicture = 0;
}
+ outlet_float( x->x_outlet_streaming, x->x_streaming );
+ outlet_float( x->x_outlet_endofstream, x->x_endofstream );
return (w+5);
***************
*** 731,734 ****
--- 791,796 ----
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;
***************
*** 737,742 ****
x->x_usethread = 1;
x->x_priority = DEFAULT_PRIORITY;
- x->x_nbframes = 0;
x->x_framerate = DEFAULT_FRAME_RATE;
x->x_samplerate = 0;
x->x_audiochannels = 0;
--- 799,805 ----
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;
***************
*** 745,750 ****
--- 808,820 ----
x->x_audio_resample_ctx = NULL;
x->x_nbvideostreams = 0;
+ x->x_videoindex = 0;
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_pts = -1;
+ x->x_previouspts = -1;
x->x_avcontext = av_mallocz(sizeof(AVFormatContext));
***************
*** 777,785 ****
(t_method)pdp_live_free, sizeof(t_pdp_live), 0, A_NULL);
! class_addmethod(pdp_live_class, (t_method)pdp_live_dsp, gensym("dsp"), 0);
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_sethelpsymbol( pdp_live_class, gensym("pdp_live~.pd") );
--- 847,856 ----
(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_threadify, gensym("thread"), A_FLOAT, A_NULL);
class_sethelpsymbol( pdp_live_class, gensym("pdp_live~.pd") );
Index: pdp_compose.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_compose.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_compose.c 17 Sep 2003 20:03:32 -0000 1.2
--- pdp_compose.c 30 Mar 2004 01:56:16 -0000 1.3
***************
*** 24,27 ****
--- 24,28 ----
#include "pdp.h"
+ #include "g_canvas.h"
#include "yuv.h"
#include <math.h>
***************
*** 118,122 ****
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! pdp_compose_draw_color( x );
}
}
--- 119,123 ----
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! if (glist_isvisible(x->x_canvas)) pdp_compose_draw_color( x );
}
}
***************
*** 130,134 ****
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! pdp_compose_draw_color( x );
}
}
--- 131,135 ----
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! if (glist_isvisible(x->x_canvas)) pdp_compose_draw_color( x );
}
}
***************
*** 142,146 ****
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! pdp_compose_draw_color( x );
}
}
--- 143,147 ----
x->x_colorU = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colorV = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! if (glist_isvisible(x->x_canvas)) pdp_compose_draw_color( x );
}
}
***************
*** 202,206 ****
x->x_colorG = yuv_YUVtoG( y, u, v );
x->x_colorB = yuv_YUVtoB( y, u, v );
! pdp_compose_draw_color( x );
}
}
--- 203,207 ----
x->x_colorG = yuv_YUVtoG( y, u, v );
x->x_colorB = yuv_YUVtoB( y, u, v );
! if (glist_isvisible(x->x_canvas)) pdp_compose_draw_color( x );
}
}
Index: pdp_cmap.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_cmap.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_cmap.c 17 Sep 2003 20:03:17 -0000 1.2
--- pdp_cmap.c 30 Mar 2004 01:56:16 -0000 1.3
***************
*** 23,26 ****
--- 23,27 ----
#include "pdp.h"
+ #include "g_canvas.h"
#include "yuv.h"
#include <math.h>
***************
*** 119,123 ****
x->x_colors[x->x_current].u = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colors[x->x_current].v = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! pdp_cmap_draw_color( x, x->x_colorR, x->x_colorG, x->x_colorB );
}
}
--- 120,124 ----
x->x_colors[x->x_current].u = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colors[x->x_current].v = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! if (glist_isvisible(x->x_canvas)) pdp_cmap_draw_color( x, x->x_colorR, x->x_colorG, x->x_colorB );
}
}
***************
*** 131,135 ****
x->x_colors[x->x_current].u = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colors[x->x_current].v = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! pdp_cmap_draw_color( x, x->x_colorR, x->x_colorG, x->x_colorB );
}
}
--- 132,136 ----
x->x_colors[x->x_current].u = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colors[x->x_current].v = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! if (glist_isvisible(x->x_canvas)) pdp_cmap_draw_color( x, x->x_colorR, x->x_colorG, x->x_colorB );
}
}
***************
*** 143,147 ****
x->x_colors[x->x_current].u = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colors[x->x_current].v = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! pdp_cmap_draw_color( x, x->x_colorR, x->x_colorG, x->x_colorB );
}
}
--- 144,148 ----
x->x_colors[x->x_current].u = (yuv_RGBtoU( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
x->x_colors[x->x_current].v = (yuv_RGBtoV( (x->x_colorR << 16) + (x->x_colorG << 8) + x->x_colorB )-128)<<8;
! if (glist_isvisible(x->x_canvas)) pdp_cmap_draw_color( x, x->x_colorR, x->x_colorG, x->x_colorB );
}
}
***************
*** 281,285 ****
x->x_colorG = yuv_YUVtoG( y, u, v );
x->x_colorB = yuv_YUVtoB( y, u, v );
! pdp_cmap_draw_color( x, x->x_colorR, x->x_colorG, x->x_colorB );
x->x_colors[x->x_current].y = 255;
x->x_colors[x->x_current].u = 255;
--- 282,286 ----
x->x_colorG = yuv_YUVtoG( y, u, v );
x->x_colorB = yuv_YUVtoB( y, u, v );
! if (glist_isvisible(x->x_canvas)) pdp_cmap_draw_color( x, x->x_colorR, x->x_colorG, x->x_colorB );
x->x_colors[x->x_current].y = 255;
x->x_colors[x->x_current].u = 255;
Index: pdp_shape.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_shape.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_shape.c 23 Oct 2003 17:18:59 -0000 1.2
--- pdp_shape.c 30 Mar 2004 01:56:16 -0000 1.3
***************
*** 57,60 ****
--- 57,61 ----
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
***************
*** 114,117 ****
--- 115,126 ----
}
+ static void pdp_shape_shape(t_pdp_shape *x, t_floatarg fshape )
+ {
+ if ( ( (t_int)fshape == 0 ) || ( (t_int)fshape == 1 ) )
+ {
+ x->x_shape = (t_int)fshape;
+ }
+ }
+
static void pdp_shape_do_detect(t_pdp_shape *x, t_floatarg X, t_floatarg Y);
static void pdp_shape_frame_detect(t_pdp_shape *x, t_floatarg X, t_floatarg Y);
***************
*** 192,198 ****
// paint it white
// post( "pdp_shape_do_detect : paint : %d %d", nX, nY );
! *(pbbY+nY*x->x_vwidth+nX) = (0xff<<7);
! *(pbbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = (0xff<<8);
! *(pbbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = (0xff<<8);
if ( ( nX < x->x_vx1 ) || ( x->x_vx1 == -1 ) )
--- 201,210 ----
// paint it white
// post( "pdp_shape_do_detect : paint : %d %d", nX, nY );
! if ( x->x_shape )
! {
! *(pbbY+nY*x->x_vwidth+nX) = (0xff<<7);
! *(pbbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = (0xff<<8);
! *(pbbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = (0xff<<8);
! }
if ( ( nX < x->x_vx1 ) || ( x->x_vx1 == -1 ) )
***************
*** 543,546 ****
--- 555,559 ----
x->x_tolerance = 20;
x->x_paint = 0;
+ x->x_shape = 1;
x->x_luminosity = 1;
***************
*** 575,578 ****
--- 588,592 ----
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_paint, gensym("paint"), A_FLOAT, A_NULL);
+ class_addmethod(pdp_shape_class, (t_method)pdp_shape_shape, gensym("shape"), A_FLOAT, A_NULL);
class_addmethod(pdp_shape_class, (t_method)pdp_shape_luminosity, gensym("luminosity"), A_FLOAT, A_NULL);
Index: pdp_ffmpeg~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_ffmpeg~.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_ffmpeg~.c 17 Sep 2003 20:04:26 -0000 1.2
--- pdp_ffmpeg~.c 30 Mar 2004 01:56:16 -0000 1.3
***************
*** 1,5 ****
/*
! * Pure Data Packet module.
! * Copyright (c) by Tom Schouten <pdp(a)zzz.kotnet.org>
*
* This program is free software; you can redistribute it and/or modify
--- 1,5 ----
/*
! * PiDiP module.
! * Copyright (c) by Yves Degoyon (ydegoyon(a)free.fr)
*
* This program is free software; you can redistribute it and/or modify
***************
*** 53,56 ****
--- 53,57 ----
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
***************
*** 311,315 ****
t_pdp *newheader = 0;
short int *newdata = 0;
! t_int newpacket = -1, i;
short int *pY, *pU, *pV;
uint8_t *pnY, *pnU, *pnV;
--- 312,316 ----
t_pdp *newheader = 0;
short int *newdata = 0;
! t_int newpacket = -1, i, j;
short int *pY, *pU, *pV;
uint8_t *pnY, *pnU, *pnV;
***************
*** 349,360 ****
{
*pnY = (uint8_t) (*(pY++)>>7);
- if ( *pnY > 255 ) *pnY=255;
pnY++;
if ( (px%2==0) && (py%2==0) )
{
*pnV = (uint8_t) (((*(pV++))>>8)+128);
- if ( *pnV > 255 ) *pnV=255;
*pnU = (uint8_t) (((*(pU++))>>8)+128);
- if ( *pnU > 255 ) *pnU=255;
pnU++;pnV++;
}
--- 350,358 ----
***************
*** 388,397 ****
{
x->x_cursec = etime.tv_sec;
! x->x_secondcount[ svideoindex ] = 0;
}
! if ( x->x_secondcount[ svideoindex ] >= x->x_avcontext->streams[i]->codec.frame_rate/10000 )
{
! x->x_nbframes_dropped++;
! continue;
}
--- 386,403 ----
{
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;
! }
}
! if ( x->x_secondcount[ svideoindex ] >= (x->x_avcontext->streams[i]->codec.frame_rate/10000) )
{
! // post("pdp_ffmpeg : index=%d actual : %d, nominal : %d",
! // svideoindex,
! // x->x_secondcount[ svideoindex ],
! // (x->x_avcontext->streams[i]->codec.frame_rate/10000) );
! x->x_nbframes_dropped++;
! continue;
}
***************
*** 464,468 ****
}
! // encode and send the picture
{
AVFrame aframe;
--- 470,474 ----
}
! // encode and send the picture
{
AVFrame aframe;
***************
*** 471,475 ****
memset(&aframe, 0, sizeof(AVFrame));
*(AVPicture*)&aframe= *x->x_final_picture;
!
aframe.quality = x->x_avcontext->streams[i]->quality;
--- 477,481 ----
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;
***************
*** 485,489 ****
{
x->x_nbframes++;
! x->x_secondcount[ svideoindex++ ]++;
}
}
--- 491,497 ----
{
x->x_nbframes++;
! x->x_secondcount[ svideoindex ]++;
! // post ("pdp_ffmpeg~ : index=%d count=%d", svideoindex, x->x_secondcount[ svideoindex ] );
! svideoindex++;
}
}
***************
*** 584,588 ****
if ( x->x_audioin_position == 2*MAX_AUDIO_PACKET_SIZE-1 )
{
! post( "pdp_ffmpeg~ : reaching end of audio buffer" );
}
fsample=*(in2++);
--- 592,596 ----
if ( x->x_audioin_position == 2*MAX_AUDIO_PACKET_SIZE-1 )
{
! // post( "pdp_ffmpeg~ : reaching end of audio buffer" );
}
fsample=*(in2++);
***************
*** 687,690 ****
--- 695,699 ----
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;
Index: pdp_spigot.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_spigot.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_spigot.c 17 Sep 2003 20:08:46 -0000 1.2
--- pdp_spigot.c 30 Mar 2004 01:56:16 -0000 1.3
***************
*** 1,5 ****
/*
! * Pure Data Packet module.
! * Copyright (c) by Tom Schouten <pdp(a)zzz.kotnet.org>
*
* This program is free software; you can redistribute it and/or modify
--- 1,5 ----
/*
! * PiDiP module.
! * Copyright (c) by Yves Degoyon (ydegoyon(a)free.fr)
*
* This program is free software; you can redistribute it and/or modify
Index: pdp_yqt.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_yqt.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pdp_yqt.c 24 Oct 2003 02:40:18 -0000 1.4
--- pdp_yqt.c 30 Mar 2004 01:56:16 -0000 1.5
***************
*** 1,5 ****
/*
! * Pure Data Packet module.
! * Copyright (c) by Tom Schouten <pdp(a)zzz.kotnet.org>
*
* This program is free software; you can redistribute it and/or modify
--- 1,5 ----
/*
! * PiDiP module.
! * Copyright (c) by Yves Degoyon (ydegoyon(a)free.fr)
*
* This program is free software; you can redistribute it and/or modify
Index: pdp_simura.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_simura.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_simura.c 17 Sep 2003 20:08:29 -0000 1.2
--- pdp_simura.c 30 Mar 2004 01:56:16 -0000 1.3
***************
*** 1,5 ****
/*
! * Pure Data Packet module.
! * Copyright (c) by Tom Schouten <pdp(a)zzz.kotnet.org>
*
* This program is free software; you can redistribute it and/or modify
--- 1,5 ----
/*
! * PiDiP module.
! * Copyright (c) by Yves Degoyon (ydegoyon(a)free.fr)
*
* This program is free software; you can redistribute it and/or modify
Index: Makefile
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/Makefile,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Makefile 8 Dec 2003 22:45:54 -0000 1.10
--- Makefile 30 Mar 2004 01:56:16 -0000 1.11
***************
*** 12,20 ****
pdp_dice.o pdp_puzzle.o pdp_text.o pdp_form.o \
pdp_compose.o pdp_cmap.o pdp_ascii.o \
! pdp_ffmpeg~.o pdp_live~.o pdp_segsnd~.o pdp_noquark.o \
! pdp_juxta.o pdp_capture.o pdp_smuck.o pdp_lumafilt.o \
pdp_transition.o pdp_imgloader.o pdp_imgsaver.o pdp_cache.o \
pdp_canvas.o pdp_pen.o pdp_shape.o pdp_fqt.o pdp_fcqt.o \
! pdp_ocanvas.o # pdp_xcanvas.o pdp_aa.o
all_modules: $(OBJECTS)
--- 12,21 ----
pdp_dice.o pdp_puzzle.o pdp_text.o pdp_form.o \
pdp_compose.o pdp_cmap.o pdp_ascii.o \
! pdp_segsnd~.o pdp_noquark.o pdp_juxta.o \
! pdp_capture.o pdp_smuck.o pdp_lumafilt.o \
pdp_transition.o pdp_imgloader.o pdp_imgsaver.o pdp_cache.o \
pdp_canvas.o pdp_pen.o pdp_shape.o pdp_fqt.o pdp_fcqt.o \
! pdp_ocanvas.o pdp_spotlight.o pdp_live~.o pdp_ffmpeg~.o
! # pdp_xcanvas.o pdp_aa.o
all_modules: $(OBJECTS)
Index: pdp_imgloader.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_imgloader.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pdp_imgloader.c 17 Sep 2003 20:05:00 -0000 1.2
--- pdp_imgloader.c 30 Mar 2004 01:56:16 -0000 1.3
***************
*** 99,104 ****
x->x_iheight = imlib_image_get_height();
post( "pdp_imgloader : loaded : %s (%dx%d)", filename->s_name, x->x_iwidth, x->x_iheight );
! x->x_xoffset = (int) fx;
! x->x_yoffset = (int) fy;
}
--- 99,104 ----
x->x_iheight = imlib_image_get_height();
post( "pdp_imgloader : loaded : %s (%dx%d)", filename->s_name, x->x_iwidth, x->x_iheight );
! if ( fx!= 0.) x->x_xoffset = (int) fx;
! if ( fy!= 0.) x->x_yoffset = (int) fy;
}