From e6f03f07422f99daaf5376ffd3dfba9f3e94f058 Mon Sep 17 00:00:00 2001 From: Niels Elburg Date: Sun, 24 Jan 2010 21:12:58 +0000 Subject: [PATCH] sync git-svn-id: svn://code.dyne.org/veejay/trunk@1355 eb8d1916-c9e9-0310-b8de-cf0c9472ead5 --- veejay-current/veejay-server/AUTHORS | 2 +- veejay-current/veejay-server/Makefile.am | 29 +- .../veejay-server/aclib/Makefile.am | 2 +- .../veejay-server/bio2jack/Makefile.in | 18 +- veejay-current/veejay-server/configure.ac | 127 +-- veejay-current/veejay-server/cpuinfo.sh | 5 +- veejay-current/veejay-server/debian/changelog | 8 +- veejay-current/veejay-server/debian/control | 2 +- veejay-current/veejay-server/debian/copyright | 6 +- veejay-current/veejay-server/debian/rules | 4 +- .../veejay-server/doc/HowtoUbuntu.txt | 92 +- .../veejay-server/libOSC/Makefile.am | 2 +- .../veejay-server/libel/Makefile.am | 4 +- veejay-current/veejay-server/libel/lav_io.c | 17 +- veejay-current/veejay-server/libel/pixbuf.c | 18 +- veejay-current/veejay-server/libel/rawdv.c | 4 +- .../veejay-server/libel/vj-avcodec.c | 4 +- .../veejay-server/libel/vj-avcodec.h | 3 +- veejay-current/veejay-server/libel/vj-el.c | 24 +- .../veejay-server/libhash/Makefile.am | 4 +- .../veejay-server/liblzo/Makefile.am | 2 +- .../veejay-server/libsample/Makefile.am | 3 +- .../veejay-server/libsample/sampleadm.c | 38 +- .../veejay-server/libsample/sampleadm.h | 6 +- .../veejay-server/libsamplerec/Makefile.am | 3 +- .../veejay-server/libsamplerec/samplerecord.c | 4 +- .../veejay-server/libstream/Makefile.am | 2 +- .../veejay-server/libstream/v4lvideo.c | 33 +- .../veejay-server/libstream/vj-tag.c | 945 +++++++++++++++++- .../veejay-server/libstream/vj-tag.h | 35 +- .../veejay-server/libstream/vj-unicap.c | 4 +- .../veejay-server/libstream/vj-vloopback.c | 2 +- .../veejay-server/libstream/vj-yuv4mpeg.c | 28 +- .../veejay-server/libstream/vj-yuv4mpeg.h | 2 + .../veejay-server/libvje/Makefile.am | 21 +- .../veejay-server/libvje/effects/colorhis.c | 2 +- .../veejay-server/libvje/effects/common.c | 14 +- .../libvje/effects/contourextract.c | 2 +- .../veejay-server/libvje/effects/diff.c | 2 +- .../veejay-server/libvje/effects/dummy.c | 7 +- .../veejay-server/libvje/effects/iris.c | 111 ++ .../veejay-server/libvje/effects/iris.h | 30 + .../veejay-server/libvje/effects/negation.c | 20 +- .../libvje/effects/radioactive.c | 2 +- .../veejay-server/libvje/effects/rgbchannel.c | 2 +- .../veejay-server/libvje/effects/texmap.c | 2 +- .../veejay-server/libvje/internal.h | 12 +- .../veejay-server/libvje/plugload.c | 4 +- .../veejay-server/libvje/vj-effect.c | 31 +- .../veejay-server/libvje/vj-effman.c | 6 + veejay-current/veejay-server/libvje/vje.h | 5 +- .../veejay-server/libvjmsg/Makefile.am | 2 +- .../veejay-server/libvjnet/Makefile.am | 3 +- veejay-current/veejay-server/libvjnet/cmd.c | 19 +- .../veejay-server/libyuv/Makefile.am | 3 +- veejay-current/veejay-server/libyuv/yuvconv.c | 11 +- veejay-current/veejay-server/man/Makefile.am | 2 +- veejay-current/veejay-server/man/veejay.1 | 6 + .../veejay-server/mjpegtools/Makefile.am | 2 +- .../veejay-server/veejay/Makefile.am | 7 +- .../veejay-server/veejay/liblavplayvj.c | 115 ++- veejay-current/veejay-server/veejay/vims.h | 5 + .../veejay-server/veejay/vj-composite.c | 2 +- .../veejay-server/veejay/vj-event.c | 176 +++- .../veejay-server/veejay/vj-event.h | 8 + .../veejay-server/veejay/vj-eventman.c | 64 +- veejay-current/veejay-server/veejay/vj-font.c | 149 ++- veejay-current/veejay-server/veejay/vj-lib.h | 2 + veejay-current/veejay-server/veejay/vj-misc.c | 29 +- veejay-current/veejay-server/veejay/vj-misc.h | 1 - .../veejay-server/veejay/vj-perform.c | 17 + .../veejay-server/veejay/vj-viewport.c | 2 +- 72 files changed, 2001 insertions(+), 379 deletions(-) create mode 100644 veejay-current/veejay-server/libvje/effects/iris.c create mode 100644 veejay-current/veejay-server/libvje/effects/iris.h diff --git a/veejay-current/veejay-server/AUTHORS b/veejay-current/veejay-server/AUTHORS index d0d0ba5b..19fe4174 100644 --- a/veejay-current/veejay-server/AUTHORS +++ b/veejay-current/veejay-server/AUTHORS @@ -24,7 +24,7 @@ veejay contributors: authors: ====================== - Niels Elburg + Niels Elburg diff --git a/veejay-current/veejay-server/Makefile.am b/veejay-current/veejay-server/Makefile.am index 0b87333c..cf3cc105 100644 --- a/veejay-current/veejay-server/Makefile.am +++ b/veejay-current/veejay-server/Makefile.am @@ -10,7 +10,20 @@ EXTRA_DIST = \ depcomp \ cpuinfo.sh \ autogen.sh \ - gveejay-paths.sh.in + PKGBUILD \ + doc/veejay-HOWTO.html \ + doc/README.quickstart \ + doc/README.whatis \ + doc/README.performance \ + doc/HowtoPlugins.txt \ + doc/HowtoCache.txt \ + doc/VIMS.txt \ + doc/NET.txt \ + debian/changelog \ + debian/control \ + debian/copyright \ + debian/rules \ + buildinfo.sh pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = veejay.pc @@ -21,8 +34,7 @@ DISTCLEANFILES = \ confdefs.h \ config.cache \ config.status \ - config.log \ - gveejay-paths.h + config.log MAINTAINERCLEANFILES = \ compile \ @@ -44,6 +56,17 @@ rpm: Makefile $(MAKE) dist rpmbuild -ta --clean $(PACKAGE)-$(VERSION).tar.gz +ubuntu: + chmod a+x debian/rules + debuild -i -us -uc -b + +release: + rm -rf .deps */.deps + $(MAKE) distcheck + +snapshot: + $(MAKE) dist distdir=$(PACKAGE)-`date +%Y-%m-%d` + ## make debs deb: Makefile dist -chmod -R +w $(PACKAGE)-$(VERSION) diff --git a/veejay-current/veejay-server/aclib/Makefile.am b/veejay-current/veejay-server/aclib/Makefile.am index be2988fe..d77b6e6b 100644 --- a/veejay-current/veejay-server/aclib/Makefile.am +++ b/veejay-current/veejay-server/aclib/Makefile.am @@ -1,6 +1,6 @@ # # Process this file with automake to produce Makefile.in. -pkginclude_HEADERS = ac.h ac_internal.h imgconvert.h img_internal.h img_x86_common.h +EXTRA_DIST= ac.h ac_internal.h imgconvert.h img_internal.h img_x86_common.h AM_CPPFLAGS = \ $(PTHREAD_CFLAGS) \ diff --git a/veejay-current/veejay-server/bio2jack/Makefile.in b/veejay-current/veejay-server/bio2jack/Makefile.in index 15a7be8c..83268d5e 100644 --- a/veejay-current/veejay-server/bio2jack/Makefile.in +++ b/veejay-current/veejay-server/bio2jack/Makefile.in @@ -110,12 +110,8 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ -FFMPEG_AVCODEC_CFLAGS = @FFMPEG_AVCODEC_CFLAGS@ -FFMPEG_AVCODEC_LIBS = @FFMPEG_AVCODEC_LIBS@ -FFMPEG_AVFORMAT_CFLAGS = @FFMPEG_AVFORMAT_CFLAGS@ -FFMPEG_AVFORMAT_LIBS = @FFMPEG_AVFORMAT_LIBS@ -FFMPEG_SWSCALER_CFLAGS = @FFMPEG_SWSCALER_CFLAGS@ -FFMPEG_SWSCALER_LIBS = @FFMPEG_SWSCALER_LIBS@ +FFMPEG_CFLAGS = @FFMPEG_CFLAGS@ +FFMPEG_LIBS = @FFMPEG_LIBS@ FREETYPE_CONFIG = @FREETYPE_CONFIG@ FT_CFLAGS = @FT_CFLAGS@ FT_LDFLAGS = @FT_LDFLAGS@ @@ -164,6 +160,7 @@ HAVE_UNICAP_FALSE = @HAVE_UNICAP_FALSE@ HAVE_UNICAP_TRUE = @HAVE_UNICAP_TRUE@ HAVE_V4L_FALSE = @HAVE_V4L_FALSE@ HAVE_V4L_TRUE = @HAVE_V4L_TRUE@ +HAVE_X = @HAVE_X@ HAVE_X86CPU_FALSE = @HAVE_X86CPU_FALSE@ HAVE_X86CPU_TRUE = @HAVE_X86CPU_TRUE@ HAVE_XML2_FALSE = @HAVE_XML2_FALSE@ @@ -182,6 +179,12 @@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBAVCODEC_CFLAGS = @LIBAVCODEC_CFLAGS@ +LIBAVCODEC_LIBS = @LIBAVCODEC_LIBS@ +LIBAVFORMAT_CFLAGS = @LIBAVFORMAT_CFLAGS@ +LIBAVFORMAT_LIBS = @LIBAVFORMAT_LIBS@ +LIBAVUTIL_CFLAGS = @LIBAVUTIL_CFLAGS@ +LIBAVUTIL_LIBS = @LIBAVUTIL_LIBS@ LIBDV_CFLAGS = @LIBDV_CFLAGS@ LIBDV_LIBS = @LIBDV_LIBS@ LIBGETOPT_LIB = @LIBGETOPT_LIB@ @@ -190,6 +193,8 @@ LIBOBJS = @LIBOBJS@ LIBQUICKTIME_CFLAGS = @LIBQUICKTIME_CFLAGS@ LIBQUICKTIME_LIBS = @LIBQUICKTIME_LIBS@ LIBS = @LIBS@ @PTHREAD_LIBS@ @JACK_LIBS@ +LIBSWSCALE_CFLAGS = @LIBSWSCALE_CFLAGS@ +LIBSWSCALE_LIBS = @LIBSWSCALE_LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ @@ -227,7 +232,6 @@ SUPPORT_READ_DV2_FALSE = @SUPPORT_READ_DV2_FALSE@ SUPPORT_READ_DV2_TRUE = @SUPPORT_READ_DV2_TRUE@ UNICAP_CFLAGS = @UNICAP_CFLAGS@ UNICAP_LIBS = @UNICAP_LIBS@ -V4LCONF_LIBS = @V4LCONF_LIBS@ VERSION = @VERSION@ XINERAMA_LIBS = @XINERAMA_LIBS@ XMKMF = @XMKMF@ diff --git a/veejay-current/veejay-server/configure.ac b/veejay-current/veejay-server/configure.ac index 02b7579a..37be2bee 100644 --- a/veejay-current/veejay-server/configure.ac +++ b/veejay-current/veejay-server/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. dnl AC_INIT -AC_INIT([veejay],[1.5.2],[veejay-users@lists.sourceforge.net]) +AC_INIT([veejay],[1.5.3],[veejay-users@lists.sourceforge.net]) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([veejay/veejay.c]) @@ -520,80 +520,67 @@ then fi fi + + AC_MSG_RESULT($CFLAGS) AC_DEFINE_UNQUOTED(HAVE_FFMPEG_UNINSTALLED,, [Defined if building against uninstalled FFmpeg source]) -PKG_CHECK_MODULES(FFMPEG_AVCODEC, [libavcodec], - [ - AC_SUBST(FFMPEG_AVCODEC_CFLAGS) - AC_SUBST(FFMPEG_AVCODEC_LIBS) - have_avcodec=true - AC_DEFINE(HAVE_AVCODEC, 1, [use avcodec])], - [have_avcodec=false]) - - -PKG_CHECK_MODULES(FFMPEG_AVFORMAT, [libavformat], - [ - AC_SUBST(FFMPEG_AVFORMAT_CFLAGS) - AC_SUBST(FFMPEG_AVFORMAT_LIBS) - have_avformat=true - AC_DEFINE(HAVE_AVFORMAT, 1, [use avformat])], - [have_avformat=false]) - -PKG_CHECK_MODULES(FFMPEG_SWSCALER, [libswscale], - [ - AC_SUBST(FFMPEG_SWSCALER_CFLAGS) - AC_SUBST(FFMPEG_SWSCALER_LIBS) - have_swscaler=true - AC_DEFINE( HAVE_SWSCALER,1,[use swscaler])], - [ have_swscaler=false] ) - - - -if test x$have_avcodec != xtrue ; then - AC_MSG_ERROR([ FFmpeg AVCodec not found. Get it from http://ffmpeg.sourceforge.net ] ) +PKG_CHECK_MODULES(LIBAVUTIL, [libavutil >= 49.7.0],have_avutil=true,have_avutil=false) +PKG_CHECK_MODULES(LIBAVCODEC,[libavcodec >= 51.57.2],have_avcodec=true,have_avcodec=false) +PKG_CHECK_MODULES(LIBAVFORMAT,[libavformat >= 52.14.0],have_avformat=true,have_avformat=false) +PKG_CHECK_MODULES(LIBSWSCALE,[libswscale >= 0.7.1],have_swscale=true,have_swscale=false) +if test x$have_swscale = xfalse; +then + AC_MSG_ERROR([libswscale not found.]) +fi +if test x$have_avutil = xfalse; +then + AC_MSG_ERROR([libavutil not found.]) +fi +if test x$have_avformat = xfalse; +then + AC_MSG_ERROR([libavformat not found.]) +fi +if test x$have_avcodec = xfalse; +then + AC_MSG_ERROR([libavcodec not found.]) fi -if test x$have_avformat != xtrue ; then - AC_MSG_ERROR([ FFmpeg AVFormat not found. Get it from http://ffmpeg.sourceforge.net ] ) -fi - -if test x$have_swscaler != xtrue ; then - AC_MSG_ERROR([ FFmpeg Swscaler not found. Did you enable it when you compiled ffmpeg ? ]) -fi - -FFMPEG_INCLUDE_AVCODEC="" -FFMPEG_INCLUDE_AVUTIL="" -FFMPEG_INCLUDE_SWSCALE="" -FFMPEG_INCLUDE_AVFORMAT="" - -AC_CHECK_HEADER( ffmpeg/avcodec.h, [FFMPEG_INCLUDE_AVCODEC=""],[]) -AC_CHECK_HEADER( ffmpeg/avformat.h, [FFMPEG_INCLUDE_AVFORMAT=""],[]) -AC_CHECK_HEADER( ffmpeg/avutil.h, [FFMPEG_INCLUDE_AVUTIL=""],[]) -AC_CHECK_HEADER( ffmpeg/swscale.h, [FFMPEG_INCLUDE_SWSCALE=""],[]) -AC_CHECK_HEADER( libavutil/avutil.h, [FFMPEG_INCLUDE_AVUTIL=""],[]) -AC_CHECK_HEADER( libswscale/swscale.h, [FFMPEG_INCLUDE_SWSCALE=""],[]) -AC_CHECK_HEADER( libavcodec/avcodec.h, [FFMPEG_INCLUDE_AVCODEC=""],[]) -AC_CHECK_HEADER( libavformat/avformat.h, [FFMPEG_INCLUDE_AVFORMAT=""],[]) - -AC_DEFINE_UNQUOTED( AVCODEC_INC, $FFMPEG_INCLUDE_AVCODEC,[] ) -AC_DEFINE_UNQUOTED( AVUTIL_INC, $FFMPEG_INCLUDE_AVUTIL,[] ) -AC_DEFINE_UNQUOTED( AVFORMAT_INC, $FFMPEG_INCLUDE_AVFORMAT,[] ) -AC_DEFINE_UNQUOTED( SWSCALE_INC, $FFMPEG_INCLUDE_SWSCALE,[] ) +FFMPEG_CFLAGS="${LIBAVFORMAT_CFLAGS} ${LIBAVCODEC_CFLAGS} ${LIBAVUTIL_CFLAGS} ${LIBSWSCALE_CFLAGS}" +FFMPEG_LIBS="${LIBAVFORMAT_LIBS} ${LIBAVCODEC_LIBS} ${LIBAVUTIL_LIBS} ${LIBSWSCALE_LIBS}" +AC_SUBST(FFMPEG_CFLAGS) +AC_SUBST(FFMPEG_LIBS) AC_SUBST(LIBM_LIBS) +dnl ******************************************************************** +dnl Look for X +AC_PATH_XTRA +AC_CHECK_HEADER(X11/Xlib.h, HAVE_X="yes", HAVE_X="no") + +if test "x$HAVE_X" = "xno" +then + AC_MSG_ERROR([Cannot find X11 development files.]) +else + X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS" + X_LIBS="$X_LIBS -lX11" + AC_SUBST(X_CFLAGS) + AC_SUBST(X_LIBS) +fi +AC_SUBST(HAVE_X) +AM_CONDITIONAL(HAVE_X, test "x$HAVE_X" = "xyes") + dnl Check for Xinerama use_xinerama=no AC_CHECK_LIB( Xinerama, XineramaQueryExtension, [ AC_CHECK_HEADER(X11/extensions/Xinerama.h, [ AC_DEFINE( HAVE_XINERAMA,1,[Use Xinerama] ) - XINERAMA_LIBS="-lXext -lXinerama" + XINERAMA_LIBS="-lXext -lX11 -lXinerama" AC_SUBST(XINERAMA_LIBS) use_xinerama=yes, ], @@ -759,20 +746,6 @@ if test x$mjt_cv_extern___progname = xyes ; then AC_DEFINE(HAVE___PROGNAME, 1, [Is __progname defined by system?]) fi -dnl ******************************************************************** -dnl Check for DGA (for v4l-conf) -dnl ******************************************************************** -AC_SUBST(V4LCONF_LIBS) -AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, - V4LCONF_LIBS="$X_LIBS -lXxf86dga" - AC_DEFINE(HAVE_LIBXXF86DGA,1, [libxf86dga is present]),, - $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS) - - -dnl Look for X -AC_PATH_XTRA -AM_CONDITIONAL(HAVE_X, test x$have_x = xyes) - dnl ******************************************************************** dnl Check for the SDL library (for software playback) dnl (defines SDL_CFLAGS and SDL_LIBS) @@ -965,6 +938,15 @@ if test "x$cflags_set" != "xyes" ; then cflags_set=yes fi +AC_CACHE_CHECK([whether gcc has -fno-stack-protector],no_stack_protector_flag,[ + saved_CFLAGS=$CFLAGS + CFLAGS="-fno-stack-protector" + AC_TRY_COMPILE(,,no_stack_protector_flag=yes,no_stack_protector_flag=no) + CFLAGS=$saved_CFLAGS]) + +if test "x$no_stack_protector_flag" = xyes; then + CFLAGS="$CFLAGS -fno-stack-protector" +fi if test x"$with_extra_cflags" != "x"; then CFLAGS="$CFLAGS $with_extra_cflags" @@ -1062,7 +1044,8 @@ AC_MSG_NOTICE([ Required dependencies:]) AC_MSG_NOTICE([ - POSIX Threads (pthread) : ${have_pthread}]) AC_MSG_NOTICE([ - FFmpeg AVFormat : ${have_avformat} ]) AC_MSG_NOTICE([ - FFmpeg AVCodec : ${have_avcodec} ]) -AC_MSG_NOTICE([ - FFmpeg Swscaler : ${have_swscaler} ]) +AC_MSG_NOTICE([ - FFmpeg Swscaler : ${have_swscale} ]) +AC_MSG_NOTICE([ - FFmpeg avutil : ${have_avutil} ]) AC_MSG_NOTICE([ - SDL support : ${have_sdl}]) AC_MSG_NOTICE([ - Freetype support : ${have_freetype}]) AC_MSG_NOTICE([ - XML c library for Gnome : ${have_xml2}]) diff --git a/veejay-current/veejay-server/cpuinfo.sh b/veejay-current/veejay-server/cpuinfo.sh index a8e6ace8..408c962a 100755 --- a/veejay-current/veejay-server/cpuinfo.sh +++ b/veejay-current/veejay-server/cpuinfo.sh @@ -144,6 +144,9 @@ case "$pvendor" in # synonym for 'k8' proc=k8 ;; + 16) + proc=barcelona + ;; *) proc=athlon-xp ;; esac @@ -239,7 +242,7 @@ if test "$proc" = "i386" ; then do_cc -march=$proc $_opt_mcpu=$proc || proc=error fi if test "$proc" = "error" ; then - echo "Your $_cc does not even support \"i386\" for '-march' and $_opt_mcpu." + echo "Your $CC does not even support \"i386\" for '-march' and $_opt_mcpu." _mcpu="" _march="" elif test "$proc" = "i586-i686"; then diff --git a/veejay-current/veejay-server/debian/changelog b/veejay-current/veejay-server/debian/changelog index cb7dbd98..35c635c9 100644 --- a/veejay-current/veejay-server/debian/changelog +++ b/veejay-current/veejay-server/debian/changelog @@ -1,10 +1,10 @@ - - -veejay (1.4-3) unstable; urgency=low +veejay (1.5.2) unstable; urgency=low + + * 1.5.2 release * 1.4-3 release * Initial official release - -- Niels Elburg Tue, 04 Nov 2008 19:38:26 +0100 + -- Niels Elburg Sat, 19 Dec 2009 19:38:26 +0100 diff --git a/veejay-current/veejay-server/debian/control b/veejay-current/veejay-server/debian/control index b1833833..e9a2e831 100644 --- a/veejay-current/veejay-server/debian/control +++ b/veejay-current/veejay-server/debian/control @@ -2,7 +2,7 @@ Source: veejay Section: video Priority: extra Maintainer: Niels Elburg -Build-Depends: debhelper (>= 5), autotools-dev,libx11-dev,libxml2-dev,libxinerama-dev,libswscale-dev,libgdk-pixbuf-dev,libsdl1.2-dev,libavformat-dev,libjack-dev,libavcodec-dev,libglib2.0-dev,libquicktime-dev,libmjpegtools-dev,libjpeg62-dev,libfreetype6-dev,libdv4-dev,libavutil-dev,libmjpegtools-dev +Build-Depends: debhelper (>= 5), libgtk2.0-dev,autotools-dev,libx11-dev,libxml2-dev,libxinerama-dev,libswscale-dev,libsdl1.2-dev,libavformat-dev,libjack-dev,libavcodec-dev,libglib2.0-dev,libquicktime-dev,libmjpegtools-dev,libjpeg62-dev,libfreetype6-dev,libdv4-dev,libavutil-dev,libmjpegtools-dev Standards-Version: 3.7.2 Package: veejay diff --git a/veejay-current/veejay-server/debian/copyright b/veejay-current/veejay-server/debian/copyright index d53693af..2c9b6f60 100644 --- a/veejay-current/veejay-server/debian/copyright +++ b/veejay-current/veejay-server/debian/copyright @@ -1,7 +1,7 @@ This package was debianized by root on -Tue, 04 Nov 2008 19:38:26 +0100. +Sat, 19 Dec 2009 17:12:26 +0100. -It was downloaded from +It was downloaded from Upstream Author(s): @@ -9,7 +9,7 @@ Upstream Author(s): Copyright: - + License: diff --git a/veejay-current/veejay-server/debian/rules b/veejay-current/veejay-server/debian/rules index 2ced9ea4..930aa905 100755 --- a/veejay-current/veejay-server/debian/rules +++ b/veejay-current/veejay-server/debian/rules @@ -49,7 +49,7 @@ build-arch: build-arch-stamp build-arch-stamp: config.status # Add here commands to compile the arch part of the package. - #$(MAKE) + $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" touch $@ build-indep: build-indep-stamp @@ -91,7 +91,7 @@ install-arch: # Add here commands to install the arch part of the package into # debian/tmp. - $(MAKE) DESTDIR=$(CURDIR)/debian/veejay install + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install dh_install -s # Must not depend on anything. This is to be called by diff --git a/veejay-current/veejay-server/doc/HowtoUbuntu.txt b/veejay-current/veejay-server/doc/HowtoUbuntu.txt index 1c951837..2785c5d8 100644 --- a/veejay-current/veejay-server/doc/HowtoUbuntu.txt +++ b/veejay-current/veejay-server/doc/HowtoUbuntu.txt @@ -1,77 +1,23 @@ -Which packages do I need ? ¶ - -You will need about 200 megabytes of available diskspace, this includes the packages below and the space needed for building veejay. - - * subversion - * cvs - * build-essentials - * autogen - * autotools-dev - * autoconf - * automake1.8 - * libtool - * libsdl1.2-dev - * libjack0.100.0-dev - * libquicktime-dev - * libxml2-dev - * libglade2-dev - * libgtk2.0-dev - -Which packages do I need to compile myself ? ¶ - - * mjpegtools - If there is a compile error in Region2D.hh, complaining about 'assert' insert a line in top of the file '#include ' - - * libunicap - * FFmpeg - * GTK Cairo - - cvs -d :pserver:anoncvs@cvs.cairographics.org:/cvs/cairo co gtkcairo - cd gtkcairo - sh autogen.sh - ./configure && make && sudo make install - -WARNING ¶ - -I use ffmpeg from source, I suggest you do the same. There are unmet dependencies in libavcodec-dev and libavformat-dev that relate to ogg,vorbis,theora, *1394* packages in Ubuntu 6.06. - - $ sudo apt-get remove libavcodec-dev libavformat-dev - $ svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg - $ cd ffmpeg - $ ./configure --help - -Disable what you dont need, then: - - $ ./configure --prefix=/usr --enable-shared ... - $ make && make install - -And continue building veejay -Building veejay ¶ - -Check if the PKG_CONFIG_PATH variable has been set properly. - - $ echo $PKG_CONFIG_PATH - -If you just ran 'configure' and 'make' for mjpegtools,libunicap etc, check if the accompanying .pc files are in /usr/local/lib/pkgconfig - - $ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig - -To get the latest veejay: - - $ svn co svn://dyne.org/veejay/trunk/veejay-current - -To build a veejay optimized for speed: - - $ sh autogen.sh - $ ./configure - $ make && sudo make install - -To build a veejay to send usefull bugreports: - - $ sh autogen.sh - $ ./configure --enable-debug - $ make && sudo make install +To build the package from source yourself: +# 1 # get the required software + sudo devscripts apt-get install libgtk2.0-dev autotools-dev libx11-dev libxml2-dev libxinerama-dev libswscale-dev libsdl1.2-dev libavformat-dev libjack-dev libavcodec-dev libglib2.0-dev libquicktime-dev libmjpegtools-dev libjpeg62-dev libfreetype6-dev libdv4-dev libavutil-dev + + +# 2 # build a .deb package + dpkg-buildpackage -rfakeroot -us -uc -b + +# 3 # install + dpkg -i veejay-1.5.x.deb + + +To install the binary version: + +# 1 dpkg -i veejay-1.5.x.deb + +(meet package dependency requirements) +# apt-cache search +# apt-get install diff --git a/veejay-current/veejay-server/libOSC/Makefile.am b/veejay-current/veejay-server/libOSC/Makefile.am index 7ad9726c..657a8fc3 100644 --- a/veejay-current/veejay-server/libOSC/Makefile.am +++ b/veejay-current/veejay-server/libOSC/Makefile.am @@ -14,7 +14,7 @@ libOSC_la_SOURCES = OSC-address-space.c \ OSC-timetag.c \ NetworkReturnAddress.c -pkginclude_HEADERS = libosc.h OSC-address-space.h OSC-dispatch.h \ +EXTRA_DIST= libosc.h OSC-address-space.h OSC-dispatch.h \ OSC-pattern-match.h OSC-string-help.h NetworkReturnAddress.h \ OSC-callbacklist.h OSC-drop.h OSC-priority-queue.h \ OSC-struct.h NetworkUDP.h OSC-common.h \ diff --git a/veejay-current/veejay-server/libel/Makefile.am b/veejay-current/veejay-server/libel/Makefile.am index 617b5496..4f682ab1 100644 --- a/veejay-current/veejay-server/libel/Makefile.am +++ b/veejay-current/veejay-server/libel/Makefile.am @@ -4,12 +4,12 @@ MAINTAINERCLEANFILES = Makefile.in AM_CFLAGS=$(OP_CFLAGS) INCLUDES = -I$(top_srcdir) -I$(includedir) -I$(top_srcdir)/vjmem \ -I$(top_srcdir)/vjmsg \ - -I$(top_srcdir)/mjpegtools $(FFMPEG_CFLAGS) $(PIXBUF_CFLAGS) \ + -I$(top_srcdir)/mjpegtools $(FFMPEG_AVUTIL_CFLAGS) $(FFMPEG_AVFORMAT_CFLAGS) $(FFMPEG_AVCODEC_CFLAGS) $(FFMPEG_SWSCALER_CFLAGS) $(PIXBUF_CFLAGS) \ $(LIBQUICKTIME_CFLAGS) VJEL_LIB_FILE = libel.la noinst_LTLIBRARIES = $(VJEL_LIB_FILE) libel_la_SOURCES = vj-mmap.c elcache.c avilib.c lav_io.c vj-dv.c rawdv.c pixbuf.c vj-avcodec.c vj-el.c -pkginclude_HEADERS = avilib.h elcache.h lav_io.h pixbuf.h \ +EXTRA_DIST = avilib.h elcache.h lav_io.h pixbuf.h \ rawdv.h vj-avcodec.h vj-dv.h vj-el.h vj-mmap.h diff --git a/veejay-current/veejay-server/libel/lav_io.c b/veejay-current/veejay-server/libel/lav_io.c index c7bb56d2..15993901 100644 --- a/veejay-current/veejay-server/libel/lav_io.c +++ b/veejay-current/veejay-server/libel/lav_io.c @@ -38,7 +38,7 @@ #ifdef USE_GDK_PIXBUF #include #endif -#include AVCODEC_INC +#include #ifdef HAVE_LIBQUICKTIME #include #include @@ -1582,6 +1582,11 @@ lav_file_t *lav_open_input_file(char *filename, int mmap_size) int pos = 0; int success = 0; while( pos < rolls ) { + if( frame != NULL ) { + free(frame); + frame = NULL; + } + if( lav_set_video_position(lav_fd, pos ) ) { pos++; continue; @@ -1590,17 +1595,19 @@ lav_file_t *lav_open_input_file(char *filename, int mmap_size) pos++; continue; } + if( (frame = (unsigned char*) malloc(len)) == 0 ) { ierr = ERROR_MALLOC; break; } if( (lav_read_frame( lav_fd, frame ) <= 0 ) ) { pos ++; - if( frame ) free(frame); + if( frame ) { free(frame);frame=NULL;} continue; } if( scan_jpeg(frame,len,1) ) { ierr = ERROR_JPEG; + if( frame ) { free(frame);frame=NULL;} break; } @@ -1700,6 +1707,7 @@ lav_file_t *lav_open_input_file(char *filename, int mmap_size) } if( pf >= 0 ) { lav_fd->interlacing = LAV_NOT_INTERLACED; + if(frame) free(frame); return lav_fd; } } @@ -1896,7 +1904,12 @@ int lav_fileno(lav_file_t *lav_file) case 'q': case 'Q': { +#if ( LQT_CODEC_API_VERSION & 0xff ) > 6 res = lqt_fileno( (quicktime_t*) lav_file->qt_fd ); +#else + quicktime_t *q = lav_file->qt_fd; + res = (int) fileno( (quicktime_t*) q->stream ); +#endif } break; #endif diff --git a/veejay-current/veejay-server/libel/pixbuf.c b/veejay-current/veejay-server/libel/pixbuf.c index 78feece1..c2802128 100644 --- a/veejay-current/veejay-server/libel/pixbuf.c +++ b/veejay-current/veejay-server/libel/pixbuf.c @@ -31,8 +31,9 @@ #include #include #include -#include AVCODEC_INC -#include SWSCALE_INC +#include +#include +#include #include #ifdef STRICT_CHECKING #include @@ -355,6 +356,7 @@ int vj_picture_save( void *picture, uint8_t **frame, int w, int h , int fmt ) #ifdef USE_GDK_PIXBUF vj_pixbuf_out_t *pic = (vj_pixbuf_out_t*) picture; GdkPixbuf *img_ = gdk_pixbuf_new( GDK_COLORSPACE_RGB, FALSE, 8, w, h ); + if(!img_) { veejay_msg(VEEJAY_MSG_ERROR, "Cant allocate buffer for RGB"); @@ -362,17 +364,17 @@ int vj_picture_save( void *picture, uint8_t **frame, int w, int h , int fmt ) } // convert frame to yuv - VJFrame *src = yuv_yuv_template( frame[0],frame[1],frame[2],w,h, fmt ); + VJFrame *src = yuv_yuv_template( frame[0],frame[1],frame[2],w,h,fmt ); VJFrame *dst = yuv_rgb_template( (uint8_t*) gdk_pixbuf_get_pixels( img_ ), gdk_pixbuf_get_width( img_ ), gdk_pixbuf_get_height( img_ ), - PIX_FMT_RGB24 + PIX_FMT_BGR24 ); - yuv_convert_any_ac( src, dst, fmt, PIX_FMT_RGB24 ); - - if( gdk_pixbuf_savev( img_, pic->filename, pic->type, NULL, NULL, NULL )) + yuv_convert_any_ac( src, dst, src->format, dst->format ); + + if( gdk_pixbuf_savev( img_, pic->filename, pic->type, NULL,NULL,NULL)) { veejay_msg(VEEJAY_MSG_INFO, "Save frame as %s of type %s", pic->filename, pic->type ); @@ -383,7 +385,7 @@ int vj_picture_save( void *picture, uint8_t **frame, int w, int h , int fmt ) veejay_msg(VEEJAY_MSG_ERROR, "Cant save file as %s (%s) size %d x %d", pic->filename,pic->type, pic->out_w, pic->out_h); } - + if( img_ ) gdk_pixbuf_unref( img_ ); diff --git a/veejay-current/veejay-server/libel/rawdv.c b/veejay-current/veejay-server/libel/rawdv.c index 3ec06ab2..429e50b5 100644 --- a/veejay-current/veejay-server/libel/rawdv.c +++ b/veejay-current/veejay-server/libel/rawdv.c @@ -28,8 +28,8 @@ #include #include #include -#include AVCODEC_INC -#include AVUTIL_INC +#include +#include #include #define DV_PAL_SIZE 144000 diff --git a/veejay-current/veejay-server/libel/vj-avcodec.c b/veejay-current/veejay-server/libel/vj-avcodec.c index e4a945d2..8959384c 100644 --- a/veejay-current/veejay-server/libel/vj-avcodec.c +++ b/veejay-current/veejay-server/libel/vj-avcodec.c @@ -30,8 +30,8 @@ #define __FALLBACK_LIBDV #include #endif -#include AVCODEC_INC -#include AVUTIL_INC +#include +#include diff --git a/veejay-current/veejay-server/libel/vj-avcodec.h b/veejay-current/veejay-server/libel/vj-avcodec.h index c249405d..85d64de5 100644 --- a/veejay-current/veejay-server/libel/vj-avcodec.h +++ b/veejay-current/veejay-server/libel/vj-avcodec.h @@ -18,8 +18,7 @@ */ #ifndef VJ_AVCODEC_H #define VJ_AVCODEC_H -//bad -#include AVCODEC_INC +#include #include "vj-el.h" #define ENCODER_MJPEG 0 diff --git a/veejay-current/veejay-server/libel/vj-el.c b/veejay-current/veejay-server/libel/vj-el.c index 062ac969..97b4390a 100644 --- a/veejay-current/veejay-server/libel/vj-el.c +++ b/veejay-current/veejay-server/libel/vj-el.c @@ -40,8 +40,9 @@ #include #include #include -#include AVCODEC_INC -#include AVFORMAT_INC +#include +#include +#include #include #include #include @@ -660,8 +661,8 @@ int open_video_file(char *filename, editlist * el, int preserve_pathname, int de pix_fmt = _el_probe_for_pixel_fmt( elfd ); #ifdef STRICT_CHECKING - if( in_pixel_format >= 0 ) - assert( pix_fmt == in_pixel_format ); + //if( in_pixel_format >= 0 ) + // assert( pix_fmt == in_pixel_format ); #endif if(pix_fmt < 0 && in_pixel_format < 0) @@ -2227,13 +2228,13 @@ char *vj_el_write_line_ascii( editlist *el, int *bytes_written ) int num_files = 0; int64_t oldfile, oldframe, of1,ofr; - int64_t index[MAX_EDIT_LIST_FILES]; + int64_t index[MAX_EDIT_LIST_FILES]; //@ TRACE int64_t n,n1=0; char *result = NULL; int64_t j = 0; int64_t n2 = el->video_frames-1; - char filename[2048]; - char fourcc[6]; + char filename[2048]; //@ TRACE + char fourcc[6]; //@ TRACE #ifdef STRICT_CHECKING int dbg_buflen = 0; @@ -2258,9 +2259,10 @@ char *vj_el_write_line_ascii( editlist *el, int *bytes_written ) { if (index[j] >= 0 && el->video_file_list[j] != NULL ) { - index[j] = (int64_t)num_files++; + index[j] = (int64_t)num_files; nnf ++; len += (strlen(el->video_file_list[j])) + 25 + 20; + num_files ++; } } @@ -2321,8 +2323,8 @@ char *vj_el_write_line_ascii( editlist *el, int *bytes_written ) } - char first[64]; - char tmpbuf[64]; + char first[256]; + char tmpbuf[256]; snprintf(first,sizeof(first), "%016lld%016lld",oldfile, oldframe); #ifdef STRICT_CHECKING dbg_buflen -= strlen(first); @@ -2350,7 +2352,7 @@ char *vj_el_write_line_ascii( editlist *el, int *bytes_written ) oldframe = N_EL_FRAME(n); } - char last_word[16]; + char last_word[64]; sprintf(last_word,"%016lld", oldframe); #ifdef STRICT_CHECKING dbg_buflen -= 16; diff --git a/veejay-current/veejay-server/libhash/Makefile.am b/veejay-current/veejay-server/libhash/Makefile.am index 23219c09..daae4010 100644 --- a/veejay-current/veejay-server/libhash/Makefile.am +++ b/veejay-current/veejay-server/libhash/Makefile.am @@ -1,7 +1,5 @@ # Makefile for veejay -pkginclude_HEADERS = hash.h - - +EXTRA_DIST= hash.h MAINTAINERCLEANFILES=Makefile.in AM_CFLAGS=$(OP_CFLAGS) INCLUDES = -I$(top_srcdir) -I$(includedir) diff --git a/veejay-current/veejay-server/liblzo/Makefile.am b/veejay-current/veejay-server/liblzo/Makefile.am index b11ed031..c8e8f9bb 100644 --- a/veejay-current/veejay-server/liblzo/Makefile.am +++ b/veejay-current/veejay-server/liblzo/Makefile.am @@ -8,4 +8,4 @@ INCLUDES = -I$(top_srcdir) -I$(includedir) -I$(top_srcdir)/vjmem \ VJLZO_LIB_FILE = libminilzo.la noinst_LTLIBRARIES = $(VJLZO_LIB_FILE) libminilzo_la_SOURCES = minilzo.c lzo.c -pkginclude_HEADERS = lzoconf.h lzodefs.h lzo.h minilzo.h +EXTRA_DIST= lzoconf.h lzodefs.h lzo.h minilzo.h diff --git a/veejay-current/veejay-server/libsample/Makefile.am b/veejay-current/veejay-server/libsample/Makefile.am index 2b16bb03..e9ab0637 100644 --- a/veejay-current/veejay-server/libsample/Makefile.am +++ b/veejay-current/veejay-server/libsample/Makefile.am @@ -6,5 +6,4 @@ AM_CFLAGS=$(OP_CFLAGS) SAMPLE_LIB_FILE = libsample.la noinst_LTLIBRARIES = $(SAMPLE_LIB_FILE) libsample_la_SOURCES = sampleadm.c - -pkginclude_HEADERS = sampleadm.h +EXTRA_DIST= sampleadm.h diff --git a/veejay-current/veejay-server/libsample/sampleadm.c b/veejay-current/veejay-server/libsample/sampleadm.c index 772d4dba..eb380701 100644 --- a/veejay-current/veejay-server/libsample/sampleadm.c +++ b/veejay-current/veejay-server/libsample/sampleadm.c @@ -49,6 +49,7 @@ #include #include #include +#include //#define KAZLIB_OPAQUE_DEBUG 1 #ifdef HAVE_XML2 @@ -524,6 +525,36 @@ int sample_get_startFrame(int sample_id) return -1; } +int sample_has_cali_fx(int sample_id) +{ + sample_info *si = sample_get(sample_id); + if(si == NULL) + return -1; + int i; + for( i =0;i < SAMPLE_MAX_EFFECTS; i ++ ) { + if(si->effect_chain[i]->effect_id == 190) + return i; + } + return -1; +} + +void sample_cali_prepare( int sample_id, int slot, int chan ) +{ + sample_info *si = sample_get(sample_id); + if(si == NULL) + return; + vj_tag *tag = vj_tag_get( chan ); + if( tag == NULL || tag->source_type != VJ_TAG_TYPE_CALI ) + return; + int fx_id = vj_effect_real_to_sequence( + si->effect_chain[slot]->effect_id ); + if( fx_id >= 0 ) { + vj_tag_cali_prepare_now( chan, fx_id ); + veejay_msg(VEEJAY_MSG_DEBUG, "Prepared calibration data."); + } +} + + int sample_get_el_position( int sample_id, int *start, int *end ) { @@ -2289,7 +2320,7 @@ int sample_apply_loop_dec(int s1, double fps) { /* print sample status information into an allocated string str*/ //int sample_chain_sprint_status(int s1, int entry, int changed, int r_changed,char *str, // int frame) -int sample_chain_sprint_status( int s1,int cache,int sa,int ca, int pfps, int frame, int mode,int total_slots, int seq_rec,int macro,char *str ) +int sample_chain_sprint_status( int s1,int cache,int sa,int ca, int pfps, int frame, int mode,int total_slots, int seq_rec,int curfps, uint32_t lo, uint32_t hi,int macro,char *str ) { sample_info *sample; sample = sample_get(s1); @@ -2317,7 +2348,7 @@ int sample_chain_sprint_status( int s1,int cache,int sa,int ca, int pfps, int fr } veejay_sprintf(str,1024, - "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", + "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", pfps, frame, mode, @@ -2336,6 +2367,9 @@ int sample_chain_sprint_status( int s1,int cache,int sa,int ca, int pfps, int fr sample->selected_entry, total_slots, cache, + curfps, + lo, + hi, sa, ca, (int)( sample->fader_val ), diff --git a/veejay-current/veejay-server/libsample/sampleadm.h b/veejay-current/veejay-server/libsample/sampleadm.h index ea3af3e2..149e6677 100644 --- a/veejay-current/veejay-server/libsample/sampleadm.h +++ b/veejay-current/veejay-server/libsample/sampleadm.h @@ -247,8 +247,8 @@ extern unsigned char * sample_chain_get_kfs( int s1, int entry, int parameter_id extern int sample_chain_set_kf_status( int s1, int entry, int status ); extern int sample_chain_set_kfs( int s1, int len, unsigned char *data ); extern int sample_chain_reset_kf( int s1, int entry ); - - +extern int sample_has_cali_fx(int sample_id); +extern void sample_cali_prepare( int sample_id, int slot, int chan ); extern int sample_set_sub_audio(int s1, int audio); extern int sample_get_audio_volume(int s1); extern int sample_set_audio_volume(int s1, int volume); @@ -295,7 +295,7 @@ extern int sample_set_chain_channel(int s1, int position, int channel); //int sample_chain_replace(int s1, int position, int effect_id); -extern int sample_chain_sprint_status(int s1,int cache,int sa,int ca, int r, int f, int m, int t,int sr, int macro,char *s ); +extern int sample_chain_sprint_status(int s1,int cache,int sa,int ca, int r, int f, int m, int t,int sr,int curfps,uint32_t lo, uint32_t hi, int macro,char *s ); extern int sample_set_render_entry(int s1, int entry); extern int sample_get_render_entry(int s1); diff --git a/veejay-current/veejay-server/libsamplerec/Makefile.am b/veejay-current/veejay-server/libsamplerec/Makefile.am index 680125ba..4d772c80 100644 --- a/veejay-current/veejay-server/libsamplerec/Makefile.am +++ b/veejay-current/veejay-server/libsamplerec/Makefile.am @@ -10,5 +10,4 @@ AM_CFLAGS=$(OP_CFLAGS) SAMPLEREC_LIB_FILE = libsamplerec.la noinst_LTLIBRARIES = $(SAMPLEREC_LIB_FILE) libsamplerec_la_SOURCES = samplerecord.c - -pkginclude_HEADERS = samplerecord.h +EXTRA_DIST = samplerecord.h diff --git a/veejay-current/veejay-server/libsamplerec/samplerecord.c b/veejay-current/veejay-server/libsamplerec/samplerecord.c index 0007fff8..298ebd88 100644 --- a/veejay-current/veejay-server/libsamplerec/samplerecord.c +++ b/veejay-current/veejay-server/libsamplerec/samplerecord.c @@ -22,8 +22,8 @@ #include #include #include -#include AVUTIL_INC -#include AVCODEC_INC +#include +#include #include #include void sample_reset_encoder(int sample_id); diff --git a/veejay-current/veejay-server/libstream/Makefile.am b/veejay-current/veejay-server/libstream/Makefile.am index c38eb8b4..07faaf0a 100644 --- a/veejay-current/veejay-server/libstream/Makefile.am +++ b/veejay-current/veejay-server/libstream/Makefile.am @@ -12,5 +12,5 @@ STREAM_LIB_FILE = libstream.la noinst_LTLIBRARIES = $(STREAM_LIB_FILE) libstream_la_SOURCES = frequencies.c v4lutils.c v4lvideo.c vj-unicap.c vj-yuv4mpeg.c vj-net.c vj-dv1394.c vj-vloopback.c vj-tag.c -pkginclude_HEADERS = dv1394.h v4lutils.h vj-dv1394.h vj-tag.h vj-vloopback.h \ +EXTRA_DIST = dv1394.h v4lutils.h vj-dv1394.h vj-tag.h vj-vloopback.h \ frequencies.h v4lvideo.h vj-net.h vj-unicap.h vj-yuv4mpeg.h diff --git a/veejay-current/veejay-server/libstream/v4lvideo.c b/veejay-current/veejay-server/libstream/v4lvideo.c index 6e4bd3fe..937b8dc0 100644 --- a/veejay-current/veejay-server/libstream/v4lvideo.c +++ b/veejay-current/veejay-server/libstream/v4lvideo.c @@ -37,8 +37,8 @@ #include #include #include -#include AVUTIL_INC -#include SWSCALE_INC +#include +#include #include #ifdef STRICT_CHECKING #include @@ -248,15 +248,16 @@ static struct { { { VIDEO_PALETTE_JPEG, "JPEG Compressed", PIX_FMT_YUVJ420P }, { VIDEO_PALETTE_RGB24 , "RGB 24 bit", PIX_FMT_BGR24 }, - { VIDEO_PALETTE_YUV422P , "YUV 4:2:2 Planar", PIX_FMT_YUV422P }, - { VIDEO_PALETTE_YUV420P , "YUV 4:2:0 Planar", PIX_FMT_YUV420P }, + { VIDEO_PALETTE_YUV422P , "YUV 4:2:2 Planar", PIX_FMT_YUVJ422P }, + { VIDEO_PALETTE_YUV420P , "YUV 4:2:0 Planar", PIX_FMT_YUVJ420P }, { VIDEO_PALETTE_YUYV, "YUYV 4:2:2 Packed", PIX_FMT_YUYV422 }, { VIDEO_PALETTE_UYVY, "UYVY 4:2:2 Packed", PIX_FMT_UYVY422 }, { VIDEO_PALETTE_RGB32 , "RGB 32 bit", PIX_FMT_RGB32 }, { -1, "Unsupported colour space", -1}, }; - +//@fixme: 16-235 yuv +// static int is_YUV(int a) { if( a == VIDEO_PALETTE_YUV422P || a == VIDEO_PALETTE_YUV420P || @@ -434,8 +435,22 @@ static v4lprocessing *v4lvideo_get_processing( v4lvideo_t *v, int w, int h, int p->src = yuv_yuv_template( NULL,NULL,NULL,p->w,p->h,p->src_fmt ); } else { - if( supported_palette != VIDEO_PALETTE_JPEG ) + if( supported_palette != VIDEO_PALETTE_JPEG ) { + //p->src = yuv_rgb_template( NULL, p->w,p->h, p->src_fmt ); + char *swaprgb = getenv("VEEJAY_SWAP_RGB"); + if(swaprgb!=NULL) { + int val = atoi(swaprgb); + if( val == 1 ) { + if( p->src_fmt == PIX_FMT_BGR24 ) + p->src_fmt = PIX_FMT_RGB24; + else if ( p->src_fmt == PIX_FMT_RGB24 ) + p->src_fmt = PIX_FMT_BGR24; + veejay_msg(VEEJAY_MSG_DEBUG, "Swapped RGB format to %s", + (p->src_fmt==PIX_FMT_RGB24? "RGB" : "BGR" )); + } + } p->src = yuv_rgb_template( NULL, p->w,p->h, p->src_fmt ); + } else { native = 2; p->src = yuv_yuv_template( NULL, NULL,NULL, p->w, p->h, p->src_fmt ); @@ -449,8 +464,8 @@ static v4lprocessing *v4lvideo_get_processing( v4lvideo_t *v, int w, int h, int *cap_palette = supported_palette; veejay_msg(VEEJAY_MSG_DEBUG, - "Capture device info: %dx%d - %dx%d src=%d,dst=%d, is_YUV=%d, native =%d ", - min_w,min_h,max_w,max_h, supported_palette, palette, is_YUV(supported_palette), native ); + "Capture device info: %dx%d - %dx%d src=%s,dst=%s, is_YUV=%d, native =%d ", + min_w,min_h,max_w,max_h, get_palette_name(supported_palette), get_palette_name(palette), is_YUV(supported_palette), native ); return p; } @@ -736,7 +751,7 @@ static void *v4lvideo_grabber_thread( void * vv ) v4lvideo_template_t *i = (v4lvideo_template_t*) vv; v4lvideo_t *v = (v4lvideo_t*) vj_calloc(sizeof(v4lvideo_t)); i->v4l = (void*) v; - + if( __v4lvideo_init( v, i->filename, i->channel, i->norm,i->frequency, i->width, i->height, i->palette ) < 0 ) { veejay_msg(0, "Unable to open capture device '%s' in %dx%d - %s", i->filename, v->video_width,v->video_height,get_palette_name(v->video_palette) ); diff --git a/veejay-current/veejay-server/libstream/vj-tag.c b/veejay-current/veejay-server/libstream/vj-tag.c index f10e5565..479727ff 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.c +++ b/veejay-current/veejay-server/libstream/vj-tag.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -78,6 +79,39 @@ extern void dummy_rgb_apply(VJFrame *frame, int width, int height, int r, int g, extern int sufficient_space(int max_size, int nframes); extern unsigned char *UTF8toLAT1(unsigned char *in); +typedef struct +{ + uint8_t *data; + uint8_t *bf; + uint8_t *lf; + uint8_t *mf; + int uv_len; + int len; + double mean[3]; +} cali_tag_t; + +#define CALI_DARK 0 +#define CALI_LIGHT 1 +#define CALI_FLAT 2 +#define CALI_BUF 4 +#define CALI_MFLAT 3 + +static uint8_t *cali_get(vj_tag *tag, int type, int len, int uv_len ) { + uint8_t *p = tag->blackframe; + switch(type) { + case CALI_DARK: + return p; //@ start of dark current + case CALI_LIGHT: + return p + (len + (2*uv_len)); //@ start of light frame + case CALI_FLAT: + return p + (2*(len + (2*uv_len))); //@ start of master frame + case CALI_MFLAT: + return p + (3*(len + (2*uv_len))); //@ processing buffer + case CALI_BUF: + return p + (4*(len + (2*uv_len))); + } + return NULL; +} static uint8_t *_temp_buffer[3]={NULL,NULL,NULL}; static VJFrame _tmp; @@ -220,6 +254,16 @@ char *vj_tag_scan_devices( void ) return n; } +int vj_tag_get_width() { + return vj_tag_input->width; +} +int vj_tag_get_height() { + return vj_tag_input->height; +} +int vj_tag_get_uvlen() { + return vj_tag_input->uv_len; +} + int vj_tag_init(int width, int height, int pix_fmt, int video_driver) { int i; @@ -446,6 +490,236 @@ int _vj_tag_new_picture( vj_tag *tag, int stream_nr, editlist *el) } #endif +uint8_t *vj_tag_get_cali_buffer(int t1, int type, int *total, int *plane, int *planeuv) +{ + vj_tag *tag = vj_tag_get(t1); + if(!tag) + return NULL; + + int w = vj_tag_input->width; + int h = vj_tag_input->height; + int len = (w*h); + int uv_len = vj_tag_input->uv_len; + + *total = len + (2*uv_len); + *plane = len; + *planeuv= uv_len; + return cali_get(tag,type,w*h,uv_len); +} + +static int cali_write_file( char *file, vj_tag *tag , editlist *el) +{ + FILE *f = fopen( file, "w" ); + if(!f) { + veejay_msg(VEEJAY_MSG_ERROR, "Unable to open '%s' for writing",file ); + return 0; + } + + char header[256]; + int w = vj_tag_input->width; + int h = vj_tag_input->height; + int len = (w*h); + int uv_len = vj_tag_input->uv_len; + + char fileheader[256]; + + snprintf(header,sizeof(header),"%08d %08d %08d %08d %g %g %g", + w, + h, + len, + uv_len, + tag->mean[0], + tag->mean[1], + tag->mean[2] ); + + int offset = 4 + strlen(header); + + snprintf(fileheader,sizeof(fileheader), "%03d %s",offset,header ); + + if( fwrite( fileheader,strlen(fileheader),1, f ) <= 0 ) { + veejay_msg(0 ,"Error while writing file header."); + return 0; + } + int n = 0; + + //@ write dark current frame + if( (n=fwrite( tag->blackframe,sizeof(uint8_t), len + uv_len + uv_len, f )) <= 0 ) { + goto CALIERR; + } + if( n != (len+uv_len + uv_len)) + goto CALIERR; + + uint8_t *lightframe = cali_get(tag,CALI_LIGHT,w*h,uv_len); + if( (n=fwrite( lightframe,sizeof(uint8_t), len + uv_len + uv_len, f )) <= 0 ) { + goto CALIERR; + } + if( n != (len+uv_len+uv_len)) + goto CALIERR; + + uint8_t *masterframe = cali_get(tag,CALI_FLAT,w*h,uv_len); + if( (n=fwrite( masterframe, sizeof(uint8_t), len + uv_len + uv_len, f )) <= 0 ) { + goto CALIERR; + } + if( n != (len+uv_len+uv_len)) + goto CALIERR; + + fclose(f); + + return 1; +CALIERR: + fclose(f); + veejay_msg(0, "File write error."); + + + return 0; +} + +int vj_tag_cali_write_file( int t1, char *name, editlist *el ) { + vj_tag *tag = vj_tag_get(t1); + if(!tag) + return 0; + if(tag->source_type != VJ_TAG_TYPE_V4L) { + veejay_msg(0, "Stream is not of type Video4Linux"); + return 0; + } + if(tag->noise_suppression == 0 ) { + veejay_msg(0, "Stream %d is not yet calibrated.", t1 ); + return 0; + } + if(tag->noise_suppression != V4L_BLACKFRAME_PROCESS ) { + veejay_msg(0, "Please finish calibration first."); + return 0; + } + if(! cali_write_file( name, tag, el ) ) { + return 0; + } + return 1; +} + + +static int cali_read_file( cali_tag_t *p, char *file,editlist *el ) +{ + FILE *f = fopen( file , "r" ); + if( f == NULL ) { + return 0; + } + + char buf[256]; + + char *header = fgets( buf, sizeof(buf), f ); + int w = 0; + int h = 0; + int len = 0; + int uv_len = 0; + int offset = 0; + + int Euv_len = vj_tag_input->uv_len; + + double mean[3]; + + if(sscanf(header, "%3d %8d %8d %8d %8d %lf %lf %lf",&offset, &w,&h,&len,&uv_len, + &mean[0],&mean[1],&mean[2] ) != 8 ) + { + veejay_msg(VEEJAY_MSG_ERROR, "Invalid header."); + return 0; + } + + if( w != el->video_width || h != el->video_height ) { + veejay_msg(VEEJAY_MSG_ERROR, "Dimensions do not match, abort."); + fclose(f); + return 0; + } + + if( len != (w*h)) { + veejay_msg(VEEJAY_MSG_ERROR, "Invalid length for plane Y"); + fclose(f); + return 0; + } + + if( Euv_len != uv_len ) { + veejay_msg(VEEJAY_MSG_ERROR, "Invalid length for planes UV"); + fclose(f); + return 0; + } + + p->data = (uint8_t*) vj_malloc(sizeof(uint8_t) * 3 * (len+uv_len+uv_len)); + p->bf = p->data; + p->lf = p->data + (len + (2*uv_len)); + p->mf = p->lf + (len + (2*uv_len)); + + p->uv_len = uv_len; + p->len = len; + p->mean[0] = mean[0]; + p->mean[1] = mean[1]; + p->mean[2] = mean[2]; + + veejay_memset( p->data,0, 3 * (len+(2*uv_len))); + + int n = 0; + + if( (n=fread( p->bf, 1, (len+2*uv_len), f )) <= 0 ) { + goto CALIREADERR; + } + + if( (n=fread( p->lf,1, (len+2*uv_len), f )) <= 0 ) { + goto CALIREADERR; + } + + if( (n=fread( p->mf,1, (len+2*uv_len),f)) <= 0 ) { + goto CALIREADERR; + } + + veejay_msg(VEEJAY_MSG_INFO, "Image calibration data loaded."); + + return 1; + +CALIREADERR: + veejay_msg(VEEJAY_MSG_ERROR, "Only got %d bytes.",n); + return 0; +} + +int _vj_tag_new_cali( vj_tag *tag, int stream_nr, editlist *el ) +{ + if(stream_nr < 0 || stream_nr > VJ_TAG_MAX_STREAM_IN) return 0; + + cali_tag_t *p = NULL; + + p = (cali_tag_t*) vj_malloc(sizeof(cali_tag_t)); + if(!p) + return 0; + memset(p, 0, sizeof(cali_tag_t)); + + if(!cali_read_file( p, tag->source_name,el ) ) { + veejay_msg(VEEJAY_MSG_ERROR, "Failed to find dark frame '%s'", tag->source_name ); + free(p); + return 0; + } + + vj_tag_input->cali[stream_nr] = (void*)p; + + veejay_msg(VEEJAY_MSG_INFO, "Image Cailbration files ready."); + + return 1; +} + +uint8_t *vj_tag_get_cali_data( int t1, int what ) { + vj_tag *tag = vj_tag_get(t1); + if(tag == NULL) + return NULL; + int w = vj_tag_input->width; + int h = vj_tag_input->height; + int uv_len = vj_tag_input->uv_len; + switch(what) { + case 0: + return tag->blackframe; + case 1: + return tag->blackframe + ((w*h)+(2*uv_len)); + case 2: + return tag->blackframe + 2 * ((w*h)+(2*uv_len)); + } + return NULL; +} + int _vj_tag_new_yuv4mpeg(vj_tag * tag, int stream_nr, editlist * el) { if (stream_nr < 0 || stream_nr > VJ_TAG_MAX_STREAM_IN) @@ -557,9 +831,6 @@ int vj_tag_new(int type, char *filename, int stream_nr, editlist * el, vj_tag *tag; - veejay_msg(VEEJAY_MSG_DEBUG, "type=%d, file=%s, stream_nr=%d, pix=%d, chan=%d, extra=%d", - type, filename, stream_nr, pix_fmt, channel, extra ); - if( this_tag_id == 0) { this_tag_id = 1; // first tag @@ -710,6 +981,11 @@ int _vj_tag_new_unicap( vj_tag * tag, int stream_nr, int width, int height, int return -1; break; #endif + case VJ_TAG_TYPE_CALI: + sprintf(tag->source_name,"%s",filename); + if(_vj_tag_new_cali( tag,stream_nr,el) != 1 ) + return -1; + break; case VJ_TAG_TYPE_YUV4MPEG: sprintf(tag->source_name, "%s", filename); if (_vj_tag_new_yuv4mpeg(tag, stream_nr, el) != 1) @@ -839,13 +1115,21 @@ int vj_tag_del(int id) switch(tag->source_type) { #ifdef HAVE_UNICAP case VJ_TAG_TYPE_V4L: -//FIXME: close based on type, could be v4lvideo #ifdef HAVE_UNICAP if(!tag->capture_type) vj_unicap_free_device(unicap_data_, vj_tag_input->unicap[tag->index] ); #endif if(tag->capture_type==1) v4lvideo_destroy( vj_tag_input->unicap[tag->index] ); + if(tag->blackframe) + free(tag->blackframe); + if( tag->bf ) free(tag->bf); + if( tag->bfu ) free(tag->bfu); + if( tag->bfv ) free(tag->bfv); + if( tag->lf ) free(tag->lf); + if( tag->lfu ) free(tag->lfu); + if( tag->lfv ) free(tag->lfv); + break; #endif case VJ_TAG_TYPE_YUV4MPEG: @@ -871,6 +1155,16 @@ int vj_tag_del(int id) vj_tag_input->picture[tag->index] = NULL; break; #endif + case VJ_TAG_TYPE_CALI: + { + cali_tag_t *pic = (cali_tag_t*) vj_tag_input->cali[tag->index]; + if(pic) { + if(pic->lf) free(pic->data); + free(pic); + } + vj_tag_input->cali[tag->index] = NULL; + } + break; case VJ_TAG_TYPE_MCAST: case VJ_TAG_TYPE_NET: net_thread_stop(tag); @@ -1734,6 +2028,55 @@ int vj_tag_set_effect(int t1, int position, int effect_id) return position; } +int vj_tag_has_cali_fx( int t1 ) { + vj_tag *tag = vj_tag_get(t1); + if (!tag) + return -1; + int i; + for( i = 0; i < SAMPLE_MAX_EFFECTS; i ++ ) { + if( tag->effect_chain[i]->effect_id == VJ_IMAGE_EFFECT_CALI ) + return i; + } + return -1; +} + +void vj_tag_cali_prepare_now( int t1, int fx_id ) { + vj_tag *tag = vj_tag_get(t1); + if(tag==NULL) + return; + if(tag->source_type != VJ_TAG_TYPE_CALI ) + return; + cali_tag_t *p = (cali_tag_t*) vj_tag_input->cali[tag->index]; + if( p == NULL ) + return; + if( fx_id <= 0) + return; + + cali_prepare( vj_effect_get_data(fx_id), + p->mean[0], + p->mean[1], + p->mean[2], + p->data, + vj_tag_input->width * vj_tag_input->height, + vj_tag_input->uv_len ); + +} + +void vj_tag_cali_prepare( int t1 , int pos, int cali_tag) { + vj_tag *tag = vj_tag_get(t1); + if (!tag) + return; + vj_tag *tagc = vj_tag_get(cali_tag); + if(!tagc) + return; + if(tagc->source_type != VJ_TAG_TYPE_CALI) + return; + int fx_id = vj_effect_real_to_sequence( tag->effect_chain[pos]->effect_id ); + if (fx_id >= 0 ) { + vj_tag_cali_prepare_now( cali_tag, fx_id ); + } +} + int vj_tag_get_chain_status(int t1, int position) { vj_tag *tag = vj_tag_get(t1); @@ -2268,6 +2611,9 @@ void vj_tag_get_by_type(int type, char *description ) case VJ_TAG_TYPE_YUV4MPEG: sprintf(description, "%s", "YUV4MPEG"); break; + case VJ_TAG_TYPE_CALI: + sprintf(description, "%s", "Image Calibration"); + break; } } @@ -2432,6 +2778,497 @@ int vj_tag_get_audio_frame(int t1, uint8_t *dst_buffer) } +/* ccd image calibration + */ + +static uint8_t *blackframe_new( int w, int h, int uv_len, uint8_t *Y, uint8_t *U, uint8_t *V, int median_radius, vj_tag *tag ) { + uint8_t *buf = (uint8_t*) vj_malloc(sizeof(uint8_t) * 5 * ((w*h) + 2 * uv_len )); + if(buf == NULL) { + veejay_msg(0,"Insufficient memory to initialize calibration."); + return NULL; + } + veejay_memset( buf, 0, sizeof(uint8_t) * 5 * ((w*h)+2*uv_len)); + tag->blackframe = buf; +#ifdef STRICT_CHECKING + assert( uv_len == ( (w/2) * h )); +#endif + const int chroma=127; + + tag->lf = (double*) vj_malloc(sizeof(double) * (w*h)); + tag->lfu= (double*) vj_malloc(sizeof(double) *uv_len); + tag->lfv= (double*) vj_malloc(sizeof(double) *uv_len); + + tag->bf = (double*) vj_malloc(sizeof(double) * (w*h)); + tag->bfu= (double*) vj_malloc(sizeof(double) * uv_len); + tag->bfv= (double*) vj_malloc(sizeof(double) * uv_len); + + if(median_radius== 0 ) { + int i; + for(i = 0; i < (w*h); i ++ ) { + tag->lf[i] = 0.0f; + tag->bf[i] = 0.0f + (double) Y[i]; + } + for(i = 0; i < uv_len; i ++ ) { + tag->lfu[i] = 0.0f; + tag->lfv[i] = 0.0f; + tag->bfu[i] = 0.0f + (double) (U[i] - chroma); + tag->bfv[i] = 0.0f + (double) (V[i] - chroma); + } + + } else { + uint8_t *ptr = cali_get(tag,CALI_BUF,w*h,uv_len); + ctmf( Y, ptr, w,h,w,w,median_radius,1,512*1024); + ctmf( U, ptr + (w*h),w/2,h,w/2,w/2,median_radius,1,512*1024); + ctmf( V, ptr + (w*h)+uv_len,w/2,h,w/2,w/2,median_radius,1,512*1024); + int i; + for(i = 0; i < (w*h); i ++ ) { + tag->lf[i] = 0.0f; + tag->bf[i] = 0.0f + (double) ptr[i]; + } + uint8_t *ptru = ptr + (w*h); + uint8_t *ptrv = ptru + uv_len; + for(i = 0; i < uv_len; i ++ ) { + tag->lfu[i] = 0.0f; + tag->lfv[i] = 0.0f; + tag->bfu[i] = 0.0f + (double) (ptru[i] - chroma); + tag->bfv[i] = 0.0f + (double) (ptrv[i] - chroma); + } + + } + + return buf; +} + +static void blackframe_process( uint8_t *Y, uint8_t *U, uint8_t *V, int w, int h, int uv_len, int median_radius, vj_tag *tag ) +{ + int i; + uint8_t *bf = cali_get(tag,CALI_DARK,w*h,uv_len); + const int chroma = 127; + double *blackframe = tag->bf; + double *blackframeu= tag->bfu; + double *blackframev= tag->bfv; + + //@ YUV = input frame + if( median_radius > 0 ) { + bf = cali_get(tag,CALI_BUF,w*h,uv_len); + } + + uint8_t *bu = bf + (w*h); + uint8_t *bv = bu + uv_len; + + uint8_t *srcY = Y; + uint8_t *srcU = U; + uint8_t *srcV = V; + + if( median_radius > 0 ) { + ctmf( Y, bf, w,h,w,w,median_radius,1,512*1024); + ctmf( U, bu, w/2,h,w/2,w/2,median_radius,1,512*1024); + ctmf( V, bv, w/2,h,w/2,w/2,median_radius,1,512*1024); + srcY = bf; + srcU = bu; + srcV = bv; + } + + for( i = 0; i < (w*h); i ++ ) { + blackframe[i] += srcY[i]; + } + for( i =0 ; i < uv_len; i ++ ) { + blackframeu[i] += (double) ( srcU[i] - chroma ); + blackframev[i] += (double) ( srcV[i] - chroma ); + } +} +static void whiteframe_new(uint8_t *buf, int w, int h, int uv_len, uint8_t *Y, uint8_t *U, uint8_t *V, int median_radius, vj_tag *tag ) { + int i; + uint8_t *bf = cali_get( tag,CALI_DARK,w*h,uv_len); + uint8_t *bu = bf + (w*h); + uint8_t *bv = bu + uv_len; + int p; + const int chroma = 127; + + double mean_of_y = 0.0; + double mean_of_u = 0.0f; + double mean_of_v = 0.0f; + + + if(median_radius > 0 ) { + uint8_t *ptr = cali_get(tag,CALI_BUF,w*h,uv_len); + ctmf( Y, ptr, w,h,w,w,median_radius,1,512*1024); + ctmf( U, ptr + (w*h),w/2,h,w/2,w/2,median_radius,1,512*1024); + ctmf( V, ptr + (w*h)+uv_len,w/2,h,w/2,w/2,median_radius,1,512*1024); + int i; + for(i = 0; i < (w*h); i ++ ) { + tag->lf[i] = 0.0f + (double) ptr[i] - bf[i]; + mean_of_y += tag->lf[i]; + } + uint8_t *ptru = ptr + (w*h); + uint8_t *ptrv = ptru + uv_len; + for(i = 0; i < uv_len; i ++ ) { + tag->lfu[i] = 0.0f + (double) (ptru[i] - chroma) - (bu[i]-chroma); + mean_of_u += tag->lfu[i]; + tag->lfv[i] = 0.0f + (double) (ptrv[i] - chroma) - (bv[i]-chroma); + mean_of_v += tag->lfv[i]; + } + } else { + for(i = 0; i < (w*h); i ++ ) { //@FIXME subtract dark current + p = Y[i] - bf[i]; + if( p < 0 ) p = 0; + tag->lf[i] = 0.0f + (double)p; + mean_of_y += p; + } + for(i = 0; i < uv_len; i ++ ) { + p = ( (U[i]-chroma) - (bu[i]-chroma)); + tag->lfu[i] = 0.0f + (double)p; + mean_of_u += p; + p = ( (V[i]-chroma) - (bv[i]-chroma)); + tag->lfv[i] = 0.0f + (double) p; + mean_of_v += p; + } + + } + + mean_of_y = mean_of_y / (w*h); + + tag->tabmean[0][ tag->bf_count - 1 ] = mean_of_y; + + mean_of_u = mean_of_u / uv_len; + mean_of_v = mean_of_v / uv_len; + +} + +static void whiteframe_process( uint8_t *Y, uint8_t *U, uint8_t *V, int w, int h, int uv_len, int median_radius, vj_tag *tag) +{ + int i; + const int chroma = 127; + + double *lightframe = tag->lf; + double *lightframe_u = tag->lfu; + double *lightframe_v = tag->lfv; + + uint8_t *bf = cali_get( tag,CALI_DARK,w*h,uv_len); + uint8_t *bu = bf + (w*h); + uint8_t *bv = bu + uv_len; + double mean_of_y = 0.0; + double mean_of_u = 0.0f; + double mean_of_v = 0.0f; + + + //@ YUV = input frame + if( median_radius > 0 ) { + uint8_t *dbf = cali_get( tag,CALI_BUF,w*h,uv_len ); + uint8_t *dbu = dbf + (w*h); + uint8_t *dbv = dbu + uv_len; + ctmf( Y, dbf, w,h,w,w,median_radius,1,512*1024); + for( i = 0; i < (w*h); i ++ ) { + lightframe[i] += (double)(dbf[i] - bf[i]); + mean_of_y += lightframe[i]; + } + ctmf( U, dbu, w/2,h,w/2,w/2,median_radius,1,512*1024); + ctmf( V, dbv, w/2,h,w/2,w/2,median_radius,1,512*1024); + for( i =0 ; i < uv_len; i ++ ) { + lightframe_u[i] += (double) ( dbu[i]-chroma ) - ( bu[i]-chroma); + mean_of_u += lightframe_u[i]; + lightframe_v[i] += (double) ( dbv[i]-chroma ) - ( bv[i]-chroma); + mean_of_v += lightframe_v[i]; + } + + } else { + int p; + //@ should subtract dark current, FIXME + for( i = 0; i < (w*h); i ++ ) { + p = Y[i] - bf[i]; + if( p < 0 ) + p = 0; + lightframe[i] += (double) p; + mean_of_y += p; + } + for( i =0 ; i < uv_len; i ++ ) { + p = ((U[i]-chroma)-(bu[i]-chroma)); + lightframe_u[i] += (double) p; + mean_of_u += p; + p = ((V[i]-chroma)-(bv[i]-chroma)); + lightframe_v[i] += (double) p; + mean_of_v += p; + } + } + + mean_of_y = mean_of_y / (w*h); + mean_of_u = mean_of_u / uv_len; + mean_of_v = mean_of_v / uv_len; + tag->tabmean[0][ tag->bf_count - 1 ] = mean_of_y; +} + +static void master_lightframe(int w,int h, int uv_len, vj_tag *tag) +{ + int i; + int duration =tag->cali_duration -1; + uint8_t *bf = cali_get(tag,CALI_LIGHT,w*h,uv_len); + uint8_t *bu = bf + (w*h); + uint8_t *bv = bu + uv_len; + + int len = w*h; + int v; + + double *sY = tag->lf; + double *sU = tag->lfu; + double *sV = tag->lfv; + const int chroma = 127; + + + double sum = 0.0; + + for( i = 0; i < len; i ++ ) { + if( sY[i] <= 0 ) + bf[i] = 0; + else + { + bf[i] = (uint8_t) ( sY[i] / duration ); + } + sum += bf[i]; + } + + sum = sum / len; + + for( i = 0; i cali_duration - 1; + uint8_t *bf = cali_get(tag,CALI_DARK,w*h,uv_len); + uint8_t *bu = bf + (w*h); + uint8_t *bv = bu + uv_len; + int len = w*h; + int v; + double *sY = tag->bf; + double *sU = tag->bfu; + double *sV = tag->bfv; + const int chroma = 127; + for( i = 0; i < len; i ++ ) { + if( sY[i] <= 0 ) + bf[i] = 0; + else + { + bf[i] = (uint8_t) ( sY[i] / duration ); + } + } + + for( i = 0; i mean[0] = mean_y; + tag->mean[1] = mean_u; + tag->mean[2] = mean_v; + +} + +static void blackframe_subtract( vj_tag *tag, uint8_t *Y, uint8_t *U, uint8_t *V, int w, int h, int uv_len,int use_light,const double mean_y,const double mean_u,const double mean_v ) +{ + int i; + uint8_t *bf = cali_get(tag, CALI_DARK,w*h,uv_len); + uint8_t *u = bf + (w*h); + uint8_t *v = u + uv_len; + + uint8_t *wy = cali_get(tag, CALI_FLAT,w*h,uv_len); + uint8_t *wu = wy + (w*h); + uint8_t *wv = wu + uv_len; + uint8_t *bu = bf + (w*h); + uint8_t *bv = bu + uv_len; + int min_Y = get_pixel_range_min_Y(); + const int chroma = 127; + + int d=0; + double p = 0.0; + const double dmean_y = (double) mean_y; + const double dmean_u = (double) mean_u; + const double dmean_v = (double) mean_v; + //@ process master flat image + + if( use_light ) { + for( i = 0; i <(w*h); i ++ ) { + p = (double) wy[i] /dmean_y; + if( p != 0.0 ) + d = (int) ( ( (double)Y[i] - bf[i]) / p); + else + d = 0.0f; //Y[i] - bf[i]; + + if( d < 0 ) d = 0; else if ( d > 255 ) d = 255; + + Y[i] = (uint8_t) d; + + } + + int d1=0; + for( i =0 ; i < uv_len; i ++ ) + { + p = (double) wu[i] / dmean_u; + d1 = (double) ( chroma + ((U[i] - chroma) - (bu[i]-chroma))); + if( d1 == 0 ) + d = chroma; + else + d = (int) ( d1 / p ); + + if ( d < 0 ) { d = 0; } else if ( d > 255 ) { d = 255;} + + U[i] = (uint8_t) d; + + p = ( wv[i] / dmean_v ); + d1 = ( double) (chroma + ((V[i] - chroma) - (bv[i]-chroma))); + if( d1 == 0 ) + d= chroma; + else + d = (int) ( d1 / p ); + if( d < 0 ) { d = 0; } else if ( d > 255 ) { d= 255; } + V[i] = (uint8_t) d; + } + + } else { + //@ just show result of frame - dark current + for( i = 0; i <(w*h); i ++ ) { + p = ( Y[i] - bf[i] ); + if( p < 0 ) + Y[i] = 0; + else + Y[i] = p; + } + for( i = 0; i < uv_len; i ++ ) { + p = U[i] - bu[i]; + if( p < 0 ) + U[i] = chroma; + else + U[i] = p; + + p = V[i] - bv[i]; + if( p < 0 ) + V[i] = chroma; + else + V[i] = p; + } + } + + + + +} + +#define V4L_WHITEFRAME 4 +#define V4L_WHITEFRAME_NEXT 5 +#define V4L_WHITEFRAME_PROCESS 6 +int vj_tag_grab_blackframe(int t1, int duration, int median_radius , int mode) +{ + vj_tag *tag = vj_tag_get(t1); + if(!tag) + return 0; + if( tag->source_type != VJ_TAG_TYPE_V4L ) { + veejay_msg(VEEJAY_MSG_INFO, "Source is not a video device."); + return 0; + } + + if( duration <= 0 ) + return 0; + + if( median_radius <= 0 ) { + median_radius = 0; + } + + veejay_msg(VEEJAY_MSG_INFO, "Creating %s (%d frames) median=%d",(mode==0?"Blackframe":"Lightframe"),duration, median_radius ); + + tag->noise_suppression = (mode == 0 ? V4L_BLACKFRAME : V4L_WHITEFRAME ); + tag->median_radius = median_radius; + tag->bf_count = duration; + tag->has_white = (mode == 1 ? 1 :0); + return 1; +} +int vj_tag_drop_blackframe(int t1) +{ + vj_tag *tag = vj_tag_get(t1); + if(!tag) + return 0; + if( tag->source_type != VJ_TAG_TYPE_V4L ) { + veejay_msg(VEEJAY_MSG_INFO, "Source is not a video device."); + return 0; + } + if( tag->blackframe ) { + tag->noise_suppression = -1; + veejay_msg(VEEJAY_MSG_INFO, "Black Frame dropped."); + } + + return 1; +} + + int vj_tag_get_frame(int t1, uint8_t *buffer[3], uint8_t * abuffer) { @@ -2455,7 +3292,6 @@ int vj_tag_get_frame(int t1, uint8_t *buffer[3], uint8_t * abuffer) veejay_memset( buffer[1], 128, uv_len ); veejay_memset( buffer[2], 128, uv_len ); } - } #ifdef HAVE_UNICAP else { @@ -2463,8 +3299,100 @@ int vj_tag_get_frame(int t1, uint8_t *buffer[3], uint8_t * abuffer) vj_unicap_grab_frame( vj_tag_input->unicap[tag->index], buffer, width,height ); } #endif + switch( tag->noise_suppression ) { + case V4L_BLACKFRAME: + tag->cali_duration = tag->bf_count; + blackframe_new(width,height,uv_len,buffer[0],buffer[1],buffer[2],tag->median_radius,tag); + tag->tabmean[0] = (double*) vj_malloc(sizeof(double)* tag->cali_duration); + if(tag->blackframe == NULL ) { + tag->noise_suppression = 0; + } else { + tag->bf_count --; + tag->noise_suppression = V4L_BLACKFRAME_NEXT; + if(tag->bf_count==0) { + master_blackframe(width,height,uv_len,tag); + tag->noise_suppression = V4L_BLACKFRAME_PROCESS; + veejay_msg(VEEJAY_MSG_INFO, "Please create a lightframe (white)"); + } + } + //@ grab black frame + break; + case V4L_WHITEFRAME: + tag->cali_duration = tag->bf_count; + if(!tag->blackframe) { + veejay_msg(0, "Please start with a black frame first (Put cap on lens)"); + tag->noise_suppression = 0; + break; + } + whiteframe_new( tag->blackframe,width,height,uv_len,buffer[0],buffer[1],buffer[2],tag->median_radius, tag); + tag->bf_count --; + tag->noise_suppression = V4L_WHITEFRAME_NEXT; + if(tag->bf_count <= 0 ) { + tag->noise_suppression = V4L_BLACKFRAME_PROCESS; + master_lightframe( width,height,uv_len,tag ); + master_flatframe( width,height,uv_len, tag ); + veejay_msg(VEEJAY_MSG_DEBUG, "Master flat frame."); + } + break; + case V4L_WHITEFRAME_NEXT: + whiteframe_process(buffer[0],buffer[1],buffer[2],width,height,uv_len,tag->median_radius,tag ); + tag->bf_count --; + if( tag->bf_count <= 0 ) { + tag->noise_suppression = V4L_BLACKFRAME_PROCESS; + master_lightframe( width,height,uv_len,tag); + master_flatframe( width,height,uv_len, tag ); + veejay_msg(VEEJAY_MSG_DEBUG, "Master flat frame"); + } else { + veejay_msg(VEEJAY_MSG_DEBUG, "Whiteframe %d",tag->bf_count ); + } + break; + case V4L_BLACKFRAME_NEXT: + blackframe_process( buffer[0],buffer[1],buffer[2],width,height,uv_len, tag->median_radius,tag ); + if( tag->bf_count <= 0 ) { + tag->noise_suppression = 0; + master_blackframe(width,height,uv_len,tag); + veejay_msg(VEEJAY_MSG_INFO, "Please create a lightframe."); + } else { + veejay_msg(VEEJAY_MSG_DEBUG, "Blackframe %d", tag->bf_count ); + tag->bf_count --; + } + break; + case V4L_BLACKFRAME_PROCESS: + blackframe_subtract( tag,buffer[0],buffer[1],buffer[2],width,height,uv_len, tag->has_white , tag->mean[0],tag->mean[1],tag->mean[2]); + break; + case -1: + if( tag->blackframe ) { + free(tag->blackframe); + tag->blackframe = NULL; + tag->noise_suppression = 0; + } + if( tag->bf ) free(tag->bf); + if( tag->bfu ) free(tag->bfu); + if( tag->bfv ) free(tag->bfv); + if( tag->lf ) free(tag->lf); + if( tag->lfu ) free(tag->lfu); + if( tag->lfv ) free(tag->lfv); + if( tag->tabmean[0]) free(tag->tabmean[0]); + break; + //@ process black frame + default: + break; + } + if( tag->noise_suppression != 0 && tag->noise_suppression != 6 && tag->noise_suppression != 3 ) + veejay_msg(VEEJAY_MSG_DEBUG, "Calibration step %d of %d", tag->bf_count, tag->cali_duration ); + return 1; break; + case VJ_TAG_TYPE_CALI: + { + cali_tag_t *p = (cali_tag_t*)vj_tag_input->cali[tag->index]; + if(p) { + veejay_memcpy(buffer[0], p->mf, len ); + veejay_memcpy(buffer[1], p->mf + len, uv_len ); + veejay_memcpy(buffer[2], p->mf + len + uv_len, uv_len); + } + } + break; #ifdef USE_GDK_PIXBUF case VJ_TAG_TYPE_PICTURE: { @@ -2526,7 +3454,7 @@ int vj_tag_get_frame(int t1, uint8_t *buffer[3], uint8_t * abuffer) //int vj_tag_sprint_status(int tag_id, int entry, int changed, char *str) -int vj_tag_sprint_status( int tag_id,int cache,int sa, int ca, int pfps,int frame, int mode,int ts, int macro, char *str ) +int vj_tag_sprint_status( int tag_id,int cache,int sa, int ca, int pfps,int frame, int mode,int ts,int curfps, uint32_t lo, uint32_t hi, int macro, char *str ) { vj_tag *tag; tag = vj_tag_get(tag_id); @@ -2537,7 +3465,7 @@ int vj_tag_sprint_status( int tag_id,int cache,int sa, int ca, int pfps,int fram //return -1; veejay_sprintf(str, 1024, - "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", + "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", pfps, frame, mode, @@ -2556,6 +3484,9 @@ int vj_tag_sprint_status( int tag_id,int cache,int sa, int ca, int pfps,int fram tag->selected_entry, ts, cache, + curfps, + lo, + hi, sa, ca, (int)(tag->fader_val), diff --git a/veejay-current/veejay-server/libstream/vj-tag.h b/veejay-current/veejay-server/libstream/vj-tag.h index f6f737ee..d4f94709 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.h +++ b/veejay-current/veejay-server/libstream/vj-tag.h @@ -19,6 +19,7 @@ #ifndef VJ_TAG_H #define VJ_TAG_H +#define VJ_TAG_TYPE_CALI 6 #define VJ_TAG_TYPE_PICTURE 5 #define VJ_TAG_TYPE_COLOR 4 #define VJ_TAG_TYPE_VLOOPBACK 3 @@ -52,7 +53,8 @@ typedef struct { vj_dv1394 *dv1394[VJ_TAG_MAX_STREAM_IN]; #ifdef USE_GDK_PIXBUF vj_picture *picture[VJ_TAG_MAX_STREAM_IN]; -#endif +#endif + void *cali[VJ_TAG_MAX_STREAM_IN]; int width; int height; int depth; @@ -114,8 +116,26 @@ typedef struct { int composite; void *viewport_config; void *viewport; + int noise_suppression; + uint8_t *blackframe; + int bf_count; + int median_radius; + int has_white; + double *tabmean[3]; + double mean[3]; + double *bf; + double *bfu; + double *bfv; + double *lf; + double *lfu; + double *lfv; + int cali_duration; } vj_tag; +#define V4L_BLACKFRAME 1 +#define V4L_BLACKFRAME_NEXT 2 +#define V4L_BLACKFRAME_PROCESS 3 + void *vj_tag_get_dict( int id ); int vj_tag_set_composite(void *compiz,int id, int n); int vj_tag_get_composite(int t1); @@ -233,11 +253,12 @@ int vj_tag_enable(int t1); int vj_tag_disable(int t1); -int vj_tag_sprint_status(int tag_id, int cache,int sa, int ca, int r, int f, int m, int t, int macro,char *str ); +int vj_tag_sprint_status(int tag_id, int cache,int sa, int ca, int r, int f, int m, int t,int curfps, uint32_t lo, uint32_t hi, int macro,char *str ); //int vj_tag_init_encoder(int t1, char *filename, int format, // int w, int h, double fps, long seconds, int autoplay); +uint8_t *vj_tag_get_cali_buffer(int t1, int type, int *total, int *len, int *uvlen); int vj_tag_stop_encoder(int t1); int vj_tag_set_brightness(int t1, int value); int vj_tag_set_contrast(int t1, int value); @@ -294,8 +315,10 @@ int vj_tag_set_logical_index(int t1, int stream_nr); int vj_tag_set_description(int t1, char *descr); int vj_tag_get_description(int t1, char *descr); void vj_tag_get_by_type( int type, char *descr ); - - +int vj_tag_get_width(); +int vj_tag_get_height(); +int vj_tag_get_uvlen(); +void vj_tag_cali_prepare_now(int a, int b); int vj_tag_chain_set_kfs( int s1, int len, unsigned char *data ); unsigned char * vj_tag_chain_get_kfs( int s1, int entry, int parameter_id, int *len ); int vj_tag_get_kf_status(int t1, int entry); @@ -307,13 +330,15 @@ void *vj_tag_get_kf_port( int s1, int entry ); char *vj_tag_scan_devices( void ); int vj_tag_get_kf_tokens( int s1, int entry, int id, int *start,int *end, int *type); - +int vj_tag_grab_blackframe(int t1, int duration, int median_radius,int mode ); +int vj_tag_drop_blackframe(int t1); int vj_tag_num_devices(); void vj_tag_reload_config( void *compiz, int t1, int mode ); void *vj_tag_get_composite_view(int t1); int vj_tag_set_composite_view(int t1, void *v); +int vj_tag_cali_write_file( int id, char *name, editlist *el ); #ifdef HAVE_XML2 void tag_writeStream( char *file, int n, xmlNodePtr node, void *font, void *vp); diff --git a/veejay-current/veejay-server/libstream/vj-unicap.c b/veejay-current/veejay-server/libstream/vj-unicap.c index a27d5518..26178cae 100644 --- a/veejay-current/veejay-server/libstream/vj-unicap.c +++ b/veejay-current/veejay-server/libstream/vj-unicap.c @@ -32,7 +32,7 @@ #include #include #include -#include AVUTIL_INC +#include #include #ifdef STRICT_CHECKING #include @@ -285,7 +285,7 @@ void vj_unicap_deinit(void *dud ) unicap_driver_t *ud = (unicap_driver_t*) dud; if( ud ) { - //vevo_port_recursive_free( ud->device_list ); + vevo_port_recursive_free( ud->device_list ); free(ud); } dud = NULL; diff --git a/veejay-current/veejay-server/libstream/vj-vloopback.c b/veejay-current/veejay-server/libstream/vj-vloopback.c index 27e616ae..b3d31be7 100644 --- a/veejay-current/veejay-server/libstream/vj-vloopback.c +++ b/veejay-current/veejay-server/libstream/vj-vloopback.c @@ -79,7 +79,7 @@ void *vj_vloopback_open(const char *device_name, int norm, int mode, memset(v , 0, sizeof(vj_vloopback_t )); - v->fd = open( device_name, O_RDWR ); + v->fd = open( device_name, O_RDWR, S_IRUSR|S_IWUSR ); v->norm = norm; v->mode = mode; v->width = w; diff --git a/veejay-current/veejay-server/libstream/vj-yuv4mpeg.c b/veejay-current/veejay-server/libstream/vj-yuv4mpeg.c index a7cc0d9e..148ea10a 100644 --- a/veejay-current/veejay-server/libstream/vj-yuv4mpeg.c +++ b/veejay-current/veejay-server/libstream/vj-yuv4mpeg.c @@ -27,8 +27,8 @@ #include #include #include -#include AVUTIL_INC -#include SWSCALE_INC +#include +#include #include #ifdef STRICT_CHECKING #include @@ -93,19 +93,31 @@ vj_yuv *vj_yuv4mpeg_alloc(editlist * el, int w, int h, int out_pixel_format) void vj_yuv4mpeg_free(vj_yuv *v) { } +static int vj_yuv_stream_start_read1(vj_yuv * yuv4mpeg, int fd, int width, int height); int vj_yuv_stream_start_read(vj_yuv * yuv4mpeg, char *filename, int width, + int height) { + int fd = open(filename,O_RDONLY); + if(!fd) { + veejay_msg(VEEJAY_MSG_ERROR, "Unable to open video stream %s\n", filename); + return -1; + } + return vj_yuv_stream_start_read1( yuv4mpeg, fd, width,height ); +} + +int vj_yuv_stream_start_read_fd( vj_yuv *yuv4mpeg, int fd, int width,int height ) +{ + return vj_yuv_stream_start_read1( yuv4mpeg,fd,width,height ); +} + +static int vj_yuv_stream_start_read1(vj_yuv * yuv4mpeg, int fd, int width, int height) { int i, w, h; - yuv4mpeg->fd = open(filename,O_RDONLY); - if (!yuv4mpeg->fd) { - veejay_msg(VEEJAY_MSG_ERROR, "Unable to open video stream %s\n", filename); - return -1; - } + yuv4mpeg->fd = fd; - i = y4m_read_stream_header(yuv4mpeg->fd, &(yuv4mpeg->streaminfo)); + i = y4m_read_stream_header(yuv4mpeg->fd, &(yuv4mpeg->streaminfo)); if (i != Y4M_OK) { veejay_msg(VEEJAY_MSG_ERROR, "yuv4mpeg: %s", y4m_strerr(i)); return -1; diff --git a/veejay-current/veejay-server/libstream/vj-yuv4mpeg.h b/veejay-current/veejay-server/libstream/vj-yuv4mpeg.h index 41901b13..94d92b1b 100644 --- a/veejay-current/veejay-server/libstream/vj-yuv4mpeg.h +++ b/veejay-current/veejay-server/libstream/vj-yuv4mpeg.h @@ -47,6 +47,8 @@ vj_yuv *vj_yuv4mpeg_alloc(editlist * el, int dst_w, int dst_h, int out_pix_fmt); void vj_yuv4mpeg_free(vj_yuv *v) ; +int vj_yuv_stream_start_read_fd( vj_yuv *, int fd, int width,int height ); + int vj_yuv_stream_start_read(vj_yuv *, char *, int width, int height); int vj_yuv_stream_write_header(vj_yuv * yuv4mpeg, editlist * el, int outchroma); diff --git a/veejay-current/veejay-server/libvje/Makefile.am b/veejay-current/veejay-server/libvje/Makefile.am index 9864b3bf..9061755d 100644 --- a/veejay-current/veejay-server/libvje/Makefile.am +++ b/veejay-current/veejay-server/libvje/Makefile.am @@ -5,8 +5,10 @@ INCLUDES = -I$(top_srcdir) -I$(includedir) -I$(top_srcdir)/vjmem -I$(top_srcdir AM_CFLAGS = $(OP_CFLAGS) -freg-struct-return -pkginclude_HEADERS = internal.h plugload.h vje.h -pkginclude_HEADERS += effects/autoeq.h effects/crosspixel.h effects/mask.h effects/rawval.h \ +pkginclude_HEADERS=vje.h + +EXTRA_DIST = internal.h plugload.h vje.h +EXTRA_DIST += effects/autoeq.h effects/crosspixel.h effects/mask.h effects/rawval.h \ effects/average.h effects/cutstop.h effects/maskstop.h effects/reflection.h \ effects/baltantv.h effects/deinterlace.h effects/mirrors2.h effects/revtv.h \ effects/bathroom.h effects/dices.h effects/mirrors.h effects/rgbchannel.h \ @@ -25,7 +27,7 @@ pkginclude_HEADERS += effects/autoeq.h effects/crosspixel.h effects/mask.h effec effects/chromium.h effects/flare.h effects/noiseadd.h effects/solarize.h \ effects/colflash.h effects/flip.h effects/noisepencil.h effects/split.h \ effects/colmorphology.h effects/frameborder.h effects/opacityadv.h effects/swirl.h \ - effects/coloradjust.h effects/gamma.h effects/opacity.h effects/texmap.h \ + effects/coloradjust.h effects/gamma.h effects/opacity.h effects/iris.h effects/texmap.h \ effects/color.h effects/ghost.h effects/opacitythreshold.h effects/threshold.h \ effects/colorhis.h effects/greyselect.h effects/overclock.h effects/timedistort.h \ effects/colormap.h effects/isolate.h effects/pencilsketch.h effects/tracer.h \ @@ -37,22 +39,25 @@ pkginclude_HEADERS += effects/autoeq.h effects/crosspixel.h effects/mask.h effec effects/complexthreshold.h effects/lumamask.h effects/radialblur.h effects/waterrippletv.h \ effects/constantblend.h effects/magicmirror.h effects/radioactive.h effects/whiteframe.h \ effects/contourextract.h effects/magicoverlays.h effects/raster.h effects/widthmirror.h \ - effects/contrast.h effects/magicscratcher.h effects/rawman.h effects/zoom.h + effects/contrast.h effects/magicscratcher.h effects/rawman.h effects/zoom.h effects/iris.h -pkginclude_HEADERS += specs/FreeFrame.h specs/frei0r.h +EXTRA_DIST += specs/FreeFrame.h specs/frei0r.h -pkginclude_HEADERS += transitions/3bar.h transitions/fadecolorrgb.h transitions/transblend.h transitions/transline.h \ +EXTRA_DIST += transitions/3bar.h transitions/fadecolorrgb.h transitions/transblend.h transitions/transline.h \ transitions/vbar.h transitions/fadecolor.h transitions/slidingdoor.h transitions/transcarot.h \ transitions/transop.h transitions/wipe.h +EXTRA_DIST += ctmf/ctmf.h + VJE_LIB_FILE = libvje.la noinst_LTLIBRARIES = $(VJE_LIB_FILE) libvje_la_SOURCES = plugload.c vj-effect.c vj-effman.c effects/common.c \ + ctmf/ctmf.c \ effects/diff.c effects/fibdownscale.c effects/killchroma.c \ effects/lumamagick.c effects/autoeq.c effects/colorhis.c \ effects/mirrors.c effects/colormap.c effects/negatechannel.c effects/negation.c \ - effects/overclock.c effects/dissolve.c effects/opacity.c effects/posterize.c \ + effects/overclock.c effects/dissolve.c effects/opacity.c effects/iris.c effects/posterize.c \ effects/dither.c effects/dices.c effects/emboss.c effects/flip.c \ effects/revtv.c effects/softblur.c effects/zoom.c effects/split.c effects/widthmirror.c \ effects/frameborder.c effects/dummy.c effects/rawman.c effects/rawval.c \ @@ -81,6 +86,6 @@ libvje_la_SOURCES = plugload.c vj-effect.c vj-effman.c effects/common.c \ effects/cartonize.c effects/tripplicity.c effects/neighbours.c effects/neighbours2.c\ effects/neighbours3.c effects/neighbours4.c effects/neighbours5.c effects/cutstop.c\ effects/contourextract.c effects/texmap.c effects/maskstop.c effects/photoplay.c effects/videoplay.c effects/rgbchannel.c \ - effects/videowall.c effects/flare.c effects/radioactive.c effects/baltantv.c effects/constantblend.c effects/picinpic.c effects/bgsubtract.c + effects/videowall.c effects/flare.c effects/radioactive.c effects/baltantv.c effects/constantblend.c effects/picinpic.c effects/bgsubtract.c effects/cali.c diff --git a/veejay-current/veejay-server/libvje/effects/colorhis.c b/veejay-current/veejay-server/libvje/effects/colorhis.c index 05acc5c4..2f16b5f5 100644 --- a/veejay-current/veejay-server/libvje/effects/colorhis.c +++ b/veejay-current/veejay-server/libvje/effects/colorhis.c @@ -22,7 +22,7 @@ #include #include "colorhis.h" #include -#include AVUTIL_INC +#include #include #include #include "common.h" diff --git a/veejay-current/veejay-server/libvje/effects/common.c b/veejay-current/veejay-server/libvje/effects/common.c index 2db03a18..ef1db5e6 100644 --- a/veejay-current/veejay-server/libvje/effects/common.c +++ b/veejay-current/veejay-server/libvje/effects/common.c @@ -25,24 +25,30 @@ #include #include #include "common.h" - +#ifdef STRICT_CHECKING +#include +#endif char **vje_build_param_list( int num, ... ) { va_list args; char buf[1024]; char **list; char *tmp = NULL; - list = (char**) vj_malloc(sizeof(char*) * num ); + list = (char**) vj_malloc(sizeof(char*) * (num+1) ); va_start( args, num ); int i; for( i = 0; i #include #include -#include AVUTIL_INC +#include #include #include #include diff --git a/veejay-current/veejay-server/libvje/effects/diff.c b/veejay-current/veejay-server/libvje/effects/diff.c index f3c26bc2..d83eee6a 100644 --- a/veejay-current/veejay-server/libvje/effects/diff.c +++ b/veejay-current/veejay-server/libvje/effects/diff.c @@ -24,7 +24,7 @@ #include #include #include -#include AVUTIL_INC +#include #include #include #include "softblur.h" diff --git a/veejay-current/veejay-server/libvje/effects/dummy.c b/veejay-current/veejay-server/libvje/effects/dummy.c index be821cb7..b42291c7 100644 --- a/veejay-current/veejay-server/libvje/effects/dummy.c +++ b/veejay-current/veejay-server/libvje/effects/dummy.c @@ -1,7 +1,7 @@ /* * Linux VeeJay * - * Copyright(C)2002 Niels Elburg + * Copyright(C)2002-2010 Niels Elburg * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -57,7 +57,7 @@ void dummy_apply( VJFrame *frame, int width, int height, int color) colorY = bl_pix_get_color_y(color); colorCb = bl_pix_get_color_cb(color); colorCr = bl_pix_get_color_cr(color); - + veejay_memset( Y, colorY, len); veejay_memset( Cb,colorCb,uv_len); veejay_memset( Cr,colorCr,uv_len); @@ -73,11 +73,10 @@ void dummy_rgb_apply( VJFrame *frame, int width, int height, int r,int g, int b) uint8_t *Cb = frame->data[1]; uint8_t *Cr = frame->data[2]; - _rgb2yuv(r,g,b,colorY,colorCb,colorCr); veejay_memset( Y, colorY, len); - veejay_memset( Cb,colorCb,uv_len); + veejay_memset( Cb,colorCb,uv_len); veejay_memset( Cr,colorCr,uv_len); } void dummy_free(){} diff --git a/veejay-current/veejay-server/libvje/effects/iris.c b/veejay-current/veejay-server/libvje/effects/iris.c new file mode 100644 index 00000000..897fb7c4 --- /dev/null +++ b/veejay-current/veejay-server/libvje/effects/iris.c @@ -0,0 +1,111 @@ +/* + * Linux VeeJay + * + * Cvalyright(C) 2009 Niels Elburg + * + * 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 2 + * of the License , or (at your valtion) any later version. + * + * This program is distributed in the hvale 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 cvaly of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA. + */ + +/* "weed"-plugin partially ported from LiVES (C) G. Finch (Salsaman) 2009 + * + * weed-plugins/multi_transitions.c?revision=286 + * + */ +#include +#include +#include +#include "iris.h" +#include "common.h" + +vj_effect *iris_init(int w, int h) +{ + vj_effect *ve = (vj_effect *) vj_calloc(sizeof(vj_effect)); + ve->num_params = 2; + + ve->defaults = (int *) vj_calloc(sizeof(int) * ve->num_params); /* default values */ + ve->limits[0] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* min */ + ve->limits[1] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* max */ + ve->limits[0][0] = 0; + ve->limits[1][0] = 100; + ve->limits[0][1] = 0; + ve->limits[1][1] = 1; + ve->defaults[0] = 1; + ve->defaults[1] = 0; + ve->description = "Iris Transition (Circle,Rect)"; + ve->sub_format = 1; //@todo: write this for native + ve->extra_frame = 1; + ve->has_user = 0; + ve->param_description = vje_build_param_list( ve->num_params, "Value", "Shape" ); + return ve; +} + + +void iris_apply( VJFrame *frame, VJFrame *frame2, int width, int height, int val, int shape) +{ + int i,j,k=0; + int len = (width * height); + int uv_len = frame->uv_len; + + uint8_t *Y0 = frame->data[0]; + uint8_t *Cb0 = frame->data[1]; + uint8_t *Cr0 = frame->data[2]; + + uint8_t *Y1 = frame2->data[0]; + uint8_t *Cb1 = frame2->data[1]; + uint8_t *Cr1 = frame2->data[2]; + + int half_wid = width >> 1; + int half_hei = height >> 1; + + float val0 = (val * 0.01f ); + float val1 = 1.0f - val0; + if( shape == 0 ) { + float x1,y1; + double rad = (double) ( (half_hei * half_hei) + (half_wid * half_wid ) ); + double sval=0; + + for( i = 0; i < len; i += width ) { + for( j = 0; j < width; j ++ ) { + //@ todo: extend this with feather for smoothness + x1 = (float)( k - half_hei ); + y1 = (float)( j - half_wid ); + fast_sqrt( sval, (x1*x1+y1*y1)/rad); + if( sval > val0 ) { + // if( sqrt( (x1 * x1 + y1 * y1 )/ rad) > val0 ) { + Y0[ i + j] = Y1[ i + j ]; + Cb0[i + j] = Cb1[ i + j ]; + Cr0[i + j] = Cr1[ i + j ]; + } + } + k ++; + } + } else if( shape == 1 ) { + float x1,y1; + for( i = 0; i < len; i += width ) { + for( j = 0; j < width; j ++ ){ + //@ todo: extend this with feather for smoothness + x1 = (float)half_wid * val1 + 0.5f; + y1 = (float)half_hei * val1 + 0.5f; + + if( j < x1 || j>=(width-x1) || k < y1 || k >= ( height-y1 )) { + Y0[ i + j] = Y1[ i + j ]; + Cb0[i + j] = Cb1[ i + j ]; + Cr0[i + j] = Cr1[ i + j ]; + } + } + k++; + } + } +} diff --git a/veejay-current/veejay-server/libvje/effects/iris.h b/veejay-current/veejay-server/libvje/effects/iris.h new file mode 100644 index 00000000..95375307 --- /dev/null +++ b/veejay-current/veejay-server/libvje/effects/iris.h @@ -0,0 +1,30 @@ +/* + * Linux VeeJay + * + * Copyright(C)2009 Niels Elburg + * + * 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 2 + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA. + */ + +#ifndef IRIS_H +#define IRIS_H +#include +#include +#include + +vj_effect *iris_init(); +void iris_apply( VJFrame *frame, VJFrame *frame2, int width, int height, int value, int shape); +void iris_free(); +#endif diff --git a/veejay-current/veejay-server/libvje/effects/negation.c b/veejay-current/veejay-server/libvje/effects/negation.c index 0aa7d831..79409439 100644 --- a/veejay-current/veejay-server/libvje/effects/negation.c +++ b/veejay-current/veejay-server/libvje/effects/negation.c @@ -21,7 +21,7 @@ #include #include #include "negation.h" - +#include vj_effect *negation_init(int w, int h) { vj_effect *ve = (vj_effect *) vj_calloc(sizeof(vj_effect)); @@ -32,7 +32,7 @@ vj_effect *negation_init(int w, int h) ve->limits[1] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* max */ ve->limits[0][0] = 0; ve->limits[1][0] = 255; - ve->defaults[0] = 255; + ve->defaults[0] = 3;// 255; ve->description = "Negation"; ve->sub_format = 0; ve->extra_frame = 0; @@ -89,6 +89,21 @@ void negation_apply( VJFrame *frame, int width, int height, int val) uint8_t *Cb = frame->data[1]; uint8_t *Cr = frame->data[2]; + + + uint8_t *buffer = (uint8_t*) vj_malloc(sizeof(uint8_t)*width*height*3); + veejay_memset( buffer,0, width*height*3); + ctmf( Y, buffer, width,height,width,width,val,1,1024*1024*8); + // ctmf( Cb,buffer + (width*height), width,height,1,1,val,1,512*1024); + // ctmf( Cr,buffer + (width*height*2),width,height,1,1,val,1,512*1024); + + veejay_memcpy( Y, buffer, width*height); + // veejay_memcpy( Cb,buffer + (width*height), width*height); + // veejay_memcpy( Cr,buffer + (width*height*2), width*height); +veejay_memset( Cb, 128, uv_len ); +veejay_memset( Cr, 128, uv_len ); + free(buffer); +/* #ifndef HAVE_ASM_MMX for (i = 0; i < len; i++) { *(Y) = val - *(Y); @@ -147,4 +162,5 @@ void negation_apply( VJFrame *frame, int width, int height, int val) __asm__ __volatile__ ( _EMMS:::"memory"); #endif +*/ } diff --git a/veejay-current/veejay-server/libvje/effects/radioactive.c b/veejay-current/veejay-server/libvje/effects/radioactive.c index d5c43245..7dd8ec21 100644 --- a/veejay-current/veejay-server/libvje/effects/radioactive.c +++ b/veejay-current/veejay-server/libvje/effects/radioactive.c @@ -32,8 +32,8 @@ #include #include "radioactive.h" #include "softblur.h" +#include #include -#include AVUTIL_INC #include "common.h" #include diff --git a/veejay-current/veejay-server/libvje/effects/rgbchannel.c b/veejay-current/veejay-server/libvje/effects/rgbchannel.c index f2a21e36..401f51d4 100644 --- a/veejay-current/veejay-server/libvje/effects/rgbchannel.c +++ b/veejay-current/veejay-server/libvje/effects/rgbchannel.c @@ -22,7 +22,7 @@ #include #include #include -#include AVUTIL_INC +#include #include "rgbchannel.h" vj_effect *rgbchannel_init(int w, int h) diff --git a/veejay-current/veejay-server/libvje/effects/texmap.c b/veejay-current/veejay-server/libvje/effects/texmap.c index ff54ebc7..23b107f0 100644 --- a/veejay-current/veejay-server/libvje/effects/texmap.c +++ b/veejay-current/veejay-server/libvje/effects/texmap.c @@ -24,7 +24,7 @@ #include #include #include -#include AVUTIL_INC +#include #include #include #include diff --git a/veejay-current/veejay-server/libvje/internal.h b/veejay-current/veejay-server/libvje/internal.h index e43fb931..c3cb5be2 100644 --- a/veejay-current/veejay-server/libvje/internal.h +++ b/veejay-current/veejay-server/libvje/internal.h @@ -119,6 +119,7 @@ enum { VJ_VIDEO_EFFECT_TEXMAP = 244, VJ_VIDEO_EFFECT_RIPPLETV = 245, VJ_VIDEO_EFFECT_SLICER = 246, + VJ_VIDEO_EFFECT_IRIS = 247, }; enum { @@ -212,14 +213,15 @@ enum { VJ_IMAGE_EFFECT_BALTANTV = 187, VJ_IMAGE_EFFECT_CONTOUR = 188, VJ_IMAGE_EFFECT_LENSCORRECTION = 189, + VJ_IMAGE_EFFECT_CALI = 190, VJ_IMAGE_EFFECT_DUMMY=100, }; #define VJ_IMAGE_EFFECT_MIN 100 -#define VJ_IMAGE_EFFECT_MAX 190 +#define VJ_IMAGE_EFFECT_MAX 191 #define VJ_VIDEO_EFFECT_MIN 200 -#define VJ_VIDEO_EFFECT_MAX 247 +#define VJ_VIDEO_EFFECT_MAX 248 #define VJ_VIDEO_COUNT (VJ_VIDEO_EFFECT_MAX - VJ_VIDEO_EFFECT_MIN) @@ -597,4 +599,10 @@ extern void nervous_apply(VJFrame *Frame, int width, int height,int delay); extern void colflash_apply( VJFrame *frame, int width, int height, int f,int r, int g, int b, int d); +extern void iris_apply( VJFrame *frame,VJFrame *frame2, int width, int height, int value, int shape ); + +extern void cali_apply(void *d , VJFrame *frame, + int width, int height, + int mode, int full); + #endif diff --git a/veejay-current/veejay-server/libvje/plugload.c b/veejay-current/veejay-server/libvje/plugload.c index 514792e8..c811ceed 100644 --- a/veejay-current/veejay-server/libvje/plugload.c +++ b/veejay-current/veejay-server/libvje/plugload.c @@ -40,8 +40,8 @@ #include #include #include -#include AVCODEC_INC -#include AVUTIL_INC +#include +#include #include #include #include diff --git a/veejay-current/veejay-server/libvje/vj-effect.c b/veejay-current/veejay-server/libvje/vj-effect.c index e5028a7e..c5a0a755 100644 --- a/veejay-current/veejay-server/libvje/vj-effect.c +++ b/veejay-current/veejay-server/libvje/vj-effect.c @@ -83,6 +83,7 @@ #include "effects/colorshift.h" #include "effects/opacitythreshold.h" #include "effects/opacityadv.h" +#include "effects/iris.h" #include "effects/rgbkeysmooth.h" #include "effects/magicscratcher.h" #include "effects/chromascratcher.h" @@ -163,12 +164,20 @@ #include "effects/diffmap.h" #include "plugload.h" #include "effects/picinpic.h" +#include "effects/cali.h" int pixel_Y_hi_ = 235; int pixel_U_hi_ = 240; int pixel_Y_lo_ = 16; int pixel_U_lo_ = 16; +int get_pixel_range_min_Y() { + return pixel_Y_lo_; +} +int get_pixel_range_min_UV() { + return pixel_U_lo_; +} + void set_pixel_range(uint8_t Yhi,uint8_t Uhi, uint8_t Ylo, uint8_t Ulo) { pixel_Y_hi_ = Yhi; @@ -189,7 +198,6 @@ static struct { dices_malloc , dices_free ,VJ_IMAGE_EFFECT_DICES }, { colorhis_malloc, colorhis_free, VJ_IMAGE_EFFECT_COLORHIS }, { autoeq_malloc, autoeq_free ,VJ_IMAGE_EFFECT_AUTOEQ }, -//{ diff_malloc , diff_free ,VJ_VIDEO_EFFECT_DIFF }, { magicscratcher_malloc , magicscratcher_free ,VJ_IMAGE_EFFECT_MAGICSCRATCHER }, { lumamask_malloc , lumamask_free ,VJ_VIDEO_EFFECT_LUMAMASK }, { motionblur_malloc , motionblur_free ,VJ_IMAGE_EFFECT_MOTIONBLUR }, @@ -256,6 +264,7 @@ static struct { diff_malloc, diff_free, VJ_VIDEO_EFFECT_DIFF }, { texmap_malloc, texmap_free, VJ_VIDEO_EFFECT_TEXMAP }, { contourextract_malloc, contourextract_free, VJ_IMAGE_EFFECT_CONTOUR }, + { cali_malloc, cali_free, VJ_IMAGE_EFFECT_CALI }, { picinpic_malloc, picinpic_free, VJ_VIDEO_EFFECT_PICINPIC }, { water_malloc, water_free, VJ_VIDEO_EFFECT_RIPPLETV }, { NULL, NULL, 0 }, @@ -384,6 +393,11 @@ int vj_effect_activate(int effect_id) return 1; } +void *vj_effect_get_data( int seq_id ) { + + return vj_effects[seq_id]->user_data; +} + int vj_effect_deactivate(int effect_id) { int seq = vj_effect_real_to_sequence(effect_id); @@ -507,7 +521,8 @@ void vj_effect_initialize(int width, int height, int full_range) vj_effects[44] = texmap_init( width,height); vj_effects[45] = water_init(width,height); vj_effects[46] = slicer_init(width,height); - vj_effects[47] = dummy_init(width,height); + vj_effects[47] = iris_init(width,height); + vj_effects[48] = dummy_init(width,height); vj_effects[i + 1] = mirrors2_init(width,height); vj_effects[i + 2] = mirrors_init(width,height); vj_effects[i + 3] = widthmirror_init(width,height); @@ -597,6 +612,7 @@ void vj_effect_initialize(int width, int height, int full_range) vj_effects[i + 88] = contourextract_init(width,height); vj_effects[i + 49] = waterrippletv_init(width,height); vj_effects[i + 89 ]= radcor_init(width,height); + vj_effects[i + 90 ]= cali_init(width,height); max_width = width; max_height = height; @@ -625,7 +641,14 @@ void vj_effect_free(vj_effect *ve) { if(ve->limits[0]) free(ve->limits[0]); if(ve->limits[1]) free(ve->limits[1]); if(ve->defaults) free(ve->defaults); - // if(ve->vjed) free(ve->vjed); + int i = 0; + if( ve->param_description != NULL ) { + for( i = 0; ve->param_description[i] != NULL; i ++ ) + free(ve->param_description[i]); + + free(ve->param_description); + } + // if(ve->vjed) free(ve->vjed); free(ve); } @@ -647,7 +670,7 @@ void vj_effect_shutdown() { contourextract_destroy(); rotozoom_destroy(); distortion_destroy(); - + cali_destroy(); } void vj_effect_dump() { diff --git a/veejay-current/veejay-server/libvje/vj-effman.c b/veejay-current/veejay-server/libvje/vj-effman.c index 905c6f9b..eb36f34d 100644 --- a/veejay-current/veejay-server/libvje/vj-effman.c +++ b/veejay-current/veejay-server/libvje/vj-effman.c @@ -105,6 +105,9 @@ void vj_effman_apply_image_effect( noisepencil_apply(frames[0],frameinfo->width,frameinfo->height, arg[0],arg[1],arg[2],arg[3]); break; + case VJ_IMAGE_EFFECT_CALI: + cali_apply( vj_effects[entry]->user_data,frames[0], frameinfo->width,frameinfo->height,arg[0], arg[1] ); + break; case VJ_IMAGE_EFFECT_DIFF: diffimg_apply(frames[0], frameinfo->width, frameinfo->height, arg[0], arg[1], @@ -435,6 +438,9 @@ void vj_effman_apply_video_effect( VJFrame **frames, VJFrameInfo *frameinfo ,vjp opacity_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, arg[0]); break; + case VJ_VIDEO_EFFECT_IRIS: + iris_apply( frames[0],frames[1], frameinfo->width,frameinfo->height,arg[0],arg[1]); + break; case VJ_VIDEO_EFFECT_THRESHOLDSMOOTH: opacitythreshold_apply(frames[0], frames[1], frameinfo->width, frameinfo->height, arg[0], arg[1],arg[2]); diff --git a/veejay-current/veejay-server/libvje/vje.h b/veejay-current/veejay-server/libvje/vje.h index 7c85095d..52af3abe 100644 --- a/veejay-current/veejay-server/libvje/vje.h +++ b/veejay-current/veejay-server/libvje/vje.h @@ -22,7 +22,7 @@ #define FX_LIMIT 1024 -#define MAX_EFFECTS 137 +#define MAX_EFFECTS 139 #define PARAM_WIDTH (1<<0x2) #define PARAM_HEIGHT (1<<0x3) #define PARAM_FADER (1<<0x1) @@ -90,6 +90,8 @@ typedef struct vj_effect_t { char padding[4]; } vj_effect; +extern int get_pixel_range_min_Y(); +extern int get_pixel_range_min_UV(); extern void vj_effect_initialize(int width, int height, int range); extern void vj_effect_shutdown(); extern int vj_effect_max_effects(); @@ -121,5 +123,6 @@ extern int vj_effect_apply( VJFrame **frames, VJFrameInfo *frameinfo, vjp_kf *kf extern int vj_effect_prepare( VJFrame *frame, int selector); extern void vj_effect_dump(void); extern int rgb_parameter_conversion_type_; +extern void *vj_effect_get_data( int seq_id ); #endif diff --git a/veejay-current/veejay-server/libvjmsg/Makefile.am b/veejay-current/veejay-server/libvjmsg/Makefile.am index 6d3f6e1b..28290b74 100644 --- a/veejay-current/veejay-server/libvjmsg/Makefile.am +++ b/veejay-current/veejay-server/libvjmsg/Makefile.am @@ -3,6 +3,6 @@ INCLUDES = -I$(top_srcdir) -I$(includedir) AM_CLFAGS=$(OP_CFLAGS) VJMSG_LIB_FILE = libvjmsg.la noinst_LTLIBRARIES = $(VJMSG_LIB_FILE) -pkginclude_HEADERS = vj-msg.h +pkginclude_HEADERS= vj-msg.h libvjmsg_la_SOURCES = vj-common.c diff --git a/veejay-current/veejay-server/libvjnet/Makefile.am b/veejay-current/veejay-server/libvjnet/Makefile.am index 432bb01a..9357a65b 100644 --- a/veejay-current/veejay-server/libvjnet/Makefile.am +++ b/veejay-current/veejay-server/libvjnet/Makefile.am @@ -4,6 +4,7 @@ MAINTAINERCLEANFILES = Makefile.in AM_CFLAGS=$(OP_CFLAGS) INCLUDES = -I$(top_srcdir) -I$(includedir) -I$(top_srcdir)/libyuv -I$(top_srcdir)/liblzo -I$(top_srcdir)/vjmem -I$(top_srcdir)/vjmsg VJNET_LIB_FILE = libvjnet.la -pkginclude_HEADERS = vj-client.h bswap.h cmd.h mcastreceiver.h mcastsender.h packet.h vj-server.h +EXTRA_DIST= vj-client.h bswap.h cmd.h mcastreceiver.h mcastsender.h packet.h vj-server.h +pkginclude_HEADERS=vj-client.h noinst_LTLIBRARIES = $(VJNET_LIB_FILE) libvjnet_la_SOURCES = packet.c mcastsender.c mcastreceiver.c cmd.c vj-server.c vj-client.c diff --git a/veejay-current/veejay-server/libvjnet/cmd.c b/veejay-current/veejay-server/libvjnet/cmd.c index 9206af43..c656bd1c 100644 --- a/veejay-current/veejay-server/libvjnet/cmd.c +++ b/veejay-current/veejay-server/libvjnet/cmd.c @@ -63,8 +63,8 @@ int sock_t_connect_and_send_http( vj_sock_t *s, char *host, int port, char *bu } struct sockaddr_in sinfo; - socklen_t sinfolen; - char *server_name[1024]; + socklen_t sinfolen=0; + char server_name[1024]; if( getsockname(s->sock_fd,(struct sockaddr*) &sinfo,&sinfolen)==0) { char *tmp = inet_ntoa( sinfo.sin_addr ); strncpy( server_name, tmp, 1024); @@ -247,6 +247,9 @@ int sock_t_send( vj_sock_t *s, unsigned char *buf, int len ) veejay_msg(0, "\t[%s], %d bytes", buf,len ); return 0; } +#ifdef NET_DEBUG + printf("%d %06d [%s]\n",s->sock_fd,len,buf ); +#endif return n; } else @@ -261,6 +264,10 @@ int sock_t_send( vj_sock_t *s, unsigned char *buf, int len ) veejay_msg(VEEJAY_MSG_ERROR, "TCP send error: %s", strerror(errno)); return 0; } +#ifdef NET_DEBUG + printf("%d %06d [%s]\n",s->sock_fd,n,buf + done ); +#endif + done += n; } return done; @@ -284,6 +291,10 @@ int sock_t_send_fd( int fd, int send_size, unsigned char *buf, int len ) veejay_msg(0, "Send error: %s",strerror(errno)); return 0; } +#ifdef NET_DEBUG + printf("%d %06d [%s]\n",fd,n,buf ); +#endif + return n; } else @@ -298,6 +309,10 @@ int sock_t_send_fd( int fd, int send_size, unsigned char *buf, int len ) veejay_msg(VEEJAY_MSG_ERROR, "TCP send error: %s", strerror(errno)); return 0; } +#ifdef NET_DEBUG + printf("%d %06d [%s]\n",fd,n,buf + done ); +#endif + bytes_left -= n; done += n; } diff --git a/veejay-current/veejay-server/libyuv/Makefile.am b/veejay-current/veejay-server/libyuv/Makefile.am index f60458e9..f50ad70a 100644 --- a/veejay-current/veejay-server/libyuv/Makefile.am +++ b/veejay-current/veejay-server/libyuv/Makefile.am @@ -4,6 +4,7 @@ MAINTAINERCLEANFILES = Makefile.in AM_CFLAGS=$(YUVCFLAGS) INCLUDES = -I$(top_srcdir) -I$(includedir) -I$(top_srcdir)/aclib -I$(top_srcdir)/vjmem -I$(top_srcdir)/vjmsg -I$(top_srcdir)/libpostproc YUV_LIB_FILE = libyuv.la -pkginclude_HEADERS = mmx.h yuvconv.h +pkginclude_HEADERS=yuvconv.h +EXTRA_DIST = mmx.h yuvconv.h mmx_macros.h noinst_LTLIBRARIES = $(YUV_LIB_FILE) libyuv_la_SOURCES = subsample.c yuvconv.c diff --git a/veejay-current/veejay-server/libyuv/yuvconv.c b/veejay-current/veejay-server/libyuv/yuvconv.c index 3dca9e25..ed50eb22 100644 --- a/veejay-current/veejay-server/libyuv/yuvconv.c +++ b/veejay-current/veejay-server/libyuv/yuvconv.c @@ -22,13 +22,13 @@ #include #include #include -#include SWSCALE_INC #include #include #include #include -#include AVUTIL_INC -#include AVCODEC_INC +#include +#include +#include /* this routine is the same as frame_YUV422_to_YUV420P , unpack * libdv's 4:2:2-packed into 4:2:0 planar * See http://mjpeg.sourceforge.net/ (MJPEG Tools) (lav-common.c) @@ -262,7 +262,7 @@ void yuv_init_lib(int extra_flags, int auto_ccir_jpeg, int default_zoomer) put( PIX_FMT_YUV444P, IMG_YUV444P ); put( PIX_FMT_YUVJ420P, IMG_YUV420P ); //@wrong, but size fits put( PIX_FMT_YUVJ422P, IMG_YUV422P ); - put( PIX_FMT_YUVJ422P, IMG_YUV444P ); + put( PIX_FMT_YUVJ422P, IMG_YUV422P ); // put( PIX_FMT_RGB24, IMG_RGB24 ); // put( PIX_FMT_BGR24, IMG_BGR24 ); put( PIX_FMT_RGB24, IMG_BGR24 ); @@ -293,7 +293,8 @@ VJFrame *yuv_yuv_template( uint8_t *Y, uint8_t *U, uint8_t *V, int w, int h, int f->uv_width = w>>1; f->uv_height= f->height; f->stride[0] = w; - f->stride[1] = f->stride[2] = f->stride[0]>>1; + f->stride[1] = w>>1; + f->stride[2] = w>>1; break; case PIX_FMT_YUV420P: case PIX_FMT_YUVJ420P: diff --git a/veejay-current/veejay-server/man/Makefile.am b/veejay-current/veejay-server/man/Makefile.am index 015e8d31..78c6e812 100644 --- a/veejay-current/veejay-server/man/Makefile.am +++ b/veejay-current/veejay-server/man/Makefile.am @@ -1,3 +1,3 @@ man_MANS = veejay.1 -EXTRA_DIST = $(man_MANS) +EXTRA_DIST = veejay.1 MAINTAINERCLEANFILES = Makefile.in diff --git a/veejay-current/veejay-server/man/veejay.1 b/veejay-current/veejay-server/man/veejay.1 index 60f06582..a5b82964 100644 --- a/veejay-current/veejay-server/man/veejay.1 +++ b/veejay-current/veejay-server/man/veejay.1 @@ -219,6 +219,12 @@ Specifiy a geometry for veejay to position the video window. Use this feature to .B VEEJAY_SCREEN_SIZE Specifiy the size of the video window. .TP +.B VEEJAY_DEFAULT_CHANNEL +Specify the default video4linux channel id +.TP +.B VEEJAY_SWAP_RGB +Capture in RGB or BGR (Video4Linux) +.TP .B Examples .TP .B VEEJAY_SCREEN_GEOMETRY=2624x1024+1600x0 diff --git a/veejay-current/veejay-server/mjpegtools/Makefile.am b/veejay-current/veejay-server/mjpegtools/Makefile.am index a5cbb9f2..2dd5796c 100644 --- a/veejay-current/veejay-server/mjpegtools/Makefile.am +++ b/veejay-current/veejay-server/mjpegtools/Makefile.am @@ -1,4 +1,4 @@ -pkginclude_HEADERS = fastintfns.h mjpeg_logging.h mpegconsts.h videodev_mjpeg.h yuv4mpeg_intern.h format_codes.h \ +EXTRA_DIST= fastintfns.h mjpeg_logging.h mpegconsts.h videodev_mjpeg.h yuv4mpeg_intern.h format_codes.h \ mjpeg_types.h mpegtimecode.h yuv4mpeg.h MAINTAINERCLEANFILES = Makefile.in AM_CFLAGS=$(OP_CFLAGS) diff --git a/veejay-current/veejay-server/veejay/Makefile.am b/veejay-current/veejay-server/veejay/Makefile.am index b36fe58c..6bf5b3ea 100644 --- a/veejay-current/veejay-server/veejay/Makefile.am +++ b/veejay-current/veejay-server/veejay/Makefile.am @@ -18,11 +18,12 @@ INCLUDES = -I$(top_srcdir) -I$(includedir) \ -I$(top_srcdir)/libvevo \ -I$(top_srcdir)/liblzo \ -I$(top_srcdir)/bio2jack \ - $(FFMPEG_AVCODEC_CFLAGS) $(FFMPEG_AVFORMAT_CFLAGS) $(LIBQUICKTIME_CFLAGS) $(FT_CFLAGS) \ + $(FFMPEG_CFLAGS) $(LIBQUICKTIME_CFLAGS) $(FT_CFLAGS) \ $(AVIPLAY_CFLAGS) $(XML2_CFLAGS) $(GTK_CFLAGS) $(DV_FLAGS) $(X_CFLAGS) \ $(DIRECTFB_CFLAGS) $(SDL_CFLAGS) $(JPEG_CFLAGS) $(JACK_CFLAGS) $(PTHREAD_CFLAGS) $(SAMPLERATE_CFLAGS) -pkginclude_HEADERS = vims.h +pkginclude_HEADERS = vims.h + VEEJAY_LIB_FILE = libveejay.la lib_LTLIBRARIES = $(VEEJAY_LIB_FILE) @@ -55,7 +56,7 @@ libveejay_la_LIBADD = -L$(top_builddir)/mjpegtools/ -lmjpegutils \ libveejay_la_LDFLAGS += $(SDL_LIBS) $(DIRECTFB_LIBS) $(X_LIBS) $(PTHREAD_LIBS) $(FT_LDFLAGS) $(FT_LIBS) \ $(XML2_LIBS) $(JPEG_LIBS) $(UNICAP_LIBS) \ - $(FFMPEG_AVFORMAT_LIBS) $(FFMPEG_AVCODEC_LIBS) $(FFMPEG_SWSCALER_LIBS) $(XINERAMA_LIBS) \ + $(FFMPEG_LIBS) $(XINERAMA_LIBS) \ $(LIBDV_LIBS) $(LIBM_LIBS) $(PIXBUF_LIBS) $(JACK_LIBS) $(LIBQUICKTIME_LIBS) $(SAMPLERATE_LIBS) \ -DDYNAMIC -O3 -Wall -rdynamic diff --git a/veejay-current/veejay-server/veejay/liblavplayvj.c b/veejay-current/veejay-server/veejay/liblavplayvj.c index cb8f0c8d..30597624 100644 --- a/veejay-current/veejay-server/veejay/liblavplayvj.c +++ b/veejay-current/veejay-server/veejay/liblavplayvj.c @@ -752,11 +752,17 @@ static int veejay_start_playing_sample( veejay_t *info, int sample_id ) info->uc->render_changed = 1; /* different render list */ sample_reset_offset( sample_id ); /* reset mixing offsets */ - veejay_set_frame(info, start); - veejay_set_speed(info, speed); - veejay_msg(VEEJAY_MSG_INFO, "Playing sample %d (FX=%x, Sl=%d, Speed=%d, Start=%d, Loop=%d)", + + + if( info->settings->sample_restart ) { + veejay_set_frame(info, start); + veejay_set_speed(info, speed); + veejay_msg(VEEJAY_MSG_INFO, "Playing sample %d (FX=%x, Sl=%d, Speed=%d, Start=%d, Loop=%d)", sample_id, tmp,info->sfd, speed, start, looptype ); - + } else { + veejay_msg(VEEJAY_MSG_INFO, "Playing sample %d (FX=%x, Sl=%d, Speed=%d, Start=%d, Loop=%d, Continue=%ld)", + sample_id,tmp,info->sfd,speed,start,looptype,info->settings->current_frame_num ); + } return 1; } @@ -947,6 +953,7 @@ void veejay_set_sample(veejay_t * info, int sampleid) int veejay_create_tag(veejay_t * info, int type, char *filename, int index, int palette, int channel) { + if( type == VJ_TAG_TYPE_NET || type == VJ_TAG_TYPE_MCAST ) { if( (filename != NULL) && ((strcasecmp( filename, "localhost" ) == 0) || (strcmp( filename, "127.0.0.1" ) == 0)) ) { if( channel == info->uc->port ) { @@ -1042,32 +1049,6 @@ static int veejay_screen_update(veejay_t * info ) } - -#ifdef HAVE_JPEG -#ifdef USE_GDK_PIXBUF - /* dirty hack to save a frame to image */ - if (info->uc->hackme == 1) - { - info->uc->hackme = 0; - -#ifdef USE_GDK_PIXBUF - if(!vj_picture_save( info->settings->export_image, frame, - info->video_output_width, info->video_output_height, - get_ffmpeg_pixfmt( info->current_edit_list->pixel_format )) ) - { - veejay_msg(VEEJAY_MSG_ERROR, - "Unable to write frame %ld to image as '%s'", - info->settings->current_frame_num, info->settings->export_image ); - } -#else -#ifdef HAVE_JPEG - vj_perform_screenshot2(info, frame); - if(info->uc->filename) free(info->uc->filename); -#endif -#endif - } -#endif -#endif #ifdef HAVE_V4L if( info->vloopback ) @@ -1088,7 +1069,30 @@ static int veejay_screen_update(veejay_t * info ) vj_perform_send_primary_frame_s2(info, 1, info->uc->current_link); } - + //@ FIXME: Both pixbuf and jpeg method is broken for screenshot +#ifdef HAVE_JPEG +#ifdef USE_GDK_PIXBUF + if (info->uc->hackme == 1) + { + info->uc->hackme = 0; +#ifdef USE_GDK_PIXBUF + if(!vj_picture_save( info->settings->export_image, frame, + info->video_output_width, info->video_output_height, + get_ffmpeg_pixfmt( info->pixel_format )) ) + { + veejay_msg(VEEJAY_MSG_ERROR, + "Unable to write frame %ld to image as '%s'", + info->settings->current_frame_num, info->settings->export_image ); + } +#else +#ifdef HAVE_JPEG + vj_perform_screenshot2(info, frame); + if(info->uc->filename) free(info->uc->filename); +#endif +#endif + } +#endif +#endif if(skip_update) { if(info->video_out == 0 ) { for(i = 0 ; i < MAX_SDL_OUT; i ++ ) @@ -1155,6 +1159,7 @@ static int veejay_screen_update(veejay_t * info ) return 0; break; } + return 1; } @@ -1240,6 +1245,10 @@ void veejay_pipe_write_status(veejay_t * info, int link_id) int mstatus = vj_event_macro_status(); + + int curfps = (int) ( 100.0f / settings->spvf ); + + switch (info->uc->playback_mode) { case VJ_PLAYBACK_MODE_SAMPLE: cache_used = sample_cache_used(0); @@ -1248,7 +1257,7 @@ void veejay_pipe_write_status(veejay_t * info, int link_id) RANDMODE_SAMPLE) pm = VJ_PLAYBACK_MODE_PATTERN; if( sample_chain_sprint_status - (info->uc->sample_id,cache_used,info->seq->active,info->seq->current,info->real_fps,settings->current_frame_num, pm, total_slots,info->seq->rec_id,mstatus,info->status_what ) != 0) + (info->uc->sample_id,cache_used,info->seq->active,info->seq->current,info->real_fps,settings->current_frame_num, pm, total_slots,info->seq->rec_id,curfps,settings->cycle_count[0],settings->cycle_count[1],mstatus,info->status_what ) != 0) { veejay_msg(VEEJAY_MSG_ERROR, "Fatal error, tried to collect properties of invalid sample"); #ifdef STRICT_CHECKING @@ -1259,7 +1268,7 @@ void veejay_pipe_write_status(veejay_t * info, int link_id) } break; case VJ_PLAYBACK_MODE_PLAIN: - veejay_sprintf(info->status_what,1024, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", + veejay_sprintf(info->status_what,1024, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %ld %d %d %d %d %d", info->real_fps, settings->current_frame_num, info->uc->playback_mode, @@ -1278,7 +1287,10 @@ void veejay_pipe_write_status(veejay_t * info, int link_id) 0, total_slots, cache_used, - 0, + curfps, + settings->cycle_count[0], + settings->cycle_count[1], + 0, 0, 0, 0, @@ -1286,7 +1298,7 @@ void veejay_pipe_write_status(veejay_t * info, int link_id) break; case VJ_PLAYBACK_MODE_TAG: if( vj_tag_sprint_status( info->uc->sample_id,cache_used,info->seq->active,info->seq->current, info->real_fps, - settings->current_frame_num, info->uc->playback_mode,total_slots,mstatus, info->status_what ) != 0 ) + settings->current_frame_num, info->uc->playback_mode,total_slots,curfps,settings->cycle_count[0],settings->cycle_count[1],mstatus, info->status_what ) != 0 ) { veejay_msg(VEEJAY_MSG_ERROR, "Invalid status!"); } @@ -1383,6 +1395,20 @@ static int veejay_create_homedir(char *path) } } free(theme_dir); + + char *font_dir = veejay_concat_paths( path, "fonts" ); + if( mkdir(font_dir,0700) == -1 ) { + if( errno != EEXIST ) + { + veejay_msg(0, "%s", strerror(errno)); + free(font_dir); + return 0; + } + } + free(font_dir); +// on dynebolic, we copy mplayer's font to veejay's homedir + system("cp /usr/share/mplayer/font/arial.ttf ~/.veejay/fonts"); + veejay_msg(VEEJAY_MSG_INFO, "veejay home is setup"); return 1; } @@ -1412,18 +1438,6 @@ void veejay_check_homedir(void *arg) return; } - char fontpath[1024]; - snprintf(fontpath,sizeof(fontpath),"%s/fonts", path); - if( veejay_create_homedir(fontpath) == 0 ) { - veejay_msg(VEEJAY_MSG_ERROR, - "Can't create %s", fontpath ); - return; - } else { - veejay_msg(VEEJAY_MSG_ERROR, "Put your favourite TrueType Font file in %s", fontpath); - veejay_msg(VEEJAY_MSG_ERROR, "and restart veejay."); - return; - } - } sprintf(tmp, "%s/plugins.cfg", path ); @@ -2240,7 +2254,11 @@ int veejay_init(veejay_t * info, int x, int y,char *arg, int def_tags) if(def_tags && id <= 0) { int n = vj_tag_num_devices(); - int nid = veejay_create_tag( info, VJ_TAG_TYPE_V4L, "bogus", info->nstreams, el->pixel_format, (def_tags-1) ); + int default_chan = 1; + char *chanid = getenv("VEEJAY_DEFAULT_CHANNEL"); + if(chanid != NULL ) + default_chan = atoi(chanid); + int nid = veejay_create_tag( info, VJ_TAG_TYPE_V4L, "bogus", info->nstreams, default_chan, (def_tags-1) ); if( nid> 0) { veejay_msg(VEEJAY_MSG_INFO, "Requested capture device available as stream %d", nid ); @@ -2838,6 +2856,7 @@ veejay_t *veejay_malloc() info->settings = (video_playback_setup *) vj_calloc(sizeof(video_playback_setup)); if (!(info->settings)) return NULL; + info->settings->sample_restart = 1; //@ default to on veejay_memset( &(info->settings->action_scheduler), 0, sizeof(vj_schedule_t)); veejay_memset( &(info->settings->viewport ), 0, sizeof(VJRectangle)); diff --git a/veejay-current/veejay-server/veejay/vims.h b/veejay-current/veejay-server/veejay/vims.h index ee4e788e..2a080961 100644 --- a/veejay-current/veejay-server/veejay/vims.h +++ b/veejay-current/veejay-server/veejay/vims.h @@ -39,6 +39,7 @@ enum { VIMS_RENDER_DEPTH = 48, VIMS_MACRO = 33, VIMS_MACRO_SELECT = 34, + VIMS_CONTINUOUS_PLAY = 35, VIMS_RECVIEWPORT = 90, VIMS_VIDEO_INFORMATION = 400, VIMS_EFFECT_LIST = 401, @@ -94,6 +95,7 @@ enum { VIMS_SCREENSHOT = 330, VIMS_NO_CACHING = 331, VIMS_RGB24_IMAGE = 333, + VIMS_CALI_IMAGE = 332, VIMS_SYNC_CORRECTION = 334, VIMS_FRAMERATE = 335, VIMS_VIDEO_PLAY_FORWARD = 10, @@ -164,6 +166,9 @@ enum { VIMS_STREAM_NEW_DV1394 = 241, VIMS_STREAM_NEW_COLOR = 242, VIMS_STREAM_NEW_Y4M = 243, + VIMS_STREAM_NEW_CALI = 244, + VIMS_V4L_BLACKFRAME = 248, + VIMS_V4L_CALI = 249, VIMS_STREAM_NEW_UNICAST = 245, VIMS_STREAM_NEW_MCAST = 246, VIMS_STREAM_NEW_PICTURE = 247, diff --git a/veejay-current/veejay-server/veejay/vj-composite.c b/veejay-current/veejay-server/veejay/vj-composite.c index 52905dc5..925a7b45 100644 --- a/veejay-current/veejay-server/veejay/vj-composite.c +++ b/veejay-current/veejay-server/veejay/vj-composite.c @@ -32,7 +32,7 @@ #include #include #include -#include AVUTIL_INC +#include #ifdef HAVE_XML2 #include diff --git a/veejay-current/veejay-server/veejay/vj-event.c b/veejay-current/veejay-server/veejay/vj-event.c index 571599d6..65176bec 100644 --- a/veejay-current/veejay-server/veejay/vj-event.c +++ b/veejay-current/veejay-server/veejay/vj-event.c @@ -2794,6 +2794,25 @@ void vj_event_suspend(void *ptr, const char format[], va_list ap) veejay_msg(VEEJAY_MSG_WARNING, "Suspending veejay"); } +void vj_event_play_norestart( void *ptr, const char format[], va_list ap ) +{ + int args[2]; + veejay_t *v = (veejay_t*) ptr; + char *s = NULL; + P_A(args,s,format,ap); + + //@ change mode so veejay does not restart samples at all + + if( args[0] == 0 ) { + //@ off + v->settings->sample_restart = 0; + } else if ( args[0] == 1 ) { + //@ on + v->settings->sample_restart = 1; + } + +} + void vj_event_set_play_mode_go(void *ptr, const char format[], va_list ap) { int args[2]; @@ -6211,7 +6230,13 @@ void vj_event_chain_entry_srccha(void *ptr, const char format[], va_list ap) { veejay_msg(VEEJAY_MSG_INFO, "Selected input channel (%s %d) to mix in", (source == VJ_TAG_TYPE_NONE ? "sample" : "stream") , channel_id); - // if(v->no_bezerk) veejay_set_sample(v,v->uc->sample_id); + if( source != VJ_TAG_TYPE_NONE ) { + int slot = sample_has_cali_fx( args[0]);//@sample + if( slot >= 0 ) { + sample_cali_prepare( args[0],slot,channel_id); + veejay_msg(VEEJAY_MSG_DEBUG, "Using calibration data of stream %d",channel_id); + } + } if(v->no_bezerk) veejay_set_frame(v,sample_get_startFrame(v->uc->sample_id)); } else @@ -6242,14 +6267,24 @@ void vj_event_chain_entry_srccha(void *ptr, const char format[], va_list ap) if( source != VJ_TAG_TYPE_NONE && vj_tag_exists(channel_id)) err = 0; - + //@ if there is CALI in FX chain, + //@ call cali_prepare and pass channel id + + if( err == 0 && vj_tag_set_chain_source(args[0],args[1],source)!=-1 && vj_tag_set_chain_channel(args[0],args[1],channel_id) != -1) { veejay_msg(VEEJAY_MSG_INFO, "Selected input channel (%s %d) to mix in", (source == VJ_TAG_TYPE_NONE ? "sample" : "stream") , channel_id); - // if(v->no_bezerk) veejay_set_sample(v,v->uc->sample_id); + + if( source != VJ_TAG_TYPE_NONE ) { + int slot = vj_tag_has_cali_fx( args[0]); + if( slot >= 0 ) { + vj_tag_cali_prepare( args[0],slot, channel_id); + } + + } } else { @@ -6768,6 +6803,82 @@ void vj_event_tag_new_dv1394(void *ptr, const char format[], va_list ap) } #endif +void vj_event_v4l_blackframe( void *ptr, const char format[] , va_list ap) +{ + veejay_t *v = (veejay_t*) ptr; + + char *str = NULL; + int args[3]; + + P_A(args,str,format,ap); + + int id = args[0]; + if( id == 0 ) { + if( STREAM_PLAYING(v) ) + id = v->uc->sample_id; + } + + if( id == 0 ) { + return; + } + + if( args[1] == 0 ) { + vj_tag_drop_blackframe(id); + } else { + vj_tag_grab_blackframe(id, args[1], args[2],args[3]); + } +} + +void vj_event_cali_write_file( void *ptr, const char format[], va_list ap) +{ + char str[1024]; + int args[2]; + veejay_t *v = (veejay_t*) ptr; + + P_A(args,str,format,ap); + + int id = args[0]; + if( id == 0 ) { + if(STREAM_PLAYING(v)) + id = v->uc->sample_id; + } + if( vj_tag_exists( id ) ){ + if(vj_tag_cali_write_file( id, str, v->current_edit_list )) { + veejay_msg(VEEJAY_MSG_INFO, "Saved calibration file to %s", str ); + } + } + else { + p_no_tag(id); + } +} + +void vj_event_stream_new_cali( void *ptr, const char format[], va_list ap) +{ + char str[1024]; + int args[2]; + veejay_t *v = (veejay_t*) ptr; + + P_A(args,str,format,ap); + + + int id = veejay_create_tag( + v, VJ_TAG_TYPE_CALI, + str, + v->nstreams, + 0,0); + if(id > 0 ) + v->nstreams++; + + vj_event_send_new_id( v, id ); + + if( id <= 0 ) + veejay_msg(VEEJAY_MSG_ERROR, "Unable to create load calibration file '%s'",str); + else + veejay_msg(VEEJAY_MSG_INFO, "Loaded calibration file to Stream %d",id ); + + +} + void vj_event_tag_new_v4l(void *ptr, const char format[], va_list ap) { veejay_t *v = (veejay_t*) ptr; @@ -7011,9 +7122,8 @@ void vj_event_vp_get_points( void *ptr, const char format[], va_list ap ) FORMAT_MSG(msg,message); SEND_MSG(v,msg); - - free(r); } + void vj_event_vp_set_points( void *ptr, const char format[], va_list ap ) { int args[4]; @@ -7061,6 +7171,8 @@ void vj_event_v4l_get_info(void *ptr, const char format[] , va_list ap) veejay_memset(send_msg, 0,sizeof(send_msg)); veejay_memset(message, 0,sizeof(message)); + sprintf( send_msg, "000" ); + if(vj_tag_exists(args[0])) { int values[6]; @@ -7069,9 +7181,10 @@ void vj_event_v4l_get_info(void *ptr, const char format[] , va_list ap) { sprintf(message, "%05d%05d%05d%05d%05d%05d", values[0],values[1],values[2],values[3],values[4],values[5] ); + FORMAT_MSG(send_msg, message); } } - FORMAT_MSG(send_msg, message); + SEND_MSG( v,send_msg ); } @@ -7172,7 +7285,7 @@ void vj_event_viewport_frontback(void *ptr, const char format[], va_list ap) if(STREAM_PLAYING(v)) { void *cur = vj_tag_get_composite_view(v->uc->sample_id); if(cur == NULL ) { - cur = composite_clone(v->composite); + cur = (void*)composite_clone(v->composite); vj_tag_set_composite_view(v->uc->sample_id,cur); } vj_tag_reload_config(v->composite,v->uc->sample_id,v->settings->composite ); @@ -8245,7 +8358,6 @@ void vj_event_send_sample_info ( void *ptr, const char format[], va_list ap ) SEND_MSG(v , _s_print_buf ); } -#ifdef USE_GDK_PIXBUF void vj_event_get_scaled_image ( void *ptr, const char format[], va_list ap ) { veejay_t *v = (veejay_t*)ptr; @@ -8320,7 +8432,45 @@ void vj_event_get_scaled_image ( void *ptr, const char format[], va_list ap ) SEND_DATA(v, header, 7 ); SEND_DATA(v, vj_perform_get_preview_buffer(), input_len ); } -#endif + +void vj_event_get_cali_image ( void *ptr, const char format[], va_list ap ) +{ + veejay_t *v = (veejay_t*)ptr; + int args[2]; + char *str = NULL; + P_A(args,str,format,ap); + + int id = args[0]; + int type = args[1]; + + if( !vj_tag_exists(id) || vj_tag_get_type(id) != VJ_TAG_TYPE_V4L || type < 0 || type > 2) + { + SEND_MSG(v, "000000000" ); + return; + } + + vj_tag *tag = vj_tag_get(id); + + int total_len = 0; + int uv_len = 0; + int len = 0; + + uint8_t *buf = vj_tag_get_cali_buffer( id , type, &total_len, &len, &uv_len ); + + if( buf == NULL ) { + SEND_MSG(v, "00000000" ); + } + else { + char header[128];//FIXME + memset(header,0,sizeof(header)); + sprintf( header, "%03d%08d%06d%06d%06d%06d",8+6+6+6+6,len, len, 0, v->current_edit_list->video_width, v->current_edit_list->video_height ); + SEND_MSG( v, header ); + + int res = vj_server_send(v->vjs[VEEJAY_PORT_CMD], v->uc->current_link, buf,len); + } +} + + void vj_event_toggle_bw( void *ptr, const char format[], va_list ap ) { @@ -8338,7 +8488,7 @@ void vj_event_send_working_dir(void *ptr, const char format[], va_list ap) P_A(args,str,format,ap); - filelist_t *list = find_media_files(v); + filelist_t *list = (filelist_t*)find_media_files(v); if(!list) { veejay_msg(VEEJAY_MSG_ERROR, "No usable files found."); sprintf(_s_print_buf, "00000000"); @@ -8386,7 +8536,7 @@ void vj_event_send_sample_list ( void *ptr, const char format[], va_list ap ) sprintf(_s_print_buf, "00000000"); n = sample_size(); - if( n >= 1 ) + if( n > 1 ) { char line[400]; veejay_memset(_print_buf, 0,SEND_BUF); @@ -8420,6 +8570,7 @@ void vj_event_send_sample_list ( void *ptr, const char format[], va_list ap ) } sprintf(_s_print_buf, "%08d%s", strlen(_print_buf),_print_buf); + } SEND_MSG(v, _s_print_buf); } @@ -9080,9 +9231,6 @@ void vj_event_screenshot(void *ptr, const char format[], va_list ap) #endif #endif - - - void vj_event_quick_bundle( void *ptr, const char format[], va_list ap) { vj_event_commit_bundle( (veejay_t*) ptr,0,0); diff --git a/veejay-current/veejay-server/veejay/vj-event.h b/veejay-current/veejay-server/veejay/vj-event.h index 15c2f296..5e19dc5d 100644 --- a/veejay-current/veejay-server/veejay/vj-event.h +++ b/veejay-current/veejay-server/veejay/vj-event.h @@ -229,6 +229,8 @@ void vj_event_mcast_start( void *ptr, const char format[], va_list ap); void vj_event_mcast_stop( void *ptr, const char format[], va_list ap); void vj_event_vloopback_start ( void *ptr, const char format[], va_list ap ); void vj_event_vloopback_stop ( void *ptr, const char format[], va_list ap ); + +void vj_event_play_norestart( void *ptr, const char format[], va_list ap ); void vj_event_quick_bundle (void *ptr, const char format[], va_list ap); void vj_event_sample_rand_start( void *ptr, const char format[], va_list ap); @@ -281,4 +283,10 @@ void vj_event_vp_set_points( void *ptr, const char format[], va_list ap ); void vj_event_vp_stack(void *ptr, const char format[], va_list ap ); void vj_event_vp_get_points( void *ptr, const char format[], va_list ap ); void vj_event_vp_proj_toggle(void *ptr, const char format[],va_list ap ); + +void vj_event_v4l_blackframe( void *ptr, const char format[], va_list ap ); + +void vj_event_cali_write_file( void *ptr, const char format[], va_list ap ); +void vj_event_stream_new_cali( void *ptr, const char format[], va_list ap ); +void vj_event_get_cali_image ( void *ptr, const char format[], va_list ap ); #endif diff --git a/veejay-current/veejay-server/veejay/vj-eventman.c b/veejay-current/veejay-server/veejay/vj-eventman.c index af231b8f..db75e973 100644 --- a/veejay-current/veejay-server/veejay/vj-eventman.c +++ b/veejay-current/veejay-server/veejay/vj-eventman.c @@ -231,7 +231,7 @@ static vevo_port_t *_new_event( sprintf(param_name, "argument_%d", n ); const char *arg = va_arg( ap, const char*); #ifdef STRICT_CHECKING - if(!arg) veejay_msg(VEEJAY_MSG_DEBUG, "\t%s - %d = '%s' of format %c (%s)",param_name, n, arg, format[it],format ); + if(!arg) veejay_msg(VEEJAY_MSG_DEBUG, "\t'%s' %s - %d = '%s' of format %c (%s)",name,param_name, n, arg, format[it],format ); assert( arg != NULL ); #endif char *descr = (char*) strdup( arg ); @@ -1147,6 +1147,43 @@ void vj_init_vevo_events(void) "Stream ID >= 1", 0, NULL ); + index_map_[VIMS_V4L_CALI] = _new_event( + "%s", + VIMS_V4L_CALI, + "Write calibration data to file", + vj_event_cali_write_file, + 1, + VIMS_REQUIRE_ALL_PARAMS | VIMS_LONG_PARAMS, + "Filename", + NULL, + NULL ); + index_map_[VIMS_STREAM_NEW_CALI] = _new_event( + "%s", + VIMS_STREAM_NEW_CALI, + "Load calibration data", + vj_event_stream_new_cali, + 1, + VIMS_REQUIRE_ALL_PARAMS | VIMS_LONG_PARAMS, + "Filename", + NULL, + NULL ); + index_map_[VIMS_V4L_BLACKFRAME] = _new_event( + "%d %d %d %d", + VIMS_V4L_BLACKFRAME, + "Capture a black/light frame and subtract it from the video stream", + vj_event_v4l_blackframe, + 4, + VIMS_REQUIRE_ALL_PARAMS, + "Tag ID", + 0, + "Frame Duration (Use 0 to drop blackframe)", + 5, + "Median Radius (0=Average, N=NxN square)", + 0, + "Blackframe=0,Lightframe=1", + 0, + NULL); + index_map_[VIMS_STREAM_NEW_V4L] = _new_event( "%d %d", VIMS_STREAM_NEW_V4L, @@ -1915,6 +1952,20 @@ void vj_init_vevo_events(void) "VIMS text", 0, NULL ); + + index_map_[VIMS_CALI_IMAGE] = _new_event( + "%d %d", + VIMS_REQUIRE_ALL_PARAMS, + "GUI: Get Calibrated image (raw)", + vj_event_get_cali_image, + 2, + VIMS_REQUIRE_ALL_PARAMS, + "ID", + 0, + "Type", + 0, + NULL ); + index_map_[VIMS_BUNDLE_CAPTURE] = _new_event( NULL, VIMS_BUNDLE_CAPTURE, @@ -2312,6 +2363,17 @@ void vj_init_vevo_events(void) NULL ); + index_map_[ VIMS_CONTINUOUS_PLAY ] = _new_event( + "%d", + VIMS_PROJ_INC, + "Continuous sample play, do not restart samples", + vj_event_play_norestart, + 1, + VIMS_ALLOW_ANY, + "0=off (default),1=on", + 0, + NULL ); + index_map_[ VIMS_PROJ_INC ] = _new_event( "%d %d", VIMS_PROJ_INC, diff --git a/veejay-current/veejay-server/veejay/vj-font.c b/veejay-current/veejay-server/veejay/vj-font.c index 61c60258..23e797df 100644 --- a/veejay-current/veejay-server/veejay/vj-font.c +++ b/veejay-current/veejay-server/veejay/vj-font.c @@ -148,6 +148,7 @@ static void vj_font_substract_timecodes( vj_font_t *font, const char *tc_srt static char *vj_font_split_strd( const char *str ); static char *vj_font_split_str( const char *str ); +static char *get_font_name( vj_font_t *f,const char *font, int id ); static int get_default_font( vj_font_t *f ); static int test_font( vj_font_t *f , const char *font, int id); @@ -636,7 +637,10 @@ void vj_font_xml_unpack( xmlDocPtr doc, xmlNodePtr node, void *font ) void vj_font_xml_pack( xmlNodePtr node, void *font ) { vj_font_t *ff = (vj_font_t*) font; - char **items = vevo_list_properties ( ff->dictionary ); + if(ff == NULL ) + return; + + char **items = vevo_list_properties ( ff->dictionary ); if(!items) return; #ifdef STRICT_CHECKING @@ -698,6 +702,9 @@ void vj_font_xml_pack( xmlNodePtr node, void *font ) int vj_font_save_srt( void *font , const char *filename ) { vj_font_t *ff = (vj_font_t*) font; + if( ff == NULL ) + return 0; + char **items = vevo_list_properties ( ff->dictionary ); if(!items) { @@ -1062,6 +1069,21 @@ static int try_deepen( vj_font_t *f , char *path ) if( f->font_index < MAX_FONTS ) { char *try_font = strdup(path); + if( get_font_name( f,try_font, f->font_index ) ) { + f->font_table[f->font_index] = try_font; + f->font_index ++; + } else { + free(try_font); + } + /* + if( fnname ) { + veejay_msg(VEEJAY_MSG_INFO, "FontName ='%s'",fnname ); + + }else { + veejay_msg(0, "Error '%s'",try_font); + } + + if( test_font (f, try_font, f->font_index) ) { f->font_table[ f->font_index ] = try_font; @@ -1070,7 +1092,7 @@ static int try_deepen( vj_font_t *f , char *path ) else { free(try_font); - } + }*/ } } } @@ -1109,12 +1131,106 @@ static char *select_font( vj_font_t *ec, int id ) return ec->font_table[id]; } + +static char *get_font_name( vj_font_t *f,const char *font, int id ) +{ + int len = 0; + char *string; + int platform,encoding,lang; + int error; + + static char *fontName = NULL; + static int fontLen = 256; + + if( fontName == NULL ) { + fontName = (char*) vj_malloc(sizeof(char) * fontLen ); + } + if( fontName == NULL ) { + return NULL; + } + + FT_SfntName sn,qn,zn; + FT_SfntName sname; + FT_UInt snamei,snamec; + + FT_Face face; + if ( (error = FT_New_Face( f->library, font, 0, &face )) != 0) + { + return 0; + } + + memset( &qn, 0,sizeof( FT_SfntName ) ); + memset( &zn, 0, sizeof( FT_SfntName )); + memset( &sn, 0, sizeof( FT_SfntName )); + + snamec = FT_Get_Sfnt_Name_Count(face); + + int found = 0; + int tlen = 0; + for(snamei=0;snamei fontLen ) { + fontLen *= 2; + fontName = (char*) realloc( fontName, fontLen ); + if( fontName == NULL ) { + return NULL; + } + } + + int i,k; + + for( i=0; i < tlen; i +=2 ) { + fontName[i/2] = string[i+1]; + } + fontName[tlen/2] = '\0'; + + f->font_list[id] = strdup( fontName ); + + return fontName; +} + static int test_font( vj_font_t *f , const char *font, int id) { char name[1024]; FT_Face face; int error; - FT_SfntName sn,qn,zn; FT_SfntName sname; FT_UInt snamei,snamec; @@ -1133,13 +1249,22 @@ static int test_font( vj_font_t *f , const char *font, int id) // FT_Get_Sfnt_Name( face, TT_NAME_ID_FONT_FAMILY, &qn ); snamec = FT_Get_Sfnt_Name_Count(face); + for(snamei=0;snameidictionary = dict; } void *vj_font_get_dict(void *font) { vj_font_t *f = (vj_font_t*) font; + if(f == NULL ) + return; return f->dictionary; } diff --git a/veejay-current/veejay-server/veejay/vj-lib.h b/veejay-current/veejay-server/veejay/vj-lib.h index 245c25aa..464787d2 100644 --- a/veejay-current/veejay-server/veejay/vj-lib.h +++ b/veejay-current/veejay-server/veejay/vj-lib.h @@ -205,6 +205,8 @@ typedef struct { int repeat_delay; int repeat_interval; int simple_frame_dup; + uint32_t cycle_count[2]; //@ required for veejay-radar + int sample_restart; } video_playback_setup; typedef struct { diff --git a/veejay-current/veejay-server/veejay/vj-misc.c b/veejay-current/veejay-server/veejay/vj-misc.c index 58310c58..416fcd91 100644 --- a/veejay-current/veejay-server/veejay/vj-misc.c +++ b/veejay-current/veejay-server/veejay/vj-misc.c @@ -39,7 +39,7 @@ #include #include #include -#include AVUTIL_INC +#include #ifdef STRICT_CHECKING #include #endif @@ -275,7 +275,7 @@ int vj_perform_screenshot2(veejay_t * info, uint8_t ** src) video_playback_setup *settings = info->settings; - jpeg_buff = (uint8_t *) malloc( 65535 * 4); + jpeg_buff = (uint8_t *) malloc( 65535 * 10); if (!jpeg_buff) return -1; @@ -290,10 +290,10 @@ int vj_perform_screenshot2(veejay_t * info, uint8_t ** src) tmp.data[1] = tmp.data[0] + tmp.len; tmp.data[2] = tmp.data[1] + tmp.len + tmp.uv_len; - tmp.format = PIX_FMT_YUV420P; + tmp.format = PIX_FMT_YUVJ420P; VJFrame *srci = yuv_yuv_template( src[0],src[1],src[2], info->video_output_width, - info->video_output_height , PIX_FMT_YUV422P); + info->video_output_height , PIX_FMT_YUVJ422P); yuv_convert_any_ac( srci,&tmp, srci->format, tmp.format ); @@ -315,7 +315,7 @@ int vj_perform_screenshot2(veejay_t * info, uint8_t ** src) if (frame) { - jpeg_size = encode_jpeg_raw(jpeg_buff, (65535*4), 100, + jpeg_size = encode_jpeg_raw(jpeg_buff, (65535*10), 100, settings->dct_method, info->current_edit_list->video_inter,0, info->video_output_width, @@ -331,6 +331,7 @@ int vj_perform_screenshot2(veejay_t * info, uint8_t ** src) if (jpeg_buff) free(jpeg_buff); + if( tmp.shift_v == 0 ) { free(tmp.data[0]); @@ -401,23 +402,26 @@ void vj_get_yuvgrey_template(VJFrame *src, int w, int h) void vj_get_yuv_template(VJFrame *src, int w, int h, int fmt) { src->width = w; - src->uv_width = w >> 1; src->height = h; src->format = get_ffmpeg_pixfmt( fmt ); - if(fmt == 0||fmt == 2) + if(fmt == FMT_420||fmt == FMT_420F) { src->uv_height = h >> 1; + src->uv_width = w >> 1; src->shift_v = 1; + src->uv_len = (w*h)/4; } - if(fmt == 1||fmt==3) + if(fmt == FMT_422||fmt==FMT_422F) { - src->uv_height = h; + src->uv_height = h >> 1; + src->uv_width = w; src->shift_v = 0; + src->uv_len = src->uv_width * src->uv_height; + } src->len = w * h; - src->uv_len = src->uv_width * src->uv_height; src->shift_h = 1; src->data[0] = NULL; src->data[1] = NULL; @@ -485,6 +489,7 @@ int verify_working_dir() snprintf( tmp, sizeof(tmp), "%s/%s", path, files[n]->d_name ); if( try_file( tmp ) ) c++; + free( files[n] ); } free(files); @@ -649,7 +654,3 @@ int veejay_sprintf( char *s, size_t size, const char *format, ... ) return done; } #endif - - - - diff --git a/veejay-current/veejay-server/veejay/vj-misc.h b/veejay-current/veejay-server/veejay/vj-misc.h index e7d5a3f7..6fff20a1 100644 --- a/veejay-current/veejay-server/veejay/vj-misc.h +++ b/veejay-current/veejay-server/veejay/vj-misc.h @@ -32,7 +32,6 @@ typedef struct #define VEEJAY_FILE_LIMIT (1048576 * 16000) int available_diskspace(void); - int vj_perform_screenshot2(veejay_t * info, uint8_t ** src); #ifdef ARCH_X86 diff --git a/veejay-current/veejay-server/veejay/vj-perform.c b/veejay-current/veejay-server/veejay/vj-perform.c index 31f9ff29..a5350856 100644 --- a/veejay-current/veejay-server/veejay/vj-perform.c +++ b/veejay-current/veejay-server/veejay/vj-perform.c @@ -556,6 +556,8 @@ static void vj_perform_record_buffer_free() } static char ppm_path[1024]; +static long CYCLE_CAP = 0; //@ saturate cycle counter at this boundary value + int vj_perform_init(veejay_t * info) { const int w = info->edit_list->video_width; @@ -656,6 +658,14 @@ int vj_perform_init(veejay_t * info) veejay_memset( &pvar_, 0, sizeof( varcache_t)); + //@ undocumented + char *cc = getenv( "VEEJAY_CYCLE_SATURATE" ); + if( cc ) { + CYCLE_CAP = atol(cc); + veejay_msg(VEEJAY_MSG_INFO, + "Saturating Cycle Count at %ld", CYCLE_CAP); + } + return 1; } @@ -3477,9 +3487,16 @@ int vj_perform_queue_frame(veejay_t * info, int skip ) break; } } + + //@ increase tick + vj_perform_clear_cache(); //__global_frame = 0; + settings->cycle_count[0] ++; + if( settings->cycle_count[0] == 0 ) + settings->cycle_count[1] ++; + return 0; } diff --git a/veejay-current/veejay-server/veejay/vj-viewport.c b/veejay-current/veejay-server/veejay/vj-viewport.c index fbf2e815..ce46f8a5 100644 --- a/veejay-current/veejay-server/veejay/vj-viewport.c +++ b/veejay-current/veejay-server/veejay/vj-viewport.c @@ -40,7 +40,7 @@ #include #include #include -#include AVUTIL_INC +#include #include #include #include