aboutsummaryrefslogtreecommitdiff
path: root/videogrid
diff options
context:
space:
mode:
authorlluís gómez i bigordà <lluisbigorda@users.sourceforge.net>2008-05-23 22:40:19 +0000
committerlluís gómez i bigordà <lluisbigorda@users.sourceforge.net>2008-05-23 22:40:19 +0000
commitd6eaeb4b20ebc57545f4ba22aebbc5751344495a (patch)
tree18756b056783c28522f7cee045c0f1c870a1a954 /videogrid
parentef148f9e84eb3b9f1482d4b926d102c18e0eb131 (diff)
changed code to be in a single file
added ffmpeg support svn path=/trunk/externals/pdvjtools/; revision=9876
Diffstat (limited to 'videogrid')
-rw-r--r--videogrid/cua.c164
-rw-r--r--videogrid/cua.h47
-rw-r--r--videogrid/qtconverter.c133
-rw-r--r--videogrid/qtconverter.h27
-rw-r--r--videogrid/tk2c.sh25
-rw-r--r--videogrid/videogrid.cpp (renamed from videogrid/videogrid.c)621
-rw-r--r--videogrid/videogrid.tk157
-rw-r--r--videogrid/videogrid.tk2c126
8 files changed, 606 insertions, 694 deletions
diff --git a/videogrid/cua.c b/videogrid/cua.c
deleted file mode 100644
index e0211b3..0000000
--- a/videogrid/cua.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
-cue for videogrid external
-Copyright (C) 2007 Sergi Lario
-
-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 "cua.h"
-
-/*
-- compilació:
- $ gcc -c -ansi -O -Wall -Wmissing-prototypes cua.c
-- muntatge:
- $ gcc cua.o -o cua
-- execució:
- $ ./cua
-*/
-/* programa principal de prova */
-/*
-int main()
-{
-
- int opc=8;
- char path[BYTESNOMFITXER];
- int ok;
- Cua cua;
- crearCua(&cua);
-
- while(opc!=5)
- {
- printf("\t\t\tMENU PRINCIPAL\n\n\n");
- printf("\t 1. Encuar\n");
- printf("\t 2. Desencuar\n");
- printf("\t 3. Nombre de nodes\n");
- printf("\t 4. Contingut de la cua\n");
- printf("\t 5. Sortir\n");
-
- scanf("%d", &opc);
-
- switch(opc)
- {
- case 1:
- printf("path a introduir:\n");
- scanf("%s", path);
- encuar(&cua, path);
- break;
-
- case 2:
- ok = desencuar(&cua);
- if(ok) printf("node eliminat de la cua\n");
- break;
-
- case 3:
- printf("nombre de nodes de la cua %d\n", numNodes(&cua));
- break;
- case 4:
- escriuCua(&cua);
- break;
- case 5:
- eliminarCua(&cua);
- break;
- }
- }
- getchar();
- return 0;
-}
-*/
-/* 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");
-}
diff --git a/videogrid/cua.h b/videogrid/cua.h
deleted file mode 100644
index 4144770..0000000
--- a/videogrid/cua.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* nombre de caracters per el nom del path del fitxer */
-#define BYTESNOMFITXER 512
-
-typedef char path[BYTESNOMFITXER];
-
-/* estructures i tipus de dades de la cua */
-
-/* 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;
-
-/* 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);
diff --git a/videogrid/qtconverter.c b/videogrid/qtconverter.c
deleted file mode 100644
index 24e99fd..0000000
--- a/videogrid/qtconverter.c
+++ /dev/null
@@ -1,133 +0,0 @@
-#include "qtconverter.h"
-
-/*
-void post(char args[]){
- printf("%s",args);
-}
-*/
-
-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;
-}
-
-
-
-/*
-cc -fPIC -c -O -Wall -Wmissing-prototypes -o qtconverter.o -c qtconverter.c
-cc -o qtconverter qtconverter.o -lc -lm -lquicktime `Wand-config --ldflags --libs`
-./qtconverter
-*/
-
-/*
-int main(void){
- pathimage imatge = "/usr/lib/pd/extra/videogrid/videos/dscn0243.mov";
- tipus_format fo = "ppm";
- int flauta;
- flauta = convertir(imatge,fo,60,40,2);
- printf("\n%d FET\n", flauta);
- return(0);
-}
-*/
-
-
diff --git a/videogrid/qtconverter.h b/videogrid/qtconverter.h
deleted file mode 100644
index da70f40..0000000
--- a/videogrid/qtconverter.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-//#include <quicktime/lqt.h>
-//#include <quicktime/colormodels.h>
-#include <lqt/lqt.h>
-#include <lqt/colormodels.h>
-
-/* 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];
-
-int convertir_img(pathimage pathFitxer, tipus_format f, int W, int H, int posi);
-/* void post(char args[]); */
-
diff --git a/videogrid/tk2c.sh b/videogrid/tk2c.sh
deleted file mode 100644
index 1b1dc09..0000000
--- a/videogrid/tk2c.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-
-#set -x
-
-while read line
-do
- for word in $line
- do
- if [ "X"$word != "X"${word#\#} ]
- then
- echo // ${line#\#}
- break
- else
- line=${line//\'/\\\'}
-#useless, slashes never gets in
- line=${line//\\/\\\\}
-#this one's dirty, i know
- line=${line//;/\\\\;}
- line=${line//\"/\\\"}
- echo 'sys_gui("'$line'\n");'
- break
- fi
- done
-done
-
diff --git a/videogrid/videogrid.c b/videogrid/videogrid.cpp
index 65825f5..69460ab 100644
--- a/videogrid/videogrid.c
+++ b/videogrid/videogrid.cpp
@@ -19,6 +19,7 @@ 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>
@@ -29,15 +30,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 a gestionar una cua */
-#include "cua.h"
-/* incloure estructures de dades i capceleres de funcions per convertir imatges a diferents formats */
-/* #include "magickconverter.h" */
-/* incloure estructures de dades i capceleres de funcions per tractar frames de vídeo */
-#include "qtconverter.h"
/* incloure estructures de dades i capceleres de funcions per traballar amb threads */
#include "pthread.h"
+/*ffmpeg includes*/
+#include <avcodec.h>
+#include <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 */
@@ -47,6 +53,457 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* 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 */
@@ -91,6 +548,134 @@ typedef struct _videogrid {
} 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){
@@ -159,7 +744,6 @@ void videogrid_afegir_imatge(t_videogrid *x, path entrada)
char nNstr[BYTES_NUM_TEMP];
int pos = 0;
/* escriu l'argument entrat */
- if (format_adequat_v(entrada) == 1){
/* post("Afegint la imatge %s ...",entrada); */
maxim = x->x_num_fil * x->x_num_col;
path ig_path = PATH_TEMPORAL;
@@ -188,7 +772,12 @@ void videogrid_afegir_imatge(t_videogrid *x, path entrada)
Quicktime per les conversions
*/
int nN = x->x_ultima_img;
- convertir_img(entrada,FORMAT_MINIATURA, W_CELL, H_CELL, nN);
+ 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,".");
@@ -207,9 +796,6 @@ void videogrid_afegir_imatge(t_videogrid *x, path entrada)
/* 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); */
- }else{
- post("Videogrid: Incompatible file format (%s).\n",entrada);
- }
/*
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",
@@ -369,8 +955,9 @@ void videogrid_putvideo(t_videogrid *x, t_symbol *entrada)
}
/* 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(t_videogrid *x)
+void *videogrid_putvideodir_thread(void *z)
{
+ t_videogrid *x = (t_videogrid *)z;
DIR *dirp;
struct dirent * direntp;
path nomImatge, directoriAnterior, pathActual;
@@ -461,7 +1048,8 @@ void videogrid_putvideodir(t_videogrid *x, t_symbol *entrada)
// ---------------- THREAD CREAT -------------------------
pthread_mutex_init(&x->x_lock, NULL);
- pthread_create(&unthread,&unatribut,(void *)videogrid_putvideodir_thread, x);
+ // 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);
}
@@ -919,10 +1507,12 @@ static void videogrid_destroy(t_videogrid *x){
/* 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"); */
- #include "videogrid.tk2c"
/*
sense pas d'arguments
videogrid_class = class_new(gensym("videogrid"),
@@ -966,7 +1556,7 @@ void videogrid_setup(void)
/* 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"), 0);
+ 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 */
@@ -981,3 +1571,4 @@ void videogrid_setup(void)
class_setwidget(videogrid_class,&videogrid_widgetbehavior);
class_sethelpsymbol(videogrid_class, gensym("videogrid.pd"));
}
+}
diff --git a/videogrid/videogrid.tk b/videogrid/videogrid.tk
deleted file mode 100644
index cd2a07d..0000000
--- a/videogrid/videogrid.tk
+++ /dev/null
@@ -1,157 +0,0 @@
-############ procediments per videogrid -- slario(at)gmail.com [a partir del codi del grid de l'Ives: ydegoyon(at)free.fr] #########
-
-proc videogrid_apply {id} {
-# strip "." from the TK id to make a variable name suffix
- set vid [string trimleft $id .]
-
-# for each variable, make a local variable to hold its name...
- set var_graph_name [concat graph_name_$vid]
- global $var_graph_name
- set var_graph_num_fil [concat graph_num_fil_$vid]
- global $var_graph_num_fil
- set var_graph_num_col [concat graph_num_col_$vid]
- global $var_graph_num_col
- set var_graph_color_fons [concat graph_color_fons_$vid]
- global $var_graph_color_fons
- set var_graph_color_marc [concat graph_color_marc_$vid]
- global $var_graph_color_marc
- set var_graph_color_grasp [concat graph_color_grasp_$vid]
- global $var_graph_color_grasp
-
- 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] \
- \;]
-#puts stderr $cmd
- pd $cmd
-}
-
-proc videogrid_cancel {id} {
- set cmd [concat $id cancel \;]
-#puts stderr $cmd
- pd $cmd
-}
-
-proc videogrid_ok {id} {
- videogrid_apply $id
- videogrid_cancel $id
-}
-
-proc pdtk_videogrid_dialog {id name num_fil num_col color_fons color_marc color_grasp} {
- set vid [string trimleft $id .]
- set var_graph_name [concat graph_name_$vid]
- global $var_graph_name
- set var_graph_num_fil [concat graph_num_fil_$vid]
- global $var_graph_num_fil
- set var_graph_num_col [concat graph_num_col_$vid]
- global $var_graph_num_col
- set var_graph_color_fons [concat graph_color_fons_$vid]
- global $var_graph_color_fons
- set var_graph_color_marc [concat graph_color_marc_$vid]
- global $var_graph_color_marc
- set var_graph_color_grasp [concat graph_color_grasp_$vid]
- global $var_graph_color_grasp
-
- set $var_graph_name $name
- set $var_graph_num_fil $num_fil
- set $var_graph_num_col $num_col
- set $var_graph_color_fons $color_fons
- set $var_graph_color_marc $color_marc
- set $var_graph_color_grasp $color_grasp
-
- toplevel $id
- wm title $id {videogrid}
- wm protocol $id WM_DELETE_WINDOW [concat videogrid_cancel $id]
-
- label $id.label -text {VIDEOGRID PROPERTIES}
- pack $id.label -side top
-
- frame $id.buttonframe
- pack $id.buttonframe -side bottom -fill x -pady 2m
- button $id.buttonframe.cancel -text {Cancel}\
- -command "videogrid_cancel $id"
- button $id.buttonframe.apply -text {Apply}\
- -command "videogrid_apply $id"
- button $id.buttonframe.ok -text {OK}\
- -command "videogrid_ok $id"
- pack $id.buttonframe.cancel -side left -expand 1
- pack $id.buttonframe.apply -side left -expand 1
- pack $id.buttonframe.ok -side left -expand 1
-
- frame $id.1rangef
- pack $id.1rangef -side top
- label $id.1rangef.lname -text "Name :"
- entry $id.1rangef.name -textvariable $var_graph_name -width 7
- pack $id.1rangef.lname $id.1rangef.name -side left
-
- frame $id.2rangef
- pack $id.2rangef -side top
- label $id.2rangef.lnum_fil -text "Rows :"
- entry $id.2rangef.num_fil -textvariable $var_graph_num_fil -width 7
- pack $id.2rangef.lnum_fil $id.2rangef.num_fil -side left
-
- frame $id.3rangef
- pack $id.3rangef -side top
- label $id.3rangef.lnum_col -text "Cols :"
- entry $id.3rangef.num_col -textvariable $var_graph_num_col -width 7
- pack $id.3rangef.lnum_col $id.3rangef.num_col -side left
-
- frame $id.4rangef
- pack $id.4rangef -side top
- label $id.4rangef.lcolor_fons -text "Bg Color :"
- entry $id.4rangef.color_fons -textvariable $var_graph_color_fons -width 7
- pack $id.4rangef.lcolor_fons $id.4rangef.color_fons -side left
-
- frame $id.5rangef
- pack $id.5rangef -side top
- label $id.5rangef.lcolor_marc -text "Border Color :"
- entry $id.5rangef.color_marc -textvariable $var_graph_color_marc -width 7
- pack $id.5rangef.lcolor_marc $id.5rangef.color_marc -side left
-
- frame $id.6rangef
- pack $id.6rangef -side top
- label $id.6rangef.lcolor_grasp -text "Sel Color :"
- entry $id.6rangef.color_grasp -textvariable $var_graph_color_grasp -width 7
- pack $id.6rangef.lcolor_grasp $id.6rangef.color_grasp -side left
-
- bind $id.1rangef.name <KeyPress-Return> [concat videogrid_ok $id]
- bind $id.2rangef.num_fil <KeyPress-Return> [concat videogrid_ok $id]
- bind $id.3rangef.num_col <KeyPress-Return> [concat videogrid_ok $id]
- bind $id.4rangef.color_fons <KeyPress-Return> [concat videogrid_ok $id]
- bind $id.5rangef.color_marc <KeyPress-Return> [concat videogrid_ok $id]
- bind $id.6rangef.color_grasp <KeyPress-Return> [concat videogrid_ok $id]
-
- focus $id.1rangef.name
-}
-
-proc table {w content args} {
- frame $w -bg black
- set r 0
- foreach row $content {
- set fields {}
- set c 0
- foreach col $row {
- # lappend fields [label $w.$r/$c -text $col]
- set img [image create photo -file $col]
- lappend fields [label $w.$r/$c -image $img]
- incr c
- }
- eval grid $fields -sticky news -padx 1 -pady 1
- incr r
- }
- set w
-}
-
-proc pdtk_videogrid_table {id name num_fil num_col} {
- table .tauler {
- {sll80x60.gif 3160x120.gif sll80x60.gif}
- {sll80x60.gif sll80x60.gif sll80x60.gif}
- {sll80x60.ppm sll80x60.gif 3160x120.gif}
- }
- pack .tauler
-}
-############ FINAL procediments per videogrid -- slario(at)gmail.com [a partir del codi del grid de l'Ives: ydegoyon(at)free.fr] ######### \ No newline at end of file
diff --git a/videogrid/videogrid.tk2c b/videogrid/videogrid.tk2c
deleted file mode 100644
index 27bc02a..0000000
--- a/videogrid/videogrid.tk2c
+++ /dev/null
@@ -1,126 +0,0 @@
-// ########### 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");