From 39e05a43165ebcc82f036d8a77afb4d42ce6ddf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?llu=C3=ADs=20g=C3=B3mez=20i=20bigord=C3=A0?= Date: Sun, 13 Feb 2011 01:44:51 +0000 Subject: First autotools build aproach and removed unneeded libquicktime dependency : should work for any *nix but probably needs to be well fixed for macos svn path=/trunk/externals/pdvjtools/; revision=14915 --- videogrid/Makefile | 35 -------------- videogrid/Makefile.in | 56 ++++++++++++++++++++++ videogrid/configure.ac | 108 ++++++++++++++++++++++++++++++++++++++++++ videogrid/videogrid.cc | 125 +------------------------------------------------ 4 files changed, 165 insertions(+), 159 deletions(-) delete mode 100755 videogrid/Makefile create mode 100755 videogrid/Makefile.in create mode 100755 videogrid/configure.ac (limited to 'videogrid') diff --git a/videogrid/Makefile b/videogrid/Makefile deleted file mode 100755 index fcded8d..0000000 --- a/videogrid/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -PD_SRC=../../../pd/src -FFMPEG_HEADERS=-I/usr/include/ffmpeg - -NAME=videogrid -CSYM=videogrid - -current: pd_linux - -# ----------------------- LINUX ----------------------- - -pd_linux: $(NAME).pd_linux - -.SUFFIXES: .pd_linux - -LINUXCFLAGS = -fPIC -DPD -DUNIX -DICECAST -O2 -funroll-loops -fomit-frame-pointer \ - -Wall -W -Wno-shadow -Wstrict-prototypes \ - -Wno-unused -Wno-parentheses -Wno-switch - - -LINUXINCLUDE = -I$(PD_SRC) -I/usr/include/ - -.cc.pd_linux: - g++ $(FFMPEG_HEADERS) -I$(PD_SRC) -fPIC -c -O -o videogrid.o videogrid.cc -# ./tk2c.bash < $*.tk > $*.tk2c - g++ $(FFMPEG_HEADERS) -Wl,--export-dynamic -shared -o videogrid.pd_linux videogrid.o -lavformat -lavcodec -lavutil -lswscale -lquicktime - rm -f $*.o - -# ---------------------------------------------------------- - -install: - cp *-help.pd ../../../doc/5.reference - -clean: - rm -f *.o *.pd_* so_locations - diff --git a/videogrid/Makefile.in b/videogrid/Makefile.in new file mode 100755 index 0000000..b87873a --- /dev/null +++ b/videogrid/Makefile.in @@ -0,0 +1,56 @@ +NAME = videogrid +VERSION = @VIDEOGRID_VERSION@ + +PD_DIR = @PD_DIR@ +GEM_DIR = @GEM_DIR@ + +FF_CFLAGS = @FF_PACKAGE_CFLAGS@ +FF_LIBS = @FF_PACKAGE_LIBS@ + +LIBS = @LIBS@ +CFLAGS = @CFLAGS@ + +# choose target by OS +UNAME := $(shell uname) +ifeq ($(UNAME), Linux) +TARGET=pd_linux +else +TARGET=pd_darwin +#FF_CFLAGS=-I/sw/include ?? +#PD_DIR=/Applications/Pd-extended.app/Contents/Resources/include ?? +endif + + +current: $(TARGET) + +# ----------------------- LINUX ----------------------- + +pd_linux: $(NAME).pd_linux + +.SUFFIXES: .pd_linux + +.cc.pd_linux: + g++ $(FF_CFLAGS) $(CFLAGS) -I$(PD_DIR)/src -I$(GEM_DIR)/src -fPIC -c -O -o videogrid.o videogrid.cc + g++ $(FF_CFLAGS) $(CFLAGS) -Wl --export-dynamic -shared -o videogrid.pd_linux videogrid.o $(FF_LIBS) $(LIBS) + rm -f $*.o + +# ---------------------------------------------------------- + +# ----------------------- LINUX ----------------------- + +pd_darwin: $(NAME).pd_darwin + +.SUFFIXES: .pd_darwin + +.cc.pd_darwin: + g++ $(FF_CFLAGS) -I$(PD_DIR)/src -I$(GEM_DIR)/src -fPIC -c -O -o videogrid.o videogrid.cc + g++ $(FF_CFLAGS) $(CFLAGS) -Wl -bundle -undefined dynamic_lookup -o videogrid.pd_darwin videogrid.o $(FF_LIBS) $(LIBS) + rm -f $*.o + +# ---------------------------------------------------------- + +install: + cp *-help.pd $(PD_DIR)/doc/5.reference + +clean: + rm -f *.o *.pd_* so_locations diff --git a/videogrid/configure.ac b/videogrid/configure.ac new file mode 100755 index 0000000..201f18b --- /dev/null +++ b/videogrid/configure.ac @@ -0,0 +1,108 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT +VIDEOGRID_VERSION=0.6 + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AM_PROG_CC_STDC +AC_PROG_INSTALL +AC_PROG_CPP +AC_ISC_POSIX +AC_HEADER_STDC +AC_PROG_MAKE_SET +AM_SANITY_CHECK + +AM_MAINTAINER_MODE +AM_WITH_DMALLOC + +AC_SUBST(VIDEOGRID_VERSION) + +# Checks for Pd and Gem source trees + +if test -d ../../../pd; +then + PD_DIR=../../../pd +else + echo "Pd sources not found" +fi + + +if test -d ../../../Gem; +then + GEM_DIR=../../../Gem +else + echo "Gem sources not found" +fi + +AC_ARG_WITH(pddir, [ --with-pddir= specify an alternate pd source tree]) +AC_ARG_WITH(gemdir, [ --with-gemdir= specify an alternate gem source tree]) + +if test "$with_gemdir" != "" +then + GEM_DIR=$with_gemdir +fi + +if test "$with_pddir" != "" +then + PD_DIR=$with_pddir +fi + +echo -n "looking for gem sources (required) ... " +if test -f $GEM_DIR/src/Base/GemMan.h +then + AC_SUBST(GEM_DIR) + echo "ok." +else + echo "gem source tree not found... use ./configure --with-gemdir= option" + exit -1 +fi + + +echo -n "looking for pd sources (required) ... " +if test -f $PD_DIR/src/m_imp.h +then + AC_SUBST(PD_DIR) + echo "ok." +else + echo "pd source tree not found... use ./configure --with-pddir= option" + exit -1 +fi + +# Checks for libraries. + +pkg_modules="libavcodec >= 0.5, libavformat >= 0.5, libavutil >= 0.5, libswscale >= 0.5" +PKG_CHECK_MODULES(FF_PACKAGE,[$pkg_modules]) +AC_SUBST(FF_PACKAGE_CFLAGS) +AC_SUBST(FF_PACKAGE_LIBS) + + +# FIXME: Replace `main' with a function in `-lc': +AC_CHECK_LIB([c], [main]) +# FIXME: Replace `main' with a function in `-lm': +AC_CHECK_LIB([m], [main]) + +# Checks for header files. +AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h malloc.h stdlib.h string.h sys/ioctl.h sys/time.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_TYPE_UINT32_T +AC_TYPE_UINT8_T + +# Checks for library functions. +AC_FUNC_ERROR_AT_LINE +AC_FUNC_MALLOC +AC_FUNC_MMAP +AC_CHECK_FUNCS([munmap pow select strstr]) + + + +LIBS="$LIBS -lm" +CFLAGS="$CFLAGS -Wall" + +AC_CONFIG_FILES([ +Makefile +]) +AC_OUTPUT diff --git a/videogrid/videogrid.cc b/videogrid/videogrid.cc index 2b4897d..bda1dcd 100644 --- a/videogrid/videogrid.cc +++ b/videogrid/videogrid.cc @@ -46,25 +46,11 @@ extern "C" /* ffmpeg includes */ - #include - #include - #include - #include - - - /* may be your ffmpeg headers are here, at least from jaunty to karmic */ - /* #include #include #include #include - */ - /* libquicktime includes */ - // #include - // #include - #include - #include /* &&&&&&&&&&&&&&&&&&&&&&&&&&&&& VIDEOGRID &&&&&&&&&&&&&&&&&&&&&&&&&&&&& */ @@ -296,107 +282,6 @@ extern "C" return 0; } - /* ----------------------------------- Quicktime functions ----------------------------------- */ - 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; - 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); - - 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; - } /* ----------------------------------- Cue > rounded list ----------------------------------- */ typedef char path[BYTESNOMFITXER]; @@ -669,18 +554,10 @@ extern "C" sys_vgui(".x%x.c delete %xS%d\n", glist_getcanvas(x->x_glist), x, x->x_ultima_img); } - /* FFMPEG o Quicktime per les conversions */ + /* FFMPEG 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); */ if (fferror>=0) { /* encua el nou node */ -- cgit v1.2.1