lists@iem
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
List overview
Download
Pd-cvs
May 2008
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
pd-cvs@lists.iem.at
16 participants
271 discussions
Start a n
N
ew thread
SF.net SVN: pure-data: [9896] trunk/externals/Makefile
by eighthave@users.sourceforge.net
24 May '08
24 May '08
Revision: 9896
http://pure-data.svn.sourceforge.net/pure-data/?rev=9896&view=rev
Author: eighthave Date: 2008-05-23 19:16:16 -0700 (Fri, 23 May 2008) Log Message: ----------- fixed for new .cc files from old .cpp files in pdvjtools Modified Paths: -------------- trunk/externals/Makefile Modified: trunk/externals/Makefile =================================================================== --- trunk/externals/Makefile 2008-05-24 02:06:26 UTC (rev 9895) +++ trunk/externals/Makefile 2008-05-24 02:16:16 UTC (rev 9896) @@ -2094,9 +2094,9 @@ # PDVJTOOLS PDVJTOOLS_NAME=pdvjtools PDVJTOOLS_OBJECTS := $(wildcard $(externals_src)/pdvjtools/*/*.c) -PDVJTOOLS_CPP_OBJECTS := $(wildcard $(externals_src)/pdvjtools/*/*.cpp) +PDVJTOOLS_CPP_OBJECTS := $(wildcard $(externals_src)/pdvjtools/*/*.cc) pdvjtools: $(PDVJTOOLS_OBJECTS:.c=.$(EXTENSION)) \ -$(PDVJTOOLS_CPP_OBJECTS:.cpp=.$(EXTENSION)) +$(PDVJTOOLS_CPP_OBJECTS:.cc=.$(EXTENSION)) pdvjtools_install: pdvjtools install -d $(objectsdir)/$(PDVJTOOLS_NAME) @@ -2121,9 +2121,9 @@ pdvjtools_clean: -rm -f -- $(PDVJTOOLS_OBJECTS:.c=.$(EXTENSION)) - -rm -f -- $(PDVJTOOLS_CPP_OBJECTS:.cpp=.$(EXTENSION)) + -rm -f -- $(PDVJTOOLS_CPP_OBJECTS:.cc=.$(EXTENSION)) -rm -f -- $(PDVJTOOLS_OBJECTS:.c=.o) - -rm -f -- $(PDVJTOOLS_CPP_OBJECTS:.cpp=.o) + -rm -f -- $(PDVJTOOLS_CPP_OBJECTS:.cc=.o) -rm -f -- $(externals_src)/pdvjtools/*.bak -rm -f -- $(externals_src)/pdvjtools/*.*~ This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data: [9895] trunk/externals/pdvjtools
by eighthave@users.sourceforge.net
24 May '08
24 May '08
Revision: 9895
http://pure-data.svn.sourceforge.net/pure-data/?rev=9895&view=rev
Author: eighthave Date: 2008-05-23 19:06:26 -0700 (Fri, 23 May 2008) Log Message: ----------- fixed for new .cc files from old .cpp files Modified Paths: -------------- trunk/externals/pdvjtools/pix_preview/Makefile trunk/externals/pdvjtools/videogrid/Makefile Modified: trunk/externals/pdvjtools/pix_preview/Makefile =================================================================== --- trunk/externals/pdvjtools/pix_preview/Makefile 2008-05-24 01:55:37 UTC (rev 9894) +++ trunk/externals/pdvjtools/pix_preview/Makefile 2008-05-24 02:06:26 UTC (rev 9895) @@ -27,8 +27,8 @@ distro: clean all rm *.o -.cpp.o: - g++ $(GEM2PNM_CPPFLAGS) $(GEM2PNM_INCLUDE) -o $*.o -c $*.cpp +.cc.o: + g++ $(GEM2PNM_CPPFLAGS) $(GEM2PNM_INCLUDE) -o $*.o -c $*.cc .c.o: gcc $(GEM2PNM_CPPFLAGS) $(GEM2PNM_INCLUDE) -o $*.o -c $*.c Modified: trunk/externals/pdvjtools/videogrid/Makefile =================================================================== --- trunk/externals/pdvjtools/videogrid/Makefile 2008-05-24 01:55:37 UTC (rev 9894) +++ trunk/externals/pdvjtools/videogrid/Makefile 2008-05-24 02:06:26 UTC (rev 9895) @@ -19,8 +19,8 @@ LINUXINCLUDE = -I$(PD_SRC) -I/usr/include/ -.cpp.pd_linux: - g++ $(FFMPEG_HEADERS) -I$(PD_SRC) -fPIC -c -O -o videogrid.o videogrid.cpp +.cc.pd_linux: + g++ $(FFMPEG_HEADERS) -I$(PD_SRC) -fPIC -c -O -o videogrid.o videogrid.cc # ./tk2c.bash < $*.tk > $*.tk2c g++ $(FFMPEG_HEADERS) -export_dynamic -shared -o videogrid.pd_linux videogrid.o -lavformat -lavcodec -lavutil -lquicktime rm -f $*.o This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data: [9894] trunk/externals/pdvjtools
by eighthave@users.sourceforge.net
24 May '08
24 May '08
Revision: 9894
http://pure-data.svn.sourceforge.net/pure-data/?rev=9894&view=rev
Author: eighthave Date: 2008-05-23 18:55:37 -0700 (Fri, 23 May 2008) Log Message: ----------- renamed helpfile to standard name; renamed C++ file to .cc for easier building, since the other C++ extenrals built with Pd-extended are .cc Added Paths: ----------- trunk/externals/pdvjtools/pix_preview/pix_preview-help.pd trunk/externals/pdvjtools/videogrid/videogrid.cc Removed Paths: ------------- trunk/externals/pdvjtools/pix_preview/help-pix_preview.pd trunk/externals/pdvjtools/videogrid/videogrid.cpp Deleted: trunk/externals/pdvjtools/pix_preview/help-pix_preview.pd =================================================================== --- trunk/externals/pdvjtools/pix_preview/help-pix_preview.pd 2008-05-24 01:51:05 UTC (rev 9893) +++ trunk/externals/pdvjtools/pix_preview/help-pix_preview.pd 2008-05-24 01:55:37 UTC (rev 9894) @@ -1,77 +0,0 @@ -#N canvas 0 25 1247 665 10; -#X obj 419 -161 cnv 15 250 350 empty empty empty 20 12 0 14 -228992 --66577 0; -#X text 423 -178 Example:; -#X obj 564 122 cnv 15 100 60 empty empty empty 20 12 0 14 -195568 -66577 -0; -#N canvas 0 0 450 300 gemwin 0; -#X obj 132 136 gemwin; -#X obj 67 89 outlet; -#X obj 67 10 inlet; -#X msg 67 70 set destroy; -#X msg 132 112 create \, 1; -#X msg 198 112 destroy; -#X msg 156 71 set create; -#X obj 67 41 route create; -#X connect 2 0 7 0; -#X connect 3 0 1 0; -#X connect 4 0 0 0; -#X connect 5 0 0 0; -#X connect 6 0 1 0; -#X connect 7 0 3 0; -#X connect 7 0 4 0; -#X connect 7 1 6 0; -#X connect 7 1 5 0; -#X restore 569 161 pd gemwin; -#X msg 569 142 destroy; -#X text 565 121 Create window:; -#X obj 421 -130 cnv 15 155 250 empty empty empty 20 12 0 14 -24198 --66577 0; -#X obj 421 -155 gemhead; -#X obj 421 142 pix_texture; -#X obj 433 -125 bng 25 250 50 0 empty empty empty 0 -6 0 8 -262144 --1 -1; -#X text 475 -161 open a supported; -#X text 476 -150 movie-clip; -#X obj 446 69 unpack 0 0 0; -#X floatatom 436 92 5 0 0 3 length - -; -#X floatatom 485 92 5 0 0 3 width - -; -#X floatatom 535 92 5 0 0 3 height - -; -#X obj 490 50 bng 15 250 50 0 empty empty end_reached 20 7 0 10 -262144 --1 -1; -#X floatatom 472 15 5 0 10000 1 frame# - -; -#X obj 433 -96 openpanel; -#X msg 433 -76 open \$1; -#X obj 421 164 rectangle 4 3; -#X obj 421 33 pix_film; -#X msg 439 -33 auto \$1; -#X obj 439 -51 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 -1; -#X msg 450 -9 colorspace Grey; -#X obj 121 101 pix_preview; -#X obj 520 -36 loadbang; -#X obj 50 -136 metro 140; -#X obj 45 -165 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 -1; -#X connect 3 0 4 0; -#X connect 4 0 3 0; -#X connect 7 0 21 0; -#X connect 8 0 20 0; -#X connect 9 0 18 0; -#X connect 12 0 13 0; -#X connect 12 1 14 0; -#X connect 12 2 15 0; -#X connect 16 0 17 0; -#X connect 17 0 21 1; -#X connect 18 0 19 0; -#X connect 19 0 21 0; -#X connect 21 0 8 0; -#X connect 21 0 25 0; -#X connect 21 1 12 0; -#X connect 21 2 16 0; -#X connect 22 0 21 0; -#X connect 23 0 22 0; -#X connect 24 0 21 0; -#X connect 26 0 23 0; -#X connect 27 0 25 0; -#X connect 28 0 27 0; Copied: trunk/externals/pdvjtools/pix_preview/pix_preview-help.pd (from rev 9891, trunk/externals/pdvjtools/pix_preview/help-pix_preview.pd) =================================================================== --- trunk/externals/pdvjtools/pix_preview/pix_preview-help.pd (rev 0) +++ trunk/externals/pdvjtools/pix_preview/pix_preview-help.pd 2008-05-24 01:55:37 UTC (rev 9894) @@ -0,0 +1,77 @@ +#N canvas 0 25 1247 665 10; +#X obj 419 -161 cnv 15 250 350 empty empty empty 20 12 0 14 -228992 +-66577 0; +#X text 423 -178 Example:; +#X obj 564 122 cnv 15 100 60 empty empty empty 20 12 0 14 -195568 -66577 +0; +#N canvas 0 0 450 300 gemwin 0; +#X obj 132 136 gemwin; +#X obj 67 89 outlet; +#X obj 67 10 inlet; +#X msg 67 70 set destroy; +#X msg 132 112 create \, 1; +#X msg 198 112 destroy; +#X msg 156 71 set create; +#X obj 67 41 route create; +#X connect 2 0 7 0; +#X connect 3 0 1 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 1 0; +#X connect 7 0 3 0; +#X connect 7 0 4 0; +#X connect 7 1 6 0; +#X connect 7 1 5 0; +#X restore 569 161 pd gemwin; +#X msg 569 142 destroy; +#X text 565 121 Create window:; +#X obj 421 -130 cnv 15 155 250 empty empty empty 20 12 0 14 -24198 +-66577 0; +#X obj 421 -155 gemhead; +#X obj 421 142 pix_texture; +#X obj 433 -125 bng 25 250 50 0 empty empty empty 0 -6 0 8 -262144 +-1 -1; +#X text 475 -161 open a supported; +#X text 476 -150 movie-clip; +#X obj 446 69 unpack 0 0 0; +#X floatatom 436 92 5 0 0 3 length - -; +#X floatatom 485 92 5 0 0 3 width - -; +#X floatatom 535 92 5 0 0 3 height - -; +#X obj 490 50 bng 15 250 50 0 empty empty end_reached 20 7 0 10 -262144 +-1 -1; +#X floatatom 472 15 5 0 10000 1 frame# - -; +#X obj 433 -96 openpanel; +#X msg 433 -76 open \$1; +#X obj 421 164 rectangle 4 3; +#X obj 421 33 pix_film; +#X msg 439 -33 auto \$1; +#X obj 439 -51 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +1; +#X msg 450 -9 colorspace Grey; +#X obj 121 101 pix_preview; +#X obj 520 -36 loadbang; +#X obj 50 -136 metro 140; +#X obj 45 -165 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 +1; +#X connect 3 0 4 0; +#X connect 4 0 3 0; +#X connect 7 0 21 0; +#X connect 8 0 20 0; +#X connect 9 0 18 0; +#X connect 12 0 13 0; +#X connect 12 1 14 0; +#X connect 12 2 15 0; +#X connect 16 0 17 0; +#X connect 17 0 21 1; +#X connect 18 0 19 0; +#X connect 19 0 21 0; +#X connect 21 0 8 0; +#X connect 21 0 25 0; +#X connect 21 1 12 0; +#X connect 21 2 16 0; +#X connect 22 0 21 0; +#X connect 23 0 22 0; +#X connect 24 0 21 0; +#X connect 26 0 23 0; +#X connect 27 0 25 0; +#X connect 28 0 27 0; Copied: trunk/externals/pdvjtools/videogrid/videogrid.cc (from rev 9893, trunk/externals/pdvjtools/videogrid/videogrid.cpp) =================================================================== --- trunk/externals/pdvjtools/videogrid/videogrid.cc (rev 0) +++ trunk/externals/pdvjtools/videogrid/videogrid.cc 2008-05-24 01:55:37 UTC (rev 9894) @@ -0,0 +1,1574 @@ + +/* +videogrid external for Puredatai +Lluis Gomez i Bigorda ::
lluis-at-hangar.org
+Sergi Lario Loyo ::
slario-at-gmail.com
+ +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 3 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, see <
http://www.gnu.org/licenses/
>. +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <dirent.h> +#include <string.h> +#include <unistd.h> +#include <math.h> + +/* incloure les definicions de variables i + prototipus de dades i de funcions de puredata */ +#include "m_pd.h" +/* incloure estructures de dades i capceleres de funcions gàfiques bàsiques de pd */ +#include "g_canvas.h" +/* incloure estructures de dades i capceleres de funcions per traballar amb threads */ +#include "pthread.h" + +/*ffmpeg includes*/ +#include <ffmpeg/avcodec.h> +#include <ffmpeg/avformat.h> + +/*libquicktime includes*/ +//#include <quicktime/lqt.h> +//#include <quicktime/colormodels.h> +#include <lqt/lqt.h> +#include <lqt/colormodels.h> + + +/* &&&&&&&&&&&&&&&&&&&&&&&&&&&&& VIDEOGRID &&&&&&&&&&&&&&&&&&&&&&&&&&&&& */ + +/* definició de l'amplada i l'alçada d'una casella */ +#define W_CELL 60 +#define H_CELL 40 + +/* definició del gruix en pixels del marc del tauler */ +#define GRUIX 2 + +/* nombre de caracters per el nom del path del fitxer */ +#define BYTESNOMFITXER 512 + +/* 8bits clamp rgb values */ + +#define CLAMP8(x) (((x)<0) ? 0 : ((x>255)? 255 : (x))) + +#define BYTESNOMFITXERIMATGE 512 +#define BYTESTIPUSFROMAT 4 + +#define FORMAT_MINIATURA "ppm" +#define PATH_TEMPORAL "/tmp/vigrid_" +#define BYTES_NUM_TEMP 4 + +typedef char pathimage[BYTESNOMFITXERIMATGE]; + +typedef char tipus_format[BYTESTIPUSFROMAT]; + +#ifdef __cplusplus +extern "C" int convertir_img_ff(pathimage pathFitxer, tipus_format f, int W, int H, int posi); +#endif + +void SaveFrame(AVFrame *pFrame, int width, int height, int W, int H, int posi) +{ + FILE *pFile; + char szFilename[32]; + int nN = posi; + + /*int cont=0;*/ + + char nNstr[BYTES_NUM_TEMP]; + pathimage ig_path = PATH_TEMPORAL; + + sprintf(nNstr, "%d", nN); + strcat(ig_path,nNstr); + strcat(ig_path,"."); + strcat(ig_path,FORMAT_MINIATURA); + + // Open file + sprintf(szFilename, ig_path); + pFile=fopen(szFilename, "wb"); + if(pFile==NULL) + return; + + // Write header + fprintf(pFile, "P6\n%d %d\n255\n", W, H); + + + int w = width; + int h = height; + float k = (width/W); + float l = (height/H); + int i,j,y,x,realx; + + // Write pixel data + for(y=0; y<H; y=y++) { + for(x=0; x<W; x=x++) { + realx = ((x*k)+(3-((int)(x*k)%3)))*3; + fwrite((pFrame->data[0]+(int)(y*l)*pFrame->linesize[0])+realx, 1, 3, pFile); + } + } + + // for (i=0;i<(l*H);i=i+l) { + // for (j=0;j<(k*W);j=j+k) { + // fwrite(pFrame->data[0]+(i*pFrame->linesize[0]+j), 1, 3, pFile); + // } + // } + + // Close file + fclose(pFile); +} + +extern "C" { +int convertir_img_ff(pathimage pathFitxer, tipus_format f, int W, int H, int posi) +{ + AVFormatContext *pFormatCtx; + int i, videoStream; + AVCodecContext *pCodecCtx; + AVCodec *pCodec; + AVFrame *pFrame; + AVFrame *pFrameRGB; + AVPacket packet; + int frameFinished; + int numBytes; + uint8_t *buffer; + + int nN = posi; + + // Register all formats and codecs + av_register_all(); + + // Open video file + if(av_open_input_file(&pFormatCtx, pathFitxer, NULL, 0, NULL)!=0) + return -1; // Couldn't open file + + + // Retrieve stream information + if(av_find_stream_info(pFormatCtx)<0) + return -1; // Couldn't find stream information + + // Dump information about file onto standard error + dump_format(pFormatCtx, 0, pathFitxer, false); + + // Find the first video stream + videoStream=-1; + for(i=0; i<pFormatCtx->nb_streams; i++) + if(pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) + { + videoStream=i; + break; + } + if(videoStream==-1) + return -1; // Didn't find a video stream + + // Get a pointer to the codec context for the video stream + pCodecCtx=pFormatCtx->streams[videoStream]->codec; + + // Find the decoder for the video stream + pCodec=avcodec_find_decoder(pCodecCtx->codec_id); + if(pCodec==NULL) + return -1; // Codec not found + + // Open codec + if(avcodec_open(pCodecCtx, pCodec)<0) + return -1; // Could not open codec + + // Hack to correct wrong frame rates that seem to be generated by some + // codecs + // if(pCodecCtx->frame_rate>1000 && pCodecCtx->frame_rate_base==1) + // pCodecCtx->frame_rate_base=1000; + + // Allocate video frame + pFrame=avcodec_alloc_frame(); + + // Allocate an AVFrame structure + pFrameRGB=avcodec_alloc_frame(); + if(pFrameRGB==NULL) + return -1; + + // Determine required buffer size and allocate buffer + numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width, + pCodecCtx->height); + buffer=new uint8_t[numBytes]; + + // Assign appropriate parts of buffer to image planes in pFrameRGB + avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24, + pCodecCtx->width, pCodecCtx->height); + + // Read frames and save first five frames to disk + av_read_frame(pFormatCtx, &packet); + // Is this a packet from the video stream? + if(packet.stream_index==videoStream) + { + // Decode video frame + avcodec_decode_video(pCodecCtx, pFrame, &frameFinished, + packet.data, packet.size); + + // Did we get a video frame? + if(frameFinished) + { + // Convert the image from its native format to RGB + img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24, + (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, + pCodecCtx->height); + + // Save the frame to disk + SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, W, H, posi); + } + } + + // Free the packet that was allocated by av_read_frame + av_free_packet(&packet); + // Read frames and save first five frames to disk + av_read_frame(pFormatCtx, &packet); + // Is this a packet from the video stream? + if(packet.stream_index==videoStream) + { + // Decode video frame + avcodec_decode_video(pCodecCtx, pFrame, &frameFinished, + packet.data, packet.size); + + // Did we get a video frame? + if(frameFinished) + { + // Convert the image from its native format to RGB + img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24, + (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, + pCodecCtx->height); + + // Save the frame to disk + SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, W, H, posi); + } + } + + // Free the packet that was allocated by av_read_frame + av_free_packet(&packet); + //} + + // Free the RGB image + delete [] buffer; + av_free(pFrameRGB); + + // Free the YUV frame + av_free(pFrame); + + // Close the codec + avcodec_close(pCodecCtx); + + // Close the video file + av_close_input_file(pFormatCtx); + + return 0; +} +} + + +int convertir_img(pathimage pathFitxer, tipus_format f, int W, int H, int posi){ + /* + Quicktime per les conversions + */ + + /* RGB vectors */ + unsigned char * qt_rows[3]; + /* YUV vesctor frame */ + unsigned char *qt_frame = NULL; + /* quicktime decoder */ + quicktime_t *qt; + /* quicktime color model */ + int qt_cmodel; + + int nN = posi; + int x_vwidth = 0; + int x_vheight = 0; + /* convertir(entrada,FORMAT_MINIATURA, W_CELL, H_CELL, nN); */ + qt = quicktime_open(pathFitxer, 1, 0); + + if (!(qt)){ + /* post("videogrid: error opening qt file"); */ + return -1; + } + + if (!quicktime_has_video(qt)) { + /* post("videogrid: no video stream"); */ + quicktime_close(qt); + return -1; + + } + else if (!quicktime_supported_video(qt,0)) { + /* post("videogrid: unsupported video codec\n"); */ + quicktime_close(qt); + return -1; + } + else + { + qt_cmodel = BC_YUV420P; + x_vwidth = quicktime_video_width(qt,0); + x_vheight = quicktime_video_height(qt,0); + + + free(qt_frame); + qt_frame = (unsigned char*)malloc(x_vwidth*x_vheight*4); + + int size = x_vwidth * x_vheight; + qt_rows[0] = &qt_frame[0]; + qt_rows[2] = &qt_frame[size]; + qt_rows[1] = &qt_frame[size + (size>>2)]; + + quicktime_set_cmodel(qt, qt_cmodel); + } + + /* int length = quicktime_video_length(qt,0); */ + /* int Vpos = quicktime_video_position(qt,0); */ + lqt_decode_video(qt, qt_rows, 0); + + switch(qt_cmodel){ + case BC_YUV420P: + printf(" "); + /* post("videogrid: qt colormodel : BC_YUV420P"); */ + + /* per a fer la miniatura + cada k colomnes pillem una + cada l files pillem una */ + int w = x_vwidth; + int h = x_vheight; + int k = (w/W); + int l = (h/H); + + /*int cont=0;*/ + + char nNstr[BYTES_NUM_TEMP]; + pathimage ig_path = PATH_TEMPORAL; + + sprintf(nNstr, "%d", nN); + strcat(ig_path,nNstr); + strcat(ig_path,"."); + strcat(ig_path,FORMAT_MINIATURA); + /* printf("Creacio de la imatge %s ...",ig_path); */ + /* escriu el contingut de data a un arxiu. */ + FILE *fp = fopen(ig_path, "w"); + fprintf (fp, "P6\n%d %d\n255\n", W, H); + + int i,j,y,u,v,r,g,b; + + for (i=0;i<(l*H);i=i+l) { + for (j=0;j<(k*W);j=j+k) { + y=qt_rows[0][(w*i+j)]; + u=qt_rows[1][(w/2)*(i/2)+(j/2)]; + v=qt_rows[2][(w/2)*(i/2)+(j/2)]; + r = CLAMP8(y + 1.402 *(v-128)); + g = CLAMP8(y - 0.34414 *(u-128) - 0.71414 *(v-128)); + b = CLAMP8(y + 1.772 *(u-128)); + fprintf (fp, "%c%c%c", r,g,b); + } + } + + /* escriu el contingut de data a un arxiu.*/ + fclose (fp); + } + return 0; +} + + +typedef char path[BYTESNOMFITXER]; + + +/* estructura de dades: un node de la cua */ +struct node +{ + /* nom del path de la imatge */ + path pathFitxer; + /* apuntador al següent node en cua */ + struct node *seguent; +}; + +/* definició del tipus node */ +typedef struct node Node; + +/* estructures i tipus de dades de la cua */ +/* definició del tipus de cua */ +typedef struct +{ + Node *davanter; + Node *final; +}Cua; + +/* declaracions de les funcions */ + +/* crea una cua */ +void crearCua(Cua *cua); +/* encuara un element al final de la cua */ +void encuar (Cua *cua, path x); +/* elimina un element de la cua */ +int desencuar (Cua *cua); +/* retorna si la cua és buida */ +int cuaBuida(Cua *cua); +/* elimina el contingut de la cua */ +void eliminarCua(Cua *cua); +/* retorna el nombre de nodes de la cua */ +int numNodes(Cua *cua); +/* escriu el contingut de la cua */ +void escriuCua(Cua *cua); + + +/* implementació de les funcions */ +void crearCua(Cua *cua) +{ + cua->davanter=cua->final=NULL; +} + +/* funció que encua el node al final de la cua */ +void encuar (Cua *cua, path x) +{ + Node *nou; + nou=(Node*)malloc(sizeof(Node)); + strcpy(nou->pathFitxer,x); + nou->seguent=NULL; + if(cuaBuida(cua)) + { + cua->davanter=nou; + } + else + cua->final->seguent=nou; + cua->final=nou; +} + +/* elimina l'element del principi de la cua */ +int desencuar (Cua *cua) +{ + if(!cuaBuida(cua)) + { + Node *nou; + nou=cua->davanter; + cua->davanter=cua->davanter->seguent; + free(nou); + return 1; + } + else + { + /* printf("Cua buida\a\n"); */ + return 0; + } + +} + +/* funció que retorna si la cua és buida */ +int cuaBuida(Cua *cua) +{ + return (cua->davanter==NULL); +} + +/* elimina el contingut de la cua */ +void eliminarCua(Cua *cua) +{ + while (!cuaBuida(cua)) desencuar(cua); + printf("Cua eliminada\n"); +} + +/* funció que retorna el nombre de nodes de la cua */ +int numNodes(Cua *cua) +{ + int contador=0; + Node *actual; + actual=cua->davanter; + if(actual) contador=1; + while((actual)&&(actual != cua->final)){ + contador ++; + actual = actual->seguent; + } + return (contador); +} + +/* funció que escriu la cua de nodes per la sortida estàndard */ +void escriuCua(Cua *cua) +{ + if(!cuaBuida(cua)) + { + Node *actual; + actual=cua->davanter; + printf("CUA DE NODES\n["); + do{ + printf("#%s#",actual->pathFitxer); + actual = actual->seguent; + }while(actual); + printf("]\n"); + + } + else + printf("Cua buida\n"); +} + + +/* crear un apuntador al nou objecte */ +static t_class *videogrid_class; +/* indica el nombre de videogrid creats - utilitzat per diferenciar el nom d'instàncies d'objectes del mateix tipus */ +static int videogridcount = 0; + +/* definició de la classe i la seva estructura de dades */ + +typedef struct _videogrid { + t_object x_obj; + /* declaració de la sortida de l'objecte */ + t_outlet *x_sortida; + /* llista d'objectes gràfics */ + t_glist *x_glist; + /* nombre de files */ + int x_num_fil; + /* nombre de columnes */ + int x_num_col; + /* posició de la última imatge en el tauler */ + int x_ultima_img; + /* path del directori actual */ + path x_dir_actual; + /* path del directori a canviar */ + path x_dir_canvi; + /* posicio ultim al directori actual */ + int x_dir_pos; + /* apuntador al primer element posicionat al tauler */ + Node *x_tauler_primer; + /* cua d'imatges */ + Cua x_cua; + /* nom de l'objecte */ + t_symbol *x_name; + /* color de fons */ + t_symbol *x_color_fons; + /* color del marge */ + t_symbol *x_color_marc; + /* mutex per evitar concurrencia sobre la cua al accedir diferents threads*/ + pthread_mutex_t x_lock; + /* v 0.2 -- posicó de la cel·la seleccionada */ + int x_pos_selected; + /* v 0.2 -- color de seleccio */ + t_symbol *x_color_grasp; + +} t_videogrid; + +void load_tk_procs () { + // ########### procediments per videogrid --
slario(at)gmail.com
[a partir del codi del grid de l'Ives: ydegoyon(at)free.fr] ######### + sys_gui("proc videogrid_apply {id} {\n"); + // strip "." from the TK id to make a variable name suffix + sys_gui("set vid [string trimleft $id .]\n"); + // for each variable, make a local variable to hold its name... + sys_gui("set var_graph_name [concat graph_name_$vid]\n"); + sys_gui("global $var_graph_name\n"); + sys_gui("set var_graph_num_fil [concat graph_num_fil_$vid]\n"); + sys_gui("global $var_graph_num_fil\n"); + sys_gui("set var_graph_num_col [concat graph_num_col_$vid]\n"); + sys_gui("global $var_graph_num_col\n"); + sys_gui("set var_graph_color_fons [concat graph_color_fons_$vid]\n"); + sys_gui("global $var_graph_color_fons\n"); + sys_gui("set var_graph_color_marc [concat graph_color_marc_$vid]\n"); + sys_gui("global $var_graph_color_marc\n"); + sys_gui("set var_graph_color_grasp [concat graph_color_grasp_$vid]\n"); + sys_gui("global $var_graph_color_grasp\n"); + sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_name] [eval concat $$var_graph_num_fil] [eval concat $$var_graph_num_col] [eval concat $$var_graph_color_fons] [eval concat $$var_graph_color_marc] [eval concat $$var_graph_color_grasp] \\;]\n"); + // puts stderr $cmd + sys_gui("pd $cmd\n"); + sys_gui("}\n"); + sys_gui("proc videogrid_cancel {id} {\n"); + sys_gui("set cmd [concat $id cancel \\;]\n"); + // puts stderr $cmd + sys_gui("pd $cmd\n"); + sys_gui("}\n"); + sys_gui("proc videogrid_ok {id} {\n"); + sys_gui("videogrid_apply $id\n"); + sys_gui("videogrid_cancel $id\n"); + sys_gui("}\n"); + sys_gui("proc pdtk_videogrid_dialog {id name num_fil num_col color_fons color_marc color_grasp} {\n"); + sys_gui("set vid [string trimleft $id .]\n"); + sys_gui("set var_graph_name [concat graph_name_$vid]\n"); + sys_gui("global $var_graph_name\n"); + sys_gui("set var_graph_num_fil [concat graph_num_fil_$vid]\n"); + sys_gui("global $var_graph_num_fil\n"); + sys_gui("set var_graph_num_col [concat graph_num_col_$vid]\n"); + sys_gui("global $var_graph_num_col\n"); + sys_gui("set var_graph_color_fons [concat graph_color_fons_$vid]\n"); + sys_gui("global $var_graph_color_fons\n"); + sys_gui("set var_graph_color_marc [concat graph_color_marc_$vid]\n"); + sys_gui("global $var_graph_color_marc\n"); + sys_gui("set var_graph_color_grasp [concat graph_color_grasp_$vid]\n"); + sys_gui("global $var_graph_color_grasp\n"); + sys_gui("set $var_graph_name $name\n"); + sys_gui("set $var_graph_num_fil $num_fil\n"); + sys_gui("set $var_graph_num_col $num_col\n"); + sys_gui("set $var_graph_color_fons $color_fons\n"); + sys_gui("set $var_graph_color_marc $color_marc\n"); + sys_gui("set $var_graph_color_grasp $color_grasp\n"); + sys_gui("toplevel $id\n"); + sys_gui("wm title $id {videogrid}\n"); + sys_gui("wm protocol $id WM_DELETE_WINDOW [concat videogrid_cancel $id]\n"); + sys_gui("label $id.label -text {VIDEOGRID PROPERTIES}\n"); + sys_gui("pack $id.label -side top\n"); + sys_gui("frame $id.buttonframe\n"); + sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n"); + sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"videogrid_cancel $id\"\n"); + sys_gui("button $id.buttonframe.apply -text {Apply} -command \"videogrid_apply $id\"\n"); + sys_gui("button $id.buttonframe.ok -text {OK} -command \"videogrid_ok $id\"\n"); + sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n"); + sys_gui("pack $id.buttonframe.apply -side left -expand 1\n"); + sys_gui("pack $id.buttonframe.ok -side left -expand 1\n"); + sys_gui("frame $id.1rangef\n"); + sys_gui("pack $id.1rangef -side top\n"); + sys_gui("label $id.1rangef.lname -text \"Name :\"\n"); + sys_gui("entry $id.1rangef.name -textvariable $var_graph_name -width 7\n"); + sys_gui("pack $id.1rangef.lname $id.1rangef.name -side left\n"); + sys_gui("frame $id.2rangef\n"); + sys_gui("pack $id.2rangef -side top\n"); + sys_gui("label $id.2rangef.lnum_fil -text \"Rows :\"\n"); + sys_gui("entry $id.2rangef.num_fil -textvariable $var_graph_num_fil -width 7\n"); + sys_gui("pack $id.2rangef.lnum_fil $id.2rangef.num_fil -side left\n"); + sys_gui("frame $id.3rangef\n"); + sys_gui("pack $id.3rangef -side top\n"); + sys_gui("label $id.3rangef.lnum_col -text \"Cols :\"\n"); + sys_gui("entry $id.3rangef.num_col -textvariable $var_graph_num_col -width 7\n"); + sys_gui("pack $id.3rangef.lnum_col $id.3rangef.num_col -side left\n"); + sys_gui("frame $id.4rangef\n"); + sys_gui("pack $id.4rangef -side top\n"); + sys_gui("label $id.4rangef.lcolor_fons -text \"Bg Color :\"\n"); + sys_gui("entry $id.4rangef.color_fons -textvariable $var_graph_color_fons -width 7\n"); + sys_gui("pack $id.4rangef.lcolor_fons $id.4rangef.color_fons -side left\n"); + sys_gui("frame $id.5rangef\n"); + sys_gui("pack $id.5rangef -side top\n"); + sys_gui("label $id.5rangef.lcolor_marc -text \"Border Color :\"\n"); + sys_gui("entry $id.5rangef.color_marc -textvariable $var_graph_color_marc -width 7\n"); + sys_gui("pack $id.5rangef.lcolor_marc $id.5rangef.color_marc -side left\n"); + sys_gui("frame $id.6rangef\n"); + sys_gui("pack $id.6rangef -side top\n"); + sys_gui("label $id.6rangef.lcolor_grasp -text \"Sel Color :\"\n"); + sys_gui("entry $id.6rangef.color_grasp -textvariable $var_graph_color_grasp -width 7\n"); + sys_gui("pack $id.6rangef.lcolor_grasp $id.6rangef.color_grasp -side left\n"); + sys_gui("bind $id.1rangef.name <KeyPress-Return> [concat videogrid_ok $id]\n"); + sys_gui("bind $id.2rangef.num_fil <KeyPress-Return> [concat videogrid_ok $id]\n"); + sys_gui("bind $id.3rangef.num_col <KeyPress-Return> [concat videogrid_ok $id]\n"); + sys_gui("bind $id.4rangef.color_fons <KeyPress-Return> [concat videogrid_ok $id]\n"); + sys_gui("bind $id.5rangef.color_marc <KeyPress-Return> [concat videogrid_ok $id]\n"); + sys_gui("bind $id.6rangef.color_grasp <KeyPress-Return> [concat videogrid_ok $id]\n"); + sys_gui("focus $id.1rangef.name\n"); + sys_gui("}\n"); + sys_gui("proc table {w content args} {\n"); + sys_gui("frame $w -bg black\n"); + sys_gui("set r 0\n"); + sys_gui("foreach row $content {\n"); + sys_gui("set fields {}\n"); + sys_gui("set c 0\n"); + sys_gui("foreach col $row {\n"); + // lappend fields [label $w.$r/$c -text $col] + sys_gui("set img [image create photo -file $col]\n"); + sys_gui("lappend fields [label $w.$r/$c -image $img]\n"); + sys_gui("incr c\n"); + sys_gui("}\n"); + sys_gui("eval grid $fields -sticky news -padx 1 -pady 1\n"); + sys_gui("incr r\n"); + sys_gui("}\n"); + sys_gui("set w\n"); + sys_gui("}\n"); + sys_gui("proc pdtk_videogrid_table {id name num_fil num_col} {\n"); + sys_gui("table .tauler {\n"); + sys_gui("{sll80x60.gif 3160x120.gif sll80x60.gif}\n"); + sys_gui("{sll80x60.gif sll80x60.gif sll80x60.gif}\n"); + sys_gui("{sll80x60.ppm sll80x60.gif 3160x120.gif}\n"); + sys_gui("}\n"); + sys_gui("pack .tauler\n"); + sys_gui("}\n"); +} + +/* calcula la posició x del tauler a partir de la posició de l'element de la cua (d'esquerra a dreta) */ +int getX(t_videogrid* x, int posCua){ + int c = x->x_num_col; + int xpos = (posCua % c) * W_CELL + ((posCua % c) + 1) * GRUIX; + return(xpos + 1); +} + +/* calcula la posició y del tauler a partir de la posició de l'element de la cua (de dalt a baix) */ +int getY(t_videogrid* x, int posCua){ + int c = x->x_num_col; + int ypos = (posCua / c) * H_CELL + ((posCua / c) + 1) * GRUIX; + return(ypos + 1); +} + +/* elimina les imatges temporals */ +void eliminar_imatges_temporals(int maxim){ + FILE *fitxer; + path path_total; + int contador = 0; + char contador_str[BYTES_NUM_TEMP]; + while(contador < maxim){ + strcpy(path_total,PATH_TEMPORAL); + sprintf(contador_str,"%d", contador); + strcat(path_total,contador_str); + strcat(path_total,"."); + strcat(path_total,FORMAT_MINIATURA); + /* elimina el fitxer si no hi ha cap problema */ + if(unlink(path_total)){ + /* post("Imatge temporal %s eliminada\n",path_total); */ + } + contador++; + } + /* post("Videogrid: Imatges temporals eliminades\n",path_total); */ +} + +int format_adequat_v(path nomF){ + int retorn = 0; + path ig_path = ""; + strcat(ig_path,nomF); + char *t1; + path extensio = ""; + for ( t1 = strtok(ig_path,"."); + t1 != NULL; + t1 = strtok(NULL,".") ) + strcpy(extensio,t1); + if(strcmp(extensio,"mov")==0) retorn = 1; + /* + if(strcmp(extensio,"eps")==0) retorn = 1; + if(strcmp(extensio,"gif")==0) retorn = 1; + if(strcmp(extensio,"jpg")==0) retorn = 1; + if(strcmp(extensio,"jpeg")==0) retorn = 1; + if(strcmp(extensio,"png")==0) retorn = 1; + if(strcmp(extensio,"ppm")==0) retorn = 1; + if(strcmp(extensio,"tif")==0) retorn = 1; + if(strcmp(extensio,"tiff")==0) retorn = 1; + */ + + return (retorn); +} + +/* afegir una imatge al grid */ +void videogrid_afegir_imatge(t_videogrid *x, path entrada) +{ + int maxim; + char nNstr[BYTES_NUM_TEMP]; + int pos = 0; + /* escriu l'argument entrat */ + /* post("Afegint la imatge %s ...",entrada); */ + maxim = x->x_num_fil * x->x_num_col; + path ig_path = PATH_TEMPORAL; + + /* si hi ha tants nodes a la cua com el maxim */ + if((numNodes(&x->x_cua)) >= maxim){ + /* desencua */ + int extret; + extret = desencuar(&x->x_cua); + /* obtenir la posició en la cua del nou node */ + if(x->x_ultima_img == maxim-1) { + pos = 0; + }else{ + pos = x->x_ultima_img+1; + } + sys_vgui(".x%x.c delete %xS%d\n", glist_getcanvas(x->x_glist), x, pos); + } + /* encua el nou node */ + encuar(&x->x_cua, entrada); + /* si no és el primer element a encuar incrementem la posicio de la última imatge insertada */ + if(numNodes(&x->x_cua) != 1) x->x_ultima_img ++; + /* si assoleix el maxim torna a començar, inicialitzant la posició en el tauler de la última imatge insertada */ + if(x->x_ultima_img == maxim) x->x_ultima_img = 0; + + /* + Quicktime per les conversions + */ + int nN = x->x_ultima_img; + if (format_adequat_v(entrada) == 1) { + convertir_img(entrada,FORMAT_MINIATURA, W_CELL, H_CELL, nN); + } else { + convertir_img_ff(entrada,FORMAT_MINIATURA, W_CELL, H_CELL, nN); + } + + sprintf(nNstr, "%d", nN); + strcat(ig_path,nNstr); + strcat(ig_path,"."); + strcat(ig_path,FORMAT_MINIATURA); + /*printf("Creacio de la imatge %s ...",ig_path);*/ + sys_vgui("image create photo img%x%d -file %s\n",x,nN,ig_path); + /* printf("1. Creacio de la imatge %s ...",ig_path); */ + sys_vgui(".x%x.c create image %d %d -image img%x%d -tags %xS%d\n", + glist_getcanvas(x->x_glist), + text_xpix(&x->x_obj, x->x_glist) + getX(x,nN) + (W_CELL/2), + text_ypix(&x->x_obj, x->x_glist) + getY(x,nN) + (H_CELL/2), + x,nN,x,nN); + /* printf("2. Creacio de la imatge %s ...",ig_path); */ + if(nN == 0){ + x->x_tauler_primer = x->x_cua.final; + /* post("Ara el primer del tauler es %s\n",x->x_tauler_primer->pathFitxer); */ + } + /* printf("SURT de la creacio de la imatge %s ...",ig_path); */ + /* + sys_vgui("image create photo img%x -file %s\n",x,entrada); + sys_vgui(".x%x.c create image %d %d -image img%x -tags %xS\n", + glist_getcanvas(glist),text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),x,x); + */ +} + +/* dibuixa videogrid */ +void videogrid_drawme(t_videogrid *x, t_glist *glist, int firsttime) +{ + /* post("Entra a drawme amb firsttime: %d", firsttime); */ + if (firsttime) { + char name[MAXPDSTRING]; + canvas_makefilename(glist_getcanvas(x->x_glist), x->x_name->s_name, name, MAXPDSTRING); + sys_vgui(".x%x.c create rectangle %d %d %d %d -fill %s -tags %xGRID -outline %s\n", + glist_getcanvas(glist), + text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), + text_xpix(&x->x_obj, glist) + (x->x_num_col * W_CELL) + 1 + (x->x_num_col * GRUIX) + GRUIX, text_ypix(&x->x_obj, glist) + (x->x_num_fil * H_CELL) + 1 + (x->x_num_fil * GRUIX) + GRUIX, + x->x_color_fons->s_name, x,x->x_color_marc->s_name); + + canvas_fixlinesfor(glist_getcanvas(glist), (t_text*)x); + /* si hi elements a la cua els afegeix (redimensió) */ + if(!cuaBuida(&x->x_cua)) + { + path ig_path; + int nN = 0; + char nNstr[BYTES_NUM_TEMP]; + Node *actual; + actual=x->x_cua.davanter; + do{ + strcpy(ig_path,PATH_TEMPORAL); + sprintf(nNstr, "%d", nN); + strcat(ig_path,nNstr); + strcat(ig_path,"."); + strcat(ig_path,FORMAT_MINIATURA); + /* post("reestablint la imatge %s", actual->pathFitxer); */ + // videogrid_afegir_imatge(x,actual->pathFitxer); + convertir_img(actual->pathFitxer,FORMAT_MINIATURA, W_CELL, H_CELL, nN); + sys_vgui("image create photo img%x%d -file %s\n",x,nN,ig_path); + sys_vgui(".x%x.c create image %d %d -image img%x%d -tags %xS%d\n", + glist_getcanvas(x->x_glist),text_xpix(&x->x_obj, x->x_glist) + getX(x,nN) + (W_CELL/2), text_ypix(&x->x_obj, x->x_glist) + getY(x,nN) + (H_CELL/2),x,nN,x,nN); + actual = actual->seguent; + nN++; + }while(actual); + } + } + else { + sys_vgui(".x%x.c coords %xGRID %d %d %d %d\n", glist_getcanvas(glist), x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),text_xpix(&x->x_obj, glist) + (x->x_num_col*W_CELL) + 1 + (x->x_num_col * GRUIX) + GRUIX, text_ypix(&x->x_obj, glist) + (x->x_num_fil*H_CELL) + 1 + (x->x_num_fil * GRUIX) + GRUIX); + if(!cuaBuida(&x->x_cua)) + { + int contador = 0; + while(contador < numNodes(&x->x_cua)){ + sys_vgui(".x%x.c coords %xS%d \ + %d %d\n", + glist_getcanvas(glist), x, contador, + text_xpix(&x->x_obj, x->x_glist) + getX(x,contador) + (W_CELL/2), text_ypix(&x->x_obj, x->x_glist) + getY(x,contador) + (H_CELL/2)); + contador++; + } + + /* char buf[800]; + sprintf(buf, "pdtk_videogrid_table %%s %s %d %d\n", x->x_name->s_name, x->x_num_fil, x->x_num_col); + gfxstub_new(&x->x_obj.ob_pd, x, buf); */ + } + if (x->x_pos_selected > -1){ + sys_vgui(".x%x.c coords %xGRASP %d %d %d %d\n", glist_getcanvas(glist), x, + text_xpix(&x->x_obj, x->x_glist) + getX(x,x->x_pos_selected), text_ypix(&x->x_obj, x->x_glist) + getY(x,x->x_pos_selected), + text_xpix(&x->x_obj, x->x_glist) + getX(x,x->x_pos_selected) + W_CELL, text_ypix(&x->x_obj, x->x_glist) + getY(x,x->x_pos_selected) + H_CELL); + } + sys_vgui(".x%x.c delete %xLINIA\n", glist_getcanvas(x->x_glist), x); + } + int xI = text_xpix(&x->x_obj, glist); + int yI = text_ypix(&x->x_obj, glist); + int xF = xI + (x->x_num_col * W_CELL) + ((x->x_num_col + 1) * GRUIX); + int yF = yI + (x->x_num_fil * H_CELL) + ((x->x_num_fil + 1) * GRUIX); + int vlines = 0; + int xi = 0; + while(vlines < x->x_num_col){ + xi = xI + getX(x,vlines) - GRUIX + 1; + sys_vgui(".x%x.c create line %d %d %d %d -fill %s -width %d -tag %xLINIA\n", glist_getcanvas(x->x_glist), xi, yI, xi, yF, x->x_color_marc->s_name,GRUIX,x); + vlines++; + } + xi = xi + W_CELL + GRUIX; + sys_vgui(".x%x.c create line %d %d %d %d -fill %s -width %d -tag %xLINIA\n", glist_getcanvas(x->x_glist), xi, yI, xi, yF, x->x_color_marc->s_name,GRUIX,x); + int hlines = 0; + int yi = 0; + while(hlines < x->x_num_fil){ + yi = yI + ((H_CELL + GRUIX) * hlines) + 2; + sys_vgui(".x%x.c create line %d %d %d %d -fill %s -width %d -tag %xLINIA\n", glist_getcanvas(x->x_glist), xI, yi, xF, yi, x->x_color_marc->s_name,GRUIX,x); + hlines++; + } + yi = yi + H_CELL + GRUIX; + sys_vgui(".x%x.c create line %d %d %d %d -fill %s -width %d -tag %xLINIA\n", glist_getcanvas(x->x_glist), xI, yi, xF, yi, x->x_color_marc->s_name,GRUIX,x); +} + +/* borra videogrid v 0.2 -- int toclear */ +void videogrid_erase(t_videogrid* x,t_glist* glist, int toclear) +{ + int maxim = x->x_num_fil * x->x_num_col; + path path_total; + char contador_str[BYTES_NUM_TEMP]; + /* post("Entra a erase"); */ + /* elimina les imatges */ + int contador = 0; + while(contador < numNodes(&x->x_cua)){ + + sys_vgui(".x%x.c delete %xS%d\n", glist_getcanvas(x->x_glist), x, contador); + strcpy(path_total,PATH_TEMPORAL); + sprintf(contador_str,"%d", contador); + strcat(path_total,contador_str); + strcat(path_total,"."); + strcat(path_total,FORMAT_MINIATURA); + if(unlink(path_total)){ + /* post("Imatge temporal %s eliminada\n",path_total); */ + } + contador++; + } + + /* elimina el grid v 0.2 -- excepte quan es fa un clear */ + if(toclear == 0){ + sys_vgui(".x%x.c delete %xGRID\n", glist_getcanvas(glist), x); + sys_vgui(".x%x.c delete %xLINIA\n", glist_getcanvas(x->x_glist), x); + } + /* v 0.2 -- elimina el marc de la casella seleccionada */ + if(x->x_pos_selected > -1){ + sys_vgui(".x%x.c delete %xGRASP\n", glist_getcanvas(glist), x); + x->x_pos_selected = -1; + } + eliminar_imatges_temporals(maxim); +} + +/* mètode de la clase que escriu un missatge al rebre un bang */ +void videogrid_bang(t_videogrid *x) +{ + /* post("Hello videogrid !!"); */ + escriuCua(&x->x_cua); +} + +/* mètode de la classe que es dispara al rebre una entrada de missatge amb [putvideo +string( com a paràmetre */ +void videogrid_putvideo(t_videogrid *x, t_symbol *entrada) +{ + /* comprova que existeixi el fitxer */ + FILE *fitxer; + path e; + strcpy(e,entrada->s_name); + /* post("putvideo de %s\n", e); */ + + fitxer = fopen(e,"r"); + if (!fitxer) { + post("Videogrid: Problem opening file %s.\n",e); + } + else { + /* post("s'encua la imatge %s\n", e); */ + videogrid_afegir_imatge(x,e); + /*outlet_symbol(x->x_sortida, entrada);*/ + } + /* post("putvideo amb img = %s\n", e); */ +} + +/* mètode de la classe que es dispara al rebre una entrada de missatge amb [putvideodir +string( com a paràmetre */ +void *videogrid_putvideodir_thread(void *z) +{ + t_videogrid *x = (t_videogrid *)z; + DIR *dirp; + struct dirent * direntp; + path nomImatge, directoriAnterior, pathActual; + int numEncuats = 0, numPosDir = 0; + int maxim; + if ((dirp = opendir(x->x_dir_canvi)) == NULL) + { + post("Videogrid: Can not open folder %s.\n", x->x_dir_canvi); + }else{ + maxim = x->x_num_fil * x->x_num_col; + strcpy(directoriAnterior, x->x_dir_actual); + strcpy(x->x_dir_actual, x->x_dir_canvi); + /* si es el mateix directori entrat l'ultim busca la ultima imatge afegida per a seguir a encuant a partir d'ella en endavant */ + if(strcmp(directoriAnterior, x->x_dir_actual) == 0){ + /* post("Videogrid: Repeteix directori %s\n", x->x_dir_actual); */ + while ( (direntp = readdir( dirp )) != NULL ){ + /* es descarta el mateix directori, el directori anterior i tot el que no sigui un fitxer regular */ + if((strcmp(direntp->d_name,"..") != 0)&&(strcmp(direntp->d_name,".") != 0)&&(direntp->d_type == DT_REG)){ + /* incrementa la posició en el directori */ + numPosDir++; + /* assolir la posició anterior en el directori */ + if(numPosDir > x->x_dir_pos){ + /* si el nombre de nodes encuats per aquest directori no supera el màxim encua el nou node */ + if(numEncuats < maxim){ + /* post("s'encua la imatge %s\n", direntp->d_name); */ + /* concatena el path i el nom de la imatge */ + strcpy(nomImatge,direntp->d_name); + strcpy(pathActual,x->x_dir_actual); + strcat(pathActual,"/"); + strcat(pathActual,nomImatge); + pthread_mutex_lock(&x->x_lock); + videogrid_afegir_imatge(x, pathActual); + pthread_mutex_unlock(&x->x_lock); + /* incrementa en 1 per indicar el nombre de nodes encuats per aquest directori */ + numEncuats++; + /* es desa la posició en el directori de l'últim node encuat */ + x->x_dir_pos = numPosDir; + } + } + } + } + }else{ + /* directori diferent omple la cua començant pel primer fitxer */ + /* post("Videogrid: Nou directori %s \n", x->x_dir_actual); */ + while ( (direntp = readdir( dirp )) != NULL ){ + /* es descarta el mateix directori, el directori anterior i tot el que no sigui un fitxer regular */ + if((strcmp(direntp->d_name,"..") != 0)&&(strcmp(direntp->d_name,".") != 0)&&(direntp->d_type == DT_REG)){ + /* incrementa la posició en el directori */ + numPosDir++; + /* si el nombre de nodes encuats per aquest directori no supera el màxim enca el nou node */ + if(numEncuats < maxim){ + /* post("s'encua la imatge %s\n", direntp->d_name); */ + /* concatena el path i el nom de la imatge */ + strcpy(nomImatge,direntp->d_name); + strcpy(pathActual,x->x_dir_actual); + strcat(pathActual,"/"); + strcat(pathActual,nomImatge); + pthread_mutex_lock(&x->x_lock); + videogrid_afegir_imatge(x, pathActual); + pthread_mutex_unlock(&x->x_lock); + /* incrementa en 1 per indicar el nombre de nodes encuats per aquest directori */ + numEncuats++; + /* es desa la posició en el directori de l'últim node encuat */ + x->x_dir_pos = numPosDir; + } + } + } + } + /* si la posicio de l'actual es la de l'utim fitxer del directori, inicialitza la posició */ + if(x->x_dir_pos >= numPosDir) x->x_dir_pos = 0; + closedir(dirp); + } + /* escriu l'argument entrat */ + /* post("Obtenint imatges del directori: %s ...",x->x_dir_canvi); */ + /* envia a la sorida l'argument entrat */ + /* outlet_symbol(x->x_sortida, entrada); */ + pthread_exit(NULL); +} + +void videogrid_putvideodir(t_videogrid *x, t_symbol *entrada) +{ + + pthread_t unthread; + pthread_attr_t unatribut; + pthread_attr_init( &unatribut ); + + strcpy(x->x_dir_canvi,entrada->s_name); + + // ---------------- THREAD CREAT ------------------------- + pthread_mutex_init(&x->x_lock, NULL); + // int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg); + pthread_create(&unthread, &unatribut, videogrid_putvideodir_thread, (void *)x); + pthread_mutex_destroy(&x->x_lock); +} + + +/* v 0.2 -- mètode de la classe que desmarca la cel·la seleccionada */ +static void videogrid_ungrasp_selected(t_videogrid *x) +{ + /* post("Ungrasp selected thumb %d", x->x_pos_selected); */ + if(x->x_pos_selected > -1) { + sys_vgui(".x%x.c delete %xGRASP\n", glist_getcanvas(x->x_glist), x); + x->x_pos_selected = -1; + } +} + +/* v 0.2 -- mètode de la classe que marca la cel·la seleccionada */ +static void videogrid_grasp_selected(t_videogrid *x, int pos) +{ + /*printf("Grasp selected thumb %d", pos);*/ + if(pos != x->x_pos_selected) { + videogrid_ungrasp_selected(x); + /* post("Grasp selected thumb %d", pos); */ + x->x_pos_selected = pos; + /* nem per aqui ---- */ + sys_vgui(".x%x.c create rectangle %d %d %d %d -fill {} -tags %xGRASP -outline %s -width %d\n", + glist_getcanvas(x->x_glist), + text_xpix(&x->x_obj, x->x_glist) + getX(x,x->x_pos_selected), text_ypix(&x->x_obj, x->x_glist) + getY(x,x->x_pos_selected), + text_xpix(&x->x_obj, x->x_glist) + getX(x,x->x_pos_selected) + W_CELL, text_ypix(&x->x_obj, x->x_glist) + getY(x,x->x_pos_selected) + H_CELL, + x,x->x_color_grasp->s_name, GRUIX + 1); + canvas_fixlinesfor(glist_getcanvas(x->x_glist), (t_text*)x); + } +} + +/* v 0.2 -- mètode de la classe que dispara l'element del taules en la posicio N [seek N( */ +void videogrid_seek(t_videogrid *x, t_floatarg postauler) +{ + /* post("seek a %d\n",postauler); */ + path pathSortida; + Node *actual; + int contador = 0; + int maxim = x->x_num_fil * x->x_num_col; + /* obtenir el path per enviar a la sortida */ + if((!cuaBuida(&x->x_cua))&&(postauler < numNodes(&x->x_cua))&&(postauler >= 0 )){ + if(x->x_tauler_primer){ + actual = x->x_tauler_primer; + while(contador <= postauler){ + if(contador == postauler){ + strcpy(pathSortida,actual->pathFitxer); + } + if(actual->seguent == NULL){ + actual = x->x_cua.davanter; + }else{ + actual = actual->seguent; + } + contador++; + } + outlet_symbol(x->x_sortida, gensym(pathSortida)); + /* post("Esta a videogrid_click amb %d %d a la posicio %d\n", x_pos, y_pos, postauler);*/ + /* v 0.2 -- marcar casella */ + videogrid_grasp_selected(x, postauler); + } + } +} + +static int videogrid_click(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) +{ + t_videogrid* x = (t_videogrid *)z; + int x_pos = xpix - text_xpix(&x->x_obj, x->x_glist); + int y_pos = ypix - text_ypix(&x->x_obj, x->x_glist); + int xa, ya, postauler; + if (doit) + { + /* obtenir la posicio en el tauler */ + // -- v 0.2 -- midoficacio pel gruix del marc // + xa = ((x_pos) / (W_CELL + GRUIX + 1)); + ya = ((y_pos) / (H_CELL + GRUIX + 1)) * x->x_num_col; + postauler = ya + xa; + // -- v 0.2 -- seleciona la casella disparant el path // + videogrid_seek(x, postauler); + } + return (1); +} + +/* v 0.2 -- mètode de la classe que buida el tauler amb el missatge [clear ( */ +void videogrid_clear(t_videogrid *x) +{ + videogrid_erase(x, x->x_glist,1); + eliminarCua(&x->x_cua); + x->x_ultima_img = 0; + x->x_dir_pos = 0; + x->x_tauler_primer = NULL; + videogrid_drawme(x, x->x_glist, 0); +} + + +static void videogrid_getrect(t_gobj *z, t_glist *glist,int *xp1, int *yp1, int *xp2, int *yp2) +{ + int cols, fils; + t_videogrid* x = (t_videogrid*)z; + cols = x->x_num_col; + fils = x->x_num_fil; + *xp1 = text_xpix(&x->x_obj, glist); + *yp1 = text_ypix(&x->x_obj, glist); + *xp2 = text_xpix(&x->x_obj, glist) + (cols*W_CELL) + ((cols + 1) * GRUIX); + *yp2 = text_ypix(&x->x_obj, glist) + (fils*H_CELL) + ((fils + 1) * GRUIX); + /* post("Esta amb el ratoli en el punt %d %d %d %d o son els vetexs de la caixa... es/bd", xp1, yp1, xp2, yp2); */ +} + +static void videogrid_displace(t_gobj *z, t_glist *glist,int dx, int dy) +{ + /* post("Entra a displace amb dx %d i dy %d", dx, dy); */ + t_videogrid *x = (t_videogrid *)z; + x->x_obj.te_xpix += dx; + x->x_obj.te_ypix += dy; + sys_vgui(".x%x.c coords %xGRID %d %d %d %d\n", + glist_getcanvas(glist), x, + text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), + text_xpix(&x->x_obj, glist) + (x->x_num_col*W_CELL) + 1 + (x->x_num_col * GRUIX) + GRUIX, text_ypix(&x->x_obj, glist) + (x->x_num_fil*H_CELL) + 1 + (x->x_num_fil * GRUIX) + GRUIX); + videogrid_drawme(x, glist, 0); + canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x); +} + +static void videogrid_select(t_gobj *z, t_glist *glist, int state) +{ + /* post("Entra select amb state %d", state); */ + t_videogrid *x = (t_videogrid *)z; + if (state) { + /* post("Videogrid seleccionat"); */ + sys_vgui(".x%x.c itemconfigure %xGRID -outline #0000FF\n", glist_getcanvas(glist), x); + } + else { + /* post("Videogrid deseleccionat"); */ + sys_vgui(".x%x.c itemconfigure %xGRID -outline %s\n", glist_getcanvas(glist), x, x->x_color_marc->s_name); + } +} + +static void videogrid_delete(t_gobj *z, t_glist *glist) +{ + /* post("Entra a delete"); */ + t_text *x = (t_text *)z; + canvas_deletelinesfor(glist_getcanvas(glist), x); +} + +static void videogrid_vis(t_gobj *z, t_glist *glist, int vis) +{ + /* post("Entra a vist amb vis %d", vis); */ + t_videogrid* s = (t_videogrid*)z; + if (vis) + videogrid_drawme(s, glist, 1); + else + videogrid_erase(s,glist,0); +} + + +static void videogrid_save(t_gobj *z, t_binbuf *b) +{ + /* post("Entra a save"); */ + t_videogrid *x = (t_videogrid *)z; + /* crea la cadena de paths per desar */ + /* 100 possibles paths com a màxim a 512 cada path*/ + /* char cadenaPaths[51200];*/ + char *cadenaPaths, *cadenaPathsInicials; + path ultimPath = ""; + cadenaPaths = (char *)malloc(51200*sizeof(char)); + strcpy(cadenaPaths,""); + cadenaPathsInicials = (char *)malloc(51200*sizeof(char)); + strcpy(cadenaPathsInicials,""); + /*strcpy(cadenaPaths,(char *)argv[5].a_w.w_symbol->s_name);*/ + if(!cuaBuida(&x->x_cua)) + { + Node *actual; + int maxim = x->x_num_fil * x->x_num_col; + int contador = x->x_ultima_img + 1; + + if (contador > maxim) { + contador = 0; + } + /* printf("\n contador %d i maxim %d i laultimaPOS %d \n", contador, maxim, x->x_ultima_img); */ + /* + strcat(cadenaPaths, actual->pathFitxer); + strcat(cadenaPaths, "1|\n"); + contador ++; + */ + /* prenem el davanter de la cua */ + actual=x->x_cua.davanter; + + while(contador < numNodes(&x->x_cua)){ + /* afegim els paths del davanter fins a l'ultim node al tauler */ + strcat(cadenaPaths, actual->pathFitxer); + strcat(cadenaPaths, "|"); + actual = actual->seguent; + contador ++; + } + if(actual != x->x_cua.final){ + /* ara resten els de de l'inici del tauler fins al final de la cua */ + while(actual != x->x_cua.final){ + strcat(cadenaPathsInicials, actual->pathFitxer); + strcat(cadenaPathsInicials, "|"); + actual = actual->seguent; + } + /* afegeix l'últim */ + strcat(ultimPath, actual->pathFitxer); + strcat(ultimPath, "|"); + /* afegeix l'ultim de la cua */ + strcat(cadenaPathsInicials, ultimPath); + }else{ + if(x->x_ultima_img == 0){ + strcat(ultimPath, actual->pathFitxer); + strcat(ultimPath, "|"); + strcat(cadenaPathsInicials, ultimPath); + } + } + /* ordena el paths segons aparicio en el tauler */ + strcat(cadenaPathsInicials, cadenaPaths); + /* DE MOMENT NO DESA ELS PATHS */ + strcat(cadenaPathsInicials, ""); + /* printf("%s",cadenaPathsInicials); */ + } + + binbuf_addv(b, "ssiissiisss", gensym("#X"),gensym("obj"), + x->x_obj.te_xpix, x->x_obj.te_ypix, + atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)), + x->x_name,x->x_num_fil,x->x_num_col,x->x_color_fons,x->x_color_marc,x->x_color_grasp,gensym(cadenaPathsInicials)); + binbuf_addv(b, ";"); +} + +static void videogrid_properties(t_gobj *z, t_glist *owner) +{ + char buf[900]; + t_videogrid *x=(t_videogrid *)z; + + /* post("Es crida a pdtk_videogrid dialog passant nom = %s\n fils = %d \t cols = %d \t color fons = %s \t color marc = %s\n", x->x_name->s_name, x->x_num_fil, x->x_num_col, x->x_color_fons->s_name, x->x_color_marc->s_name); */ + sprintf(buf, "pdtk_videogrid_dialog %%s %s %d %d %s %s %s\n", + x->x_name->s_name, x->x_num_fil, x->x_num_col, x->x_color_fons->s_name, x->x_color_marc->s_name, x->x_color_grasp->s_name); + /* post("videogrid_properties : %s", buf ); */ + gfxstub_new(&x->x_obj.ob_pd, x, buf); +} + +static void videogrid_dialog(t_videogrid *x, t_symbol *s, int argc, t_atom *argv) +{ + int maxim, maxdigit; + int nfil = 0; + int ncol = 0; + if ( !x ) { + post("Videogrid: error_ Attempt to alter the properties of an object that does not exist.\n"); + } + switch (argc) { + case 3: + /* versio inicial */ + if (argv[0].a_type != A_SYMBOL || argv[1].a_type != A_FLOAT || argv[2].a_type != A_FLOAT) + { + post("Videogrid: error_ Some of the values are inconsistent in its data type.\n"); + return; + } + x->x_name = argv[0].a_w.w_symbol; + nfil = (int)argv[1].a_w.w_float; + ncol = (int)argv[2].a_w.w_float; + break; + case 5: + /* versio 0.1 */ + if (argv[0].a_type != A_SYMBOL || argv[1].a_type != A_FLOAT || argv[2].a_type != A_FLOAT || argv[3].a_type != A_SYMBOL || argv[4].a_type != A_SYMBOL) + { + post("Videogrid: error_ Some of the values are inconsistent in its data type.\n"); + return; + } + x->x_name = argv[0].a_w.w_symbol; + nfil = (int)argv[1].a_w.w_float; + ncol = (int)argv[2].a_w.w_float; + x->x_color_fons = argv[3].a_w.w_symbol; + x->x_color_marc = argv[4].a_w.w_symbol; + break; + case 6: + /* versio 0.2 */ + if (argv[0].a_type != A_SYMBOL || argv[1].a_type != A_FLOAT || argv[2].a_type != A_FLOAT || argv[3].a_type != A_SYMBOL || argv[4].a_type != A_SYMBOL || argv[5].a_type != A_SYMBOL) + { + post("Videogrid: error_ Some of the values are inconsistent in its data type.\n"); + return; + } + x->x_name = argv[0].a_w.w_symbol; + nfil = (int)argv[1].a_w.w_float; + ncol = (int)argv[2].a_w.w_float; + x->x_color_fons = argv[3].a_w.w_symbol; + x->x_color_marc = argv[4].a_w.w_symbol; + x->x_color_grasp = argv[5].a_w.w_symbol; + break; + default: + /* no fa res */ + break; + } + /* el màxim es fixa pel nombre de digits utilitzats pel nom de la imatge temporal */ + maxdigit = pow(10,BYTES_NUM_TEMP); + if((nfil*ncol) <= maxdigit){ + if((nfil*ncol) > 0){ + x->x_num_fil = nfil; + x->x_num_col = ncol; + }else{ + post("Videogrid: The number of rows and columns is less than the minimum allowed: 1 cell.\n",maxdigit); + } + }else{ + post("Videogrid: The number of rows and columns exceeds the maximum allowed: a total of %d cells.\n",maxdigit); + } + /* post("Videogrid: Modified values\n name = %s\n rows = %d \t cols = %d.\n", x->x_name->s_name, x->x_num_fil, x->x_num_col); */ + /* elimina els nodes no representables amb la nova configuració */ + maxim = x->x_num_fil * x->x_num_col; + int extret; + videogrid_erase(x, x->x_glist,0); + /* si hi ha més nodes a la cua que el maxim */ + while((numNodes(&x->x_cua)) > maxim){ + /* desencuem */ + extret = desencuar(&x->x_cua); + } + /* al reestablir el tamany del tauler cal saber la posició de l'últim element */ + x->x_ultima_img = numNodes(&x->x_cua) - 1; + if (x->x_ultima_img < 0) x->x_ultima_img = 0; + x->x_tauler_primer = x->x_cua.davanter; + videogrid_drawme(x, x->x_glist, 1); +} + +t_widgetbehavior videogrid_widgetbehavior; + +static void videogrid_setwidget(void) +{ + /* post("Entra a setwidget"); */ + videogrid_widgetbehavior.w_getrectfn = videogrid_getrect; + videogrid_widgetbehavior.w_displacefn = videogrid_displace; + videogrid_widgetbehavior.w_selectfn = videogrid_select; + videogrid_widgetbehavior.w_activatefn = NULL; + videogrid_widgetbehavior.w_deletefn = videogrid_delete; + videogrid_widgetbehavior.w_visfn = videogrid_vis; + /* clic del ratoli */ + videogrid_widgetbehavior.w_clickfn = videogrid_click; + +#if PD_MINOR_VERSION < 37 + videogrid_widgetbehavior.w_savefn = videogrid_save; + videogrid_widgetbehavior.w_propertiesfn = videogrid_properties; +#endif + +} + +/* el constructor de la classe*/ +static void *videogrid_new(t_symbol* name, int argc, t_atom *argv) +{ + /* instanciació del nou objecte */ + t_videogrid *x = (t_videogrid *)pd_new(videogrid_class); + /* crea una sortida per l'objecte*/ + x->x_sortida = outlet_new(&x->x_obj,&s_symbol); + /* s'obté el canvas de pd */ + x->x_glist = (t_glist*) canvas_getcurrent(); + /* posició en el tauler de la última imatge afegida */ + x->x_ultima_img = 0; + /* posició de l'últim fitxer del directori encuat */ + x->x_dir_pos = 0; + /* apuntador al primer element en el tauler */ + x->x_tauler_primer = NULL; + x->x_pos_selected = -1; + /* fixa el nom de l'objecte */ + char nom[15]; + sprintf(nom, "videogrid%d", ++videogridcount); + name = gensym(nom); + x->x_name = name; + /* amb aquest nom es prepara per poder rebre dades */ + pd_bind(&x->x_obj.ob_pd, x->x_name); + /* crea la cua de nodes */ + crearCua(&x->x_cua); + post("NEW videogrid: created with %d parameters.\n", argc); + + switch (argc) { + case 3: + /* versio inicial */ + x->x_num_fil = (int)atom_getintarg(1, argc, argv); + x->x_num_col = (int)atom_getintarg(2, argc, argv); + x->x_color_fons = gensym("#F0F0F0"); + x->x_color_marc = gensym("#0F0F0F"); + x->x_color_grasp = gensym("#F1882B"); + break; + case 5: + /* versio 0.1 */ + x->x_num_fil = (int)atom_getintarg(1, argc, argv); + x->x_num_col = (int)atom_getintarg(2, argc, argv); + x->x_color_fons = argv[3].a_w.w_symbol; + x->x_color_marc = argv[4].a_w.w_symbol; + x->x_color_grasp = gensym("#F1882B"); + break; + case 6: + /* versio 0.2 */ + x->x_num_fil = (int)atom_getintarg(1, argc, argv); + x->x_num_col = (int)atom_getintarg(2, argc, argv); + x->x_color_fons = argv[3].a_w.w_symbol; + x->x_color_marc = argv[4].a_w.w_symbol; + x->x_color_grasp = argv[5].a_w.w_symbol; + break; + case 7: + /* versio 0.1 - paths dels elsements del tauler */ + x->x_num_fil = (int)atom_getintarg(1, argc, argv); + x->x_num_col = (int)atom_getintarg(2, argc, argv); + x->x_color_fons = argv[3].a_w.w_symbol; + x->x_color_marc = argv[4].a_w.w_symbol; + x->x_color_grasp = argv[5].a_w.w_symbol; + /* + // -- llegir la cadena de paths | afegir els paths a la cua // + // -- ATENCIO! NO AFEGEIX ELS PATHS !!! // + char *cadenaPaths; + cadenaPaths = (char *)malloc(51200*sizeof(char)); + strcpy(cadenaPaths,(char *)argv[6].a_w.w_symbol->s_name); + // -- printf("Es carreguen els paths %s --- %s **** %s\n", cadenaPaths, argv[5].a_w.w_symbol->s_name,argv[3].a_w.w_symbol->s_name); // + // -- split // + char *token; + t_symbol *tt; + for ( token = strtok(argv[6].a_w.w_symbol->s_name,"|"); + token != NULL; + token = strtok(NULL,"|") ){ + tt = gensym(token); + // -- printf("AFEGINT CARREGANT %s\n",tt->s_name); // + // -- imagegrid_putimg(x,tt); // + // -- ATENCIO! NO AFEGEIX ELS PATHS !!! // + // -- imagegrid_afegir_imatge(x,tt->s_name); // + } + + token = strtok(cadenaPaths,"|"); + while(token){ + tt = gensym(token); + printf("AFEGINT CARREGANT %s\n",tt->s_name); + imagegrid_putimg(x,tt); + token = strtok(NULL,"|"); + } + free(cadenaPaths); + */ + break; + + default: + /* crea un objecte nou per defecte */ + /* post("NEW imagegrid created.\n"); */ + /* fixa el nombre de files */ + x->x_num_fil = 3; + /* fixa el nombre de columnes */ + x->x_num_col = 5; + /* colors de fons i de marc*/ + x->x_color_fons = gensym("#F0F0F0"); + x->x_color_marc = gensym("#0F0F0F"); + x->x_color_grasp = gensym("#F1882B"); + break; + } + /* printf("S'ha instanciat un videogrid anomenat %s amb les caracteristiques seguents:",x->x_name->s_name); + printf("Nombre de files %d - Nombre de columnes: %d", x->x_num_fil, x->x_num_col); */ + + return (x); +} + +static void videogrid_destroy(t_videogrid *x){ + /* elimina el contingut de la cua */ + eliminarCua(&x->x_cua); + post("Videogrid destroyed.\n"); +} + +/* generacio d'una nova classe */ +/* al carregar la nova llibreria my_lib pd intenta cridar la funció my_lib_setup */ +/* aquesta crea la nova classe i les seves propietats només un sol cop */ + +extern "C" +{ +void videogrid_setup(void) +{ + load_tk_procs(); + /* post("Entra a setup per generar la classe videogrid"); */ + /* + sense pas d'arguments + videogrid_class = class_new(gensym("videogrid"), + (t_newmethod)videogrid_new, + (t_method)videogrid_destroy, + sizeof(t_videogrid), + CLASS_DEFAULT, + A_DEFSYM, + 0); + amb pas d'arguments: + */ + videogrid_class = class_new(gensym("videogrid"), + (t_newmethod)videogrid_new, + (t_method)videogrid_destroy, + sizeof(t_videogrid), + CLASS_DEFAULT, + A_GIMME, + 0); + /* class_new crea la nova classe retornant un punter al seu prototipus, + el primer argument es el nom simbolic de la classe, + el segon i tercer corresponen al constructor i destructor de la classe respectivament, + (el constructor instancia un objecte i inicialitza les seves dades cada cop que es crea un objecte + el destructor allibera la memoria reservada al destruid l'objecte per qualsevol causa) + el quart correspon a la mida de l'estructura de dades, per tal de poder reservar la memoria necessària, + el cinquè influeix en el mòde de representació gràfica del objectes. Per defecte CLASS_DEFAULT o ``0', + la resta d'arguments defineixen els arguments de l'objecte i el seu tipus, la llista acaba amb 0 + */ + + /* afegeix el mètode helloworld_bang a la classe helloworld_class */ + class_addbang(videogrid_class, videogrid_bang); + + /* afegeix el mètode videogrid_putvideo a la classe videogrid per a entrades de missatge + que inicien amb putvideo i una cadena string com a argument */ + class_addmethod(videogrid_class,(t_method)videogrid_putvideo,gensym("putvideo"), A_DEFSYMBOL, 0); + + /* afegeix el mètode videogrid_putvideodir a la classe videogrid per a entrades de missatge + que inicien amb putvideodir i una cadena string com a argument */ + class_addmethod(videogrid_class,(t_method)videogrid_putvideodir,gensym("putvideodir"), A_DEFSYMBOL, 0); + /* afegeix un metode per a modificar el valor de les propietats de l'objecte */ + class_addmethod(videogrid_class, (t_method)videogrid_dialog, gensym("dialog"), A_GIMME, 0); + /* afegeix un metode per l'obtencio de la posicio del clic del ratolí */ + class_addmethod(videogrid_class, (t_method)videogrid_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + /* v 0.2 -- afegeix un metode netejar el contigut del tauler */ + class_addmethod(videogrid_class, (t_method)videogrid_clear, gensym("clear"), A_GIMME, 0); + /* v 0.2 -- afegeix un metode seek #num per disparar */ + class_addmethod(videogrid_class, (t_method)videogrid_seek, gensym("seek"), A_FLOAT, 0); + /* inicia el comportament de videogrid */ + videogrid_setwidget(); + +#if PD_MINOR_VERSION >= 37 + class_setsavefn(videogrid_class,&videogrid_save); + class_setpropertiesfn(videogrid_class, videogrid_properties); +#endif + + /* afegeix el mètode videogrid_widgetbehavior al la classe videogrid per a la creació de l'element visual */ + class_setwidget(videogrid_class,&videogrid_widgetbehavior); + class_sethelpsymbol(videogrid_class, gensym("videogrid.pd")); +} +} Deleted: trunk/externals/pdvjtools/videogrid/videogrid.cpp =================================================================== --- trunk/externals/pdvjtools/videogrid/videogrid.cpp 2008-05-24 01:51:05 UTC (rev 9893) +++ trunk/externals/pdvjtools/videogrid/videogrid.cpp 2008-05-24 01:55:37 UTC (rev 9894) @@ -1,1574 +0,0 @@ - -/* -videogrid external for Puredatai -Lluis Gomez i Bigorda ::
lluis-at-hangar.org
-Sergi Lario Loyo ::
slario-at-gmail.com
- -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 3 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, see <
http://www.gnu.org/licenses/
>. -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <dirent.h> -#include <string.h> -#include <unistd.h> -#include <math.h> - -/* incloure les definicions de variables i - prototipus de dades i de funcions de puredata */ -#include "m_pd.h" -/* incloure estructures de dades i capceleres de funcions gàfiques bàsiques de pd */ -#include "g_canvas.h" -/* incloure estructures de dades i capceleres de funcions per traballar amb threads */ -#include "pthread.h" - -/*ffmpeg includes*/ -#include <ffmpeg/avcodec.h> -#include <ffmpeg/avformat.h> - -/*libquicktime includes*/ -//#include <quicktime/lqt.h> -//#include <quicktime/colormodels.h> -#include <lqt/lqt.h> -#include <lqt/colormodels.h> - - -/* &&&&&&&&&&&&&&&&&&&&&&&&&&&&& VIDEOGRID &&&&&&&&&&&&&&&&&&&&&&&&&&&&& */ - -/* definició de l'amplada i l'alçada d'una casella */ -#define W_CELL 60 -#define H_CELL 40 - -/* definició del gruix en pixels del marc del tauler */ -#define GRUIX 2 - -/* nombre de caracters per el nom del path del fitxer */ -#define BYTESNOMFITXER 512 - -/* 8bits clamp rgb values */ - -#define CLAMP8(x) (((x)<0) ? 0 : ((x>255)? 255 : (x))) - -#define BYTESNOMFITXERIMATGE 512 -#define BYTESTIPUSFROMAT 4 - -#define FORMAT_MINIATURA "ppm" -#define PATH_TEMPORAL "/tmp/vigrid_" -#define BYTES_NUM_TEMP 4 - -typedef char pathimage[BYTESNOMFITXERIMATGE]; - -typedef char tipus_format[BYTESTIPUSFROMAT]; - -#ifdef __cplusplus -extern "C" int convertir_img_ff(pathimage pathFitxer, tipus_format f, int W, int H, int posi); -#endif - -void SaveFrame(AVFrame *pFrame, int width, int height, int W, int H, int posi) -{ - FILE *pFile; - char szFilename[32]; - int nN = posi; - - /*int cont=0;*/ - - char nNstr[BYTES_NUM_TEMP]; - pathimage ig_path = PATH_TEMPORAL; - - sprintf(nNstr, "%d", nN); - strcat(ig_path,nNstr); - strcat(ig_path,"."); - strcat(ig_path,FORMAT_MINIATURA); - - // Open file - sprintf(szFilename, ig_path); - pFile=fopen(szFilename, "wb"); - if(pFile==NULL) - return; - - // Write header - fprintf(pFile, "P6\n%d %d\n255\n", W, H); - - - int w = width; - int h = height; - float k = (width/W); - float l = (height/H); - int i,j,y,x,realx; - - // Write pixel data - for(y=0; y<H; y=y++) { - for(x=0; x<W; x=x++) { - realx = ((x*k)+(3-((int)(x*k)%3)))*3; - fwrite((pFrame->data[0]+(int)(y*l)*pFrame->linesize[0])+realx, 1, 3, pFile); - } - } - - // for (i=0;i<(l*H);i=i+l) { - // for (j=0;j<(k*W);j=j+k) { - // fwrite(pFrame->data[0]+(i*pFrame->linesize[0]+j), 1, 3, pFile); - // } - // } - - // Close file - fclose(pFile); -} - -extern "C" { -int convertir_img_ff(pathimage pathFitxer, tipus_format f, int W, int H, int posi) -{ - AVFormatContext *pFormatCtx; - int i, videoStream; - AVCodecContext *pCodecCtx; - AVCodec *pCodec; - AVFrame *pFrame; - AVFrame *pFrameRGB; - AVPacket packet; - int frameFinished; - int numBytes; - uint8_t *buffer; - - int nN = posi; - - // Register all formats and codecs - av_register_all(); - - // Open video file - if(av_open_input_file(&pFormatCtx, pathFitxer, NULL, 0, NULL)!=0) - return -1; // Couldn't open file - - - // Retrieve stream information - if(av_find_stream_info(pFormatCtx)<0) - return -1; // Couldn't find stream information - - // Dump information about file onto standard error - dump_format(pFormatCtx, 0, pathFitxer, false); - - // Find the first video stream - videoStream=-1; - for(i=0; i<pFormatCtx->nb_streams; i++) - if(pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) - { - videoStream=i; - break; - } - if(videoStream==-1) - return -1; // Didn't find a video stream - - // Get a pointer to the codec context for the video stream - pCodecCtx=pFormatCtx->streams[videoStream]->codec; - - // Find the decoder for the video stream - pCodec=avcodec_find_decoder(pCodecCtx->codec_id); - if(pCodec==NULL) - return -1; // Codec not found - - // Open codec - if(avcodec_open(pCodecCtx, pCodec)<0) - return -1; // Could not open codec - - // Hack to correct wrong frame rates that seem to be generated by some - // codecs - // if(pCodecCtx->frame_rate>1000 && pCodecCtx->frame_rate_base==1) - // pCodecCtx->frame_rate_base=1000; - - // Allocate video frame - pFrame=avcodec_alloc_frame(); - - // Allocate an AVFrame structure - pFrameRGB=avcodec_alloc_frame(); - if(pFrameRGB==NULL) - return -1; - - // Determine required buffer size and allocate buffer - numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width, - pCodecCtx->height); - buffer=new uint8_t[numBytes]; - - // Assign appropriate parts of buffer to image planes in pFrameRGB - avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24, - pCodecCtx->width, pCodecCtx->height); - - // Read frames and save first five frames to disk - av_read_frame(pFormatCtx, &packet); - // Is this a packet from the video stream? - if(packet.stream_index==videoStream) - { - // Decode video frame - avcodec_decode_video(pCodecCtx, pFrame, &frameFinished, - packet.data, packet.size); - - // Did we get a video frame? - if(frameFinished) - { - // Convert the image from its native format to RGB - img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24, - (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, - pCodecCtx->height); - - // Save the frame to disk - SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, W, H, posi); - } - } - - // Free the packet that was allocated by av_read_frame - av_free_packet(&packet); - // Read frames and save first five frames to disk - av_read_frame(pFormatCtx, &packet); - // Is this a packet from the video stream? - if(packet.stream_index==videoStream) - { - // Decode video frame - avcodec_decode_video(pCodecCtx, pFrame, &frameFinished, - packet.data, packet.size); - - // Did we get a video frame? - if(frameFinished) - { - // Convert the image from its native format to RGB - img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24, - (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, - pCodecCtx->height); - - // Save the frame to disk - SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, W, H, posi); - } - } - - // Free the packet that was allocated by av_read_frame - av_free_packet(&packet); - //} - - // Free the RGB image - delete [] buffer; - av_free(pFrameRGB); - - // Free the YUV frame - av_free(pFrame); - - // Close the codec - avcodec_close(pCodecCtx); - - // Close the video file - av_close_input_file(pFormatCtx); - - return 0; -} -} - - -int convertir_img(pathimage pathFitxer, tipus_format f, int W, int H, int posi){ - /* - Quicktime per les conversions - */ - - /* RGB vectors */ - unsigned char * qt_rows[3]; - /* YUV vesctor frame */ - unsigned char *qt_frame = NULL; - /* quicktime decoder */ - quicktime_t *qt; - /* quicktime color model */ - int qt_cmodel; - - int nN = posi; - int x_vwidth = 0; - int x_vheight = 0; - /* convertir(entrada,FORMAT_MINIATURA, W_CELL, H_CELL, nN); */ - qt = quicktime_open(pathFitxer, 1, 0); - - if (!(qt)){ - /* post("videogrid: error opening qt file"); */ - return -1; - } - - if (!quicktime_has_video(qt)) { - /* post("videogrid: no video stream"); */ - quicktime_close(qt); - return -1; - - } - else if (!quicktime_supported_video(qt,0)) { - /* post("videogrid: unsupported video codec\n"); */ - quicktime_close(qt); - return -1; - } - else - { - qt_cmodel = BC_YUV420P; - x_vwidth = quicktime_video_width(qt,0); - x_vheight = quicktime_video_height(qt,0); - - - free(qt_frame); - qt_frame = (unsigned char*)malloc(x_vwidth*x_vheight*4); - - int size = x_vwidth * x_vheight; - qt_rows[0] = &qt_frame[0]; - qt_rows[2] = &qt_frame[size]; - qt_rows[1] = &qt_frame[size + (size>>2)]; - - quicktime_set_cmodel(qt, qt_cmodel); - } - - /* int length = quicktime_video_length(qt,0); */ - /* int Vpos = quicktime_video_position(qt,0); */ - lqt_decode_video(qt, qt_rows, 0); - - switch(qt_cmodel){ - case BC_YUV420P: - printf(" "); - /* post("videogrid: qt colormodel : BC_YUV420P"); */ - - /* per a fer la miniatura - cada k colomnes pillem una - cada l files pillem una */ - int w = x_vwidth; - int h = x_vheight; - int k = (w/W); - int l = (h/H); - - /*int cont=0;*/ - - char nNstr[BYTES_NUM_TEMP]; - pathimage ig_path = PATH_TEMPORAL; - - sprintf(nNstr, "%d", nN); - strcat(ig_path,nNstr); - strcat(ig_path,"."); - strcat(ig_path,FORMAT_MINIATURA); - /* printf("Creacio de la imatge %s ...",ig_path); */ - /* escriu el contingut de data a un arxiu. */ - FILE *fp = fopen(ig_path, "w"); - fprintf (fp, "P6\n%d %d\n255\n", W, H); - - int i,j,y,u,v,r,g,b; - - for (i=0;i<(l*H);i=i+l) { - for (j=0;j<(k*W);j=j+k) { - y=qt_rows[0][(w*i+j)]; - u=qt_rows[1][(w/2)*(i/2)+(j/2)]; - v=qt_rows[2][(w/2)*(i/2)+(j/2)]; - r = CLAMP8(y + 1.402 *(v-128)); - g = CLAMP8(y - 0.34414 *(u-128) - 0.71414 *(v-128)); - b = CLAMP8(y + 1.772 *(u-128)); - fprintf (fp, "%c%c%c", r,g,b); - } - } - - /* escriu el contingut de data a un arxiu.*/ - fclose (fp); - } - return 0; -} - - -typedef char path[BYTESNOMFITXER]; - - -/* estructura de dades: un node de la cua */ -struct node -{ - /* nom del path de la imatge */ - path pathFitxer; - /* apuntador al següent node en cua */ - struct node *seguent; -}; - -/* definició del tipus node */ -typedef struct node Node; - -/* estructures i tipus de dades de la cua */ -/* definició del tipus de cua */ -typedef struct -{ - Node *davanter; - Node *final; -}Cua; - -/* declaracions de les funcions */ - -/* crea una cua */ -void crearCua(Cua *cua); -/* encuara un element al final de la cua */ -void encuar (Cua *cua, path x); -/* elimina un element de la cua */ -int desencuar (Cua *cua); -/* retorna si la cua és buida */ -int cuaBuida(Cua *cua); -/* elimina el contingut de la cua */ -void eliminarCua(Cua *cua); -/* retorna el nombre de nodes de la cua */ -int numNodes(Cua *cua); -/* escriu el contingut de la cua */ -void escriuCua(Cua *cua); - - -/* implementació de les funcions */ -void crearCua(Cua *cua) -{ - cua->davanter=cua->final=NULL; -} - -/* funció que encua el node al final de la cua */ -void encuar (Cua *cua, path x) -{ - Node *nou; - nou=(Node*)malloc(sizeof(Node)); - strcpy(nou->pathFitxer,x); - nou->seguent=NULL; - if(cuaBuida(cua)) - { - cua->davanter=nou; - } - else - cua->final->seguent=nou; - cua->final=nou; -} - -/* elimina l'element del principi de la cua */ -int desencuar (Cua *cua) -{ - if(!cuaBuida(cua)) - { - Node *nou; - nou=cua->davanter; - cua->davanter=cua->davanter->seguent; - free(nou); - return 1; - } - else - { - /* printf("Cua buida\a\n"); */ - return 0; - } - -} - -/* funció que retorna si la cua és buida */ -int cuaBuida(Cua *cua) -{ - return (cua->davanter==NULL); -} - -/* elimina el contingut de la cua */ -void eliminarCua(Cua *cua) -{ - while (!cuaBuida(cua)) desencuar(cua); - printf("Cua eliminada\n"); -} - -/* funció que retorna el nombre de nodes de la cua */ -int numNodes(Cua *cua) -{ - int contador=0; - Node *actual; - actual=cua->davanter; - if(actual) contador=1; - while((actual)&&(actual != cua->final)){ - contador ++; - actual = actual->seguent; - } - return (contador); -} - -/* funció que escriu la cua de nodes per la sortida estàndard */ -void escriuCua(Cua *cua) -{ - if(!cuaBuida(cua)) - { - Node *actual; - actual=cua->davanter; - printf("CUA DE NODES\n["); - do{ - printf("#%s#",actual->pathFitxer); - actual = actual->seguent; - }while(actual); - printf("]\n"); - - } - else - printf("Cua buida\n"); -} - - -/* crear un apuntador al nou objecte */ -static t_class *videogrid_class; -/* indica el nombre de videogrid creats - utilitzat per diferenciar el nom d'instàncies d'objectes del mateix tipus */ -static int videogridcount = 0; - -/* definició de la classe i la seva estructura de dades */ - -typedef struct _videogrid { - t_object x_obj; - /* declaració de la sortida de l'objecte */ - t_outlet *x_sortida; - /* llista d'objectes gràfics */ - t_glist *x_glist; - /* nombre de files */ - int x_num_fil; - /* nombre de columnes */ - int x_num_col; - /* posició de la última imatge en el tauler */ - int x_ultima_img; - /* path del directori actual */ - path x_dir_actual; - /* path del directori a canviar */ - path x_dir_canvi; - /* posicio ultim al directori actual */ - int x_dir_pos; - /* apuntador al primer element posicionat al tauler */ - Node *x_tauler_primer; - /* cua d'imatges */ - Cua x_cua; - /* nom de l'objecte */ - t_symbol *x_name; - /* color de fons */ - t_symbol *x_color_fons; - /* color del marge */ - t_symbol *x_color_marc; - /* mutex per evitar concurrencia sobre la cua al accedir diferents threads*/ - pthread_mutex_t x_lock; - /* v 0.2 -- posicó de la cel·la seleccionada */ - int x_pos_selected; - /* v 0.2 -- color de seleccio */ - t_symbol *x_color_grasp; - -} t_videogrid; - -void load_tk_procs () { - // ########### procediments per videogrid --
slario(at)gmail.com
[a partir del codi del grid de l'Ives: ydegoyon(at)free.fr] ######### - sys_gui("proc videogrid_apply {id} {\n"); - // strip "." from the TK id to make a variable name suffix - sys_gui("set vid [string trimleft $id .]\n"); - // for each variable, make a local variable to hold its name... - sys_gui("set var_graph_name [concat graph_name_$vid]\n"); - sys_gui("global $var_graph_name\n"); - sys_gui("set var_graph_num_fil [concat graph_num_fil_$vid]\n"); - sys_gui("global $var_graph_num_fil\n"); - sys_gui("set var_graph_num_col [concat graph_num_col_$vid]\n"); - sys_gui("global $var_graph_num_col\n"); - sys_gui("set var_graph_color_fons [concat graph_color_fons_$vid]\n"); - sys_gui("global $var_graph_color_fons\n"); - sys_gui("set var_graph_color_marc [concat graph_color_marc_$vid]\n"); - sys_gui("global $var_graph_color_marc\n"); - sys_gui("set var_graph_color_grasp [concat graph_color_grasp_$vid]\n"); - sys_gui("global $var_graph_color_grasp\n"); - sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_name] [eval concat $$var_graph_num_fil] [eval concat $$var_graph_num_col] [eval concat $$var_graph_color_fons] [eval concat $$var_graph_color_marc] [eval concat $$var_graph_color_grasp] \\;]\n"); - // puts stderr $cmd - sys_gui("pd $cmd\n"); - sys_gui("}\n"); - sys_gui("proc videogrid_cancel {id} {\n"); - sys_gui("set cmd [concat $id cancel \\;]\n"); - // puts stderr $cmd - sys_gui("pd $cmd\n"); - sys_gui("}\n"); - sys_gui("proc videogrid_ok {id} {\n"); - sys_gui("videogrid_apply $id\n"); - sys_gui("videogrid_cancel $id\n"); - sys_gui("}\n"); - sys_gui("proc pdtk_videogrid_dialog {id name num_fil num_col color_fons color_marc color_grasp} {\n"); - sys_gui("set vid [string trimleft $id .]\n"); - sys_gui("set var_graph_name [concat graph_name_$vid]\n"); - sys_gui("global $var_graph_name\n"); - sys_gui("set var_graph_num_fil [concat graph_num_fil_$vid]\n"); - sys_gui("global $var_graph_num_fil\n"); - sys_gui("set var_graph_num_col [concat graph_num_col_$vid]\n"); - sys_gui("global $var_graph_num_col\n"); - sys_gui("set var_graph_color_fons [concat graph_color_fons_$vid]\n"); - sys_gui("global $var_graph_color_fons\n"); - sys_gui("set var_graph_color_marc [concat graph_color_marc_$vid]\n"); - sys_gui("global $var_graph_color_marc\n"); - sys_gui("set var_graph_color_grasp [concat graph_color_grasp_$vid]\n"); - sys_gui("global $var_graph_color_grasp\n"); - sys_gui("set $var_graph_name $name\n"); - sys_gui("set $var_graph_num_fil $num_fil\n"); - sys_gui("set $var_graph_num_col $num_col\n"); - sys_gui("set $var_graph_color_fons $color_fons\n"); - sys_gui("set $var_graph_color_marc $color_marc\n"); - sys_gui("set $var_graph_color_grasp $color_grasp\n"); - sys_gui("toplevel $id\n"); - sys_gui("wm title $id {videogrid}\n"); - sys_gui("wm protocol $id WM_DELETE_WINDOW [concat videogrid_cancel $id]\n"); - sys_gui("label $id.label -text {VIDEOGRID PROPERTIES}\n"); - sys_gui("pack $id.label -side top\n"); - sys_gui("frame $id.buttonframe\n"); - sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n"); - sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"videogrid_cancel $id\"\n"); - sys_gui("button $id.buttonframe.apply -text {Apply} -command \"videogrid_apply $id\"\n"); - sys_gui("button $id.buttonframe.ok -text {OK} -command \"videogrid_ok $id\"\n"); - sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n"); - sys_gui("pack $id.buttonframe.apply -side left -expand 1\n"); - sys_gui("pack $id.buttonframe.ok -side left -expand 1\n"); - sys_gui("frame $id.1rangef\n"); - sys_gui("pack $id.1rangef -side top\n"); - sys_gui("label $id.1rangef.lname -text \"Name :\"\n"); - sys_gui("entry $id.1rangef.name -textvariable $var_graph_name -width 7\n"); - sys_gui("pack $id.1rangef.lname $id.1rangef.name -side left\n"); - sys_gui("frame $id.2rangef\n"); - sys_gui("pack $id.2rangef -side top\n"); - sys_gui("label $id.2rangef.lnum_fil -text \"Rows :\"\n"); - sys_gui("entry $id.2rangef.num_fil -textvariable $var_graph_num_fil -width 7\n"); - sys_gui("pack $id.2rangef.lnum_fil $id.2rangef.num_fil -side left\n"); - sys_gui("frame $id.3rangef\n"); - sys_gui("pack $id.3rangef -side top\n"); - sys_gui("label $id.3rangef.lnum_col -text \"Cols :\"\n"); - sys_gui("entry $id.3rangef.num_col -textvariable $var_graph_num_col -width 7\n"); - sys_gui("pack $id.3rangef.lnum_col $id.3rangef.num_col -side left\n"); - sys_gui("frame $id.4rangef\n"); - sys_gui("pack $id.4rangef -side top\n"); - sys_gui("label $id.4rangef.lcolor_fons -text \"Bg Color :\"\n"); - sys_gui("entry $id.4rangef.color_fons -textvariable $var_graph_color_fons -width 7\n"); - sys_gui("pack $id.4rangef.lcolor_fons $id.4rangef.color_fons -side left\n"); - sys_gui("frame $id.5rangef\n"); - sys_gui("pack $id.5rangef -side top\n"); - sys_gui("label $id.5rangef.lcolor_marc -text \"Border Color :\"\n"); - sys_gui("entry $id.5rangef.color_marc -textvariable $var_graph_color_marc -width 7\n"); - sys_gui("pack $id.5rangef.lcolor_marc $id.5rangef.color_marc -side left\n"); - sys_gui("frame $id.6rangef\n"); - sys_gui("pack $id.6rangef -side top\n"); - sys_gui("label $id.6rangef.lcolor_grasp -text \"Sel Color :\"\n"); - sys_gui("entry $id.6rangef.color_grasp -textvariable $var_graph_color_grasp -width 7\n"); - sys_gui("pack $id.6rangef.lcolor_grasp $id.6rangef.color_grasp -side left\n"); - sys_gui("bind $id.1rangef.name <KeyPress-Return> [concat videogrid_ok $id]\n"); - sys_gui("bind $id.2rangef.num_fil <KeyPress-Return> [concat videogrid_ok $id]\n"); - sys_gui("bind $id.3rangef.num_col <KeyPress-Return> [concat videogrid_ok $id]\n"); - sys_gui("bind $id.4rangef.color_fons <KeyPress-Return> [concat videogrid_ok $id]\n"); - sys_gui("bind $id.5rangef.color_marc <KeyPress-Return> [concat videogrid_ok $id]\n"); - sys_gui("bind $id.6rangef.color_grasp <KeyPress-Return> [concat videogrid_ok $id]\n"); - sys_gui("focus $id.1rangef.name\n"); - sys_gui("}\n"); - sys_gui("proc table {w content args} {\n"); - sys_gui("frame $w -bg black\n"); - sys_gui("set r 0\n"); - sys_gui("foreach row $content {\n"); - sys_gui("set fields {}\n"); - sys_gui("set c 0\n"); - sys_gui("foreach col $row {\n"); - // lappend fields [label $w.$r/$c -text $col] - sys_gui("set img [image create photo -file $col]\n"); - sys_gui("lappend fields [label $w.$r/$c -image $img]\n"); - sys_gui("incr c\n"); - sys_gui("}\n"); - sys_gui("eval grid $fields -sticky news -padx 1 -pady 1\n"); - sys_gui("incr r\n"); - sys_gui("}\n"); - sys_gui("set w\n"); - sys_gui("}\n"); - sys_gui("proc pdtk_videogrid_table {id name num_fil num_col} {\n"); - sys_gui("table .tauler {\n"); - sys_gui("{sll80x60.gif 3160x120.gif sll80x60.gif}\n"); - sys_gui("{sll80x60.gif sll80x60.gif sll80x60.gif}\n"); - sys_gui("{sll80x60.ppm sll80x60.gif 3160x120.gif}\n"); - sys_gui("}\n"); - sys_gui("pack .tauler\n"); - sys_gui("}\n"); -} - -/* calcula la posició x del tauler a partir de la posició de l'element de la cua (d'esquerra a dreta) */ -int getX(t_videogrid* x, int posCua){ - int c = x->x_num_col; - int xpos = (posCua % c) * W_CELL + ((posCua % c) + 1) * GRUIX; - return(xpos + 1); -} - -/* calcula la posició y del tauler a partir de la posició de l'element de la cua (de dalt a baix) */ -int getY(t_videogrid* x, int posCua){ - int c = x->x_num_col; - int ypos = (posCua / c) * H_CELL + ((posCua / c) + 1) * GRUIX; - return(ypos + 1); -} - -/* elimina les imatges temporals */ -void eliminar_imatges_temporals(int maxim){ - FILE *fitxer; - path path_total; - int contador = 0; - char contador_str[BYTES_NUM_TEMP]; - while(contador < maxim){ - strcpy(path_total,PATH_TEMPORAL); - sprintf(contador_str,"%d", contador); - strcat(path_total,contador_str); - strcat(path_total,"."); - strcat(path_total,FORMAT_MINIATURA); - /* elimina el fitxer si no hi ha cap problema */ - if(unlink(path_total)){ - /* post("Imatge temporal %s eliminada\n",path_total); */ - } - contador++; - } - /* post("Videogrid: Imatges temporals eliminades\n",path_total); */ -} - -int format_adequat_v(path nomF){ - int retorn = 0; - path ig_path = ""; - strcat(ig_path,nomF); - char *t1; - path extensio = ""; - for ( t1 = strtok(ig_path,"."); - t1 != NULL; - t1 = strtok(NULL,".") ) - strcpy(extensio,t1); - if(strcmp(extensio,"mov")==0) retorn = 1; - /* - if(strcmp(extensio,"eps")==0) retorn = 1; - if(strcmp(extensio,"gif")==0) retorn = 1; - if(strcmp(extensio,"jpg")==0) retorn = 1; - if(strcmp(extensio,"jpeg")==0) retorn = 1; - if(strcmp(extensio,"png")==0) retorn = 1; - if(strcmp(extensio,"ppm")==0) retorn = 1; - if(strcmp(extensio,"tif")==0) retorn = 1; - if(strcmp(extensio,"tiff")==0) retorn = 1; - */ - - return (retorn); -} - -/* afegir una imatge al grid */ -void videogrid_afegir_imatge(t_videogrid *x, path entrada) -{ - int maxim; - char nNstr[BYTES_NUM_TEMP]; - int pos = 0; - /* escriu l'argument entrat */ - /* post("Afegint la imatge %s ...",entrada); */ - maxim = x->x_num_fil * x->x_num_col; - path ig_path = PATH_TEMPORAL; - - /* si hi ha tants nodes a la cua com el maxim */ - if((numNodes(&x->x_cua)) >= maxim){ - /* desencua */ - int extret; - extret = desencuar(&x->x_cua); - /* obtenir la posició en la cua del nou node */ - if(x->x_ultima_img == maxim-1) { - pos = 0; - }else{ - pos = x->x_ultima_img+1; - } - sys_vgui(".x%x.c delete %xS%d\n", glist_getcanvas(x->x_glist), x, pos); - } - /* encua el nou node */ - encuar(&x->x_cua, entrada); - /* si no és el primer element a encuar incrementem la posicio de la última imatge insertada */ - if(numNodes(&x->x_cua) != 1) x->x_ultima_img ++; - /* si assoleix el maxim torna a començar, inicialitzant la posició en el tauler de la última imatge insertada */ - if(x->x_ultima_img == maxim) x->x_ultima_img = 0; - - /* - Quicktime per les conversions - */ - int nN = x->x_ultima_img; - if (format_adequat_v(entrada) == 1) { - convertir_img(entrada,FORMAT_MINIATURA, W_CELL, H_CELL, nN); - } else { - convertir_img_ff(entrada,FORMAT_MINIATURA, W_CELL, H_CELL, nN); - } - - sprintf(nNstr, "%d", nN); - strcat(ig_path,nNstr); - strcat(ig_path,"."); - strcat(ig_path,FORMAT_MINIATURA); - /*printf("Creacio de la imatge %s ...",ig_path);*/ - sys_vgui("image create photo img%x%d -file %s\n",x,nN,ig_path); - /* printf("1. Creacio de la imatge %s ...",ig_path); */ - sys_vgui(".x%x.c create image %d %d -image img%x%d -tags %xS%d\n", - glist_getcanvas(x->x_glist), - text_xpix(&x->x_obj, x->x_glist) + getX(x,nN) + (W_CELL/2), - text_ypix(&x->x_obj, x->x_glist) + getY(x,nN) + (H_CELL/2), - x,nN,x,nN); - /* printf("2. Creacio de la imatge %s ...",ig_path); */ - if(nN == 0){ - x->x_tauler_primer = x->x_cua.final; - /* post("Ara el primer del tauler es %s\n",x->x_tauler_primer->pathFitxer); */ - } - /* printf("SURT de la creacio de la imatge %s ...",ig_path); */ - /* - sys_vgui("image create photo img%x -file %s\n",x,entrada); - sys_vgui(".x%x.c create image %d %d -image img%x -tags %xS\n", - glist_getcanvas(glist),text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),x,x); - */ -} - -/* dibuixa videogrid */ -void videogrid_drawme(t_videogrid *x, t_glist *glist, int firsttime) -{ - /* post("Entra a drawme amb firsttime: %d", firsttime); */ - if (firsttime) { - char name[MAXPDSTRING]; - canvas_makefilename(glist_getcanvas(x->x_glist), x->x_name->s_name, name, MAXPDSTRING); - sys_vgui(".x%x.c create rectangle %d %d %d %d -fill %s -tags %xGRID -outline %s\n", - glist_getcanvas(glist), - text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), - text_xpix(&x->x_obj, glist) + (x->x_num_col * W_CELL) + 1 + (x->x_num_col * GRUIX) + GRUIX, text_ypix(&x->x_obj, glist) + (x->x_num_fil * H_CELL) + 1 + (x->x_num_fil * GRUIX) + GRUIX, - x->x_color_fons->s_name, x,x->x_color_marc->s_name); - - canvas_fixlinesfor(glist_getcanvas(glist), (t_text*)x); - /* si hi elements a la cua els afegeix (redimensió) */ - if(!cuaBuida(&x->x_cua)) - { - path ig_path; - int nN = 0; - char nNstr[BYTES_NUM_TEMP]; - Node *actual; - actual=x->x_cua.davanter; - do{ - strcpy(ig_path,PATH_TEMPORAL); - sprintf(nNstr, "%d", nN); - strcat(ig_path,nNstr); - strcat(ig_path,"."); - strcat(ig_path,FORMAT_MINIATURA); - /* post("reestablint la imatge %s", actual->pathFitxer); */ - // videogrid_afegir_imatge(x,actual->pathFitxer); - convertir_img(actual->pathFitxer,FORMAT_MINIATURA, W_CELL, H_CELL, nN); - sys_vgui("image create photo img%x%d -file %s\n",x,nN,ig_path); - sys_vgui(".x%x.c create image %d %d -image img%x%d -tags %xS%d\n", - glist_getcanvas(x->x_glist),text_xpix(&x->x_obj, x->x_glist) + getX(x,nN) + (W_CELL/2), text_ypix(&x->x_obj, x->x_glist) + getY(x,nN) + (H_CELL/2),x,nN,x,nN); - actual = actual->seguent; - nN++; - }while(actual); - } - } - else { - sys_vgui(".x%x.c coords %xGRID %d %d %d %d\n", glist_getcanvas(glist), x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),text_xpix(&x->x_obj, glist) + (x->x_num_col*W_CELL) + 1 + (x->x_num_col * GRUIX) + GRUIX, text_ypix(&x->x_obj, glist) + (x->x_num_fil*H_CELL) + 1 + (x->x_num_fil * GRUIX) + GRUIX); - if(!cuaBuida(&x->x_cua)) - { - int contador = 0; - while(contador < numNodes(&x->x_cua)){ - sys_vgui(".x%x.c coords %xS%d \ - %d %d\n", - glist_getcanvas(glist), x, contador, - text_xpix(&x->x_obj, x->x_glist) + getX(x,contador) + (W_CELL/2), text_ypix(&x->x_obj, x->x_glist) + getY(x,contador) + (H_CELL/2)); - contador++; - } - - /* char buf[800]; - sprintf(buf, "pdtk_videogrid_table %%s %s %d %d\n", x->x_name->s_name, x->x_num_fil, x->x_num_col); - gfxstub_new(&x->x_obj.ob_pd, x, buf); */ - } - if (x->x_pos_selected > -1){ - sys_vgui(".x%x.c coords %xGRASP %d %d %d %d\n", glist_getcanvas(glist), x, - text_xpix(&x->x_obj, x->x_glist) + getX(x,x->x_pos_selected), text_ypix(&x->x_obj, x->x_glist) + getY(x,x->x_pos_selected), - text_xpix(&x->x_obj, x->x_glist) + getX(x,x->x_pos_selected) + W_CELL, text_ypix(&x->x_obj, x->x_glist) + getY(x,x->x_pos_selected) + H_CELL); - } - sys_vgui(".x%x.c delete %xLINIA\n", glist_getcanvas(x->x_glist), x); - } - int xI = text_xpix(&x->x_obj, glist); - int yI = text_ypix(&x->x_obj, glist); - int xF = xI + (x->x_num_col * W_CELL) + ((x->x_num_col + 1) * GRUIX); - int yF = yI + (x->x_num_fil * H_CELL) + ((x->x_num_fil + 1) * GRUIX); - int vlines = 0; - int xi = 0; - while(vlines < x->x_num_col){ - xi = xI + getX(x,vlines) - GRUIX + 1; - sys_vgui(".x%x.c create line %d %d %d %d -fill %s -width %d -tag %xLINIA\n", glist_getcanvas(x->x_glist), xi, yI, xi, yF, x->x_color_marc->s_name,GRUIX,x); - vlines++; - } - xi = xi + W_CELL + GRUIX; - sys_vgui(".x%x.c create line %d %d %d %d -fill %s -width %d -tag %xLINIA\n", glist_getcanvas(x->x_glist), xi, yI, xi, yF, x->x_color_marc->s_name,GRUIX,x); - int hlines = 0; - int yi = 0; - while(hlines < x->x_num_fil){ - yi = yI + ((H_CELL + GRUIX) * hlines) + 2; - sys_vgui(".x%x.c create line %d %d %d %d -fill %s -width %d -tag %xLINIA\n", glist_getcanvas(x->x_glist), xI, yi, xF, yi, x->x_color_marc->s_name,GRUIX,x); - hlines++; - } - yi = yi + H_CELL + GRUIX; - sys_vgui(".x%x.c create line %d %d %d %d -fill %s -width %d -tag %xLINIA\n", glist_getcanvas(x->x_glist), xI, yi, xF, yi, x->x_color_marc->s_name,GRUIX,x); -} - -/* borra videogrid v 0.2 -- int toclear */ -void videogrid_erase(t_videogrid* x,t_glist* glist, int toclear) -{ - int maxim = x->x_num_fil * x->x_num_col; - path path_total; - char contador_str[BYTES_NUM_TEMP]; - /* post("Entra a erase"); */ - /* elimina les imatges */ - int contador = 0; - while(contador < numNodes(&x->x_cua)){ - - sys_vgui(".x%x.c delete %xS%d\n", glist_getcanvas(x->x_glist), x, contador); - strcpy(path_total,PATH_TEMPORAL); - sprintf(contador_str,"%d", contador); - strcat(path_total,contador_str); - strcat(path_total,"."); - strcat(path_total,FORMAT_MINIATURA); - if(unlink(path_total)){ - /* post("Imatge temporal %s eliminada\n",path_total); */ - } - contador++; - } - - /* elimina el grid v 0.2 -- excepte quan es fa un clear */ - if(toclear == 0){ - sys_vgui(".x%x.c delete %xGRID\n", glist_getcanvas(glist), x); - sys_vgui(".x%x.c delete %xLINIA\n", glist_getcanvas(x->x_glist), x); - } - /* v 0.2 -- elimina el marc de la casella seleccionada */ - if(x->x_pos_selected > -1){ - sys_vgui(".x%x.c delete %xGRASP\n", glist_getcanvas(glist), x); - x->x_pos_selected = -1; - } - eliminar_imatges_temporals(maxim); -} - -/* mètode de la clase que escriu un missatge al rebre un bang */ -void videogrid_bang(t_videogrid *x) -{ - /* post("Hello videogrid !!"); */ - escriuCua(&x->x_cua); -} - -/* mètode de la classe que es dispara al rebre una entrada de missatge amb [putvideo +string( com a paràmetre */ -void videogrid_putvideo(t_videogrid *x, t_symbol *entrada) -{ - /* comprova que existeixi el fitxer */ - FILE *fitxer; - path e; - strcpy(e,entrada->s_name); - /* post("putvideo de %s\n", e); */ - - fitxer = fopen(e,"r"); - if (!fitxer) { - post("Videogrid: Problem opening file %s.\n",e); - } - else { - /* post("s'encua la imatge %s\n", e); */ - videogrid_afegir_imatge(x,e); - /*outlet_symbol(x->x_sortida, entrada);*/ - } - /* post("putvideo amb img = %s\n", e); */ -} - -/* mètode de la classe que es dispara al rebre una entrada de missatge amb [putvideodir +string( com a paràmetre */ -void *videogrid_putvideodir_thread(void *z) -{ - t_videogrid *x = (t_videogrid *)z; - DIR *dirp; - struct dirent * direntp; - path nomImatge, directoriAnterior, pathActual; - int numEncuats = 0, numPosDir = 0; - int maxim; - if ((dirp = opendir(x->x_dir_canvi)) == NULL) - { - post("Videogrid: Can not open folder %s.\n", x->x_dir_canvi); - }else{ - maxim = x->x_num_fil * x->x_num_col; - strcpy(directoriAnterior, x->x_dir_actual); - strcpy(x->x_dir_actual, x->x_dir_canvi); - /* si es el mateix directori entrat l'ultim busca la ultima imatge afegida per a seguir a encuant a partir d'ella en endavant */ - if(strcmp(directoriAnterior, x->x_dir_actual) == 0){ - /* post("Videogrid: Repeteix directori %s\n", x->x_dir_actual); */ - while ( (direntp = readdir( dirp )) != NULL ){ - /* es descarta el mateix directori, el directori anterior i tot el que no sigui un fitxer regular */ - if((strcmp(direntp->d_name,"..") != 0)&&(strcmp(direntp->d_name,".") != 0)&&(direntp->d_type == DT_REG)){ - /* incrementa la posició en el directori */ - numPosDir++; - /* assolir la posició anterior en el directori */ - if(numPosDir > x->x_dir_pos){ - /* si el nombre de nodes encuats per aquest directori no supera el màxim encua el nou node */ - if(numEncuats < maxim){ - /* post("s'encua la imatge %s\n", direntp->d_name); */ - /* concatena el path i el nom de la imatge */ - strcpy(nomImatge,direntp->d_name); - strcpy(pathActual,x->x_dir_actual); - strcat(pathActual,"/"); - strcat(pathActual,nomImatge); - pthread_mutex_lock(&x->x_lock); - videogrid_afegir_imatge(x, pathActual); - pthread_mutex_unlock(&x->x_lock); - /* incrementa en 1 per indicar el nombre de nodes encuats per aquest directori */ - numEncuats++; - /* es desa la posició en el directori de l'últim node encuat */ - x->x_dir_pos = numPosDir; - } - } - } - } - }else{ - /* directori diferent omple la cua començant pel primer fitxer */ @@ Diff output truncated at 100000 characters. @@ This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data: [9893] trunk/externals
by eighthave@users.sourceforge.net
24 May '08
24 May '08
Revision: 9893
http://pure-data.svn.sourceforge.net/pure-data/?rev=9893&view=rev
Author: eighthave Date: 2008-05-23 18:51:05 -0700 (Fri, 23 May 2008) Log Message: ----------- - First stabs at getting pdvjtools as part of Pd-extended - build fixes for Mac OS X - updated help files to standard names Modified Paths: -------------- trunk/externals/Makefile trunk/externals/pdvjtools/videogrid/videogrid.cpp Added Paths: ----------- trunk/externals/pdvjtools/Makefile trunk/externals/pdvjtools/imagegrid/imagegrid.libs trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r-help.pd trunk/externals/pdvjtools/pix_preview/pix_preview.cc trunk/externals/pdvjtools/videogrid/videogrid.libs Removed Paths: ------------- trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd trunk/externals/pdvjtools/pix_preview/pix_preview.cpp Modified: trunk/externals/Makefile =================================================================== --- trunk/externals/Makefile 2008-05-24 01:44:50 UTC (rev 9892) +++ trunk/externals/Makefile 2008-05-24 01:51:05 UTC (rev 9893) @@ -43,20 +43,20 @@ # this variable is to support old "win" directories, rather than "windows" BUILDSRC_OS_NAME = $(OS_NAME) -CFLAGS = -DPD $(OPT_CFLAGS) -I$(pd_src)/src -Wall -W $(DEBUG_CFLAGS) +CFLAGS = -DPD $(OPT_CFLAGS) -I$(pd_src)/src -Wall -W $(DEBUG_CFLAGS) -I$(gem_src)/src LDFLAGS = LIBS = -lm ifeq ($(OS_NAME),darwin) - CFLAGS += -I/sw/include -DMACOSX -DUNIX -Dunix - LDFLAGS += -bundle -bundle_loader $(pd_src)/bin/pd -L/sw/lib \ - -weak_framework Carbon + CFLAGS += -I/sw/include -I$(externals_src)/pdp/include -DMACOSX -DUNIX -Dunix + LDFLAGS += -bundle -bundle_loader $(pd_src)/bin/pd -undefined dynamic_lookup \ + -L/sw/lib -weak_framework Carbon LIBS += -lc DYLIB_LDFLAGS = -dynamiclib -undefined dynamic_lookup -read_only_relocs warning -L/sw/lib STRIP = strip -x endif ifeq ($(OS_NAME),linux) - CFLAGS += -DUNIX -Dunix -fPIC + CFLAGS += -I$(externals_src)/pdp/include -DUNIX -Dunix -fPIC LDFLAGS += -Wl,-export_dynamic -shared LIBS += -lc DYLIB_LDFLAGS = $(LDFLAGS) @@ -2091,6 +2091,45 @@ #------------------------------------------------------------------------------# +# PDVJTOOLS +PDVJTOOLS_NAME=pdvjtools +PDVJTOOLS_OBJECTS := $(wildcard $(externals_src)/pdvjtools/*/*.c) +PDVJTOOLS_CPP_OBJECTS := $(wildcard $(externals_src)/pdvjtools/*/*.cpp) +pdvjtools: $(PDVJTOOLS_OBJECTS:.c=.$(EXTENSION)) \ +$(PDVJTOOLS_CPP_OBJECTS:.cpp=.$(EXTENSION)) + +pdvjtools_install: pdvjtools + install -d $(objectsdir)/$(PDVJTOOLS_NAME) + $(scripts_src)/generate-libdir-metafile.sh $(objectsdir) $(PDVJTOOLS_NAME) \ + --author "" \ + --description "Pure Data Video Junk" + install -p $(PDVJTOOLS_OBJECTS:.c=.$(EXTENSION)) $(objectsdir)/$(PDVJTOOLS_NAME) + install -d $(helpdir)/$(PDVJTOOLS_NAME) + install -p $(externals_src)/pdvjtools/*/*-help.pd \ + $(helpdir)/$(PDVJTOOLS_NAME) + install -d $(manualsdir)/$(PDVJTOOLS_NAME) + install -p $(externals_src)/pdvjtools/pdp_freeframe/INSTALL \ + $(manualsdir)/$(PDVJTOOLS_NAME)/pdp_freeframe_INSTALL + install -p $(externals_src)/pdvjtools/pdp_frei0r/INSTALL \ + $(manualsdir)/$(PDVJTOOLS_NAME)/pdp_frei0r_INSTALL +# install -d $(readmesdir) +# install -p $(externals_src)/pdvjtools/README \ +# $(readmesdir)/$(PDVJTOOLS_NAME).txt +# install -d $(examplesdir)/$(PDVJTOOLS_NAME) +# install -p $(externals_src)/pdvjtools/examples/*.pd \ +# $(examplesdir)/$(PDVJTOOLS_NAME) + +pdvjtools_clean: + -rm -f -- $(PDVJTOOLS_OBJECTS:.c=.$(EXTENSION)) + -rm -f -- $(PDVJTOOLS_CPP_OBJECTS:.cpp=.$(EXTENSION)) + -rm -f -- $(PDVJTOOLS_OBJECTS:.c=.o) + -rm -f -- $(PDVJTOOLS_CPP_OBJECTS:.cpp=.o) + -rm -f -- $(externals_src)/pdvjtools/*.bak + -rm -f -- $(externals_src)/pdvjtools/*.*~ + + + +#------------------------------------------------------------------------------# # PIDIP PIDIP_NAME=pidip $(externals_src)/pidip/configure: $(externals_src)/pidip/configure.ac Added: trunk/externals/pdvjtools/Makefile =================================================================== --- trunk/externals/pdvjtools/Makefile (rev 0) +++ trunk/externals/pdvjtools/Makefile 2008-05-24 01:51:05 UTC (rev 9893) @@ -0,0 +1,17 @@ +TARGET := $(shell pwd | sed 's|.*/\(.*\)$$|\1|') +EXTERNALS_ROOT := $(shell pwd | sed 's|^\(/.*externals\).*|\1|') + +default: + make -C $(EXTERNALS_ROOT) $(TARGET) + +install: + make -C $(EXTERNALS_ROOT) $(TARGET)_install + +clean: + make -C $(EXTERNALS_ROOT) $(TARGET)_clean + +test_locations: + make -C $(EXTERNALS_ROOT) test_locations + +etags: + etags *.[ch] ~/code/pure-data/trunk/pd/src/*.[ch] /usr/include/*.h /usr/include/sys/*.h Added: trunk/externals/pdvjtools/imagegrid/imagegrid.libs =================================================================== --- trunk/externals/pdvjtools/imagegrid/imagegrid.libs (rev 0) +++ trunk/externals/pdvjtools/imagegrid/imagegrid.libs 2008-05-24 01:51:05 UTC (rev 9893) @@ -0,0 +1 @@ +-lMagick -lWand Deleted: trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd =================================================================== --- trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd 2008-05-24 01:44:50 UTC (rev 9892) +++ trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd 2008-05-24 01:51:05 UTC (rev 9893) @@ -1,330 +0,0 @@ -#N canvas 528 22 996 665 10; -#X floatatom 151 379 5 0 0 0 - - -; -#X obj 196 377 hradio 15 1 0 49 empty empty empty 0 -6 0 8 -262144 --1 -1 0; -#X obj 261 171 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X obj 401 171 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X obj 541 171 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X msg 258 191 param 3 \$1; -#X msg 398 190 param 4 \$1; -#X msg 539 190 param 5 \$1; -#X text 197 358 Select the plugin; -#X text 258 72 Adjust plugin parameters.; -#X symbolatom 87 501 20 0 0 0 - - -; -#X text 240 501 <-- plugin name; -#X floatatom 106 479 5 0 0 0 - - -; -#X text 154 477 <-- number of parameters; -#X text 205 451 <-- parameter name; -#X text 232 423 <-- parameter type; -#X obj 263 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X obj 401 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X obj 542 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X obj 261 234 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X obj 402 234 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X obj 544 234 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X msg 260 131 param 0 \$1; -#X msg 398 131 param 1 \$1; -#X msg 539 131 param 2 \$1; -#X msg 260 254 param 6 \$1; -#X msg 399 253 param 7 \$1; -#X msg 541 253 param 8 \$1; -#N canvas 0 22 996 665 pname 0; -#X obj 51 119 l2s; -#X obj 80 119 l2s; -#X obj 111 119 l2s; -#X obj 143 119 l2s; -#X obj 207 120 l2s; -#X obj 236 120 l2s; -#X obj 267 120 l2s; -#X obj 298 119 l2s; -#X obj 327 119 l2s; -#X obj 97 51 inlet; -#X obj 51 154 s ffparam0; -#X obj 79 178 s ffparam1; -#X obj 118 205 s ffparam2; -#X obj 148 227 s ffparam3; -#X obj 185 157 s ffparam4; -#X obj 213 181 s ffparam5; -#X obj 255 206 s ffparam6; -#X obj 283 230 s ffparam7; -#X obj 305 155 s ffparam8; -#X obj 391 53 inlet; -#X msg 390 79 symbol; -#X obj 359 118 l2s; -#X obj 391 118 l2s; -#X obj 97 79 route 0 1 2 3 4 5 6 7 8 9 10; -#X obj 357 178 s ffparam9; -#X obj 414 202 s ffparam10; -#X connect 0 0 10 0; -#X connect 1 0 11 0; -#X connect 2 0 12 0; -#X connect 3 0 13 0; -#X connect 4 0 14 0; -#X connect 5 0 15 0; -#X connect 6 0 16 0; -#X connect 7 0 17 0; -#X connect 8 0 18 0; -#X connect 9 0 23 0; -#X connect 19 0 20 0; -#X connect 20 0 10 0; -#X connect 20 0 11 0; -#X connect 20 0 12 0; -#X connect 20 0 13 0; -#X connect 20 0 14 0; -#X connect 20 0 15 0; -#X connect 20 0 16 0; -#X connect 20 0 17 0; -#X connect 20 0 18 0; -#X connect 20 0 24 0; -#X connect 20 0 25 0; -#X connect 21 0 24 0; -#X connect 22 0 25 0; -#X connect 23 0 0 0; -#X connect 23 1 1 0; -#X connect 23 2 2 0; -#X connect 23 3 3 0; -#X connect 23 4 4 0; -#X connect 23 5 5 0; -#X connect 23 6 6 0; -#X connect 23 7 7 0; -#X connect 23 8 8 0; -#X connect 23 9 21 0; -#X connect 23 10 22 0; -#X restore 137 451 pd pname; -#X symbolatom 260 93 18 0 0 0 - ffparam0 -; -#X symbolatom 399 92 18 0 0 0 - ffparam1 -; -#X symbolatom 538 92 18 0 0 0 - ffparam2 -; -#X symbolatom 261 154 18 0 0 0 - ffparam3 -; -#X symbolatom 400 153 18 0 0 0 - ffparam4 -; -#X symbolatom 539 153 18 0 0 0 - ffparam5 -; -#X symbolatom 261 214 18 0 0 0 - ffparam6 -; -#X symbolatom 400 213 18 0 0 0 - ffparam7 -; -#X symbolatom 539 213 18 0 0 0 - ffparam8 -; -#X text 489 424 frei0r host for Pure Data Packet version 0.1; -#X text 491 439 by Lluis Gomez i Bigorda (lluis(a)artefacte.org); -#X text 510 452 & Yves Degoyon (ydegoyon(a)free.fr); -#X text 491 495 made at piksel yearly gathering :
http://www.piksel.no
-; -#X obj 155 423 print type; -#X text 491 467 using frei0r specification 1.1 by Georg Seidel \, Phillip -Promesberger and Martin Bayer; -#X obj 261 304 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X obj 404 304 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X symbolatom 261 283 18 0 0 0 - ffparam9 -; -#X symbolatom 400 283 18 0 0 0 - ffparam10 -; -#X msg 259 323 param 9 \$1; -#X msg 401 323 param 10 \$1; -#X obj 46 545 pdp_xv; -#N canvas 222 59 450 300 input1 0; -#X obj 49 181 pdp_qt; -#X msg 49 49 bang; -#X msg 110 111 loop 1; -#X obj 50 214 pdp_scale 320 240; -#X msg 167 111 open \$1; -#X obj 167 89 openpanel; -#X text 98 49 Load a mov file; -#X obj 244 113 pdp_v4l; -#X msg 244 58 bang; -#X obj 49 250 outlet; -#X obj 49 5 inlet; -#X obj 251 7 inlet; -#X obj 247 33 route 0; -#X msg 298 59 stop; -#X obj 50 28 route 0; -#X msg 14 79 stop; -#X obj 49 111 metro 80; -#X obj 244 86 metro 80; -#X connect 0 0 3 0; -#X connect 1 0 2 0; -#X connect 1 0 5 0; -#X connect 1 0 16 0; -#X connect 2 0 0 0; -#X connect 3 0 9 0; -#X connect 4 0 0 0; -#X connect 5 0 4 0; -#X connect 7 0 3 0; -#X connect 8 0 17 0; -#X connect 10 0 14 0; -#X connect 11 0 12 0; -#X connect 12 0 13 0; -#X connect 12 1 8 0; -#X connect 13 0 17 0; -#X connect 14 0 15 0; -#X connect 14 1 1 0; -#X connect 15 0 16 0; -#X connect 16 0 0 0; -#X connect 17 0 7 0; -#X restore 44 44 pd input1; -#X text 49 24 .mov; -#X text 115 24 cam; -#X obj 102 10 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 -; -#X obj 44 10 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 -; -#X text 85 89 .mov; -#X text 151 89 cam; -#X obj 138 75 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 -; -#X obj 80 75 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 -; -#N canvas 222 59 450 300 input2 0; -#X obj 49 181 pdp_qt; -#X msg 49 49 bang; -#X msg 110 111 loop 1; -#X obj 50 214 pdp_scale 320 240; -#X msg 167 111 open \$1; -#X obj 167 89 openpanel; -#X text 98 49 Load a mov file; -#X obj 244 113 pdp_v4l; -#X msg 244 58 bang; -#X obj 49 250 outlet; -#X obj 49 5 inlet; -#X obj 251 7 inlet; -#X obj 247 33 route 0; -#X msg 298 59 stop; -#X obj 50 28 route 0; -#X msg 14 79 stop; -#X obj 49 111 metro 80; -#X obj 244 86 metro 80; -#X connect 0 0 3 0; -#X connect 1 0 2 0; -#X connect 1 0 5 0; -#X connect 1 0 16 0; -#X connect 2 0 0 0; -#X connect 3 0 9 0; -#X connect 4 0 0 0; -#X connect 5 0 4 0; -#X connect 7 0 3 0; -#X connect 8 0 17 0; -#X connect 10 0 14 0; -#X connect 11 0 12 0; -#X connect 12 0 13 0; -#X connect 12 1 8 0; -#X connect 13 0 17 0; -#X connect 14 0 15 0; -#X connect 14 1 1 0; -#X connect 15 0 16 0; -#X connect 16 0 0 0; -#X connect 17 0 7 0; -#X restore 80 109 pd input2; -#X text 116 148 .mov; -#X text 182 148 cam; -#X obj 169 134 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 -1; -#X obj 111 134 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 -1; -#N canvas 222 59 450 300 input3 0; -#X obj 49 181 pdp_qt; -#X msg 49 49 bang; -#X msg 110 111 loop 1; -#X obj 50 214 pdp_scale 320 240; -#X msg 167 111 open \$1; -#X obj 167 89 openpanel; -#X text 98 49 Load a mov file; -#X obj 244 113 pdp_v4l; -#X msg 244 58 bang; -#X obj 49 250 outlet; -#X obj 49 5 inlet; -#X obj 251 7 inlet; -#X obj 247 33 route 0; -#X msg 298 59 stop; -#X obj 50 28 route 0; -#X msg 14 79 stop; -#X obj 49 111 metro 80; -#X obj 244 86 metro 80; -#X connect 0 0 3 0; -#X connect 1 0 2 0; -#X connect 1 0 5 0; -#X connect 1 0 16 0; -#X connect 2 0 0 0; -#X connect 3 0 9 0; -#X connect 4 0 0 0; -#X connect 5 0 4 0; -#X connect 7 0 3 0; -#X connect 8 0 17 0; -#X connect 10 0 14 0; -#X connect 11 0 12 0; -#X connect 12 0 13 0; -#X connect 12 1 8 0; -#X connect 13 0 17 0; -#X connect 14 0 15 0; -#X connect 14 1 1 0; -#X connect 15 0 16 0; -#X connect 16 0 0 0; -#X connect 17 0 7 0; -#X restore 111 168 pd input3; -#X obj 43 202 pdp_scale 320 240; -#X obj 69 232 pdp_scale 320 240; -#X obj 93 262 pdp_scale 320 240; -#X obj 905 409 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 -1; -#X obj 905 461 pdp_control; -#X msg 905 434 thread \$1; -#X floatatom 905 522 5 0 0 0 - - -; -#X obj 905 493 route pdp_drop; -#X text 498 547 constructor : pdp_frei0r <index>; -#X obj 46 376 pdp_frei0r 16; -#X text 499 562 you can get the index from the list of loaded plugins -; -#X text 498 575 at startup ( check pd window ); -#X text 13 290 WARNING : sizes of inputs; -#X text 12 302 _must_ be the same; -#X msg 290 18 plugindir /usr/local/lib/frei0r; -#X connect 0 0 75 3; -#X connect 1 0 0 0; -#X connect 2 0 5 0; -#X connect 3 0 6 0; -#X connect 4 0 7 0; -#X connect 5 0 75 0; -#X connect 6 0 75 0; -#X connect 7 0 75 0; -#X connect 12 0 28 1; -#X connect 16 0 22 0; -#X connect 17 0 23 0; -#X connect 18 0 24 0; -#X connect 19 0 25 0; -#X connect 20 0 26 0; -#X connect 21 0 27 0; -#X connect 22 0 75 0; -#X connect 23 0 75 0; -#X connect 24 0 75 0; -#X connect 25 0 75 0; -#X connect 26 0 75 0; -#X connect 27 0 75 0; -#X connect 44 0 48 0; -#X connect 45 0 49 0; -#X connect 48 0 75 0; -#X connect 49 0 75 0; -#X connect 51 0 66 0; -#X connect 54 0 51 1; -#X connect 55 0 51 0; -#X connect 58 0 60 1; -#X connect 59 0 60 0; -#X connect 60 0 67 0; -#X connect 63 0 65 1; -#X connect 64 0 65 0; -#X connect 65 0 68 0; -#X connect 66 0 75 0; -#X connect 67 0 75 1; -#X connect 68 0 75 2; -#X connect 69 0 71 0; -#X connect 70 0 73 0; -#X connect 71 0 70 0; -#X connect 73 0 72 0; -#X connect 75 0 50 0; -#X connect 75 1 10 0; -#X connect 75 2 12 0; -#X connect 75 3 28 0; -#X connect 75 4 42 0; -#X connect 80 0 75 0; Copied: trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r-help.pd (from rev 9892, trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd) =================================================================== --- trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r-help.pd (rev 0) +++ trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r-help.pd 2008-05-24 01:51:05 UTC (rev 9893) @@ -0,0 +1,330 @@ +#N canvas 528 22 996 665 10; +#X floatatom 151 379 5 0 0 0 - - -; +#X obj 196 377 hradio 15 1 0 49 empty empty empty 0 -6 0 8 -262144 +-1 -1 0; +#X obj 261 171 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 401 171 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 541 171 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X msg 258 191 param 3 \$1; +#X msg 398 190 param 4 \$1; +#X msg 539 190 param 5 \$1; +#X text 197 358 Select the plugin; +#X text 258 72 Adjust plugin parameters.; +#X symbolatom 87 501 20 0 0 0 - - -; +#X text 240 501 <-- plugin name; +#X floatatom 106 479 5 0 0 0 - - -; +#X text 154 477 <-- number of parameters; +#X text 205 451 <-- parameter name; +#X text 232 423 <-- parameter type; +#X obj 263 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 401 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 542 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 261 234 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 402 234 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 544 234 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X msg 260 131 param 0 \$1; +#X msg 398 131 param 1 \$1; +#X msg 539 131 param 2 \$1; +#X msg 260 254 param 6 \$1; +#X msg 399 253 param 7 \$1; +#X msg 541 253 param 8 \$1; +#N canvas 0 22 996 665 pname 0; +#X obj 51 119 l2s; +#X obj 80 119 l2s; +#X obj 111 119 l2s; +#X obj 143 119 l2s; +#X obj 207 120 l2s; +#X obj 236 120 l2s; +#X obj 267 120 l2s; +#X obj 298 119 l2s; +#X obj 327 119 l2s; +#X obj 97 51 inlet; +#X obj 51 154 s ffparam0; +#X obj 79 178 s ffparam1; +#X obj 118 205 s ffparam2; +#X obj 148 227 s ffparam3; +#X obj 185 157 s ffparam4; +#X obj 213 181 s ffparam5; +#X obj 255 206 s ffparam6; +#X obj 283 230 s ffparam7; +#X obj 305 155 s ffparam8; +#X obj 391 53 inlet; +#X msg 390 79 symbol; +#X obj 359 118 l2s; +#X obj 391 118 l2s; +#X obj 97 79 route 0 1 2 3 4 5 6 7 8 9 10; +#X obj 357 178 s ffparam9; +#X obj 414 202 s ffparam10; +#X connect 0 0 10 0; +#X connect 1 0 11 0; +#X connect 2 0 12 0; +#X connect 3 0 13 0; +#X connect 4 0 14 0; +#X connect 5 0 15 0; +#X connect 6 0 16 0; +#X connect 7 0 17 0; +#X connect 8 0 18 0; +#X connect 9 0 23 0; +#X connect 19 0 20 0; +#X connect 20 0 10 0; +#X connect 20 0 11 0; +#X connect 20 0 12 0; +#X connect 20 0 13 0; +#X connect 20 0 14 0; +#X connect 20 0 15 0; +#X connect 20 0 16 0; +#X connect 20 0 17 0; +#X connect 20 0 18 0; +#X connect 20 0 24 0; +#X connect 20 0 25 0; +#X connect 21 0 24 0; +#X connect 22 0 25 0; +#X connect 23 0 0 0; +#X connect 23 1 1 0; +#X connect 23 2 2 0; +#X connect 23 3 3 0; +#X connect 23 4 4 0; +#X connect 23 5 5 0; +#X connect 23 6 6 0; +#X connect 23 7 7 0; +#X connect 23 8 8 0; +#X connect 23 9 21 0; +#X connect 23 10 22 0; +#X restore 137 451 pd pname; +#X symbolatom 260 93 18 0 0 0 - ffparam0 -; +#X symbolatom 399 92 18 0 0 0 - ffparam1 -; +#X symbolatom 538 92 18 0 0 0 - ffparam2 -; +#X symbolatom 261 154 18 0 0 0 - ffparam3 -; +#X symbolatom 400 153 18 0 0 0 - ffparam4 -; +#X symbolatom 539 153 18 0 0 0 - ffparam5 -; +#X symbolatom 261 214 18 0 0 0 - ffparam6 -; +#X symbolatom 400 213 18 0 0 0 - ffparam7 -; +#X symbolatom 539 213 18 0 0 0 - ffparam8 -; +#X text 489 424 frei0r host for Pure Data Packet version 0.1; +#X text 491 439 by Lluis Gomez i Bigorda (lluis(a)artefacte.org); +#X text 510 452 & Yves Degoyon (ydegoyon(a)free.fr); +#X text 491 495 made at piksel yearly gathering :
http://www.piksel.no
+; +#X obj 155 423 print type; +#X text 491 467 using frei0r specification 1.1 by Georg Seidel \, Phillip +Promesberger and Martin Bayer; +#X obj 261 304 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 404 304 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X symbolatom 261 283 18 0 0 0 - ffparam9 -; +#X symbolatom 400 283 18 0 0 0 - ffparam10 -; +#X msg 259 323 param 9 \$1; +#X msg 401 323 param 10 \$1; +#X obj 46 545 pdp_xv; +#N canvas 222 59 450 300 input1 0; +#X obj 49 181 pdp_qt; +#X msg 49 49 bang; +#X msg 110 111 loop 1; +#X obj 50 214 pdp_scale 320 240; +#X msg 167 111 open \$1; +#X obj 167 89 openpanel; +#X text 98 49 Load a mov file; +#X obj 244 113 pdp_v4l; +#X msg 244 58 bang; +#X obj 49 250 outlet; +#X obj 49 5 inlet; +#X obj 251 7 inlet; +#X obj 247 33 route 0; +#X msg 298 59 stop; +#X obj 50 28 route 0; +#X msg 14 79 stop; +#X obj 49 111 metro 80; +#X obj 244 86 metro 80; +#X connect 0 0 3 0; +#X connect 1 0 2 0; +#X connect 1 0 5 0; +#X connect 1 0 16 0; +#X connect 2 0 0 0; +#X connect 3 0 9 0; +#X connect 4 0 0 0; +#X connect 5 0 4 0; +#X connect 7 0 3 0; +#X connect 8 0 17 0; +#X connect 10 0 14 0; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 12 1 8 0; +#X connect 13 0 17 0; +#X connect 14 0 15 0; +#X connect 14 1 1 0; +#X connect 15 0 16 0; +#X connect 16 0 0 0; +#X connect 17 0 7 0; +#X restore 44 44 pd input1; +#X text 49 24 .mov; +#X text 115 24 cam; +#X obj 102 10 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 44 10 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X text 85 89 .mov; +#X text 151 89 cam; +#X obj 138 75 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 80 75 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#N canvas 222 59 450 300 input2 0; +#X obj 49 181 pdp_qt; +#X msg 49 49 bang; +#X msg 110 111 loop 1; +#X obj 50 214 pdp_scale 320 240; +#X msg 167 111 open \$1; +#X obj 167 89 openpanel; +#X text 98 49 Load a mov file; +#X obj 244 113 pdp_v4l; +#X msg 244 58 bang; +#X obj 49 250 outlet; +#X obj 49 5 inlet; +#X obj 251 7 inlet; +#X obj 247 33 route 0; +#X msg 298 59 stop; +#X obj 50 28 route 0; +#X msg 14 79 stop; +#X obj 49 111 metro 80; +#X obj 244 86 metro 80; +#X connect 0 0 3 0; +#X connect 1 0 2 0; +#X connect 1 0 5 0; +#X connect 1 0 16 0; +#X connect 2 0 0 0; +#X connect 3 0 9 0; +#X connect 4 0 0 0; +#X connect 5 0 4 0; +#X connect 7 0 3 0; +#X connect 8 0 17 0; +#X connect 10 0 14 0; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 12 1 8 0; +#X connect 13 0 17 0; +#X connect 14 0 15 0; +#X connect 14 1 1 0; +#X connect 15 0 16 0; +#X connect 16 0 0 0; +#X connect 17 0 7 0; +#X restore 80 109 pd input2; +#X text 116 148 .mov; +#X text 182 148 cam; +#X obj 169 134 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 111 134 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#N canvas 222 59 450 300 input3 0; +#X obj 49 181 pdp_qt; +#X msg 49 49 bang; +#X msg 110 111 loop 1; +#X obj 50 214 pdp_scale 320 240; +#X msg 167 111 open \$1; +#X obj 167 89 openpanel; +#X text 98 49 Load a mov file; +#X obj 244 113 pdp_v4l; +#X msg 244 58 bang; +#X obj 49 250 outlet; +#X obj 49 5 inlet; +#X obj 251 7 inlet; +#X obj 247 33 route 0; +#X msg 298 59 stop; +#X obj 50 28 route 0; +#X msg 14 79 stop; +#X obj 49 111 metro 80; +#X obj 244 86 metro 80; +#X connect 0 0 3 0; +#X connect 1 0 2 0; +#X connect 1 0 5 0; +#X connect 1 0 16 0; +#X connect 2 0 0 0; +#X connect 3 0 9 0; +#X connect 4 0 0 0; +#X connect 5 0 4 0; +#X connect 7 0 3 0; +#X connect 8 0 17 0; +#X connect 10 0 14 0; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 12 1 8 0; +#X connect 13 0 17 0; +#X connect 14 0 15 0; +#X connect 14 1 1 0; +#X connect 15 0 16 0; +#X connect 16 0 0 0; +#X connect 17 0 7 0; +#X restore 111 168 pd input3; +#X obj 43 202 pdp_scale 320 240; +#X obj 69 232 pdp_scale 320 240; +#X obj 93 262 pdp_scale 320 240; +#X obj 905 409 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 905 461 pdp_control; +#X msg 905 434 thread \$1; +#X floatatom 905 522 5 0 0 0 - - -; +#X obj 905 493 route pdp_drop; +#X text 498 547 constructor : pdp_frei0r <index>; +#X obj 46 376 pdp_frei0r 16; +#X text 499 562 you can get the index from the list of loaded plugins +; +#X text 498 575 at startup ( check pd window ); +#X text 13 290 WARNING : sizes of inputs; +#X text 12 302 _must_ be the same; +#X msg 290 18 plugindir /usr/local/lib/frei0r; +#X connect 0 0 75 3; +#X connect 1 0 0 0; +#X connect 2 0 5 0; +#X connect 3 0 6 0; +#X connect 4 0 7 0; +#X connect 5 0 75 0; +#X connect 6 0 75 0; +#X connect 7 0 75 0; +#X connect 12 0 28 1; +#X connect 16 0 22 0; +#X connect 17 0 23 0; +#X connect 18 0 24 0; +#X connect 19 0 25 0; +#X connect 20 0 26 0; +#X connect 21 0 27 0; +#X connect 22 0 75 0; +#X connect 23 0 75 0; +#X connect 24 0 75 0; +#X connect 25 0 75 0; +#X connect 26 0 75 0; +#X connect 27 0 75 0; +#X connect 44 0 48 0; +#X connect 45 0 49 0; +#X connect 48 0 75 0; +#X connect 49 0 75 0; +#X connect 51 0 66 0; +#X connect 54 0 51 1; +#X connect 55 0 51 0; +#X connect 58 0 60 1; +#X connect 59 0 60 0; +#X connect 60 0 67 0; +#X connect 63 0 65 1; +#X connect 64 0 65 0; +#X connect 65 0 68 0; +#X connect 66 0 75 0; +#X connect 67 0 75 1; +#X connect 68 0 75 2; +#X connect 69 0 71 0; +#X connect 70 0 73 0; +#X connect 71 0 70 0; +#X connect 73 0 72 0; +#X connect 75 0 50 0; +#X connect 75 1 10 0; +#X connect 75 2 12 0; +#X connect 75 3 28 0; +#X connect 75 4 42 0; +#X connect 80 0 75 0; Copied: trunk/externals/pdvjtools/pix_preview/pix_preview.cc (from rev 9891, trunk/externals/pdvjtools/pix_preview/pix_preview.cpp) =================================================================== --- trunk/externals/pdvjtools/pix_preview/pix_preview.cc (rev 0) +++ trunk/externals/pdvjtools/pix_preview/pix_preview.cc 2008-05-24 01:51:05 UTC (rev 9893) @@ -0,0 +1,538 @@ +//////////////////////////////////////////////////////// +// +// GEM - Graphics Environment for Multimedia +// +// zmoelnig(a)iem.kug.ac.at +// +// Implementation file +// +// Copyright (c) 1997-1998 Mark Danks. +// Copyright (c) G\xFCnther Geiger. +// Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::f\xFCr::uml\xE4ute. IEM +// Copyright (c) 2002 James Tittle & Chris Clepper +// For information on usage and redistribution, and for a DISCLAIMER OF ALL +// WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. +// +///////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////// +// +// pix_preview +// +// 0409:forum::f\xFCr::uml\xE4ute:2000 +// IOhannes m zmoelnig +// mailto:zmoelnig@iem.kug.ac.at +// +///////////////////////////////////////////////////////// + +#include <iostream> +#include <string> +#include <sstream> +using namespace std; +#include "stdio.h" + + +#include "m_pd.h" +#include "m_imp.h" +#include "g_canvas.h" +#include "t_tk.h" + +#include "pix_preview.h" + +int guidebug=0; + +#define COLORGRID_SYS_VGUI2(a,b) if (guidebug) \ + post(a,b);\ + sys_vgui(a,b) + +#define COLORGRID_SYS_VGUI3(a,b,c) if (guidebug) \ + post(a,b,c);\ + sys_vgui(a,b,c) + +#define COLORGRID_SYS_VGUI4(a,b,c,d) if (guidebug) \ + post(a,b,c,d);\ + sys_vgui(a,b,c,d) + +#define COLORGRID_SYS_VGUI5(a,b,c,d,e) if (guidebug) \ + post(a,b,c,d,e);\ + sys_vgui(a,b,c,d,e) + +#define COLORGRID_SYS_VGUI6(a,b,c,d,e,f) if (guidebug) \ + post(a,b,c,d,e,f);\ + sys_vgui(a,b,c,d,e,f) + +#define COLORGRID_SYS_VGUI7(a,b,c,d,e,f,g) if (guidebug) \ + post(a,b,c,d,e,f,g );\ + sys_vgui(a,b,c,d,e,f,g) + +#define COLORGRID_SYS_VGUI8(a,b,c,d,e,f,g,h) if (guidebug) \ + post(a,b,c,d,e,f,g,h );\ + sys_vgui(a,b,c,d,e,f,g,h) + +#define COLORGRID_SYS_VGUI9(a,b,c,d,e,f,g,h,i) if (guidebug) \ + post(a,b,c,d,e,f,g,h,i );\ + sys_vgui(a,b,c,d,e,f,g,h,i) + + + char *fdata="R0lGODlhHAAcAIABAAAAAP///ywAAAAAHAAcAAACGoSPqcvtD6OctNqLs968+w+G4kiW5omm6ooUADs="; + + +/* base64 conversion*/ + +static const std::string base64_chars = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + +std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) { + std::string ret; + int i = 0; + int j = 0; + unsigned char char_array_3[3]; + unsigned char char_array_4[4]; + + while (in_len--) { + char_array_3[i++] = *(bytes_to_encode++); + if (i == 3) { + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); + char_array_4[3] = char_array_3[2] & 0x3f; + + for(i = 0; (i <4) ; i++) + ret += base64_chars[char_array_4[i]]; + i = 0; + } + } + + if (i) + { + for(j = i; j < 3; j++) + char_array_3[j] = '\0'; + + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); + char_array_4[3] = char_array_3[2] & 0x3f; + + for (j = 0; (j < i + 1); j++) + ret += base64_chars[char_array_4[j]]; + + while((i++ < 3)) + ret += '='; + + } + + return ret; + +} + + + + + + + + + + + + + + + +CPPEXTERN_NEW_WITH_TWO_ARGS(pix_preview, t_floatarg, A_DEFFLOAT, t_floatarg, A_DEFFLOAT) + + + ///////////////////////////////////////////////////////// + // + // pix_preview + // + ///////////////////////////////////////////////////////// + // Constructor + // + ///////////////////////////////////////////////////////// + pix_preview :: pix_preview(t_floatarg fx, t_floatarg fy) +{ + #include "pix_preview.tk2c" + xsize = (int)fx; + ysize = (int)fy; + m_csize = 3; + + + image_widgetbehavior.w_getrectfn = image_getrect; + image_widgetbehavior.w_displacefn = image_displace; + image_widgetbehavior.w_selectfn = image_select; + image_widgetbehavior.w_activatefn = image_activate; + image_widgetbehavior.w_deletefn = image_delete; + image_widgetbehavior.w_visfn = image_vis; +#if (PD_VERSION_MINOR > 31) + image_widgetbehavior.w_clickfn = NULL; + image_widgetbehavior.w_propertiesfn = NULL; +#endif +#if PD_MINOR_VERSION < 37 + image_widgetbehavior.w_savefn = image_save; +#endif + + + class_setwidget(pix_preview_class,&image_widgetbehavior); + + if (xsize < 0) xsize = 0; + if (ysize < 0) ysize = 0; + + m_xsize = xsize; + m_ysize = ysize; + + oldimagex = xsize; + oldimagey = ysize; + + m_bufsize = m_xsize * m_ysize * m_csize; + + m_buffer = new t_atom[m_bufsize]; + + //m_dataOut = outlet_new(this->x_obj, &s_list); +} + +///////////////////////////////////////////////////////// +// Destructor +// +///////////////////////////////////////////////////////// +pix_preview :: ~pix_preview() +{ +} + +///////////////////////////////////////////////////////// +// processImage +// +///////////////////////////////////////////////////////// +void pix_preview :: processImage(imageStruct &image) +{ + int x = m_xsize, y = m_ysize, c = m_csize; + + if (image.xsize != oldimagex) { + oldimagex = image.xsize; + m_xsize = ((!xsize) || (xsize > oldimagex))?oldimagex:xsize; + } + if (image.ysize != oldimagey) { + oldimagey = image.ysize; + m_ysize = ((!ysize) || (ysize > oldimagey))?oldimagey:ysize; + } + + if (image.csize != m_csize) m_csize = image.csize; + + if ( (m_xsize != x) || (m_ysize != y) || (m_csize != c) ) { + // resize the image buffer + if(m_buffer)delete [] m_buffer; + m_bufsize = m_xsize * m_ysize * m_csize; + m_buffer = new t_atom[m_bufsize]; + + m_xstep = m_csize * ((float)image.xsize/(float)m_xsize); + m_ystep = m_csize * ((float)image.ysize/(float)m_ysize) * image.xsize; + } + + m_data = image.data; +} + +///////////////////////////////////////////////////////// +// processYUVImage +// +///////////////////////////////////////////////////////// +void pix_preview :: processYUVImage(imageStruct &image) +{ + int x = m_xsize, y = m_ysize, c = m_csize; + + if (image.xsize != oldimagex) { + oldimagex = image.xsize; + m_xsize = ((!xsize) || (xsize > oldimagex))?oldimagex:xsize; + } + if (image.ysize != oldimagey) { + oldimagey = image.ysize; + m_ysize = ((!ysize) || (ysize > oldimagey))?oldimagey:ysize; + } + + if (image.csize != m_csize) m_csize = image.csize; + + if ( (m_xsize != x) || (m_ysize != y) || (m_csize != c) ) { + // resize the image buffer + if(m_buffer)delete [] m_buffer; + m_bufsize = m_xsize * m_ysize * m_csize; + m_buffer = new t_atom[m_bufsize]; + + m_xstep = m_csize * ((float)image.xsize/(float)m_xsize); + m_ystep = m_csize * ((float)image.ysize/(float)m_ysize) * image.xsize; + } + + m_data = image.data; +} + +///////////////////////////////////////////////////////// +// trigger +// +///////////////////////////////////////////////////////// +void pix_preview :: trigger() +{ + if (!m_data) return; + + int n = m_ysize, m = 0; + int i = 0; + + unsigned char *data, *line; + stringstream sx,sy; + + fprintf (stderr,"%d %d %d %d %d %d \n",xsize, ysize,m_xsize, m_ysize,oldimagex,oldimagey); + + std::string pnm; + std::string pnm64; + pnm += "P6\n"; + sx << m_xsize; + pnm += sx.str(); + pnm += " "; + sy << m_ysize; + pnm += sy.str(); + pnm += "\n255\n"; + + //fprintf (stderr,"%s",pnm.c_str()); + + /*/escriu el contingut de data a un arxiu.*/ + char* ig_path = "/tmp/pixdump01.pnm"; + FILE * fp = fopen(ig_path, "w"); + fprintf (fp, "P6\n%d %d\n255\n", m_xsize, m_ysize); + data = line = m_data; + switch(m_csize){ + case 4: +/* + while (n > 0) { + while (m < m_xsize) { + int r, g, b, a; + r = (int)data[chRed]; + fprintf (fp, "%c", (char)r); + i++; + g = (int)data[chGreen]; + fprintf (fp, "%c", (char)g); + i++; + b = (int)data[chBlue]; + fprintf (fp, "%c", (char)b); + i++; + a = (int)data[chAlpha]; + i++; + m++; + data = line + (int)(m_xstep * (float)m); + } + m = 0; + n--; + line = m_data + (int)(m_ystep*n); + data = line; + } + fclose (fp); +*/ + while (n > 0) { + while (m < m_xsize) { + int r, g, b, a; + r = (int)data[chRed]; + pnm += (char)r; + fprintf (fp, "%c", (char)r); + i++; + g = (int)data[chGreen]; + pnm += (char)g; + fprintf (fp, "%c", (char)g); + i++; + b = (int)data[chBlue]; + pnm += (char)b; + fprintf (fp, "%c", (char)b); + i++; + a = (int)data[chAlpha]; + i++; + m++; + data = line + (int)(m_xstep * (float)m); + } + m = 0; + n--; + line = m_data + (int)(m_ystep*n); + data = line; + } + fclose (fp); + + + //std::cout << "NOT encoded: " << pnm << std::endl; + + //pnm64 = base64_encode(reinterpret_cast<const unsigned char*>(pnm.c_str()), pnm.length()); + //std::cout << "encoded: " << pnm64 << std::endl; + + + + //m_glist = (t_glist *) canvas_getcurrent(); + + + //sys_vgui("img%x put {%s}\n", this->x_obj, reinterpret_cast<const unsigned char*>(pnm64.c_str()) ); + image_drawme((pix_preview *)this->x_obj, (t_glist *) this->getCanvas(), 0, m_xsize, m_ysize); +// sys_vgui(".x%x.c coords %xS %d %d\n", +// this->getCanvas(), this->x_obj, +// text_xpix(this->x_obj, (t_glist *)this->getCanvas()) + (m_xsize/2), text_ypix(this->x_obj, (t_glist *)this->getCanvas()) + (m_ysize/2)); + //fprintf (stderr, "%x %x - %d %d\n",x,(t_object*)x, text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); + + break; + case 2: + while (n < m_ysize) { + while (m < m_xsize/2) { + float y,u,y1,v; + u = (float)data[0] / 255.f; + SETFLOAT(&m_buffer[i], u); + i++; + y = (float)data[1] / 255.f; + SETFLOAT(&m_buffer[i], y); + i++; + v = (float)data[2] / 255.f; + SETFLOAT(&m_buffer[i], v); + i++; + y1 = (float)data[3] / 255.f; + SETFLOAT(&m_buffer[i], y1); + i++; + m++; + data = line + (int)(m_xstep * (float)m); + } + m = 0; + n++; + line = m_data + (int)(m_ystep*n); + data = line; + } + case 1: default: + int datasize=m_xsize*m_ysize*m_csize/4; + while (datasize--) { + float v; + v = (float)(*data++) / 255.f; SETFLOAT(&m_buffer[i], v); + v = (float)(*data++) / 255.f; SETFLOAT(&m_buffer[i+1], v); + v = (float)(*data++) / 255.f; SETFLOAT(&m_buffer[i+2], v); + v = (float)(*data++) / 255.f; SETFLOAT(&m_buffer[i+3], v); + i+=4; + } + } + //outlet_list(m_dataOut, gensym("list"), i, m_buffer); +} + +///////////////////////////////////////////////////////// +// static member function +// +///////////////////////////////////////////////////////// +void pix_preview :: obj_setupCallback(t_class *classPtr) +{ + class_addbang(classPtr, (t_method)&pix_preview::triggerMessCallback); +} + +void pix_preview :: triggerMessCallback(void *data) +{ + GetMyClass(data)->trigger(); +} + + + + +/* widget helper functions */ + + + + +void pix_preview :: image_drawme(pix_preview *x, t_glist *glist, int firsttime, int m_xsize, int m_ysize) +{ + char* ig_path = "/tmp/pixdump01.pnm"; + if (firsttime) { + + sys_vgui("image create photo img%x -data {%s}\n",x,fdata); + sys_vgui(".x%x.c create image %d %d -image img%x -tags %xS\n", + glist_getcanvas(glist),text_xpix((t_object*)x, glist)+14, text_ypix((t_object*)x, glist)+14,x,x); + //fprintf (stderr, "%x %x - %d %d \n",x,(t_object*)x, text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); + } + else { + sys_vgui(".x%x.c delete %xS\n", glist_getcanvas(glist), x); + sys_vgui(".x%x.c delete img%x\n", glist_getcanvas(glist), x); + sys_vgui("image create photo img%x -file %s\n",x,ig_path); + sys_vgui(".x%x.c create image %d %d -image img%x -tags %xS\n", + glist_getcanvas(glist),text_xpix((t_object*)x, glist)+(m_xsize/2), text_ypix((t_object*)x, glist)+(m_ysize/2),x,x); + //sys_vgui(".x%x.c coords %xS \ +%d %d\n", + // glist_getcanvas(glist), x, + // text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); + //fprintf (stderr, "%x %x - %d %d\n",x,(t_object*)x, text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); + } + +} + +void pix_preview :: image_erase(pix_preview* x,t_glist* glist) +{ + int n; + sys_vgui(".x%x.c delete %xS\n", + glist_getcanvas(glist), x); + +} + + +/* ------------------------ image widgetbehaviour----------------------------- */ + + +void pix_preview :: image_getrect(t_gobj *z, t_glist *glist, + int *xp1, int *yp1, int *xp2, int *yp2) +{ + int width, height; + pix_preview* x = (pix_preview*)z; + + + width = 250; + height = 50; + *xp1 = text_xpix((t_object*)x, glist); + *yp1 = text_ypix((t_object*)x, glist); + *xp2 = text_xpix((t_object*)x, glist) + width; + *yp2 = text_ypix((t_object*)x, glist) + height; +} + +void pix_preview :: image_displace(t_gobj *z, t_glist *glist, + int dx, int dy) +{ + t_object *x = (t_object *)z; + x->te_xpix += dx; + x->te_ypix += dy; + sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n", + glist_getcanvas(glist), x, + text_xpix(x, glist), text_ypix(x, glist), + text_xpix(x, glist) + 25, text_ypix(x, glist) + 25); + + //image_drawme((pix_preview *)x, glist, 0); + canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x); +} + +void pix_preview :: image_select(t_gobj *z, t_glist *glist, int state) +{ t_object *x = (t_object *)z; + if (state) { + sys_vgui(".x%x.c create rectangle \ +%d %d %d %d -tags %xSEL -outline blue\n", + glist_getcanvas(glist), + text_xpix(x, glist), text_ypix(x, glist), + text_xpix(x, glist) + 25, text_ypix(x, glist) + 25, + x); + } + else { + sys_vgui(".x%x.c delete %xSEL\n", + glist_getcanvas(glist), x); + } +} + + +void pix_preview :: image_activate(t_gobj *z, t_glist *glist, int state) +{ +} + +void pix_preview :: image_delete(t_gobj *z, t_glist *glist) +{ + + t_text *x = (t_text *)z; + pix_preview* s = (pix_preview*)z; + canvas_deletelinesfor(glist_getcanvas(glist), x); + image_erase(s, glist); +} + + +void pix_preview :: image_vis(t_gobj *z, t_glist *glist, int vis) +{ + pix_preview* s = (pix_preview*)z; + if (vis) + image_drawme(s, glist, 1, 28, 28); +} + Deleted: trunk/externals/pdvjtools/pix_preview/pix_preview.cpp =================================================================== --- trunk/externals/pdvjtools/pix_preview/pix_preview.cpp 2008-05-24 01:44:50 UTC (rev 9892) +++ trunk/externals/pdvjtools/pix_preview/pix_preview.cpp 2008-05-24 01:51:05 UTC (rev 9893) @@ -1,538 +0,0 @@ -//////////////////////////////////////////////////////// -// -// GEM - Graphics Environment for Multimedia -// -// zmoelnig(a)iem.kug.ac.at -// -// Implementation file -// -// Copyright (c) 1997-1998 Mark Danks. -// Copyright (c) G\xFCnther Geiger. -// Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::f\xFCr::uml\xE4ute. IEM -// Copyright (c) 2002 James Tittle & Chris Clepper -// For information on usage and redistribution, and for a DISCLAIMER OF ALL -// WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. -// -///////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////// -// -// pix_preview -// -// 0409:forum::f\xFCr::uml\xE4ute:2000 -// IOhannes m zmoelnig -// mailto:zmoelnig@iem.kug.ac.at -// -///////////////////////////////////////////////////////// - -#include <iostream> -#include <string> -#include <sstream> -using namespace std; -#include "stdio.h" - - -#include "m_pd.h" -#include "m_imp.h" -#include "g_canvas.h" -#include "t_tk.h" - -#include "pix_preview.h" - -int guidebug=0; - -#define COLORGRID_SYS_VGUI2(a,b) if (guidebug) \ - post(a,b);\ - sys_vgui(a,b) - -#define COLORGRID_SYS_VGUI3(a,b,c) if (guidebug) \ - post(a,b,c);\ - sys_vgui(a,b,c) - -#define COLORGRID_SYS_VGUI4(a,b,c,d) if (guidebug) \ - post(a,b,c,d);\ - sys_vgui(a,b,c,d) - -#define COLORGRID_SYS_VGUI5(a,b,c,d,e) if (guidebug) \ - post(a,b,c,d,e);\ - sys_vgui(a,b,c,d,e) - -#define COLORGRID_SYS_VGUI6(a,b,c,d,e,f) if (guidebug) \ - post(a,b,c,d,e,f);\ - sys_vgui(a,b,c,d,e,f) - -#define COLORGRID_SYS_VGUI7(a,b,c,d,e,f,g) if (guidebug) \ - post(a,b,c,d,e,f,g );\ - sys_vgui(a,b,c,d,e,f,g) - -#define COLORGRID_SYS_VGUI8(a,b,c,d,e,f,g,h) if (guidebug) \ - post(a,b,c,d,e,f,g,h );\ - sys_vgui(a,b,c,d,e,f,g,h) - -#define COLORGRID_SYS_VGUI9(a,b,c,d,e,f,g,h,i) if (guidebug) \ - post(a,b,c,d,e,f,g,h,i );\ - sys_vgui(a,b,c,d,e,f,g,h,i) - - - char *fdata="R0lGODlhHAAcAIABAAAAAP///ywAAAAAHAAcAAACGoSPqcvtD6OctNqLs968+w+G4kiW5omm6ooUADs="; - - -/* base64 conversion*/ - -static const std::string base64_chars = - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - -std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) { - std::string ret; - int i = 0; - int j = 0; - unsigned char char_array_3[3]; - unsigned char char_array_4[4]; - - while (in_len--) { - char_array_3[i++] = *(bytes_to_encode++); - if (i == 3) { - char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; - char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); - char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); - char_array_4[3] = char_array_3[2] & 0x3f; - - for(i = 0; (i <4) ; i++) - ret += base64_chars[char_array_4[i]]; - i = 0; - } - } - - if (i) - { - for(j = i; j < 3; j++) - char_array_3[j] = '\0'; - - char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; - char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); - char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); - char_array_4[3] = char_array_3[2] & 0x3f; - - for (j = 0; (j < i + 1); j++) - ret += base64_chars[char_array_4[j]]; - - while((i++ < 3)) - ret += '='; - - } - - return ret; - -} - - - - - - - - - - - - - - - -CPPEXTERN_NEW_WITH_TWO_ARGS(pix_preview, t_floatarg, A_DEFFLOAT, t_floatarg, A_DEFFLOAT) - - - ///////////////////////////////////////////////////////// - // - // pix_preview - // - ///////////////////////////////////////////////////////// - // Constructor - // - ///////////////////////////////////////////////////////// - pix_preview :: pix_preview(t_floatarg fx, t_floatarg fy) -{ - #include "pix_preview.tk2c" - xsize = (int)fx; - ysize = (int)fy; - m_csize = 3; - - - image_widgetbehavior.w_getrectfn = image_getrect; - image_widgetbehavior.w_displacefn = image_displace; - image_widgetbehavior.w_selectfn = image_select; - image_widgetbehavior.w_activatefn = image_activate; - image_widgetbehavior.w_deletefn = image_delete; - image_widgetbehavior.w_visfn = image_vis; -#if (PD_VERSION_MINOR > 31) - image_widgetbehavior.w_clickfn = NULL; - image_widgetbehavior.w_propertiesfn = NULL; -#endif -#if PD_MINOR_VERSION < 37 - image_widgetbehavior.w_savefn = image_save; -#endif - - - class_setwidget(pix_preview_class,&image_widgetbehavior); - - if (xsize < 0) xsize = 0; - if (ysize < 0) ysize = 0; - - m_xsize = xsize; - m_ysize = ysize; - - oldimagex = xsize; - oldimagey = ysize; - - m_bufsize = m_xsize * m_ysize * m_csize; - - m_buffer = new t_atom[m_bufsize]; - - //m_dataOut = outlet_new(this->x_obj, &s_list); -} - -///////////////////////////////////////////////////////// -// Destructor -// -///////////////////////////////////////////////////////// -pix_preview :: ~pix_preview() -{ -} - -///////////////////////////////////////////////////////// -// processImage -// -///////////////////////////////////////////////////////// -void pix_preview :: processImage(imageStruct &image) -{ - int x = m_xsize, y = m_ysize, c = m_csize; - - if (image.xsize != oldimagex) { - oldimagex = image.xsize; - m_xsize = ((!xsize) || (xsize > oldimagex))?oldimagex:xsize; - } - if (image.ysize != oldimagey) { - oldimagey = image.ysize; - m_ysize = ((!ysize) || (ysize > oldimagey))?oldimagey:ysize; - } - - if (image.csize != m_csize) m_csize = image.csize; - - if ( (m_xsize != x) || (m_ysize != y) || (m_csize != c) ) { - // resize the image buffer - if(m_buffer)delete [] m_buffer; - m_bufsize = m_xsize * m_ysize * m_csize; - m_buffer = new t_atom[m_bufsize]; - - m_xstep = m_csize * ((float)image.xsize/(float)m_xsize); - m_ystep = m_csize * ((float)image.ysize/(float)m_ysize) * image.xsize; - } - - m_data = image.data; -} - -///////////////////////////////////////////////////////// -// processYUVImage -// -///////////////////////////////////////////////////////// -void pix_preview :: processYUVImage(imageStruct &image) -{ - int x = m_xsize, y = m_ysize, c = m_csize; - - if (image.xsize != oldimagex) { - oldimagex = image.xsize; - m_xsize = ((!xsize) || (xsize > oldimagex))?oldimagex:xsize; - } - if (image.ysize != oldimagey) { - oldimagey = image.ysize; - m_ysize = ((!ysize) || (ysize > oldimagey))?oldimagey:ysize; - } - - if (image.csize != m_csize) m_csize = image.csize; - - if ( (m_xsize != x) || (m_ysize != y) || (m_csize != c) ) { - // resize the image buffer - if(m_buffer)delete [] m_buffer; - m_bufsize = m_xsize * m_ysize * m_csize; - m_buffer = new t_atom[m_bufsize]; - - m_xstep = m_csize * ((float)image.xsize/(float)m_xsize); - m_ystep = m_csize * ((float)image.ysize/(float)m_ysize) * image.xsize; - } - - m_data = image.data; -} - -///////////////////////////////////////////////////////// -// trigger -// -///////////////////////////////////////////////////////// -void pix_preview :: trigger() -{ - if (!m_data) return; - - int n = m_ysize, m = 0; - int i = 0; - - unsigned char *data, *line; - stringstream sx,sy; - - fprintf (stderr,"%d %d %d %d %d %d \n",xsize, ysize,m_xsize, m_ysize,oldimagex,oldimagey); - - std::string pnm; - std::string pnm64; - pnm += "P6\n"; - sx << m_xsize; - pnm += sx.str(); - pnm += " "; - sy << m_ysize; - pnm += sy.str(); - pnm += "\n255\n"; - - //fprintf (stderr,"%s",pnm.c_str()); - - /*/escriu el contingut de data a un arxiu.*/ - char* ig_path = "/tmp/pixdump01.pnm"; - FILE * fp = fopen(ig_path, "w"); - fprintf (fp, "P6\n%d %d\n255\n", m_xsize, m_ysize); - data = line = m_data; - switch(m_csize){ - case 4: -/* - while (n > 0) { - while (m < m_xsize) { - int r, g, b, a; - r = (int)data[chRed]; - fprintf (fp, "%c", (char)r); - i++; - g = (int)data[chGreen]; - fprintf (fp, "%c", (char)g); - i++; - b = (int)data[chBlue]; - fprintf (fp, "%c", (char)b); - i++; - a = (int)data[chAlpha]; - i++; - m++; - data = line + (int)(m_xstep * (float)m); - } - m = 0; - n--; - line = m_data + (int)(m_ystep*n); - data = line; - } - fclose (fp); -*/ - while (n > 0) { - while (m < m_xsize) { - int r, g, b, a; - r = (int)data[chRed]; - pnm += (char)r; - fprintf (fp, "%c", (char)r); - i++; - g = (int)data[chGreen]; - pnm += (char)g; - fprintf (fp, "%c", (char)g); - i++; - b = (int)data[chBlue]; - pnm += (char)b; - fprintf (fp, "%c", (char)b); - i++; - a = (int)data[chAlpha]; - i++; - m++; - data = line + (int)(m_xstep * (float)m); - } - m = 0; - n--; - line = m_data + (int)(m_ystep*n); - data = line; - } - fclose (fp); - - - //std::cout << "NOT encoded: " << pnm << std::endl; - - //pnm64 = base64_encode(reinterpret_cast<const unsigned char*>(pnm.c_str()), pnm.length()); - //std::cout << "encoded: " << pnm64 << std::endl; - - - - //m_glist = (t_glist *) canvas_getcurrent(); - - - //sys_vgui("img%x put {%s}\n", this->x_obj, reinterpret_cast<const unsigned char*>(pnm64.c_str()) ); - image_drawme((pix_preview *)this->x_obj, (t_glist *) this->getCanvas(), 0, m_xsize, m_ysize); -// sys_vgui(".x%x.c coords %xS %d %d\n", -// this->getCanvas(), this->x_obj, -// text_xpix(this->x_obj, (t_glist *)this->getCanvas()) + (m_xsize/2), text_ypix(this->x_obj, (t_glist *)this->getCanvas()) + (m_ysize/2)); - //fprintf (stderr, "%x %x - %d %d\n",x,(t_object*)x, text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); - - break; - case 2: - while (n < m_ysize) { - while (m < m_xsize/2) { - float y,u,y1,v; - u = (float)data[0] / 255.f; - SETFLOAT(&m_buffer[i], u); - i++; - y = (float)data[1] / 255.f; - SETFLOAT(&m_buffer[i], y); - i++; - v = (float)data[2] / 255.f; - SETFLOAT(&m_buffer[i], v); - i++; - y1 = (float)data[3] / 255.f; - SETFLOAT(&m_buffer[i], y1); - i++; - m++; - data = line + (int)(m_xstep * (float)m); - } - m = 0; - n++; - line = m_data + (int)(m_ystep*n); - data = line; - } - case 1: default: - int datasize=m_xsize*m_ysize*m_csize/4; - while (datasize--) { - float v; - v = (float)(*data++) / 255.f; SETFLOAT(&m_buffer[i], v); - v = (float)(*data++) / 255.f; SETFLOAT(&m_buffer[i+1], v); - v = (float)(*data++) / 255.f; SETFLOAT(&m_buffer[i+2], v); - v = (float)(*data++) / 255.f; SETFLOAT(&m_buffer[i+3], v); - i+=4; - } - } - //outlet_list(m_dataOut, gensym("list"), i, m_buffer); -} - -///////////////////////////////////////////////////////// -// static member function -// -///////////////////////////////////////////////////////// -void pix_preview :: obj_setupCallback(t_class *classPtr) -{ - class_addbang(classPtr, (t_method)&pix_preview::triggerMessCallback); -} - -void pix_preview :: triggerMessCallback(void *data) -{ - GetMyClass(data)->trigger(); -} - - - - -/* widget helper functions */ - - - - -void pix_preview :: image_drawme(pix_preview *x, t_glist *glist, int firsttime, int m_xsize, int m_ysize) -{ - char* ig_path = "/tmp/pixdump01.pnm"; - if (firsttime) { - - sys_vgui("image create photo img%x -data {%s}\n",x,fdata); - sys_vgui(".x%x.c create image %d %d -image img%x -tags %xS\n", - glist_getcanvas(glist),text_xpix((t_object*)x, glist)+14, text_ypix((t_object*)x, glist)+14,x,x); - //fprintf (stderr, "%x %x - %d %d \n",x,(t_object*)x, text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); - } - else { - sys_vgui(".x%x.c delete %xS\n", glist_getcanvas(glist), x); - sys_vgui(".x%x.c delete img%x\n", glist_getcanvas(glist), x); - sys_vgui("image create photo img%x -file %s\n",x,ig_path); - sys_vgui(".x%x.c create image %d %d -image img%x -tags %xS\n", - glist_getcanvas(glist),text_xpix((t_object*)x, glist)+(m_xsize/2), text_ypix((t_object*)x, glist)+(m_ysize/2),x,x); - //sys_vgui(".x%x.c coords %xS \ -%d %d\n", - // glist_getcanvas(glist), x, - // text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); - //fprintf (stderr, "%x %x - %d %d\n",x,(t_object*)x, text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); - } - -} - -void pix_preview :: image_erase(pix_preview* x,t_glist* glist) -{ - int n; - sys_vgui(".x%x.c delete %xS\n", - glist_getcanvas(glist), x); - -} - - -/* ------------------------ image widgetbehaviour----------------------------- */ - - -void pix_preview :: image_getrect(t_gobj *z, t_glist *glist, - int *xp1, int *yp1, int *xp2, int *yp2) -{ - int width, height; - pix_preview* x = (pix_preview*)z; - - - width = 250; - height = 50; - *xp1 = text_xpix((t_object*)x, glist); - *yp1 = text_ypix((t_object*)x, glist); - *xp2 = text_xpix((t_object*)x, glist) + width; - *yp2 = text_ypix((t_object*)x, glist) + height; -} - -void pix_preview :: image_displace(t_gobj *z, t_glist *glist, - int dx, int dy) -{ - t_object *x = (t_object *)z; - x->te_xpix += dx; - x->te_ypix += dy; - sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n", - glist_getcanvas(glist), x, - text_xpix(x, glist), text_ypix(x, glist), - text_xpix(x, glist) + 25, text_ypix(x, glist) + 25); - - //image_drawme((pix_preview *)x, glist, 0); - canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x); -} - -void pix_preview :: image_select(t_gobj *z, t_glist *glist, int state) -{ t_object *x = (t_object *)z; - if (state) { - sys_vgui(".x%x.c create rectangle \ -%d %d %d %d -tags %xSEL -outline blue\n", - glist_getcanvas(glist), - text_xpix(x, glist), text_ypix(x, glist), - text_xpix(x, glist) + 25, text_ypix(x, glist) + 25, - x); - } - else { - sys_vgui(".x%x.c delete %xSEL\n", - glist_getcanvas(glist), x); - } -} - - -void pix_preview :: image_activate(t_gobj *z, t_glist *glist, int state) -{ -} - -void pix_preview :: image_delete(t_gobj *z, t_glist *glist) -{ - - t_text *x = (t_text *)z; - pix_preview* s = (pix_preview*)z; - canvas_deletelinesfor(glist_getcanvas(glist), x); - image_erase(s, glist); -} - - -void pix_preview :: image_vis(t_gobj *z, t_glist *glist, int vis) -{ - pix_preview* s = (pix_preview*)z; - if (vis) - image_drawme(s, glist, 1, 28, 28); -} - Modified: trunk/externals/pdvjtools/videogrid/videogrid.cpp =================================================================== --- trunk/externals/pdvjtools/videogrid/videogrid.cpp 2008-05-24 01:44:50 UTC (rev 9892) +++ trunk/externals/pdvjtools/videogrid/videogrid.cpp 2008-05-24 01:51:05 UTC (rev 9893) @@ -34,8 +34,8 @@ #include "pthread.h" /*ffmpeg includes*/ -#include <avcodec.h> -#include <avformat.h> +#include <ffmpeg/avcodec.h> +#include <ffmpeg/avformat.h> /*libquicktime includes*/ //#include <quicktime/lqt.h> Added: trunk/externals/pdvjtools/videogrid/videogrid.libs =================================================================== --- trunk/externals/pdvjtools/videogrid/videogrid.libs (rev 0) +++ trunk/externals/pdvjtools/videogrid/videogrid.libs 2008-05-24 01:51:05 UTC (rev 9893) @@ -0,0 +1 @@ +-lavcodec -lavformat -lavutil -lquicktime This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data: [9892] trunk/externals/pdvjtools
by eighthave@users.sourceforge.net
24 May '08
24 May '08
Revision: 9892
http://pure-data.svn.sourceforge.net/pure-data/?rev=9892&view=rev
Author: eighthave Date: 2008-05-23 18:44:50 -0700 (Fri, 23 May 2008) Log Message: ----------- added [plugindir( message and set default plugindir in _new*( functions Modified Paths: -------------- trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r.c Modified: trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c =================================================================== --- trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c 2008-05-24 01:20:14 UTC (rev 9891) +++ trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c 2008-05-24 01:44:50 UTC (rev 9892) @@ -192,7 +192,8 @@ static void pdp_freeframe_plugindir(t_pdp_freeframe *x, t_symbol *s) { x->plugindir = s; - ff_loadplugins(x, x->plugindir); + if( s != &s_) + ff_loadplugins(x, x->plugindir); } static void pdp_freeframe_process_rgb(t_pdp_freeframe *x) Modified: trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd =================================================================== --- trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd 2008-05-24 01:20:14 UTC (rev 9891) +++ trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd 2008-05-24 01:44:50 UTC (rev 9892) @@ -1,7 +1,7 @@ -#N canvas 0 0 996 665 10; +#N canvas 528 22 996 665 10; #X floatatom 151 379 5 0 0 0 - - -; #X obj 196 377 hradio 15 1 0 49 empty empty empty 0 -6 0 8 -262144 --1 -1 16; +-1 -1 0; #X obj 261 171 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X obj 401 171 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 @@ -20,9 +20,9 @@ #X text 205 451 <-- parameter name; #X text 232 423 <-- parameter type; #X obj 263 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 3200 1; +-1 -1 0 1; #X obj 401 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 4100 1; +-1 -1 0 1; #X obj 542 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X obj 261 234 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 @@ -37,7 +37,7 @@ #X msg 260 254 param 6 \$1; #X msg 399 253 param 7 \$1; #X msg 541 253 param 8 \$1; -#N canvas 0 0 996 665 pname 0; +#N canvas 0 22 996 665 pname 0; #X obj 51 119 l2s; #X obj 80 119 l2s; #X obj 111 119 l2s; @@ -168,7 +168,7 @@ #X restore 44 44 pd input1; #X text 49 24 .mov; #X text 115 24 cam; -#X obj 102 10 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +#X obj 102 10 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #X obj 44 10 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; @@ -176,7 +176,7 @@ #X text 151 89 cam; #X obj 138 75 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; -#X obj 80 75 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +#X obj 80 75 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #N canvas 222 59 450 300 input2 0; #X obj 49 181 pdp_qt; @@ -280,6 +280,7 @@ #X text 498 575 at startup ( check pd window ); #X text 13 290 WARNING : sizes of inputs; #X text 12 302 _must_ be the same; +#X msg 290 18 plugindir /usr/local/lib/frei0r; #X connect 0 0 75 3; #X connect 1 0 0 0; #X connect 2 0 5 0; @@ -326,3 +327,4 @@ #X connect 75 2 12 0; #X connect 75 3 28 0; #X connect 75 4 42 0; +#X connect 80 0 75 0; Modified: trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r.c =================================================================== --- trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r.c 2008-05-24 01:20:14 UTC (rev 9891) +++ trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r.c 2008-05-24 01:44:50 UTC (rev 9892) @@ -87,6 +87,8 @@ int x_plugin; int x_infosok; + t_symbol *plugindir; + PLUGIN *plugins; } t_pdp_frei0r; @@ -111,10 +113,10 @@ } } -void fr_loadplugins(t_pdp_frei0r *x, char *plugindir) +void fr_loadplugins(t_pdp_frei0r *x, t_symbol *plugindirsymbol) { + char* plugindir = plugindirsymbol->s_name; char libname[PATH_MAX]; - unsigned instance, numparameters; int i; char *pluginname; void *plugin_handle; @@ -233,6 +235,13 @@ x->plugins = NULL; } +static void pdp_frei0r_plugindir(t_pdp_frei0r *x, t_symbol *s) +{ + x->plugindir = s; + if( s != &s_) + fr_loadplugins(x, x->plugindir); +} + static void pdp_frei0r_process_rgba(t_pdp_frei0r *x) { t_pdp *newheader = pdp_packet_header(x->x_packet2); @@ -257,7 +266,7 @@ x->x_size = x->x_width*x->x_height; //load the plugins - fr_loadplugins(x, FR_PLUGIN_DIR); + fr_loadplugins(x, x->plugindir); } newheader->info.image.encoding = lheader->info.image.encoding; @@ -420,7 +429,7 @@ post( "frei0r : plugin out of range : %d", (t_int)f ); return; } - post ("pdp_freeframe :: %s selected, %d parameters", x->plugins[x->x_plugin].name, x->plugins[x->x_plugin].numparameters); + post ("pdp_frei0r :: %s selected, %d parameters", x->plugins[x->x_plugin].name, x->plugins[x->x_plugin].numparameters); outlet_symbol(x->x_pname, gensym( x->plugins[x->x_plugin].name ) ); outlet_float(x->x_nparams, (float)x->plugins[x->x_plugin].numparameters); for ( pi=0; pi<x->plugins[x->x_plugin].numparameters; pi++ ) @@ -602,7 +611,20 @@ //load the plugins x->x_plugin_count = 0; x->x_infosok = 0; - fr_loadplugins(x, FR_PLUGIN_DIR); + + char fr_plugin_dir[FILENAME_MAX]; + char *home = getenv("HOME"); + int home_len; + if(home != NULL) + { + home_len = strlen(home); + if(home_len >= FILENAME_MAX) + home_len = FILENAME_MAX - 1; + memcpy(fr_plugin_dir, home, home_len); + fr_plugin_dir[home_len] = '\0'; + strncpy(fr_plugin_dir, "/.frf", FILENAME_MAX - home_len); + pdp_frei0r_plugindir(x, gensym(fr_plugin_dir)); + } //select plugin pdp_frei0r_plugin(x, f); @@ -629,6 +651,7 @@ class_addmethod(pdp_frei0r_class, (t_method)pdp_frei0r_input_2, gensym("pdp2"), A_SYMBOL, A_DEFFLOAT, A_NULL); class_addmethod(pdp_frei0r_class, (t_method)pdp_frei0r_plugin, gensym("plugin"), A_FLOAT, A_NULL); class_addmethod(pdp_frei0r_class, (t_method)pdp_frei0r_param, gensym("param"), A_GIMME, A_NULL); + class_addmethod(pdp_frei0r_class, (t_method)pdp_frei0r_plugindir, gensym("plugindir"), A_SYMBOL, A_NULL); } This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data: [9891] trunk/externals/pdp/opengl
by eighthave@users.sourceforge.net
24 May '08
24 May '08
Revision: 9891
http://pure-data.svn.sourceforge.net/pure-data/?rev=9891&view=rev
Author: eighthave Date: 2008-05-23 18:20:14 -0700 (Fri, 23 May 2008) Log Message: ----------- quick fixup on Makefiles to get things building on Mac OS X Modified Paths: -------------- trunk/externals/pdp/opengl/Makefile trunk/externals/pdp/opengl/Makefile.config Modified: trunk/externals/pdp/opengl/Makefile =================================================================== --- trunk/externals/pdp/opengl/Makefile 2008-05-24 00:43:06 UTC (rev 9890) +++ trunk/externals/pdp/opengl/Makefile 2008-05-24 01:20:14 UTC (rev 9891) @@ -24,7 +24,7 @@ pdp_opengl.pd_darwin: subdirs rm -f pdp_opengl.pd_linux - $(CC) -o pdp_opengl.pd_pd_darwin ../modules/*/*.o ../system/pdp.o ../system/*/*.o ../puredata/*.o modules/*.o system/*.o $(PDP_LIBS) -bundle -undefined error -twolevel_namespace -bundle_loader $(PD_EXECUTABLE) + $(CC) -o pdp_opengl.pd_pd_darwin ../modules/*/*.o ../system/pdp.o ../system/*/*.o ../puredata/*.o modules/*.o system/*.o $(PDP_LIBS) -bundle -undefined dynamic_lookup -bundle_loader $(PD_EXECUTABLE) # $(CC) -o pdp_opengl.pd_pd_darwin modules/*.o system/*.o $(LDFLAGS) -g -dynamic -bundle -flat_namespace -undefined suppress Modified: trunk/externals/pdp/opengl/Makefile.config =================================================================== --- trunk/externals/pdp/opengl/Makefile.config 2008-05-24 00:43:06 UTC (rev 9890) +++ trunk/externals/pdp/opengl/Makefile.config 2008-05-24 01:20:14 UTC (rev 9891) @@ -8,25 +8,28 @@ CFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer -ffast-math \ -Wall -W -Wstrict-prototypes -Werror \ - -Wno-unused -Wno-parentheses -Wno-switch -g + -Wno-unused -Wno-parentheses -Wno-switch -g -I../../../../pd/src CPPFLAGS = -I$(PDP_DIR) -I$(PDP_OGL_DIR) -I/usr/X11R6/include -DPDP_VERSION=\"$(PDP_VERSION)\" # CPPFLAGS = -I$(PD_DIR) -I$(PDP_DIR) -I$(PDP_OGL_DIR) -I/usr/X11R6/include -LDFLAGS = -lGL -lglut +UNAME := $(shell uname -s) +ifeq ($(UNAME),Linux) + TARGET=linux + LDFLAGS = -lGL -lglut +endif +ifeq ($(UNAME),Darwin) + TARGET = darwin + CPPFLAGS += -I/sw/include + PD_EXECUTABLE=../../../pd/bin/pd + LDFLAGS = -lGL -lGLU -lglut -lX11 -L/sw/lib -L/usr/X11R6/lib +endif -TARGET=linux + PDP_OPENGL_LIBRARY_NAME=pdp_opengl.pd_$(TARGET) -#uncomment these for darwin: -#TARGET=darwin -#CPPFLAGS+=-I/sw/include -#PD_EXECUTABLE=/usr/local/bin/pd -#LDFLAGS = -lGL -lGLU -lglut -lX11 -L/sw/lib -L/usr/X11R6/lib - - .c.o: $(CC) $(CFLAGS) $(CPPFLAGS) -o $*.o -c $*.c This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data: [9890] trunk/externals/pdvjtools/pix_preview/ pix_preview.h
by lluisbigorda@users.sourceforge.net
24 May '08
24 May '08
Revision: 9890
http://pure-data.svn.sourceforge.net/pure-data/?rev=9890&view=rev
Author: lluisbigorda Date: 2008-05-23 17:43:06 -0700 (Fri, 23 May 2008) Log Message: ----------- Modified Paths: -------------- trunk/externals/pdvjtools/pix_preview/pix_preview.h Modified: trunk/externals/pdvjtools/pix_preview/pix_preview.h =================================================================== --- trunk/externals/pdvjtools/pix_preview/pix_preview.h 2008-05-24 00:42:12 UTC (rev 9889) +++ trunk/externals/pdvjtools/pix_preview/pix_preview.h 2008-05-24 00:43:06 UTC (rev 9890) @@ -78,6 +78,8 @@ ////////// void trigger(); + int getx(); + int gety(); ////////// // The color outlet @@ -109,8 +111,21 @@ t_widgetbehavior image_widgetbehavior; - static void image_drawme(pix_preview *x, t_glist *glist, int firsttime); + + +private: + + ////////// + // Static member callbacks + static void triggerMessCallback(void *dump); + static void GREYMessCallback(void *dump); + static void RGBAMessCallback(void *dump); + static void RGBMessCallback(void *dump); + + + static void image_drawme(pix_preview *x, t_glist *glist, int firsttime, int m_xsize, int m_ysize); + static void image_erase(pix_preview* x,t_glist* glist); @@ -129,16 +144,6 @@ static void image_vis(t_gobj *z, t_glist *glist, int vis); - -private: - - ////////// - // Static member callbacks - static void triggerMessCallback(void *dump); - static void GREYMessCallback(void *dump); - static void RGBAMessCallback(void *dump); - static void RGBMessCallback(void *dump); - }; #endif // for header file This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data: [9889] trunk/externals/pdvjtools/pix_preview/ pix_preview.cpp
by lluisbigorda@users.sourceforge.net
24 May '08
24 May '08
Revision: 9889
http://pure-data.svn.sourceforge.net/pure-data/?rev=9889&view=rev
Author: lluisbigorda Date: 2008-05-23 17:42:12 -0700 (Fri, 23 May 2008) Log Message: ----------- now the inlet is well putted in the top-left corner of the image back to the file version instead to the data one Modified Paths: -------------- trunk/externals/pdvjtools/pix_preview/pix_preview.cpp Modified: trunk/externals/pdvjtools/pix_preview/pix_preview.cpp =================================================================== --- trunk/externals/pdvjtools/pix_preview/pix_preview.cpp 2008-05-24 00:40:51 UTC (rev 9888) +++ trunk/externals/pdvjtools/pix_preview/pix_preview.cpp 2008-05-24 00:42:12 UTC (rev 9889) @@ -279,7 +279,7 @@ unsigned char *data, *line; stringstream sx,sy; - //fprintf (stderr,"%d %d %d %d %d %d",xsize, ysize,m_xsize, m_ysize,oldimagex,oldimagey); + fprintf (stderr,"%d %d %d %d %d %d \n",xsize, ysize,m_xsize, m_ysize,oldimagex,oldimagey); std::string pnm; std::string pnm64; @@ -293,9 +293,10 @@ //fprintf (stderr,"%s",pnm.c_str()); - /*/escriu el contingut de data a un arxiu. - FILE * fp = fopen("/tmp/pixdump01.pnm", "w"); - fprintf (fp, "P6\n%d %d\n255\n", m_xsize, m_ysize);*/ + /*/escriu el contingut de data a un arxiu.*/ + char* ig_path = "/tmp/pixdump01.pnm"; + FILE * fp = fopen(ig_path, "w"); + fprintf (fp, "P6\n%d %d\n255\n", m_xsize, m_ysize); data = line = m_data; switch(m_csize){ case 4: @@ -329,12 +330,15 @@ int r, g, b, a; r = (int)data[chRed]; pnm += (char)r; + fprintf (fp, "%c", (char)r); i++; g = (int)data[chGreen]; pnm += (char)g; + fprintf (fp, "%c", (char)g); i++; b = (int)data[chBlue]; pnm += (char)b; + fprintf (fp, "%c", (char)b); i++; a = (int)data[chAlpha]; i++; @@ -346,17 +350,25 @@ line = m_data + (int)(m_ystep*n); data = line; } + fclose (fp); + //std::cout << "NOT encoded: " << pnm << std::endl; - pnm64 = base64_encode(reinterpret_cast<const unsigned char*>(pnm.c_str()), pnm.length()); + //pnm64 = base64_encode(reinterpret_cast<const unsigned char*>(pnm.c_str()), pnm.length()); //std::cout << "encoded: " << pnm64 << std::endl; //m_glist = (t_glist *) canvas_getcurrent(); + - sys_vgui("img%x put {%s}\n", this->x_obj, reinterpret_cast<const unsigned char*>(pnm64.c_str()) ); + //sys_vgui("img%x put {%s}\n", this->x_obj, reinterpret_cast<const unsigned char*>(pnm64.c_str()) ); + image_drawme((pix_preview *)this->x_obj, (t_glist *) this->getCanvas(), 0, m_xsize, m_ysize); +// sys_vgui(".x%x.c coords %xS %d %d\n", +// this->getCanvas(), this->x_obj, +// text_xpix(this->x_obj, (t_glist *)this->getCanvas()) + (m_xsize/2), text_ypix(this->x_obj, (t_glist *)this->getCanvas()) + (m_ysize/2)); + //fprintf (stderr, "%x %x - %d %d\n",x,(t_object*)x, text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); break; case 2: @@ -419,8 +431,9 @@ -void pix_preview :: image_drawme(pix_preview *x, t_glist *glist, int firsttime) +void pix_preview :: image_drawme(pix_preview *x, t_glist *glist, int firsttime, int m_xsize, int m_ysize) { + char* ig_path = "/tmp/pixdump01.pnm"; if (firsttime) { sys_vgui("image create photo img%x -data {%s}\n",x,fdata); @@ -429,10 +442,15 @@ //fprintf (stderr, "%x %x - %d %d \n",x,(t_object*)x, text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); } else { - sys_vgui(".x%x.c coords %xS \ + sys_vgui(".x%x.c delete %xS\n", glist_getcanvas(glist), x); + sys_vgui(".x%x.c delete img%x\n", glist_getcanvas(glist), x); + sys_vgui("image create photo img%x -file %s\n",x,ig_path); + sys_vgui(".x%x.c create image %d %d -image img%x -tags %xS\n", + glist_getcanvas(glist),text_xpix((t_object*)x, glist)+(m_xsize/2), text_ypix((t_object*)x, glist)+(m_ysize/2),x,x); + //sys_vgui(".x%x.c coords %xS \ %d %d\n", - glist_getcanvas(glist), x, - text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); + // glist_getcanvas(glist), x, + // text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); //fprintf (stderr, "%x %x - %d %d\n",x,(t_object*)x, text_xpix((t_object*)x, glist), text_ypix((t_object*)x, glist)); } @@ -476,7 +494,7 @@ text_xpix(x, glist), text_ypix(x, glist), text_xpix(x, glist) + 25, text_ypix(x, glist) + 25); - image_drawme((pix_preview *)x, glist, 0); + //image_drawme((pix_preview *)x, glist, 0); canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x); } @@ -515,6 +533,6 @@ { pix_preview* s = (pix_preview*)z; if (vis) - image_drawme(s, glist, 1); + image_drawme(s, glist, 1, 28, 28); } This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data: [9888] trunk/externals/pdvjtools/imagegrid/ imagegrid-help.pd
by sergi_ll@users.sourceforge.net
24 May '08
24 May '08
Revision: 9888
http://pure-data.svn.sourceforge.net/pure-data/?rev=9888&view=rev
Author: sergi_ll Date: 2008-05-23 17:40:51 -0700 (Fri, 23 May 2008) Log Message: ----------- help patch changed Modified Paths: -------------- trunk/externals/pdvjtools/imagegrid/imagegrid-help.pd Modified: trunk/externals/pdvjtools/imagegrid/imagegrid-help.pd =================================================================== --- trunk/externals/pdvjtools/imagegrid/imagegrid-help.pd 2008-05-24 00:35:19 UTC (rev 9887) +++ trunk/externals/pdvjtools/imagegrid/imagegrid-help.pd 2008-05-24 00:40:51 UTC (rev 9888) @@ -4,22 +4,26 @@ #X obj 79 67 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 184 110 ADD IMAGES FROM FOLDER; -#X text 184 60 ADD A IMAGE; +#X text 184 70 ADD A IMAGE; #X text 77 50 LIST STDOUT; #X text 81 324 LOCATION OF THE SELECTED IMAGE; #X text 25 29 Object to select the path location of an image added in the grid.; #X msg 185 124 putimgdir /usr/local/lib/pd/extra/imagegrid/images; -#X msg 186 74 putimg /usr/local/lib/pd/extra/imagegrid/images/logo100.gif -; #X msg -19 98 clear; #X obj 78 156 imagegrid imagegrid1 3 5 #F0F0F0 #0a0b0c #F1882B; #X floatatom 27 77 5 0 0 0 - - -; #X msg 27 97 seek \$1; -#X connect 2 0 11 0; -#X connect 8 0 11 0; -#X connect 9 0 11 0; -#X connect 10 0 11 0; -#X connect 11 0 1 0; -#X connect 12 0 13 0; -#X connect 13 0 11 0; +#X obj 406 47 openpanel; +#X obj 406 19 bng 15 250 50 0 empty empty empty 0 -6 0 10 -262144 -1 +-1; +#X msg 186 84 putimg \$1; +#X connect 2 0 10 0; +#X connect 8 0 10 0; +#X connect 9 0 10 0; +#X connect 10 0 1 0; +#X connect 11 0 12 0; +#X connect 12 0 10 0; +#X connect 13 0 15 0; +#X connect 14 0 13 0; +#X connect 15 0 10 0; This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data: [9887] trunk/externals/pdvjtools/videogrid
by lluisbigorda@users.sourceforge.net
24 May '08
24 May '08
Revision: 9887
http://pure-data.svn.sourceforge.net/pure-data/?rev=9887&view=rev
Author: lluisbigorda Date: 2008-05-23 17:35:19 -0700 (Fri, 23 May 2008) Log Message: ----------- Modified Paths: -------------- trunk/externals/pdvjtools/videogrid/Makefile trunk/externals/pdvjtools/videogrid/videogrid-help.pd Modified: trunk/externals/pdvjtools/videogrid/Makefile =================================================================== --- trunk/externals/pdvjtools/videogrid/Makefile 2008-05-24 00:20:06 UTC (rev 9886) +++ trunk/externals/pdvjtools/videogrid/Makefile 2008-05-24 00:35:19 UTC (rev 9887) @@ -19,10 +19,10 @@ LINUXINCLUDE = -I$(PD_SRC) -I/usr/include/ -.c.pd_linux: - g++ $(FFMPEG_HEADERS) -fPIC -c -O -o videogrid.o videogrid.cpp +.cpp.pd_linux: + g++ $(FFMPEG_HEADERS) -I$(PD_SRC) -fPIC -c -O -o videogrid.o videogrid.cpp # ./tk2c.bash < $*.tk > $*.tk2c - g++ $(FFMPEG_HEADERS) -export_dynamic -shared -o videogrid.pd_linux videogrid.o -lavformat -lavcodec -lavutil -lavcodec -lavutil -lquicktime -lgsm -lz -lm + g++ $(FFMPEG_HEADERS) -export_dynamic -shared -o videogrid.pd_linux videogrid.o -lavformat -lavcodec -lavutil -lquicktime rm -f $*.o # ---------------------------------------------------------- Modified: trunk/externals/pdvjtools/videogrid/videogrid-help.pd =================================================================== --- trunk/externals/pdvjtools/videogrid/videogrid-help.pd 2008-05-24 00:20:06 UTC (rev 9886) +++ trunk/externals/pdvjtools/videogrid/videogrid-help.pd 2008-05-24 00:35:19 UTC (rev 9887) @@ -11,14 +11,20 @@ #X text 24 93 LIST STDOUT; #X msg 156 127 putvideodir /usr/local/lib/pd/extra/videogrid/videos ; -#X obj 83 159 videogrid videogrid2 3 5 #F0F0F0 #0F0F0F #F1882B; +#X obj 83 159 videogrid videogrid1 3 5 #F0F0F0 #0F0F0F #F1882B; #X msg 156 77 putvideo \$1; #X obj 268 74 openpanel; #X obj 348 73 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; +#X msg 16 160 clear; +#X msg 13 212 seek \$1; +#X floatatom 19 185 5 0 0 0 - - -; #X connect 1 0 9 0; #X connect 8 0 9 0; #X connect 9 0 0 0; #X connect 10 0 9 0; #X connect 11 0 10 0; #X connect 12 0 11 0; +#X connect 13 0 9 0; +#X connect 14 0 9 0; +#X connect 15 0 14 0; This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
28
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Results per page:
10
25
50
100
200