aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN.N. <sergi_ll@users.sourceforge.net>2010-03-25 21:21:01 +0000
committerN.N. <sergi_ll@users.sourceforge.net>2010-03-25 21:21:01 +0000
commitc0356750137256b4222493adf546bcf9a1d9a4d9 (patch)
tree667971eec376657628c0c9005ac1e3497567909f
parent34f933e7643a176a2f78b852f9be24faa4c150b9 (diff)
bug after update properties solved
svn path=/trunk/externals/pdvjtools/; revision=13271
-rw-r--r--videogrid/videogrid.cc495
1 files changed, 238 insertions, 257 deletions
diff --git a/videogrid/videogrid.cc b/videogrid/videogrid.cc
index 2191623..fbb2d00 100644
--- a/videogrid/videogrid.cc
+++ b/videogrid/videogrid.cc
@@ -44,27 +44,28 @@ extern "C"
#define __STDC_CONSTANT_MACROS 1
/* ffmpeg includes */
+
#include <ffmpeg/avcodec.h>
#include <ffmpeg/avformat.h>
#include <ffmpeg/avutil.h>
#include <ffmpeg/swscale.h>
+ /* may be your ffmpeg headers are here, at least from jaunty to karmic */
+ /*
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
+ #include <libavutil/avutil.h>
+ #include <libswscale/swscale.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
- //v 0.2.1 -- passen a ser propietats de l'objecte
- */
-
/* definició del gruix en pixels del marc del tauler */
#define GRUIX 2
@@ -81,7 +82,6 @@ extern "C"
#define PATH_TEMPORAL "/tmp/vigrid_"
#define BYTES_NUM_TEMP 4
-
typedef char pathimage[BYTESNOMFITXERIMATGE];
typedef char tipus_format[BYTESTIPUSFROMAT];
@@ -126,178 +126,169 @@ extern "C"
}
}
- // 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;
- static int sws_flags = SWS_BICUBIC;
- struct SwsContext *img_convert_ctx;
-
- 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
+ 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;
+ static int sws_flags = SWS_BICUBIC;
+ struct SwsContext *img_convert_ctx;
+
+ int nN = posi;
+
+ // Register all formats and codecs
+ av_register_all();
- // Get a pointer to the codec context for the video stream
- pCodecCtx=pFormatCtx->streams[videoStream]->codec;
+ // Open video file
+ if(av_open_input_file(&pFormatCtx, pathFitxer, NULL, 0, NULL)!=0)
+ return -1; // Couldn't open file
- // Find the decoder for the video stream
- pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
- if(pCodec==NULL)
- return -1; // Codec not found
+ // Retrieve stream information
+ if(av_find_stream_info(pFormatCtx)<0)
+ return -1; // Couldn't find stream information
- // Open codec
- if(avcodec_open(pCodecCtx, pCodec)<0)
- return -1; // Could not open codec
+ // Dump information about file onto standard error
+ dump_format(pFormatCtx, 0, pathFitxer, false);
- // 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;
+ // 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
- // Allocate video frame
- pFrame=avcodec_alloc_frame();
+ // Get a pointer to the codec context for the video stream
+ pCodecCtx=pFormatCtx->streams[videoStream]->codec;
- // Allocate an AVFrame structure
- pFrameRGB=avcodec_alloc_frame();
- if(pFrameRGB==NULL)
- return -1;
+ // Find the decoder for the video stream
+ pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
+ if(pCodec==NULL)
+ return -1; // Codec not found
- // Determine required buffer size and allocate buffer
- numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width,
- pCodecCtx->height);
- buffer=new uint8_t[numBytes];
+ // Open codec
+ if(avcodec_open(pCodecCtx, pCodec)<0)
+ return -1; // Could not open codec
- // Assign appropriate parts of buffer to image planes in pFrameRGB
- avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,
- pCodecCtx->width, pCodecCtx->height);
+ // 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;
- // Read frames and save first five frames to disk
- av_read_frame(pFormatCtx, &packet);
+ // Allocate video frame
+ pFrame=avcodec_alloc_frame();
- // Is this a packet from the video stream?
- if(packet.stream_index==videoStream)
+ // 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)
{
- // 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);
- img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height,
- pCodecCtx->pix_fmt,
- pCodecCtx->width, pCodecCtx->height,
- PIX_FMT_RGB24,
- sws_flags, NULL, NULL, NULL);
-
- sws_scale (img_convert_ctx, pFrame->data, pFrame->linesize,
- 0, pCodecCtx->height,
- pFrameRGB->data, pFrameRGB->linesize);
- sws_freeContext(img_convert_ctx);
-
- // Save the frame to disk
- SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, W, H, posi);
- }
+ // 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);
+ img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height,
+ pCodecCtx->pix_fmt,
+ pCodecCtx->width, pCodecCtx->height,
+ PIX_FMT_RGB24,
+ sws_flags, NULL, NULL, NULL);
+
+ sws_scale (img_convert_ctx, pFrame->data, pFrame->linesize,
+ 0, pCodecCtx->height,
+ pFrameRGB->data, pFrameRGB->linesize);
+ sws_freeContext(img_convert_ctx);
+
+ // 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);
- // 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)
+ // Did we get a video frame?
+ if(frameFinished)
{
- // 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);
- img_convert_ctx = sws_getContext( pCodecCtx->width, pCodecCtx->height,
- pCodecCtx->pix_fmt,
- pCodecCtx->width, pCodecCtx->height,
- PIX_FMT_RGB24,
- sws_flags, NULL, NULL, NULL);
-
- sws_scale (img_convert_ctx, pFrame->data, pFrame->linesize,
- 0, pCodecCtx->height,
- pFrameRGB->data, pFrameRGB->linesize);
- sws_freeContext(img_convert_ctx);
-
- // Save the frame to disk
- SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, W, H, posi);
- }
+ // 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);
+ img_convert_ctx = sws_getContext( pCodecCtx->width, pCodecCtx->height,
+ pCodecCtx->pix_fmt,
+ pCodecCtx->width, pCodecCtx->height,
+ PIX_FMT_RGB24,
+ sws_flags, NULL, NULL, NULL);
+
+ sws_scale (img_convert_ctx, pFrame->data, pFrame->linesize,
+ 0, pCodecCtx->height,
+ pFrameRGB->data, pFrameRGB->linesize);
+ sws_freeContext(img_convert_ctx);
+
+ // 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 packet that was allocated by av_read_frame
+ av_free_packet(&packet);
- // Free the RGB image
- delete [] buffer;
- av_free(pFrameRGB);
+ // Free the RGB image
+ delete [] buffer;
+ av_free(pFrameRGB);
- // Free the YUV frame
- av_free(pFrame);
+ // Free the YUV frame
+ av_free(pFrame);
- // Close the codec
- avcodec_close(pCodecCtx);
+ // Close the codec
+ avcodec_close(pCodecCtx);
- // Close the video file
- av_close_input_file(pFormatCtx);
+ // Close the video file
+ av_close_input_file(pFormatCtx);
- return 0;
- //} extern c
+ return 0;
}
/* ----------------------------------- Quicktime functions ----------------------------------- */
@@ -363,9 +354,9 @@ extern "C"
/* printf(" "); */
/* post("videogrid: qt colormodel : BC_YUV420P"); */
- /* per a fer la miniatura
- cada k colomnes pillem una
- cada l files pillem una */
+ /* 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);
@@ -379,7 +370,7 @@ extern "C"
strcat(ig_path,".");
strcat(ig_path,FORMAT_MINIATURA);
/* printf("Creacio de la imatge %s ...",ig_path); */
- /* escriu el contingut de data a un arxiu. */
+ /* escriu el contingut de data a un arxiu. */
FILE *fp = fopen(ig_path, "w");
fprintf (fp, "P6\n%d %d\n255\n", W, H);
@@ -396,14 +387,12 @@ extern "C"
fprintf (fp, "%c%c%c", r,g,b);
}
}
-
- /* escriu el contingut de data a un arxiu.*/
+ /* escriu el contingut de data a un arxiu.*/
fclose (fp);
}
return 0;
}
-
/* ----------------------------------- Cue > rounded list ----------------------------------- */
typedef char path[BYTESNOMFITXER];
@@ -444,7 +433,6 @@ extern "C"
/* escriu el contingut de la cua */
void escriuCua(Cua *cua);
-
/* implementació de les funcions */
void crearCua(Cua *cua)
{
@@ -483,7 +471,6 @@ extern "C"
/* printf("Cua buida\a\n"); */
return 0;
}
-
}
/* funció que retorna si la cua és buida */
@@ -581,7 +568,6 @@ extern "C"
t_symbol *x_color_grasp;
/* v 0.2.1 -- llista de formats */
t_symbol *x_format_list;
-
} t_videogrid;
/* ---------------- control functions ------------ */
@@ -681,14 +667,13 @@ extern "C"
/* FFMPEG o Quicktime per les conversions */
int fferror=0;
int nN = x->x_ultima_img;
- /*
+ /*
if (format_adequat_v(entrada, x->x_format_list) == 0) {
-
// convertir_img(entrada,FORMAT_MINIATURA, x->x_w_cell, x->x_h_cell, nN);
fferror = -1;
} else {
- */
+ */
fferror=convertir_img_ff(entrada,FORMAT_MINIATURA, x->x_w_cell, x->x_h_cell, nN);
/* } */
/* post ("%d",fferror); */
@@ -698,9 +683,9 @@ extern "C"
/* si no és el primer element a encuar incrementem la posicio de la última imatge insertada */
if(numNodes(&x->x_cua) != 0) x->x_ultima_img ++;
/*
- * si assoleix el maxim torna a començar,
- * inicialitzant la posició en el tauler de la última imatge insertada
- */
+ * 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;
sprintf(nNstr, "%d", nN);
@@ -795,12 +780,12 @@ extern "C"
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) + x->x_w_cell, text_ypix(&x->x_obj, x->x_glist) + getY(x,x->x_pos_selected) + x->x_h_cell);
- }
- sys_vgui(".x%x.c delete %xLINIA\n", glist_getcanvas(x->x_glist), x);
+ 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) + x->x_w_cell, text_ypix(&x->x_obj, x->x_glist) + getY(x,x->x_pos_selected) + x->x_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);
@@ -809,18 +794,18 @@ extern "C"
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 + 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 + x->x_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 + ((x->x_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 + ((x->x_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 + x->x_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);
@@ -873,11 +858,11 @@ extern "C"
/* 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);
+ 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);
+ sys_vgui(".x%x.c delete %xGRASP\n", glist_getcanvas(glist), x);
x->x_pos_selected = -1;
}
eliminar_imatges_temporals(maxim);
@@ -961,17 +946,17 @@ extern "C"
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);
+ /* 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);
@@ -1125,13 +1110,13 @@ extern "C"
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;
+ // x->x_ultima_img = numNodes(&x->x_cua) - 1;
+ x->x_ultima_img = numNodes(&x->x_cua);
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);
}
-
/* 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)
{
@@ -1172,18 +1157,16 @@ extern "C"
if (doit)
{
/* obtenir la posicio en el tauler */
- // -- v 0.2 -- midoficacio pel gruix del marc //
- xa = ((x_pos) / (x->x_w_cell + GRUIX + 1));
+ // -- v 0.2 -- midoficacio pel gruix del marc //
+ xa = ((x_pos) / (x->x_w_cell + GRUIX + 1));
ya = ((y_pos) / (x->x_h_cell + GRUIX + 1)) * x->x_num_col;
postauler = ya + xa;
- // -- v 0.2 -- seleciona la casella disparant el path //
+ // -- v 0.2 -- seleciona la casella disparant el path //
videogrid_seek(x, postauler);
}
return (1);
}
-
-
/* --------- videogrid functions ---------- */
/* v 0.2 -- mètode de la classe que buida el tauler amb el missatge [clear ( */
@@ -1216,9 +1199,9 @@ extern "C"
post("Videogrid: Problem opening file %s.\n",e);
}
else {
- if (format_adequat_v(e, x->x_format_list) != 0) {
- videogrid_afegir_imatge(x,e);
- }
+ if (format_adequat_v(e, x->x_format_list) != 0) {
+ videogrid_afegir_imatge(x,e);
+ }
}
}
@@ -1238,10 +1221,10 @@ extern "C"
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
- */
+ /*
+ * 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 ){
@@ -1259,15 +1242,15 @@ extern "C"
strcpy(pathActual,x->x_dir_actual);
strcat(pathActual,"/");
strcat(pathActual,nomImatge);
- if (format_adequat_v(pathActual, x->x_format_list) != 0) {
- 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;
+ if (format_adequat_v(pathActual, x->x_format_list) != 0) {
+ 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;
}
}
}
@@ -1288,15 +1271,15 @@ extern "C"
strcpy(pathActual,x->x_dir_actual);
strcat(pathActual,"/");
strcat(pathActual,nomImatge);
- if (format_adequat_v(pathActual, x->x_format_list) != 0) {
- 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;
+ if (format_adequat_v(pathActual, x->x_format_list) != 0) {
+ 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;
}
}
}
@@ -1324,7 +1307,7 @@ extern "C"
// ---------------- 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_create(&unthread, &unatribut, videogrid_putvideodir_thread, (void *)x);
pthread_mutex_destroy(&x->x_lock);
}
@@ -1401,7 +1384,6 @@ extern "C"
/* tk help windows */
-
void load_tk_procs_videogrid () {
// ########### 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");
@@ -1697,32 +1679,32 @@ extern "C"
/*
// -- 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){
+ 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);
- token = strtok(NULL,"|");
- }
- free(cadenaPaths);
- */
+ // -- 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:
@@ -1813,4 +1795,3 @@ extern "C"
class_setpropertiesfn(videogrid_class, videogrid_properties);
}
}
-