aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN.N. <sevyves@users.sourceforge.net>2003-10-24 02:40:18 +0000
committerN.N. <sevyves@users.sourceforge.net>2003-10-24 02:40:18 +0000
commit32cf526237040a10eb5b2ccb8eb1f3026c7a7705 (patch)
treec0178fbb4c65fcd514d22d36d8a72f7181fa7886
parent7467da1f33ae253a5cd628a04d018d9552d4eafc (diff)
Added frame rate
svn path=/trunk/externals/pidip/; revision=1130
-rw-r--r--doc/help-pdp_yqt.pd27
-rw-r--r--modules/pdp_yqt.c41
2 files changed, 45 insertions, 23 deletions
diff --git a/doc/help-pdp_yqt.pd b/doc/help-pdp_yqt.pd
index ab21309..b3b6809 100644
--- a/doc/help-pdp_yqt.pd
+++ b/doc/help-pdp_yqt.pd
@@ -27,31 +27,34 @@
#X floatatom 317 164 5 0 0 0 - - -;
#X text 368 164 Frame command;
#X obj 316 183 t b f;
-#X obj 296 261 dac~;
-#X obj 225 223 pdp_yqt;
+#X obj 320 259 dac~;
#X text 81 360 pdp_yqt : quicktime movie reader with audio support
;
#X text 82 392 with big plundering from pdp_qt ( Tom Schouten );
#X text 81 376 written by Yves Degoyon;
+#X floatatom 328 331 5 0 0 0 - - -;
+#X text 377 331 Frame rate;
+#X obj 225 223 pdp_yqt ----------;
#X connect 1 0 10 0;
-#X connect 2 0 24 0;
+#X connect 2 0 29 0;
#X connect 3 0 2 0;
-#X connect 4 0 24 0;
+#X connect 4 0 29 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 24 0;
+#X connect 10 0 29 0;
#X connect 11 0 13 0;
#X connect 12 0 15 0;
#X connect 13 0 12 0;
#X connect 15 0 14 0;
#X connect 20 0 22 0;
-#X connect 22 0 24 0;
-#X connect 22 1 24 1;
-#X connect 24 0 0 0;
-#X connect 24 1 16 0;
-#X connect 24 2 17 0;
-#X connect 24 3 23 0;
-#X connect 24 4 23 1;
+#X connect 22 0 29 0;
+#X connect 22 1 29 1;
+#X connect 29 0 0 0;
+#X connect 29 1 16 0;
+#X connect 29 2 17 0;
+#X connect 29 3 27 0;
+#X connect 29 4 23 0;
+#X connect 29 5 23 1;
diff --git a/modules/pdp_yqt.c b/modules/pdp_yqt.c
index 26cffa9..2a37414 100644
--- a/modules/pdp_yqt.c
+++ b/modules/pdp_yqt.c
@@ -22,6 +22,8 @@
#include "pdp.h"
#include "pdp_llconv.h"
+#include "time.h"
+#include "sys/time.h"
#include <quicktime/lqt.h>
#include <quicktime/colormodels.h>
@@ -35,22 +37,25 @@ typedef struct pdp_yqt_struct
t_float x_f;
t_outlet *x_outlet0;
- t_outlet *x_outlet1;
- t_outlet *x_outlet2;
- t_outlet *x_outlet3; /* audio left channel */
- t_outlet *x_outlet4; /* audio right channel */
+ t_outlet *x_curframe;
+ t_outlet *x_nbframes;
+ t_outlet *x_framerate;
+ t_outlet *x_ol; /* audio left channel */
+ t_outlet *x_or; /* audio right channel */
int packet0;
bool initialized;
unsigned int x_vwidth;
unsigned int x_vheight;
+ t_int x_cursec;
+ t_int x_framescount;
bool loop;
unsigned char * qt_rows[3];
- unsigned char * qt_frame;
+ unsigned char *qt_frame;
quicktime_t *qt;
int qt_cmodel;
@@ -124,7 +129,7 @@ static void pdp_yqt_open(t_pdp_yqt *x, t_symbol *name)
quicktime_set_cmodel(x->qt, x->qt_cmodel);
x->initialized = true;
- outlet_float(x->x_outlet2, (float)quicktime_video_length(x->qt,0));
+ outlet_float(x->x_nbframes, (float)quicktime_video_length(x->qt,0));
}
@@ -175,6 +180,7 @@ static void pdp_yqt_bang(t_pdp_yqt *x)
int object, length, pos, i, j;
short int* data;
t_pdp* header;
+ struct timeval etime;
if (!(x->initialized)){
//post("pdp_yqt: no qt file opened");
@@ -228,8 +234,20 @@ static void pdp_yqt_bang(t_pdp_yqt *x)
post("pdp_yqt : error on decode: unkown colour model");
break;
}
+
+ if ( gettimeofday(&etime, NULL) == -1)
+ {
+ post("pdp_fcqt : could not get time" );
+ }
+ if ( etime.tv_sec != x->x_cursec )
+ {
+ x->x_cursec = etime.tv_sec;
+ outlet_float(x->x_framerate, (float)x->x_framescount);
+ x->x_framescount = 0;
+ }
+ x->x_framescount++;
- outlet_float(x->x_outlet1, (float)pos);
+ outlet_float(x->x_curframe, (float)pos);
pdp_packet_pass_if_valid(x->x_outlet0, &object);
// fills in the audio buffer with a chunk if necessary
@@ -317,11 +335,12 @@ void *pdp_yqt_new(void)
inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("frame_cold"));
x->x_outlet0 = outlet_new(&x->x_obj, &s_anything);
- x->x_outlet1 = outlet_new(&x->x_obj, &s_float);
- x->x_outlet2 = outlet_new(&x->x_obj, &s_float);
+ x->x_curframe = outlet_new(&x->x_obj, &s_float);
+ x->x_nbframes = outlet_new(&x->x_obj, &s_float);
+ x->x_framerate = outlet_new(&x->x_obj, &s_float);
- x->x_outlet3 = outlet_new(&x->x_obj, &s_signal); /* audio left channel */
- x->x_outlet4 = outlet_new(&x->x_obj, &s_signal); /* audio right channel */
+ x->x_ol = outlet_new(&x->x_obj, &s_signal); /* audio left channel */
+ x->x_or = outlet_new(&x->x_obj, &s_signal); /* audio right channel */
x->packet0 = -1;