diff --git a/veejay-ng/ChangeLog b/veejay-ng/ChangeLog index 922fc72a..e69de29b 100644 --- a/veejay-ng/ChangeLog +++ b/veejay-ng/ChangeLog @@ -1,617 +0,0 @@ -0.7.2 - + fixed Network Streaming (VIMS 165:hostname port_id; ) - + fixed handling of multiple connections - + added new tool 'mcastOSC' - + added commandline parameter '-g' to sayVIMS for multicast - + added commandline parameter '-V' for veejay VIMS multicast - + added commandline parameter '-M' for veejay OSC multicast - + fixed a small bug in multicast OSC - + added doc/NET.txt to explain network streaming/multicast - + fixed segfault in Ghost effect - + added basic negotiation on frame information for Network Streaming - + refactorized vj-server.c/vj-client.c - + refactorized network dependent code to libvjnet - + fixed screenshot dump when playing 4:2:2 - + changed VIMS 054 (screenshot) 054:name.jpg; or 054:; - + added multicast video transmitter/receiver !! - + revisited OSC implementation ( use veejay -u -n |less ) - + updated documentation (Howto, MAN pages, etc) - + removed obsolete VIMS messages - + librified editlist,stream and yuv functions - + removed any references on dropped vloopback support - + fixed ticket 6 - + fixed ticket 7 - + fixed autosplitting while recording - + added dv1394 stream support - (uses libdv, so its slow even on a pentium3/1 ghz) - -0.7.1 - + fixed color corruption in fib - + removed veejay.spec from configure.in - + added render history list - + fixed bug in Displacement Map - + added new effect 'Cartoon' (Flatten bitdepth) - + added new effect 'Nervous' - + removed obsolete file 'motiondetect' from libvje - + fixed mode 2 of 'Amplify Low Noise' effect - + added new effect 'Cartoon' - + added new effect 'Motion Ghost' - + added new effect 'Morphology' - + added new effect 'Nervous' - + added new effect 'Video Blobs' - + fixed ticket #3 (editlist load bug) - + added new effect 'Video Boids' - + refurbished status line (all modi have 13 status bytes now) - + fixed minor bug in 'video boids' - + bumped version to 0.7.2 - - render to history list mismatches frames in clip - (too many) - -0.7.0 - + added --version commandline - + fixed use of implicit declarations and other compiler warnings - + fixed several effects (mostly blending effects) - + moved sample functionality to libsample - + started documentation of VIMS (see doc/VIMS.txt) - + added dummy mode (works for real now this time!) - + added commandline parameter -d for Dummy mode - + added commandline parameter -W (width) for dummy - + added commandline parameter -H (height) for dummy - + added commandline parameter -R (rate) for dummy - + added commandline parameter -N (norm) for dummy - + fixed cycling of effect parameters (keyboard) - + added optimized memcpy for ppc - + added --auto-loop commandline option - + changes to build configuration - + minor bugfix in remotely adding effects on streams - + added save editlist / save selection - + added error check on switching playmodes in dummy mode - + fixed bug in fade in/fade out chain - + some cleanup - + updated veejay MAN page - -0.6.4 / 0.6.5 - + added experimental network streaming - + fixed rawdv2yuv when not having libdv - + fixed parsing of VIMS arguments - + moved veejays effects into libvje - + moved memory managment into libvjmem - + moved logging functions to libvjmsg - + compiles on PPC - + compiles on MIPS - + fixed a lot of bugs - + refactorized OSC code (now also used by Lives) - + fixed recording of streams - + put back in ChangeLog (some changes were lost :( , - most of them are bugfixes during piksel workshop ) - + moved sample administrator to libsample - + removed external wav files from libsample - + removed keyframe interpolation from libsample - -0.6.3 - + small fixes to zoom effect - + small optimizations to motion blur - + added DrawText plugin from Gustavo Sverzut Barbieri - + added Dummy Example Plugin - + added Veejay Plugins ( see plugins/README ) - + added FreeType to configure script - + updated email address in license information - -0.6.2 (fork of 0.6.0) - - + dropped vloopback support - + removed vj-motion.c - + removed cpu_accel.c - + removed obsolete vj-frameinfo.c - + removed obsolete colorspace.c - + removed obsolete client - + removed obsolete RGB output stream - + removed all of ccvt yuv<->rgb conversion routines - + all encoders/decoders working with both 4:2:0 and 4:2:2 - + added FOURCC 'yv16' to record YUV 4:2:2 planar to AVI - + touched all effects to work in 4:2:0 and in 4:2:2 planar - + added '--ycbcr'/ '-Y' [01] commandline options to force - using 4:2:0 or 4:2:2 - + changes to performer to include YUV 4:2:2 Planar - + added SDL_YUY2_OVERLAY to SDL Video Window (to display 4:2:2) - + added chromacity sampling YCbCr 4:2:2 <=> YUV 4:4:4 - + audio resampling for trickplay - + on the fly audio resampling - + added '--force' or 'r' to force adding files to the editlist, - this effectivly turns on auto interlacing and disrespects norm/video framerate - + included avformat/avcodec to open and decode various stream formats - (not all types are supported, tested with Xvid,Divx,Mpeg4,mjpeg,dvvideo) - + refactorized Edit Decision List to include probing with AVFormat - + libdv optional now - + fixed bug in radial blur that caused segmentation fault - + extended chrominance palette to key on color - + cleanup overlay scratcher - -0.6.1 - + fork of veejay to experiment with the MLT framework (mlt.sourceforge.net) - probably this will be an extension to the Edit Decision List. - (experimental tarball can be found on the veejay's sourceforge files page) - -0.6.0 - + fixed bug in performer when using a stream multiple times - + fixed bug in veejay -u / --dump-events - (prints effect numbers correctly now) - + changed setting playmode to 0=clip,1=stream,2=plain video - so it is consistent with source/channel selections. - + some cleanups - + fixed VIMS duplicate NET_EFFECT_LIST and VLOOPBACK_START - (both have unique numbers now) - + fixed compile error in split.c (forgot to remove valgrind lines) - + fixed possible race condition in handling events - + fixed luma key effect (corrected dimensions) - + veejay console has coloured text now - + fixed use of errors/warnings/debug/info troughout veejay - + fixed (synchronized) looping of overlaying clips - + fixed memory leak while overriding effects - + dont show effects in plain video mode - + finally found the famous last-frame editlist bug - + 'HOME' includes benchmark information about render duration - + clarified (some) event names in vj-event.c - + added 3 new vims events (bezerk,verbose, sample-mode) - + added -n/--no-color commandline option - + added -b/--bezerk commandline option - + added -v/--verbose commandline option - + added -F/--features commandline option - + added -m/--sample-mode commandline option to select supersampling filter - (fast or high quality) - + supersampling method now selectable trough console ('sa') - + clip/stream information informs user if the effect is super sampled - (4:4:4) or not (4:2:0) - + removed -q/--quit commandline option (use VIMS) - + optimized effect fib downscale - + optimized effect splitted screens - + optimized effect bathroom window - + optimized effect pixelate - + optimized effect pixel raster - + optimized effect width mirror - + optimized effect replace pure white - + optimized effect flip - + optimized effect complex sync - + optimized effect luma blend - + optimized effect overlay magic - + improvement to SSE/MMX/MMX2 memcpy functions (updates from xine cvs) - + improvements to effect luma magick - + fixed bug in effect overlay by threshold range - + fixes to flexible effect manager (vj-effect and vj-perform) - + set performer framebuffer to black to avoid green screens - while switching clip/streams that have large effect chain - + use of const keyword in most of effects now (helps compiler) - + when using -O3 -o stdout veejay will dump the yuv4mpeg - stream to stdout - + cleanup and improved Performer - + improvements to down sampling 4:4:4 -> 4:2:0 (slightly better quality) - + pressing ESC when no clips exist will result in playing a tag - + updated MAN page - + updated HOWTO - + updated VIMS.txt in doc/ - + updated some testcases in test/ - + added new testcase 'swirl-vims.txt' in test/code - + added new effect 'Radial Blur' (from xine), both horizontal and vertical - + added new effect 'Binary Overlays' - + added new effect 'Chromium' to swap chroma/invert chroma channels - + added new effect 'Chrominance palette' - - -0.5.9t9 - + fixed small bug in magic overlay additive mode - + added new commandline option '-F' to show compiled in features - + JACK is optional in configure script now. ( ./configure --disable-jack ) - + updatd MAN pages veejay,yuv2rawdv,rawdv2yuv and sendVIMS - + fixes to 'Splitted Screen' effect - + fixed VIMS toggle between source (streams and clips) while mixing - + fixed VIMS select previous channel - + fixed VIMS select next channel - + fixed VIMS print stream/clip information - + fixes to mixing different types of sources - + fixed VIMS 'select effect' (displays effect type now) - + added experimental shared memory streams - (start writer with veejay -O4 , start reader with 253: ) - works only with -a0 (no audio) - + changed key for switching sources , is now SLASH - + added new event 'add WAV file to clip' (VIMS 136:file.wav;) - the clip recorder will , when writing to disk, use this file - file to import PCM WAVE. The WAV file must match the properties in your editlist - + added new event 'del WAV file from clip' - + disallow changing dataformat while recording - + fixes to freeing of memory in vj-perform - + added command line parameter '-I/--deinterlace' - + added check on unsupported video codecs - + updated bio2jack from cvs (july 2004) - + fixed 'additive' mode in chroma magick - + fixed 'subtractive' mode in chroma magick - + added '24' (darken) mode to chroma magick - + added '25' (lighten) mode to chroma magick - + added 'sendVIMS' utility to tools/ and MAN page - + lot of cleanup - - -0.5.9t8 - + fixed recording of clips in DV 2 format - + Magic Motion improved, p0 = anti alias p1=min threshold frame A, - + p2 = min threshold frame B, p3 = bw/color toggle - + new keyboard event ALT+B to take and set a static background - + (use with Magic Motion) - + improved memory managment in vj-perform.c - + removed caching of clips from vj-perform.c - + new 2gb auto splitter for streams - + better error handling for recording clips/streams - + JACK support (dropped audiolib) - + added command line parameter '-x/--geometryx' - + added command line parameter '-y/--geometryy' - + removed obsolete command line parameters - - -0.5.9t7 - + fixed bug in clip recording (never stopped recording on 130:0 0;) - + renamed Magic Motion to Difference Overlay - p0 = lighter/darker - p1 = noise level Luma channel - p2 = noise level chrominance Cb - p3 = noise level chrominance Cr - -0.5.9t6 - + fixed segfault in stopping clip recording - + fixed possible segfault in event handler - + added testcases for various effects in tests/ - - todo: 2 gb auto splitter for stream recording - -0.5.9t5 - + new effect 'Swirl' - + new effect 'Fish Eye' - + new effect 'Pixel Smear' - + new effect 'Grid' - + fixed bug in loading Mjpegtools'editlists - + using fsincos for faster sin/cos operations (common.h) - + fixed bug in clip / stream recorder - (missed last frame) - + 2 gb file limit - auto splitter (only for clips for now) - + changed default values in (smooth) rgb key effects - + fixed bug in recording the number of frames requested - + new set of demos in tests/ - -0.5.9t4 - + fixed bug in performer when mixing different codecs - + new effect 'Pixelate' - + new effect 'Magic Mirror' - + new effect 'Distortion Map' - + fixed steepness factor in gamma correction - + fixed solarize effect - + changed default values for saturation effect - + small bugfix in RippleTV - + clip recorder duration 0 results in recording of entire clip start ~ end - + fixed writing of pcm wave when recording clips in any format - + dynamical effect chain (greatly reduces memory hog) - + various smaller fixes - - -0.5.9t3 - + fixed mixing stream with clip - + fixed RippleTV effect - + fixed bug in switching clips/streams while mixing - + renewed Multi Mirrors effect - + fixed cache system in performer - + changed default values in some effects - + partly updated veejay MAN page - + renewed --dump-events for VIMS/effect ID's - + example perl script test/tests/auto-vj.pl - that generates a textfile for use with the testclient - (demonstrates the new multi mirror effect) - + new fourcc 'IYUV' added, which allows storing - of raw YUV 4:2:0 i420 in AVI. - (experimental) - -0.5.9t2 - + fixes in ChromaMagick/MatteScratcher - + fixes in Motion Blur - + fixes in Splitted Screens - + 'RippleTV' effect ported from EffecTV - + MMX memset - + MMX optimized filters killchroma and few others - + XML based Action File - (Press CTRL+Key to create a effect template from the current chain, - press SHIFT+Key to apply the template. - Use 'al' to load the templates from an Action File' - Use 'as' to save. - + bugfixes in event handler - + new VIMS message for deleting all clips - + new VIMS message for copying clips - + bugfixes performer (reduced memcpy()) - + improved performance in v4l - + improved performance in y4m - + removed obsolete commandline parameters - + fixes in vjrender command - + added '?' ,'h' and 'H' commands to console - + finally fixed dummy mode - + fixed keyboard events play_backward and play_forward - when playing at high speeds - + fixed looping at high speeds - + fixed use of effects, 1xx = single frame effect, 2xx = mixing effect - - -0.5.9t1 - + General bugfixes, fixed a few memory leaks and use of unitialized variables - + fixed Makefile.am / configure.in to auto detect cpu capabilities, - also fixed build order problem with ffmpeg - + added support for DivX ;) encoding/decoding - limitation: for mpeg4/divx every frame must be a key frame - or veejay cannot really work with them. - + added new effect 'Enhanced Magic Blend' - + added new effect 'Pencil Sketch (8)' - + new effect 'Color Enhance' , allows increasing of R, G, B , each 0 - 255 - + new effect 'Noise Pencil' - + renamed posterize to posterize (threshold range) - + Export DV2/MJPG/MPEG4/Divx videofiles with sample/stream-recorder - + partly rewritten veejay socket server - + Fixed handling of YUV 4:2:0 and YUV 4:2:2 data - + vloopback streams in YV12 or RGB24 - + added new feature 'Effect Key Frame' - + Increased EditList's capacity to 4096 files (thanks to ronald bultje) - + Renamed sample to clip , tag to stream - + Increased Stream/Clip capacity to 16384 - + Up to 20 effects on the effect chain - + per clip / stream effect chain enable/disable - + stream/clip effect chain by default on - + fixes to all scratcher overlay effects - + increased scratcher buffer to 100 frames - + rewritten OSC message structure (not decided yet) - + added VIMS test cases in test/ - + added perl scripts to generate VIMS test cases in test/perl - + factorization of callbacks routines - vj-callbacks.c/h, vj-console.c/h,veejay.c => vj-event - + OSC maps to VIMS (OpenSoundControl) - + NET maps to VIMS (internal protocol) - + SDL maps to VIMS (SDL keyboard) - + can add new events to VIMS (message bundles) - + finished veejay control documentation,vims/osc/sdl - + removed sample countdown (use marker instead) - + added --action-file to load keybundles - + actionfile and bundles scripts to remake live-cinema - - -0.5.3 - - added OMC from experimental veejay branch - - fixed bug in starting UDP server - - fixed bug in reaching end of video in plain mode - - added chain fade feature , - this will enable the effect chain and fade in the - chain to 100% in num seconds - - implemented tag encoder which records from a tag - for num seconds and auto-adds a sample to the samplelist - - added OSC callbacks: - - implemented sample countdown ( 5....4...3...2...1 ... 0) - - added zoom algorithm ( best neighbour algorithm ) - uses deinterlacing for use with common v4l hardware. - (temporary) - - fixed rendering of samples - - added Image Effect DeInterlace effect (from yuvkineco) - - added Video Effect Simple Mask effect - - added Pixel Raster effect - - ffmpeg updated to ffmpeg cvs (late November) - -0.5.2 - - added Motion blur by averaging frames over time. - - added Average effect - allows increasing the luminance by a fraction - - added Sinoids Effect - - added Ripple Effect - - added Bathroom Effect (horizontal and vertical modes with p0) - - added 'Gesture Control Interface' and Motion Detector - - added feature to toggle effect upon motion - - added raw rgb stream out - - added raw rgb stream in - - added raw rgb interactive mode - - added raw rgb burst mode - - added y4m open/close in veejay console - - added new utility 'rawdv2yuv' which decodes rawdv to iv12 or i420 - with the possibility scale to half size + simple clipping. - - added 22 new modes to Matte Scratcher - - added Sample creation on Scene Detection - - renamed 'Various Embossing/Edge ...' to 'Various Weird Effects' - - minor optimizations in playback mechanism - - fixed bug in proc detection of v4l/vloopback devices - - fixed bug in print_sample_info - - fixed console command 'vi' for opening of v4l device - - fixes in audio playback - - fixed reverse audio playback - - fixes in DirectFB output - - fixed bug in marker - - fixed bug in numeric keypad key 'ENTER' (pressed state) - - -0.5.1 - - added mode 7 - 22 to chroma magick effect - (exclusive, diffnegate and additive) - - changes in mode 9 of overlay magic (exclusive) - includes Cb/Cr now - - fixed bug in mixing audio while rendering - - fixed bug in audio playback - - audio/video and video files can be combined now, - - fixed bug in vjrender (bail if sample frames dont fit) - - updated spec file - - fixed deleting tag multiple times - (no hangup after 2nd time opening of a yuv4mpeg stream) - -0.5.0 - - fixed compile error when optimizations are enabled - - fixes in splitted screens effect - - optimizations in splitted screens effect - - changes in vj-performer to fix mem leaks - - changes in liblavplayvj to fix mem leaks - - fixed bug in vj-effman - - fixed bug in vj-server - - fixes in overlay scratcher for bounce mode - - fixed sharpen effect - - fixes in render mechanism (audio) - - several other smaller fixes - - introduced 'has_internal_data' to cleanup memory - in use by some effect at veejay shutdown - - fixed creation of samples while playing tags - - fixed gcc-2 compile error in split.c - - fixed memory leaks in vj-tag and sampleadm - - fixed memory leaks in vj-callbacks - - fixed bug in resize video - - fixed bug in audio toggle - - fixed playing audio in pause in mode plain - - fixed playing of last frame in mode plain - - fixed bug in smooth threshold - -0.5.0pre1 - - added commandline parameter to start veejay without default tags - - bugfix in vj-sdl - - changes in vj-perform - - added feature to move rendered sample to a new sample - - added feature to delete rendered entries - - changed default parameter in bump 2d - - fixed possible crash in transition translate opacity/blend - - fixed parameter in multi mirror - - fixes in switches between playmodes - - fixes in getting all tags - - fixed queuing of non exiting frames (beyond editlist) - - fixed tag deletion - - disabled sliding door transition (possible segfault) - - fixed rendering of audio - - fixed switching between tag <-> samples - - fixed bug in rendering mechanism - - changed code to non multithread for render job (simpler). - - fix bug in luma blend mode (possible crash) - - fix bug in noiseadd (possible crash) - - fix bug in softblur mode (possible crash) - - fixed another possible crash in distortion effect - - fixed bug in softblur - - fixed bugs in magic overlays - - fixed smuck - - fixed splitted screens - - fixed dices - - fixed a few compiler warnings. - - fixed out of sync effect (for real now) - - some experiments in enhancemask.c - - parameter minimum change in contrast (-255 to 255) - -0.4.9rc3 - - fix bug in opening of v4l device - - fix bug in switching between audio/video sample and tags - - fix bug in general audio playback - - synced hash.c / hash.h from kazlib (version 1.20) - - minor bugfixes here and there - -0.4.9rc2 - - fixes in rendering mechanism, - audio and samples at different speed get correctly - inserted - - fixed ghost frame in render mechanism - - fixes in a few callbacks - - added 'Amplify low noise' effect - - added sharpen filter from yuvdenoise - allowing 0 - 2048 for extra grainy video. - - synced colorspace.c/colorspace.h with mjpegtools-1.6.1.90 - - fixes in queuing mechanism - - fixes in vjrender initialization - - fixes in activating/deactivating tags - - fixes in default tags - - disallow user to render while playing - - disallow user to render while rendering. - -0.4.9 - - added more command line parameters to vjrender - - added frame duplicator feature - - finalized sample render history - - added msg to retrieve devices (v4l/vloopback) - - veejay closes connections properly now - - changed default value of colored border transition - - changed default value of tranform cubicq (effectv) - - fixed bugs/assertions in a number of callbacks - - implemented basic functionality in veejay for history list - - implemented functions for finding v4l/vloopback devices - - default tags are activated at startup - - fixed serious bug in effect chain when not starting at entry 0 - - builded a new gui - - documented Tags/setting playmode in Networking.txt - - added new section 'VIDEO COMMANDS' to man , a few examples - and new commandline parameters have been included. - - renamed 'About Video' to 'Video Information' ('VI') in console - - added 'Add videofile as sample' in console - - added 'Add videofile' in console - - added tag creation callbacks for remote - - added fake video - - added resize screen command - - added command line parameters for fake video - - fixes in mode 2 of chromamagic (select max ) - - sample stores frame duplicator - - fixed out of sync effect - - fixed bug in rendering of frames in effect chain - - fixed bug in makefile for make uninstall - -0.4.8 - - functionality improved, - veejay informs gui about disabled effects - (old situation: gui sees disabled effects as ) - - fixed saving of samples (did not save parameters correctly) - - fixed bug in veejay_open - - fixed compile errors in liblavplay (declaration after statement) - - new effect 3bars - - -0.4.7 - updated audiolib,lav_io,avilib - (synced against mjpegtools-1.6.1) - - updated ffmpeg - - improved audio support - - added german keyboard hack, GER_KEY_HACK - - fixed some compile errors and warnings - - created vjrender for rendering of samples - - updated doc/Networking - - fixed sample update start/end - - fixed save/load samplelist console status message - - updated test/client.c - - restriction on set_speed : do not go outside sample - - fixed audio queuing/timing problems - - added new network command to add and set effect in 1 go - -0.4.6 - - fix in out of sync - - new effect isolate color - - moved libvjplay into libveejay - - fast memset/memcpy revised, code taken from DirectFB ,mplayer, - transcode and /usr/src/linux/arch/ - - magic motion completed. - - general optimizations - - optimizations in sampleadm - - cleanups , bugfixing - -0.4.5 - - memory leaks fixed in sampleload,effectload, - - fixes in parameter update rules - - fixed bugs in veejay / gveejay - - fixed Magic Motion - -0.4.4 - - changes in initialization phase - - new image effect out of sync - - new video effect out of sync (replace out of sync by video) - - new image effect complex invert - - new video effect complex threshold - - new image effect complex saturation - - changes to diff.c (incomplete) - - memory leaks: - - fixed vj-comm.c (gveejay/veejay talkback) - - fixed vj-callbacks.c (veejay talkback) - - fixed liblavplayvj.c - - fixed vj-perform.c - - fixed vj-server.c - -0.4.3 - - new effect 'Greyscale by Color Key' - - new effect 'Blend by Color Key' - - changes to Soft Blur/Sharpen (new mode: 3 set distance) - - new effect 'Black/White on Threshold' - - fixed bug in 'set defaults' (gveejay) - - fixed bug in sample info (duration/frames update) - - removed frame trimmer (gveejay) - - removed obsolete menu items - -0.4.2 diff --git a/veejay-ng/Makefile.am b/veejay-ng/Makefile.am index 54f7b498..1b7a418b 100644 --- a/veejay-ng/Makefile.am +++ b/veejay-ng/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = bio2jack libhash libvjmsg libvjmem SUBDIRS += libvevo libplugger libvjnet libyuv libel libvjaudio vevosample veejay -SUBDIRS += tools man +SUBDIRS += tools ui man # diff --git a/veejay-ng/README b/veejay-ng/README index 6d9fcec6..eaddf6f5 100644 --- a/veejay-ng/README +++ b/veejay-ng/README @@ -64,27 +64,16 @@ Example FX For this to work, you need to grab pluginpack from the repository and edit the ~.veejay/plugins file to include the path to the installed -plugins +plugins. sayOSC localhost 3490 s /sample_1/fx_0/set LVDPhotoplay sayOSC localhost 3490 i /sample_1/fx_0/fx_status 1 -If you need a GUI, you can use Khagan -http://khagan.berlios.de/ -Veejay dumps .kh files in the directory where you started it. +If you need a GUI, you can use 'veejayui' -$ sayOSC localhost 3490 /sample_1/khagan -$ khagan - File -> Open -> sample_1.kh - -Otherwise, - -See the updated namespace: -sayOSC localhost 3490 0 /sample_1/print - -sayOSC localhost 3490 i /sample_1/fx_0/photoplay/square_size 23 +veejayui localhost CONTACT / FEEDBACK & HELP @@ -95,14 +84,5 @@ Niels Elburg Please use the mailinglist on http://veejay.sourceforge.net -BUG REPORTS / BLEEDING EDGE SOURCE CODE -======================================= - -Please use the ticket system ! - -http://veejay.dyne.org - - -ENJOY! And let us know about your performances/installations with veejay! diff --git a/veejay-ng/configure.ac b/veejay-ng/configure.ac index 94e6013f..eefb0301 100644 --- a/veejay-ng/configure.ac +++ b/veejay-ng/configure.ac @@ -420,6 +420,25 @@ AM_PATH_XML2(2.5.4, [ fi fi +glib_modules="glib-2.0 >= 2.4" +PKG_CHECK_MODULES(GLIB, [$glib_modules]) +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) + +gtk_modules="gtk+-2.0 >= 2.4" +PKG_CHECK_MODULES(GTK, [$gtk_modules]) +AC_SUBST(GTK_CFLAGS) +AC_SUBST(GTK_LIBS) + +libglade_modules="libglade-2.0 >= 2.2.0" +PKG_CHECK_MODULES(GLADE, [$libglade_modules]) +AC_SUBST(GLADE_CFLAGS) +AC_SUBST(GLADE_LIBS) + +dnl get the genmarshal command for the *.list files +GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0` +AC_SUBST(GLIB_GENMARSHAL) + AC_MSG_CHECKING(whether to compile in debugging information) debugCFLAGS="" if test "x$enable_debug" = "xyes" ; then @@ -796,6 +815,7 @@ bio2jack/Makefile vevosample/Makefile veejay/Makefile tools/Makefile +ui/Makefile man/Makefile veejay-config veejay.pc diff --git a/veejay-ng/libyuv/yuvconv.c b/veejay-ng/libyuv/yuvconv.c index 2c410204..0be23022 100644 --- a/veejay-ng/libyuv/yuvconv.c +++ b/veejay-ng/libyuv/yuvconv.c @@ -978,7 +978,7 @@ void yuv_deinterlace( VJFrame *A, uint8_t *Y,uint8_t *U, uint8_t *V ) AVPicture p,q; p.data[0] = A->data[0]; p.data[1] = A->data[1]; - p.data[2] = A->data[3]; + p.data[2] = A->data[2]; p.linesize[0] = A->width; p.linesize[1] = A->uv_width; p.linesize[2] = A->uv_width; diff --git a/veejay-ng/pluginpack/AUTHORS b/veejay-ng/pluginpack/AUTHORS new file mode 100644 index 00000000..a8a325ce --- /dev/null +++ b/veejay-ng/pluginpack/AUTHORS @@ -0,0 +1,22 @@ + + +Livido: + + (C) Gabriel "Salsaman" Finch, + Niels Elburg, + Dennis "Jaromil" Rojo, + Daniel Fischer, + Martin Bayer, + Kentaro Fukuchi, + Andraz Tori 2005. + + + http://livido.dyne.org/trac.cgi/wiki/TechnicalSpecCurrent + + + +Veejay: + + Niels Elburg + + http://veejay.dyne.org diff --git a/veejay-ng/pluginpack/COPYING b/veejay-ng/pluginpack/COPYING new file mode 100644 index 00000000..223ede7d --- /dev/null +++ b/veejay-ng/pluginpack/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/veejay-ng/pluginpack/README b/veejay-ng/pluginpack/README new file mode 100644 index 00000000..6bb9f56a --- /dev/null +++ b/veejay-ng/pluginpack/README @@ -0,0 +1,39 @@ + + + 10x0 0x x10x0x10x0x10x 10x0x10x0x10x0 x0x1 x0x1 10x0 x0x1 + 0x10x0 0x0x x10x0x10x0x10x 10x0x10x0x10x0 x0x1 10x0x10x 10x0x1 10x0x1 +0x0x10 0x0x10 x10x 10x0 x0x1 10x0x10x x0x10x 10x0 +0x0x10x0 0x0x10 x10x0x10x0x1 10x0x10x0x10 x0x1 0x10 0x0 x10x0x10 + 0x10x0 x10x0x x10x0x10x0x10x 10x0x10x0x10 x0x1 0x10x0x10x0 x10x0x10 + 10x0x1 x0x10x x10x 10x0 x0x1 0x10x0x10x0 0x0x + x0x10x0x10x0x1 x10x 10x0 x10x x0x1 0x10x0x10x0x10 0x0x + x10x0x10x0 x10x0x10x0x10x 10x0x10x0x10x0 x10x 10x0 0x0x 0x10 0x0x + 0x0x10 x10x0x10x0x10x 10x0x10x0x10x0 0x010x0 0x0x 0x10 0x0x + + + :: Veejay, a visual instrument for GNU :: + http://veejay.dyne.org + + +LIVIDO PLUGIN PACK +================== + + +You will need the gcc compiler in order to build the plugins. + +run or edit RUNME.sh to compile the plugins. + + + +Example: + +$ mkdir -p /test/livido +$ ./RUNME.sh /test/livido + + +To add them to veejay: + +mkdir ~/.veejay +echo "/test/livido" > ~/.veejay/plugins + + diff --git a/veejay-ng/pluginpack/RUNME.sh b/veejay-ng/pluginpack/RUNME.sh new file mode 100755 index 00000000..f9831fd1 --- /dev/null +++ b/veejay-ng/pluginpack/RUNME.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +OUTDIR=$1 + +MY_CC=gcc +MY_CFLAGS="-g -DIS_LIVIDO_PLUGIN -DSTRICT_CHECKING" +MY_INCLUDES="-I `pwd`" + + +for i in lvd* ; do + + bname=`echo \`basename $i\` | cut -d '.' -f1` + modulename=$bname.so + + echo $MY_CC $MY_CFLAGS $MY_INCLUDES -shared -o $OUTDIR/$modulename + $MY_CC $MY_CFLAGS $MY_INCLUDES -shared $i -o $OUTDIR/$modulename || exit 1 + +done; diff --git a/veejay-ng/pluginpack/livido-utils.c b/veejay-ng/pluginpack/livido-utils.c new file mode 100644 index 00000000..55606b7b --- /dev/null +++ b/veejay-ng/pluginpack/livido-utils.c @@ -0,0 +1,358 @@ +/* LiViDO is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + LiViDO 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this source code; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + LiViDO is developed by: + + Niels Elburg - http://veejay.sf.net + + Gabriel "Salsaman" Finch - http://lives.sourceforge.net + + Denis "Jaromil" Rojo - http://freej.dyne.org + + Tom Schouten - http://zwizwa.fartit.com + + Andraz Tori - http://cvs.cinelerra.org + + reviewed with suggestions and contributions from: + + Silvano "Kysucix" Galliani - http://freej.dyne.org + + Kentaro Fukuchi - http://megaui.net/fukuchi + + Jun Iio - http://www.malib.net + + Carlo Prelz - http://www2.fluido.as:8080/ + +*/ + +/* (C) Gabriel "Salsaman" Finch, 2005 */ + + +///////////////////////////////////////////////////////////////// + +#include +#include +#include "livido.h" + +int livido_has_property (livido_port_t *port, const char *key) { + if (livido_property_get(port,key,0,NULL)==LIVIDO_ERROR_NOSUCH_PROPERTY) return 0; + return 1; +} + +///////////////////////////////////////////////////////////////// +// property setters + +int livido_set_int_value (livido_port_t *port, const char *key, int value) { + // returns a LIVIDO_ERROR + return livido_property_set (port,key,LIVIDO_ATOM_TYPE_INT,1,&value); +} + +int livido_set_double_value (livido_port_t *port, const char *key, double value) { + // returns a LIVIDO_ERROR + return livido_property_set (port,key,LIVIDO_ATOM_TYPE_DOUBLE,1,&value); +} + +int livido_set_boolean_value (livido_port_t *port, const char *key, int value) { + // returns a LIVIDO_ERROR + return livido_property_set (port,key,LIVIDO_ATOM_TYPE_BOOLEAN,1,&value); +} + +int livido_set_string_value (livido_port_t *port, const char *key, char *value) { + // returns a LIVIDO_ERROR + return livido_property_set (port,key,LIVIDO_ATOM_TYPE_STRING,1,&value); +} + +int livido_set_portptr_value (livido_port_t *port, const char *key, void *value) { + // returns a LIVIDO_ERROR + return livido_property_set (port,key,LIVIDO_ATOM_TYPE_PORTPTR,1,&value); +} + +int livido_set_voidptr_value (livido_port_t *port, const char *key, void *value) { + // returns a LIVIDO_ERROR + return livido_property_set (port,key,LIVIDO_ATOM_TYPE_VOIDPTR,1,&value); +} + + +/////////// these functions need a size //////////// + + +////////////////////////////////////////////////////////////////////////////////////////////////// +// general property getter + +inline int livido_get_value (livido_port_t *port, const char *key, void *value) { + // returns a LIVIDO_ERROR + return livido_property_get( port, key, 0, value); +} + +//////////////////////////////////////////////////////////// + +int livido_get_int_value (livido_port_t *port, const char *key, int *error) { + int retval=0; + if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_INT) { + *error=LIVIDO_ERROR_WRONG_ATOM_TYPE; + return retval; + } + else *error=livido_get_value (port,key,&retval); + return retval; +} + +double livido_get_double_value (livido_port_t *port, const char *key, int *error) { + double retval=0.; + if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_DOUBLE) { + *error=LIVIDO_ERROR_WRONG_ATOM_TYPE; + return retval; + } + *error=livido_get_value (port,key,&retval); + return retval; +} + +int livido_get_boolean_value (livido_port_t *port, const char *key, int *error) { + int retval=0; + if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_BOOLEAN) { + *error=LIVIDO_ERROR_WRONG_ATOM_TYPE; + return retval; + } + *error=livido_get_value (port,key,&retval); + return retval; +} + +char *livido_get_string_value (livido_port_t *port, const char *key, int *error) { + char *retval=NULL; + if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_STRING) { + *error=LIVIDO_ERROR_WRONG_ATOM_TYPE; + return NULL; + } + if ((retval=(char *)livido_malloc(livido_property_element_size(port,key,0)+1))==NULL) { + *error=LIVIDO_ERROR_MEMORY_ALLOCATION; + return NULL; + } + if ((*error=livido_get_value (port,key,&retval))!=LIVIDO_NO_ERROR) { + livido_free (retval); + return NULL; + } + return retval; +} + +void *livido_get_voidptr_value (livido_port_t *port, const char *key, int *error) { + void *retval=NULL; + if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_VOIDPTR) { + *error=LIVIDO_ERROR_WRONG_ATOM_TYPE; + return retval; + } + *error=livido_get_value (port,key,&retval); + return retval; +} + +livido_port_t *livido_get_portptr_value (livido_port_t *port, const char *key, int *error) { + livido_port_t *retval=NULL; + if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_PORTPTR) { + *error=LIVIDO_ERROR_WRONG_ATOM_TYPE; + return retval; + } + *error=livido_get_value (port,key,&retval); + return retval; +} + + +//////////////////////////////////////////////////////////// + +int *livido_get_int_array (livido_port_t *port, const char *key, int *error) { + int i; + int num_elems; + int *retval; + + if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_INT) { + *error=LIVIDO_ERROR_WRONG_ATOM_TYPE; + return NULL; + } + + if ((num_elems=livido_property_num_elements (port,key))==0) return NULL; + + if ((retval=(int *)livido_malloc(num_elems*sizeof(int)))==NULL) { + *error=LIVIDO_ERROR_MEMORY_ALLOCATION; + return NULL; + } + + for (i=0;i=0;i--) livido_free(retval[i]); + *error=LIVIDO_ERROR_MEMORY_ALLOCATION; + livido_free (retval); + return NULL; + } + if ((*error=livido_property_get(port, key, i, &retval[i]))!=LIVIDO_NO_ERROR) { + for (--i;i>=0;i--) livido_free(retval[i]); + livido_free (retval); + return NULL; + } + } + return retval; +} + +void **livido_get_voidptr_array (livido_port_t *port, const char *key, int *error) { + int i; + int num_elems; + void **retval; + + if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_VOIDPTR) { + *error=LIVIDO_ERROR_WRONG_ATOM_TYPE; + return NULL; + } + + if ((num_elems=livido_property_num_elements (port,key))==0) return NULL; + + if ((retval=(void **)livido_malloc(num_elems*sizeof(void *)))==NULL) { + *error=LIVIDO_ERROR_MEMORY_ALLOCATION; + return NULL; + } + + for (i=0;i + +//////////////////////////////////// IS_LIVIDO_PLUGIN +#ifdef IS_LIVIDO_PLUGIN +typedef void livido_port_t; +#endif + +#define LIVIDO_API_VERSION 100 +#define LIVIDO_PALETTE_RGB888 1 +#define LIVIDO_PALETTE_RGB24 1 +#define LIVIDO_PALETTE_BGR888 2 +#define LIVIDO_PALETTE_BGR24 2 +#define LIVIDO_PALETTE_RGBA8888 3 +#define LIVIDO_PALETTE_RGBA32 3 +#define LIVIDO_PALETTE_ARGB8888 4 +#define LIVIDO_PALETTE_ARGB32 4 +#define LIVIDO_PALETTE_RGBFLOAT 5 +#define LIVIDO_PALETTE_ARGBFLOAT 6 +#define LIVIDO_PALETTE_RGB565 7 +#define LIVIDO_PALETTE_YUV422P 513 +#define LIVIDO_PALETTE_YV16 513 +#define LIVIDO_PALETTE_YUV420P 514 +#define LIVIDO_PALETTE_YV12 514 +#define LIVIDO_PALETTE_YVU420P 515 +#define LIVIDO_PALETTE_I420 515 +#define LIVIDO_PALETTE_YUV444P 516 +#define LIVIDO_PALETTE_YUV4444P 517 +#define LIVIDO_PALETTE_YUYV8888 518 +#define LIVIDO_PALETTE_UYVY8888 519 +#define LIVIDO_PALETTE_YUV411 520 +#define LIVIDO_PALETTE_YUV888 521 +#define LIVIDO_PALETTE_YUVA8888 522 +#define LIVIDO_PALETTE_A1 1025 +#define LIVIDO_PALETTE_A8 1026 +#define LIVIDO_PALETTE_AFLOAT 1027 +#define LIVIDO_FILTER_NON_REALTIME (1<<0) +#define LIVIDO_FILTER_CAN_DO_INPLACE (1<<1) +#define LIVIDO_FILTER_NON_STATELESS (1<<2) +#define LIVIDO_FILTER_IS_CONVERTOR (1<<3) +#define LIVIDO_CHANNEL_CHANGE_UNADVISED (1<<0) +#define LIVIDO_CHANNEL_PALETTE_UNADVISED (1<<1) +#define LIVIDO_PARAMETER_CHANGE_UNADVISED (1<<0) +#define LIVIDO_PROPERTY_READONLY (1<<0) +#define LIVIDO_YUV_SAMPLING_NONE 0 +#define LIVIDO_YUV_SAMPLING_SMPTE 1 +#define LIVIDO_YUV_SAMPLING_JPEG 2 +#define LIVIDO_YUV_SAMPLING_MPEG2 3 +#define LIVIDO_YUV_SAMPLING_DVPAL 4 +#define LIVIDO_YUV_SAMPLING_DVNTSC 5 +#define LIVIDO_INTERLACE_NONE 0 +#define LIVIDO_INTERLACE_TOPFIRST 1 +#define LIVIDO_INTERLACE_BOTTOMFIRST 2 +#define LIVIDO_INTERLACE_PROGRESSIVE 3 +#define LIVIDO_NO_ERROR 0 +#define LIVIDO_ERROR_MEMORY_ALLOCATION 1 +#define LIVIDO_ERROR_PROPERTY_READONLY 2 +#define LIVIDO_ERROR_NOSUCH_ELEMENT 3 +#define LIVIDO_ERROR_NOSUCH_PROPERTY 4 +#define LIVIDO_ERROR_WRONG_ATOM_TYPE 5 +#define LIVIDO_ERROR_TOO_MANY_INSTANCES 6 +#define LIVIDO_ERROR_HARDWARE 7 +#define LIVIDO_ATOM_TYPE_INT 1 +#define LIVIDO_ATOM_TYPE_DOUBLE 2 +#define LIVIDO_ATOM_TYPE_BOOLEAN 3 +#define LIVIDO_ATOM_TYPE_STRING 4 +#define LIVIDO_ATOM_TYPE_VOIDPTR 65 +#define LIVIDO_ATOM_TYPE_PORTPTR 66 +#define LIVIDO_PORT_TYPE_PLUGIN_INFO 1 +#define LIVIDO_PORT_TYPE_FILTER_CLASS 2 +#define LIVIDO_PORT_TYPE_FILTER_INSTANCE 3 +#define LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE 4 +#define LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE 5 +#define LIVIDO_PORT_TYPE_CHANNEL 6 +#define LIVIDO_PORT_TYPE_PARAMETER 7 +#define LIVIDO_PORT_TYPE_GUI 8 + +//#define FUNCSTRUCT +/* + Uncomment the #define above and recompile all + */ + + +typedef int (*livido_init_f) (livido_port_t * filter_instance); +typedef int (*livido_process_f) (livido_port_t * filter_instance, + double timestamp); +typedef int (*livido_deinit_f) (livido_port_t * filter_instance); + + +typedef void *(*livido_malloc_f) (size_t size); +typedef void (*livido_free_f) (void *ptr); +typedef void *(*livido_memset_f) (void *s, int c, size_t n); +typedef void *(*livido_memcpy_f) (void *dest, const void *src, size_t n); +typedef livido_port_t *(*livido_port_new_f) (int); +typedef void (*livido_port_free_f) (livido_port_t * port); +typedef int (*livido_property_set_f) (livido_port_t *, const char *, int, int, void *); +typedef int (*livido_property_get_f) (livido_port_t *, const char *, int, void *); +typedef int (*livido_property_num_elements_f) (livido_port_t *, const char *); +typedef size_t(*livido_property_element_size_f) (livido_port_t *, const char *, const int); +typedef int (*livido_property_atom_type_f) (livido_port_t *, const char *); +typedef char **(*livido_list_properties_f) (livido_port_t *); + +typedef struct +{ + void (*f)(); +// void *f; +} livido_setup_t; +typedef livido_port_t *(*livido_setup_f) (const livido_setup_t list[], int ); + +#define LIVIDO_PLUGIN \ +static livido_port_t *(*livido_port_new) (int) = 0;\ +static void (*livido_port_free) (livido_port_t * port) = 0;\ +static int (*livido_property_set) (livido_port_t * port,const char *key, int atom_type, int num_elems, void *value) = 0;\ +static int (*livido_property_get) (livido_port_t * port,const char *key, int idx, void *value) = 0;\ +static int (*livido_property_num_elements) (livido_port_t * port,const char *key) = 0;\ +static int (*livido_property_atom_type) (livido_port_t * port,const char *key) = 0;\ +static size_t(*livido_property_element_size) (livido_port_t * port,const char *key, const int idx) = 0;\ +static char **(*livido_list_properties) (livido_port_t * port) = 0;\ +static void *(*livido_malloc) (size_t size) = 0;\ +static void (*livido_free) (void *ptr) = 0;\ +static void *(*livido_memset) (void *s, int c, size_t n) = 0;\ +static void *(*livido_memcpy) (void *dest, const void *src, size_t n) = 0;\ + + +/* Using void* to pass base address of function, needs explicit typecast and host + must match ordering */ +#define LIVIDO_IMPORT(list) \ +{\ + livido_malloc = (livido_malloc_f) list[0].f;\ + livido_free = (livido_free_f) list[1].f;\ + livido_memset = (livido_memset_f) list[2].f;\ + livido_memcpy = (livido_memcpy_f) list[3].f;\ + livido_port_free = (livido_port_free_f) list[5].f;\ + livido_port_new = (livido_port_new_f) list[4].f;\ + livido_property_set = (livido_property_set_f) list[6].f;\ + livido_property_get = (livido_property_get_f) list[7].f;\ + livido_property_num_elements = (livido_property_num_elements_f) list[8].f;\ + livido_property_atom_type = (livido_property_atom_type_f) list[9].f;\ + livido_property_element_size = (livido_property_element_size_f) list[10].f;\ + livido_list_properties = (livido_list_properties_f) list[11].f;\ +} + +LIVIDO_END_DECLS +#endif // #ifndef __LIVIDO_H__ diff --git a/veejay-ng/pluginpack/lvd_cartonize.c b/veejay-ng/pluginpack/lvd_cartonize.c new file mode 100644 index 00000000..4ccd735b --- /dev/null +++ b/veejay-ng/pluginpack/lvd_cartonize.c @@ -0,0 +1,187 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2006 Niels Elburg + * See COPYING for software license and distribution details + */ + + +#define IS_LIVIDO_PLUGIN +#include +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + return LIVIDO_NO_ERROR; +} + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + int len =0; + int i = 0; + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + + int palette[3]; + int w[3]; + int h[3]; + + int error = lvd_extract_channel_values( my_instance, "in_channels", 0, &w[0], &h[0], A, &palette[0] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + + error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w[1],&h[1], O,&palette[1] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + +#ifdef STRICT_CHECKING + assert( w[0] == w[1] ); + assert( h[0] == h[1] ); + assert( palette[0] == palette[1] ); + assert( A[0] != NULL ); + assert( A[1] != NULL ); + assert( A[2] != NULL ); + assert( O[0] != NULL ); + assert( O[1] != NULL ); + assert( O[2] != NULL ); +#endif + + int uv_len = lvd_uv_plane_len( palette[0],w[0],h[0] ); + len = w[0] * h[0]; + + double db[3]; + for( i = 0; i < 3 ; i ++ ) + db[i] = lvd_extract_param_number( my_instance, "in_parameters",i); + int base = (const int) (db[0] * 255.0); + int ubase = (const int) (db[1] * 255.0); + int vbase = (const int) (db[2] * 255.0); + if( ubase <= 0 ) + ubase = 1; + if( vbase <= 0 ) + vbase = 1; + if( base <= 0) + base = 1; + uint8_t tmp; + int p; + + for( i = 0; i < len; i ++ ) + { + tmp = A[0][i]; + O[0][i] = (tmp/base) * base; + } + + if( db[1] > 0.0 ) + for( i = 0; i < uv_len ; i ++ ) + { + p = A[1][i] - 128; + O[1][i] = (p / ubase) * ubase + 128; + } + if( db[2] > 0.0 ) + for( i = 0; i < uv_len ; i ++ ) + { + p = A[2][i] - 128; + O[2][i] = (p / vbase) * vbase + 128; + } + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[3]; + livido_port_t *in_chans[1]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + livido_set_string_value( port, "name", "Cartonize"); + livido_set_string_value( port, "description", "Reduces pixel depth"); + livido_set_string_value( port, "author", "Niels Elburg"); + + livido_set_int_value( port, "flags", 0); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + int palettes0[] = { + LIVIDO_PALETTE_YUV420P, + LIVIDO_PALETTE_YUV422P, + LIVIDO_PALETTE_YUV444P, + 0 + }; + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + + livido_set_string_value( port, "name", "Channel A"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + livido_set_string_value(port, "name", "Y base" ); + livido_set_string_value(port, "kind", "NUMBER" ); + livido_set_double_value( port, "min", 0.0 ); + livido_set_double_value( port, "max", 1.0 ); + livido_set_double_value( port, "default", 1.0 ); + livido_set_string_value( port, "description" ,"Scale all luminance pixels to a set value"); + + in_params[1] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[1]; + + livido_set_string_value(port, "name", "U base" ); + livido_set_string_value(port, "kind", "NUMBER" ); + livido_set_double_value( port, "min", 0.0 ); + livido_set_double_value( port, "max", 1.0 ); + livido_set_double_value( port, "default", 1.0 ); + livido_set_string_value( port, "description" ,"Scale all pixels to a set value"); + + in_params[2] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[2]; + + livido_set_string_value(port, "name", "V base" ); + livido_set_string_value(port, "kind", "NUMBER" ); + livido_set_double_value( port, "min", 0.0 ); + livido_set_double_value( port, "max", 1.0 ); + livido_set_double_value( port, "default", 1.0 ); + livido_set_string_value( port, "description" ,"Scale all pixels to a set value"); + + livido_set_portptr_array( filter, "in_channel_templates", 1 , in_chans ); + livido_set_portptr_array( filter, "out_parameter_templates",0, NULL ); + livido_set_portptr_array( filter, "in_parameter_templates",3, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-ng/pluginpack/lvd_magmir.c b/veejay-ng/pluginpack/lvd_magmir.c new file mode 100644 index 00000000..a5b481b0 --- /dev/null +++ b/veejay-ng/pluginpack/lvd_magmir.c @@ -0,0 +1,261 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2006 Niels Elburg + * See COPYING for software license and distribution details + */ + + +#define IS_LIVIDO_PLUGIN +#include +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" + + +typedef struct +{ + double *x; + double *y; + int *cx; + int *cy; + double last[2]; +} magicmirror_t; + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + int w=0; + int h=0; + magicmirror_t *m = (magicmirror_t*) livido_malloc( sizeof(magicmirror_t)); + livido_memset( m, 0, sizeof( magicmirror_t )); + + lvd_extract_dimensions( my_instance, "out_channels", &w, &h ); + + m->x = (double*) livido_malloc( sizeof(double) * w ); + m->y = (double*) livido_malloc( sizeof(double) * h ); + + m->cx = (int*) livido_malloc(sizeof(int) * w ); + m->cy = (int*) livido_malloc(sizeof(int) * h ); + + livido_memset( m->x, 0, sizeof(double) * w ); + livido_memset( m->y, 0, sizeof(double) * h ); + livido_memset( m->cx,0, sizeof(int) * w ); + livido_memset( m->cy,0, sizeof(int) * h ); + + + int error = livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR, 1, &m ); + + return error; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + magicmirror_t *m = NULL; + int error = livido_property_get( my_instance, "PLUGIN_private", + 0, &m ); +#ifdef STRICT_CHECKING + assert( m != NULL ); +#endif + livido_free( m->x ); + livido_free( m->y ); + livido_free( m->cx ); + livido_free( m->cy ); + livido_free( m ); + + livido_property_set( my_instance , "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR, 0, NULL ); + + return error; +} + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + int len =0; + int x, y; + unsigned int i,q; + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + + int palette[3]; + int w[3]; + int h[3]; + + double p[4]; + for( i = 0; i < 4; i ++ ) + p[i] = lvd_extract_param_number( my_instance, "in_parameters", i ); + + int error = lvd_extract_channel_values( my_instance, "in_channels", 0, &w[0], &h[0], A, &palette[0] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + + error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w[1],&h[1], O,&palette[1] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + + magicmirror_t *mm = NULL; + + error = livido_property_get( my_instance, "PLUGIN_private", 0, &mm ); + +#ifdef STRICT_CHECKING + assert( w[0] == w[1] ); + assert( h[0] == h[1] ); + assert( palette[0] == palette[1] ); + assert( A[0] != NULL ); + assert( A[1] != NULL ); + assert( A[2] != NULL ); + assert( O[0] != NULL ); + assert( O[1] != NULL ); + assert( O[2] != NULL ); + assert( mm != NULL ); +#endif + + p[0] *= w[0]; + p[1] *= h[0]; + p[2] = p[2] * 0.001; + p[3] = p[3] * 0.001; + + if( mm->last[0] != p[2] ) + { + mm->last[0] = p[2]; + for( x = 0; x < w[0]; x ++ ) + fast_sin( mm->x[x], (double)(x * p[2])); + } + if( mm->last[1] != p[3] ) + { + mm->last[1] = p[3]; + for( y = 0; y < h[0]; y ++ ) + fast_sin( mm->y[y], (double)(y * p[3])); + } + + for( x = 0; x < w[0]; x ++ ) + { + int dx = x + mm->x[x] * p[0]; + if( dx < 0) dx += w[0]; + if( dx < 0) dx = 0; else if (dx >= w[0] ) dx = w[0] - 1; + mm->cx[x] = dx; + } + for( y = 0; y < h[0]; y ++ ) + { + int dy = y + mm->y[y] * p[1]; + if( dy < 0) dy += h[0]; + if( dy < 0) dy = 0; else if (dy >= h[0] ) dy = h[0] - 1; + mm->cy[y] = dy; + } + for( y = 1; y < h[0] - 1; y ++ ) + { + for ( x = 1; x < w[0] - 1; x ++ ) + { + i = mm->cy[y] * w[0] + mm->cx[x]; + q = y * w[0] + x; + O[0][q] = A[0][i]; + O[1][q] = A[1][i]; + O[2][q] = A[2][i]; + } + } + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[4]; + livido_port_t *in_chans[1]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + livido_set_string_value( port, "name", "MagicMirror"); + livido_set_string_value( port, "description", "Look into the mirror just like in a fun house"); + livido_set_string_value( port, "author", "Niels Elburg"); + + livido_set_int_value( port, "flags", 0); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + int palettes0[] = { + LIVIDO_PALETTE_YUV444P, + 0 + }; + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + + livido_set_string_value( port, "name", "Channel A"); + livido_set_int_array( port, "palette_list", 2, palettes0); + livido_set_int_value( port, "flags", 0); + + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 2, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "X" ); + livido_set_string_value(port, "kind", "NUMBER" ); + livido_set_double_value( port, "min", 0.0 ); + livido_set_double_value( port, "max", 1.0 ); + livido_set_double_value( port, "default", 0.1 ); + livido_set_string_value( port, "description" ,"Displace horizontally"); + + in_params[1] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[1]; + + livido_set_string_value(port, "name", "Y" ); + livido_set_string_value(port, "kind", "NUMBER" ); + livido_set_double_value( port, "min", 0.0 ); + livido_set_double_value( port, "max", 1.0 ); + livido_set_double_value( port, "default", 0.1 ); + livido_set_string_value( port, "description" ,"Displace vertically"); + + in_params[2] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[2]; + + livido_set_string_value(port, "name", "DegX" ); + livido_set_string_value(port, "kind", "NUMBER" ); + livido_set_double_value( port, "min", 0.0 ); + livido_set_double_value( port, "max", 360.0 ); + livido_set_double_value( port, "default", 1.2 ); + livido_set_string_value( port, "description" ,"DegreeX"); + + in_params[3] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[3]; + + livido_set_string_value(port, "name", "DegY" ); + livido_set_string_value(port, "kind", "NUMBER" ); + livido_set_double_value( port, "min", 0.0 ); + livido_set_double_value( port, "max", 360.0 ); + livido_set_double_value( port, "default", 1.3 ); + livido_set_string_value( port, "description" ,"DegreeY"); + + + livido_set_portptr_array( filter, "in_channel_templates", 1 , in_chans ); + livido_set_portptr_array( filter, "out_parameter_templates",0, NULL ); + livido_set_portptr_array( filter, "in_parameter_templates",4, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-ng/pluginpack/lvd_negation.c b/veejay-ng/pluginpack/lvd_negation.c new file mode 100644 index 00000000..54e4c964 --- /dev/null +++ b/veejay-ng/pluginpack/lvd_negation.c @@ -0,0 +1,146 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2006 Niels Elburg + * See COPYING for software license and distribution details + */ + + +#define IS_LIVIDO_PLUGIN +#include +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + return LIVIDO_NO_ERROR; +} + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + int len =0; + int i = 0; + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + + int palette[3]; + int w[3]; + int h[3]; + + int error = lvd_extract_channel_values( my_instance, "in_channels", 0, &w[0], &h[0], A, &palette[0] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + + error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w[1],&h[1], O,&palette[1] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + +#ifdef STRICT_CHECKING + assert( w[0] == w[1] ); + assert( h[0] == h[1] ); + assert( palette[0] == palette[1] ); + assert( A[0] != NULL ); + assert( A[1] != NULL ); + assert( A[2] != NULL ); + assert( O[0] != NULL ); + assert( O[1] != NULL ); + assert( O[2] != NULL ); +#endif + + int uv_len = lvd_uv_plane_len( palette[0],w[0],h[0] ); + len = w[0] * h[0]; + + + if( !lvd_is_yuv444( palette[0]) ) + { + for( i = 0; i < len; i ++ ) + O[0][i] = 255 - A[0][i]; + for( i = 0; i < uv_len; i ++ ) + { + O[1][i] = 255 - A[1][i]; + O[2][i] = 255 - A[2][i]; + } + } + else + { + for( i = 0; i < len ; i ++ ) + { + O[0][i] = 255 - A[0][i]; + O[1][i] = 255 - A[1][i]; + O[2][i] = 255 - A[2][i]; + } + } + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[1]; + livido_port_t *in_chans[3]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + livido_set_string_value( port, "name", "Negation"); + livido_set_string_value( port, "description", "Negates the image"); + livido_set_string_value( port, "author", "Niels Elburg"); + + livido_set_int_value( port, "flags", 0); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + int palettes0[] = { + LIVIDO_PALETTE_YUV420P, + LIVIDO_PALETTE_YUV422P, + LIVIDO_PALETTE_YUV444P, + 0 + }; + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + + livido_set_string_value( port, "name", "Channel A"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + livido_set_portptr_array( filter, "in_channel_templates", 1 , in_chans ); + livido_set_portptr_array( filter, "out_parameter_templates",0, NULL ); + livido_set_portptr_array( filter, "in_parameter_templates",0, NULL ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + //livido_set_portptr_array( filter, "out_channel_templates", 0, NULL ); + + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-ng/pluginpack/lvd_opacity.c b/veejay-ng/pluginpack/lvd_opacity.c new file mode 100644 index 00000000..04217720 --- /dev/null +++ b/veejay-ng/pluginpack/lvd_opacity.c @@ -0,0 +1,181 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2006 Niels Elburg + * See COPYING for software license and distribution details + */ + + +#define IS_LIVIDO_PLUGIN +#include +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + return LIVIDO_NO_ERROR; +} + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + int len =0; + int i = 0; + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + uint8_t *B[4] = { NULL,NULL,NULL,NULL }; + int palette[3]; + int w[3]; + int h[3]; + + int error = lvd_extract_channel_values( my_instance, "in_channels", 0, &w[0], &h[0], A, &palette[0] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + + error = lvd_extract_channel_values( my_instance, "in_channels", 1, &w[1], &h[1], B, &palette[1] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + + + + error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w[2],&h[2], O,&palette[2] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + +#ifdef STRICT_CHECKING + assert( w[0] == w[1] ); + assert( h[0] == h[1] ); + assert( w[2] == w[1] ); + assert( h[2] == h[1] ); + assert( palette[0] == palette[1] ); + assert( palette[2] == palette[1] ); + assert( A[0] != NULL ); + assert( A[1] != NULL ); + assert( A[2] != NULL ); + assert( B[0] != NULL ); + assert( B[1] != NULL ); + assert( B[2] != NULL ); + assert( O[0] != NULL ); + assert( O[1] != NULL ); + assert( O[2] != NULL ); +#endif + + int uv_len = lvd_uv_plane_len( palette[0],w[0],h[0] ); + len = w[0] * h[0]; + + uint8_t op0; + uint8_t op1; + + double opacity = lvd_extract_param_number( my_instance, "in_parameters", 0 ); + + op1 = (uint8_t) (opacity * 255.0); + op0 = 255 - op1; + + if( !lvd_is_yuv444( palette[0]) ) + { + for( i = 0; i < len; i ++ ) + O[0][i] = (op0 * A[0][i] + op1 * B[0][i]) >> 8; + for( i = 0; i < uv_len; i ++ ) + { + O[1][i] = (op0 * A[1][i] + op1 * B[1][i]) >> 8; + O[2][i] = (op0 * A[2][i] + op1 * B[2][i]) >> 8; + } + } + else + { + for( i = 0; i < len ; i ++ ) + { + O[0][i] = (op0 * A[0][i] + op1 * B[0][i]) >> 8; + O[1][i] = (op0 * A[1][i] + op1 * B[1][i]) >> 8; + O[2][i] = (op0 * A[2][i] + op1 * B[2][i]) >> 8; + } + } + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[1]; + livido_port_t *in_chans[2]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + + port = filter; + + livido_set_string_value( port, "name", "Normal Overlay"); + livido_set_string_value( port, "description", "Overlay by Opacity"); + livido_set_string_value( port, "author", "Niels Elburg"); + + livido_set_int_value( port, "flags", 0); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + int palettes0[] = { + LIVIDO_PALETTE_YUV420P, + LIVIDO_PALETTE_YUV422P, + LIVIDO_PALETTE_YUV444P, + 0 + }; + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "Opacity" ); + livido_set_string_value(port, "kind", "NUMBER" ); + livido_set_double_value( port, "min", 0.0 ); + livido_set_double_value( port, "max", 1.0 ); + livido_set_double_value( port, "default", 0.1 ); + livido_set_string_value( port, "description" ,"Transparency"); + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + + livido_set_string_value( port, "name", "Channel A"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_chans[1] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[1]; + + livido_set_string_value( port, "name", "Channel B"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + livido_set_portptr_array( filter, "in_channel_templates", 2 , in_chans ); + livido_set_portptr_array( filter, "out_parameter_templates",0, NULL ); + livido_set_portptr_array( filter, "in_parameter_templates",1, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-ng/pluginpack/lvd_pencilsketch.c b/veejay-ng/pluginpack/lvd_pencilsketch.c new file mode 100644 index 00000000..241d25f8 --- /dev/null +++ b/veejay-ng/pluginpack/lvd_pencilsketch.c @@ -0,0 +1,295 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2006 Niels Elburg + * See COPYING for software license and distribution details + */ + + +#define IS_LIVIDO_PLUGIN +#include +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + return LIVIDO_NO_ERROR; +} +/* PenCil sketch pixel Functions + applies some artithematic on pixel a and b, +*/ + typedef uint8_t (*_pcf) (uint8_t a, uint8_t b, int t_max); + typedef uint8_t (*_pcbcr) (uint8_t a, uint8_t b); + + static uint8_t _pcf_dneg(uint8_t a, uint8_t b, int t_max) + { + uint8_t p = + 255 - ( abs ( (255 - abs((255-a)-a)) - (255-abs((255-b)-b))) ); + p = (abs(abs(p-b) - b)); + return p; + } + + static uint8_t _pcf_lghtn(uint8_t a, uint8_t b, int t_max) + { + uint8_t p = (a > b ? a : b ); + return p; + } + + static uint8_t _pcf_dneg2(uint8_t a,uint8_t b, int t_max) + { + uint8_t p = ( 255 - abs ( (255-a)- b ) ); + return p; + } + + static uint8_t _pcf_min(uint8_t a, uint8_t b, int t_max) + { + uint8_t p = ( (b < a) ? b : a); + p = ( 255 - abs( (255-p) - b ) ); + return p; + } + + static uint8_t _pcf_max(uint8_t a,uint8_t b, int t_max) + { + int p = ( (b > a) ? b : a); + p = ( 255 - ((255 - b) * (255 - b)) / p); + return (uint8_t)p; + } + + static uint8_t _pcf_pq(uint8_t a,uint8_t b, int t_max) + { + int p = 255 - ((255-a) * (255-a)) / a; + int q = 255 - ((255-b) * (255-b)) / b; + p = ( 255 - ((255-p) * (255 - a)) / q); + return (uint8_t)p; + } + static uint8_t _pcf_color(uint8_t a, uint8_t b, int t_max) + { + uint8_t p = + 255 - ( abs ( (255 - abs((255-a)-a)) - (255-abs((255-b)-b))) ); + p = (abs(abs(p-b) - b)); + p = p + b - (( p * b ) >> 8); + return p; + } + static uint8_t _pcbcr_color(uint8_t a,uint8_t b) + { + int p = a - 128; + int q = b - 128; + return ( p + q - (( p * q ) >> 8) ) + 128 ; + } + + static uint8_t _pcf_none(uint8_t a, uint8_t b, int t_max) + { + if( a >= 16 || a <= t_max) a = 16 ; else a = 240; + return a; + } + + /* get a pointer to a pixel function */ + static _pcf _get_pcf(int type) + { + + switch(type) + { + + case 0: return &_pcf_dneg; + case 3: return &_pcf_lghtn; + case 1: return &_pcf_min; + case 2: return &_pcf_max; + case 5: return &_pcf_pq; + case 6: return &_pcf_dneg2; + case 7: return &_pcf_color; + } + + return &_pcf_none; + } +/* PenCil sketch pixel Functions + applies some artithematic on pixel a and b, +*/ + + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + int len =0; + int i = 0; + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + + int palette[3]; + int w[3]; + int h[3]; + + int error = lvd_extract_channel_values( my_instance, "in_channels", 0, &w[0], &h[0], A, &palette[0] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + + error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w[1],&h[1], O,&palette[1] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + +#ifdef STRICT_CHECKING + assert( w[0] == w[1] ); + assert( h[0] == h[1] ); + assert( palette[0] == palette[1] ); + assert( A[0] != NULL ); + assert( A[1] != NULL ); + assert( A[2] != NULL ); + assert( O[0] != NULL ); + assert( O[1] != NULL ); + assert( O[2] != NULL ); +#endif + + int uv_len = lvd_uv_plane_len( palette[0],w[0],h[0] ); + len = w[0] * h[0]; + + int type = lvd_extract_param_index( my_instance, "in_parameters", 0 ); + double lt = lvd_extract_param_number( my_instance, "in_parameters", 1 ); + double ht = lvd_extract_param_number( my_instance, "in_parameters",2 ); + uint8_t min_threshold = 255 * lt; + uint8_t max_threshold = 255 * ht; + int m,d; + /* get a pointer to a pixel blend function */ + _pcf _pff = _get_pcf(type); + _pcbcr _pcbcrff = &_pcbcr_color; + + int rlen = len - w[0] - 1; + uint8_t y,yb; + for ( i = 0; i < rlen ;i ++ ) + { + yb = y = A[0][i]; + if(yb<16) + yb=16; + if( y >= min_threshold && y <= max_threshold ) + { + // sharpen + m = ( A[0][i+1] + A[0][(i + w[0])] + A[0][ (i + w[0] + 1)] + 2 ) >> 2; + d = y - m; + d *= 500; + d /= 100; + m = m + d; + /* a magical forumula to combine the pixel with the original*/ + y = ((((y << 1) - (255 - m))>>1) + A[0][i])>>1; + if(y < 16) y =16; + O[0][i] = _pff(y,yb,max_threshold); + } + else + O[0][i] = 0xff; + } + + if( type != y ) + { + livido_memset( O[1], 128, uv_len ); + livido_memset( O[2], 128, uv_len ); + } + else + { + uint8_t u,v; + for( i = 0; i < uv_len; i ++ ) + { + u = A[1][i]; + v = A[2][i]; + if( u < 16 ) u = 16; + if( v < 16 ) v = 16; + O[1][i] = _pcbcrff(128, u); + O[2][i] = _pcbcrff(128, v); + } + } + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[3]; + livido_port_t *in_chans[1]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + livido_set_string_value( port, "name", "Pencil Sketch"); + livido_set_string_value( port, "description", "Artistify Image"); + livido_set_string_value( port, "author", "Niels Elburg"); + + livido_set_int_value( port, "flags", 0); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + int palettes0[] = { + LIVIDO_PALETTE_YUV420P, + LIVIDO_PALETTE_YUV422P, + LIVIDO_PALETTE_YUV444P, + 0 + }; + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + + livido_set_string_value( port, "name", "Channel A"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "Mode" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 8 ); + livido_set_int_value( port, "default", 0 ); + livido_set_string_value( port, "description" ,"Pencil Type"); + + in_params[1] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[1]; + + livido_set_string_value(port, "name", "Min Threshold" ); + livido_set_string_value(port, "kind", "NUMBER" ); + livido_set_double_value( port, "min", 0.0 ); + livido_set_double_value( port, "max", 1.0 ); + livido_set_double_value( port, "default", 0.1 ); + livido_set_string_value( port, "description" ,"Minimum threshold"); + + in_params[2] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[2]; + livido_set_string_value(port, "name", "Maximum Threshold" ); + livido_set_string_value(port, "kind", "NUMBER" ); + livido_set_double_value( port, "min", 0.0 ); + livido_set_double_value( port, "max", 1.0 ); + livido_set_double_value( port, "default", 0.9 ); + livido_set_string_value( port, "description" ,"Maximum threshold"); + + livido_set_portptr_array( filter, "in_channel_templates", 1 , in_chans ); + livido_set_portptr_array( filter, "out_parameter_templates",0, NULL ); + livido_set_portptr_array( filter, "in_parameter_templates",3, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-ng/pluginpack/lvd_photoplay.c b/veejay-ng/pluginpack/lvd_photoplay.c new file mode 100644 index 00000000..078887d3 --- /dev/null +++ b/veejay-ng/pluginpack/lvd_photoplay.c @@ -0,0 +1,361 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2006 Niels Elburg + * See COPYING for software license and distribution details + */ + + +#define IS_LIVIDO_PLUGIN +#include +LIVIDO_PLUGIN + + +#define USE_MATRIX_PLACEMENT + +#include "utils.h" +#include "livido-utils.c" + +typedef struct +{ + uint8_t *data[3]; + int w; + int h; +} picture_t; + +typedef struct +{ + picture_t **photo_list; + int num_photos; + int frame_counter; + int frame_delay; +} photoplay_t; + +static int prepare_filmstrip(photoplay_t *p, int film_length, int w, int h ) +{ + int i,j; + int picture_width = w / sqrt(film_length); + int picture_height = h / sqrt(film_length); + + p->photo_list = (picture_t**) livido_malloc(sizeof(picture_t*) * (film_length + 1) ); +#ifdef STRICT_CHECKING + assert( p->photo_list != NULL ); +#endif + if(!p->photo_list) + return 0; + + p->num_photos = film_length; + + uint8_t val = 0; + + for ( i = 0; i < p->num_photos; i ++ ) + { + p->photo_list[i] = livido_malloc(sizeof(picture_t)); + if(!p->photo_list[i]) + return 0; + p->photo_list[i]->w = picture_width; + p->photo_list[i]->h = picture_height; + for( j = 0; j < 3; j ++ ) + { + p->photo_list[i]->data[j] = livido_malloc(sizeof(uint8_t) * picture_width * picture_height ); + if(!p->photo_list[i]->data[j]) + return 0; + memset(p->photo_list[i]->data[j], (j==0 ? 16 : 128), picture_width *picture_height ); + } + } + p->frame_counter = 0; + + return 1; + +} +static void destroy_filmstrip(photoplay_t *p) +{ + if(p) + { + int i = 0; + while(i < p->num_photos) + { + if( p->photo_list[i] ) + { + int j; + for( j = 0; j < 3; j ++ ) + if(p->photo_list[i]->data[j]) + free(p->photo_list[i]->data[j]); + free(p->photo_list[i]); + } + i++; + } + free(p->photo_list); + } + p->photo_list = NULL; + p->num_photos = 0; + p->frame_counter = 0; +} +static void take_photo( photoplay_t *p, uint8_t *plane, uint8_t *dst_plane, int w, int h, int index ) +{ + int x,y,dx,dy; + int sum; + int dst_x, dst_y; + int box_width = p->photo_list[index]->w; + int box_height = p->photo_list[index]->h; +#ifdef STRICT_CHECKING + assert( box_width > 0 ); + assert( box_height > 0 ); + assert( w > 0 ); + assert( h > 0 ); +#endif + int step_x = w / box_width; + int step_y = h / box_height; + + for( y = 0 ,dst_y = 0; y < h && dst_y < box_height; y += step_y ) + { + for( x = 0, dst_x = 0; x < w && dst_x < box_width; x+= step_x ) + { + sum = 0; + for( dy = 0; dy < step_y; dy ++ ) + { + for( dx = 0; dx < step_x; dx++) + { + sum += plane[ ((y+dy)*w+(dx+x)) ]; + } + } + if(sum > 0) + dst_plane[(dst_y*box_width)+dst_x] = sum / (step_y*step_x); + else + dst_plane[(dst_y*box_width)+dst_x] = 0; + + dst_x++; + } + dst_y++; + } +} +static void put_photo( photoplay_t *p, uint8_t *dst_plane, uint8_t *photo, int dst_w, int dst_h, int index , matrix_t matrix) +{ + int box_w = p->photo_list[index]->w; + int box_h = p->photo_list[index]->h; + int x,y; + + uint8_t *P = dst_plane + (matrix.h*dst_w); + int offset = matrix.w; + + for( y = 0; y < box_h; y ++ ) + { + for( x = 0; x < box_w; x ++ ) + { + *(P+offset+x) = photo[(y*box_w)+x]; + } + P += dst_w; + } +} + + + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + int w=0; + int h=0; + photoplay_t *p = (photoplay_t*) livido_malloc( sizeof(photoplay_t)); + livido_memset( p, 0, sizeof( photoplay_t )); + + int error = livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR, 1, &p ); + + return error; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + photoplay_t *p = NULL; + int error = livido_property_get( my_instance, "PLUGIN_private", + 0, &p ); +#ifdef STRICT_CHECKING + assert( p != NULL ); +#endif + + destroy_filmstrip( p ); + + free(p); + + livido_property_set( my_instance , "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR, 0, NULL ); + + return error; +} + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + unsigned int i,j; + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + + int palette[3]; + int w[3]; + int h[3]; + + int p1 = lvd_extract_param_index( my_instance, "in_parameters", 0 ); + int p2 = lvd_extract_param_index( my_instance, "in_parameters", 1 ); + int p3 = lvd_extract_param_index( my_instance, "in_parameters", 2 ); + + int error = lvd_extract_channel_values( my_instance, "in_channels", 0, &w[0], &h[0], A, &palette[0] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + + error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w[1],&h[1], O,&palette[1] ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky + + photoplay_t *p = NULL; + error = livido_property_get( my_instance, "PLUGIN_private", 0, &p ); + +#ifdef STRICT_CHECKING + assert( w[0] == w[1] ); + assert( h[0] == h[1] ); + assert( palette[0] == palette[1] ); + assert( A[0] != NULL ); + assert( A[1] != NULL ); + assert( A[2] != NULL ); + assert( O[0] != NULL ); + assert( O[1] != NULL ); + assert( O[2] != NULL ); + assert( p != NULL ); +#endif + + matrix_f matrix_placement = get_matrix_func( p3 ); + + if( (p1*p1) != p->num_photos || p->num_photos == 0) + { + destroy_filmstrip(p); + prepare_filmstrip(p, (p1*p1), w[0],h[0]); + p->frame_delay = 0; + } + + if( p->frame_delay ) + p->frame_delay --; + + if( p->frame_delay == 0 ) + { + for( i = 0; i < 3 ; i ++ ) + take_photo( + p, + A[i], + p->photo_list[ (p->frame_counter % p->num_photos) ]->data[i], + w[0], + h[0], + (p->frame_counter % p->num_photos ) + ); + p->frame_delay = p2; + } + + for( i = 0; i < p->num_photos; i ++ ) + { + for( j = 0; j < 3 ; j ++ ) + { + put_photo( + p, + O[j], + p->photo_list[i]->data[j], + w[0], + h[0], + i, + matrix_placement( i, p1,w[0],h[0] ) + ); + } + } + + if( p->frame_delay == p2 ) + p->frame_counter ++; + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[3]; + livido_port_t *in_chans[1]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + livido_set_string_value( port, "name", "PhotoPlay"); + livido_set_string_value( port, "description", "Create a filmstrip of many small images"); + livido_set_string_value( port, "author", "Niels Elburg"); + + livido_set_int_value( port, "flags", 0); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + int palettes0[] = { + LIVIDO_PALETTE_YUV444P, + 0 + }; + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + + livido_set_string_value( port, "name", "Channel A"); + livido_set_int_array( port, "palette_list", 2, palettes0); + livido_set_int_value( port, "flags", 0); + + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 2, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "Square size" ); + livido_set_string_value(port, "kind", "INDEX" ); //@ visual representation could be different + livido_set_int_value( port, "min", 2 ); + livido_set_int_value( port, "max", 64 ); + livido_set_int_value( port, "default", 4 ); + livido_set_string_value( port, "description" ,"Number of Squares"); + + in_params[1] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[1]; + + livido_set_string_value(port, "name", "Shutter" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 2500 ); + livido_set_int_value( port, "default", 1 ); + livido_set_string_value( port, "description" ,"Shutter speed"); + + in_params[2] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[2]; + + livido_set_string_value(port, "name", "Mode" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 3 ); + livido_set_int_value( port, "default", 0 ); + livido_set_string_value( port, "description" ,"Placement"); + + livido_set_portptr_array( filter, "in_channel_templates", 1 , in_chans ); + livido_set_portptr_array( filter, "out_parameter_templates",0, NULL ); + livido_set_portptr_array( filter, "in_parameter_templates",3, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-ng/pluginpack/utils.h b/veejay-ng/pluginpack/utils.h new file mode 100644 index 00000000..a701dc66 --- /dev/null +++ b/veejay-ng/pluginpack/utils.h @@ -0,0 +1,245 @@ +#ifndef LVDUTILSFX +#define LVDUTILSFX + +#include +#include +#ifdef STRICT_CHECKING +#include +#endif + +#include + +#ifdef ARCH_X86 +#define fast_sin(d,x) asm("fsin" : "=t" (d) : "0" (x)) +#define fast_cos(d,x) asm("fcos" : "=t" (d) : "0" (x)) +#else +#define fast_sin(d,x) d = sin(x) +#define fast_cos(d,x) d = cos(x) +#endif + +#ifdef USE_MATRIX_PLACEMENT +typedef struct +{ + int w; + int h; +} matrix_t; + +typedef matrix_t (*matrix_f)(int i, int s, int w, int h); +static matrix_t matrix_placementA(int photoindex, int size, int w , int h); +static matrix_t matrix_placementB(int photoindex, int size, int w , int h); +static matrix_f get_matrix_func(int type); + +static matrix_t matrix_placementA(int photoindex, int size, int w , int h) +{ + matrix_t m; + m.w = (photoindex % size) * (w/size); + m.h = (photoindex / size) * (h/size); + return m; +} + +static matrix_t matrix_placementB(int photoindex, int size, int w , int h) +{ + matrix_t m; + m.w = (photoindex/size) * (w/size); + m.h = (photoindex % size) * (h/size); + return m; +} + +static matrix_t matrix_placementC(int photoindex, int size, int w , int h) +{ + matrix_t m; + int n = size*size-1; + m.w = ((n-photoindex) % size) * (w/size); + m.h = ((n-photoindex) / size) * (h/size); + return m; +} + +static matrix_t matrix_placementD(int photoindex, int size, int w , int h) +{ + matrix_t m; + int n = size*size-1; + m.w = ((n-photoindex) / size) * (w/size); + m.h = ((n-photoindex) % size) * (h/size); + return m; +} + +static matrix_f get_matrix_func(int type) +{ + if(type==0) + return &matrix_placementA; + if(type==1) + return &matrix_placementB; + if(type==2) + return &matrix_placementC; + return &matrix_placementD; +} +#endif + +static int power_of(int size) +{ + int power = 1; + while( size-- ) + power *= 2; + + return power; +} + +static int max_power(int w) +{ + int i=1; + while(power_of(i) < w) + i++; + return i; +} + +static int lvd_is_yuv444( int palette ) +{ + if( palette == LIVIDO_PALETTE_YUV444P ) + return 1; + return 0; +} + +static int lvd_uv_plane_len( int palette, int w, int h ) +{ + switch(palette) + { + case LIVIDO_PALETTE_YUV422P: + return ( (w * h)/2 ); + break; + case LIVIDO_PALETTE_YUV420P: + return ( (w/2) * (h/2) ); + break; + case LIVIDO_PALETTE_YUV444P: + return (w*h); + break; + default: +#ifdef STRICT_CHECKING + assert(0); +#endif + break; + + } + return 0; +} + +static double lvd_extract_param_number( livido_port_t *instance, const char *pname, int n ) +{ + double pn = 0.0; + livido_port_t *c = NULL; + int error = livido_property_get( instance, pname,n, &c ); +#ifdef STRICT_CHECKING + assert( error == LIVIDO_NO_ERROR ); +#endif + + error = livido_property_get( c, "value", 0, &pn ); +#ifdef STRICT_CHECKING + assert( error == LIVIDO_NO_ERROR ); +#endif + return pn; +} + + +static int lvd_extract_param_index( livido_port_t *instance, const char *pname, int n ) +{ + int pn = 0; + livido_port_t *c = NULL; + int error = livido_property_get( instance, pname,n, &c ); +#ifdef STRICT_CHECKING + assert( error == LIVIDO_NO_ERROR ); +#endif + + error = livido_property_get( c, "value", 0, &pn ); +#ifdef STRICT_CHECKING + assert( error == LIVIDO_NO_ERROR ); +#endif + return pn; +} + +static int lvd_extract_param_boolean( livido_port_t *instance, const char *pname, int n ) +{ + int pn = 0; + livido_port_t *c = NULL; + int error = livido_property_get( instance, pname,n, &c ); +#ifdef STRICT_CHECKING + assert( error == LIVIDO_NO_ERROR ); +#endif + + error = livido_property_get( c, "value", 0, &pn ); +#ifdef STRICT_CHECKING + assert( error == LIVIDO_NO_ERROR ); +#endif + return pn; +} +static void lvd_set_param_number( livido_port_t *instance, const char *pname,int id, double num ) +{ + livido_port_t *c = NULL; + int error = livido_property_get( instance, pname,id, &c ); +#ifdef STRICT_CHECKING + assert( error == LIVIDO_NO_ERROR ); +#endif + error = livido_property_set( c, "value",LIVIDO_ATOM_TYPE_DOUBLE, 1, &num ); + +#ifdef STRICT_CHECKING + assert( error == LIVIDO_NO_ERROR ); +#endif +} + + +static void lvd_extract_dimensions( livido_port_t *instance,const char *name, int *w, int *h ) +{ + livido_port_t *channel = NULL; + int error = livido_property_get( instance, name, 0, &channel ); +#ifdef STRICT_CHECKING + assert( error == LIVIDO_NO_ERROR ); +#endif + error = livido_property_get( channel, "width", 0, w ); +#ifdef STRICT_CHECKING + assert( error == LIVIDO_NO_ERROR ); +#endif + error = livido_property_get( channel, "height",0, h ); +#ifdef STRICT_CHECKING + assert( error == LIVIDO_NO_ERROR ); +#endif +} + +static int lvd_extract_channel_values( livido_port_t *instance, + const char *pname, + int n, + int *w, + int *h, + uint8_t **pixel_data, + int *palette ) +{ + livido_port_t *c = NULL; + int error = livido_property_get( instance, pname,n, &c ); + error = livido_property_get( c, "width", 0,w ); +#ifdef STRICT_CHECKING + if(error!=LIVIDO_NO_ERROR) printf("%s: width not found\n",__FUNCTION__); + assert( error == LIVIDO_NO_ERROR ); +#endif + error = livido_property_get( c, "height",0,h ); +#ifdef STRICT_CHECKING + if(error!=LIVIDO_NO_ERROR) printf("%s: height not found\n",__FUNCTION__); + + assert( error == LIVIDO_NO_ERROR ); +#endif + error = livido_property_get( c, "current_palette",0, palette ); +#ifdef STRICT_CHECKING + if(error!=LIVIDO_NO_ERROR) printf("%s: current_palette not found\n",__FUNCTION__); + + assert( error == LIVIDO_NO_ERROR ); +#endif + int i = 0; + for( i = 0; i <4 ; i ++ ) + { + error = livido_property_get( c, "pixel_data", i, &(pixel_data[i])); +#ifdef STRICT_CHECKING + if( error != LIVIDO_NO_ERROR ) + printf("%s: pixel_data[%d] not set in %s %d\n",__FUNCTION__,i,pname,n); + assert( error == LIVIDO_NO_ERROR ); +#endif + } + return LIVIDO_NO_ERROR; +} + +#endif diff --git a/veejay-ng/veejay/liblavplayvj.c b/veejay-ng/veejay/liblavplayvj.c index f3af3655..2d2bc7b2 100644 --- a/veejay-ng/veejay/liblavplayvj.c +++ b/veejay-ng/veejay/liblavplayvj.c @@ -77,6 +77,7 @@ #include #include #include +#include #include #include #include @@ -135,7 +136,7 @@ int veejay_osc_verify_format( void *vevo_port, char const *types ) return 0; } -int veejay_osc_property_calls_event( void *instance, const char *path, char *types, void **argv[] ) +int veejay_osc_property_calls_event( void *instance, const char *path, char *types, void **argv[], void *raw ) { veejay_t *v = (veejay_t*) instance; void *vevo_port = v->osc_namespace; @@ -154,7 +155,7 @@ int veejay_osc_property_calls_event( void *instance, const char *path, char *ty error = vevo_property_get( port, "func",0,&f ); if( error == VEVO_NO_ERROR ) { - (*f)( instance,path, types, argv ); + (*f)( instance,path, types, argv,raw ); return 1; } } @@ -472,8 +473,6 @@ int veejay_push_results( veejay_t *info ) { sample_video_info_t *vid_info = info->video_info; - // must lock! - VJFrame *ref = performer_get_output_frame( info ); switch( info->use_display ) @@ -490,6 +489,26 @@ int veejay_push_results( veejay_t *info ) return 1; } + +void veejay_lock( veejay_t *info , const char *f) +{ +// veejay_msg(0, "%s locks", f); + int n = pthread_mutex_lock( &(info->vevo_mutex) ); +#ifdef STRICT_CHECKING + assert( n == 0 ); +#endif +} + +void veejay_unlock( veejay_t *info, const char *f ) +{ + int n = pthread_mutex_unlock( &(info->vevo_mutex) ); +#ifdef STRICT_CHECKING + assert(n == 0 ); +#endif +// veejay_msg(0, "%s unlocks",f); +} + + //! Veejay Software Playback thread /**! \param arg Veejay Object @@ -602,8 +621,6 @@ int veejay_open(veejay_t * info) memset( &(settings->lastframe_completion), 0, sizeof(struct timeval)); pthread_mutex_init(&(settings->valid_mutex), NULL); pthread_mutex_init(&(settings->syncinfo_mutex), NULL); - pthread_mutex_init( &(info->vevo_mutex), 0 ); - /* Invalidate all buffers, and initialize the conditions */ settings->valid[0] = 0; settings->buffer_entry[0] = 0; @@ -750,22 +767,36 @@ int veejay_close(veejay_t * info) void veejay_deinit(veejay_t *info) { - //vj_event_stop(); - samplebank_free(); + char **items = vevo_list_properties( info->clients ); + int i; + if(items!=NULL) + { + for( i = 0; items[i] != NULL ; i ++ ) + { + void *s = NULL; + if(vevo_property_get(info->clients, items[i],0,&s)==VEVO_NO_ERROR) + veejay_free_osc_sender( s ); + free(items[i]); + } + free(items); + } + veejay_osc_del_methods( info,info->osc_namespace,info ,info); + //vj_event_stop(); + samplebank_free(); vevo_port_recursive_free( info->osc_namespace ); - + vevo_port_free( info->clients ); // vj_server_shutdown(info->status_socket); // vj_server_shutdown(info->command_socket); // vj_server_shutdown(info->frame_socket); - veejay_free_osc_server(info->osc_server ); plug_sys_free(); - performer_destroy(info); + if(info->performer) + performer_destroy(info); vj_el_deinit(); } @@ -874,69 +905,13 @@ int veejay_init(veejay_t * info) veejay_msg(VEEJAY_MSG_INFO, "Loading plugins"); int n = plug_sys_detect_plugins(); veejay_msg(VEEJAY_MSG_INFO, "\tPlugin(s) loaded: %d", n); -// veejay_msg(VEEJAY_MSG_INFO,"Loaded %d Plugins",n); - -/* vj_event_init(); - - if(!vj_server_setup(info)) - { - veejay_msg(0, "Cannot setup service"); - return -1; - } - else - { - veejay_msg(VEEJAY_MSG_INFO, "TCP/UDP service (port range %d-%d)", - info->port_offset, info->port_offset+5); - }*/ - + if(info->itu601) + veejay_msg(VEEJAY_MSG_INFO, "\tKeep video data in ITU601"); vj_el_set_itu601_preference( info->itu601 ); - - //load_video_settings - // - // -/* if(sample_fx_set( id, 0,5 )) - { - veejay_msg(VEEJAY_MSG_INFO, "Loaded effect 2"); - sample_fx_set_in_channel(id,0,0,id ); - //sample_set_fx_alpha( sample, 0,100 ); - sample_toggle_process_entry( sample, 0, 1 ); - }*/ -/* if(sample_fx_set( id, 1,2 )) - { - veejay_msg(VEEJAY_MSG_INFO, "Loaded effect 2"); - sample_fx_set_in_channel(id,1,0,id ); - //sample_set_fx_alpha( sample, 0,100 ); - sample_toggle_process_entry( sample, 1, 1 ); - }*/ - - - //sample_cache_data( info->current_sample ); - - /* - if(info->current_edit_list->has_audio) { - if (vj_perform_init_audio(info) == 0) - veejay_msg(VEEJAY_MSG_INFO, "Initialized Audio Task"); - else - veejay_msg(VEEJAY_MSG_ERROR, - "Unable to initialize Audio Task"); - } - - int fmt = 0; - veejay_msg(VEEJAY_MSG_DEBUG, "PF == %d", info->pixel_format); - if( info->pixel_format == 0 ) - fmt = PIX_FMT_YUV420P; - else - fmt = PIX_FMT_YUV422P; - if( !vj_server_setup(info) ) - { - veejay_msg(VEEJAY_MSG_ERROR,"Setting up server"); - return -1; - } -*/ - // pthread_mutex_init( &(info->display_mutex), 0 ); + if(info->use_display==1) { info->sdl_display = vj_sdl_allocate( @@ -946,13 +921,6 @@ int veejay_init(veejay_t * info) vj_sdl_init( info->sdl_display, 352,288, "Veejay", 1, 0 ); } - /* After we have fired up the audio and video threads system (which - * are assisted if we're installed setuid root, we want to set the - * effective user id to the real user id - */ - - - if (seteuid(getuid()) < 0) { /* fixme: get rid of sys_errlist and use sys_strerror */ @@ -963,19 +931,21 @@ int veejay_init(veejay_t * info) if (!veejay_set_playback_rate(info, vid_info->fps, vid_info->norm )) { + veejay_msg(VEEJAY_MSG_ERROR, + "Cannot set video playback rate"); return -1; } - veejay_change_state( info, VEEJAY_STATE_PLAYING ); - - - if(veejay_open(info) != 1) { veejay_msg(VEEJAY_MSG_ERROR, "Unable to initialize the threading system"); return -1; } + + veejay_change_state( info, VEEJAY_STATE_PLAYING ); + + return 0; } @@ -1236,6 +1206,133 @@ static void *veejay_playback_thread(void *data) return NULL; } + +void veejay_create_sample_ui( veejay_t *info, int id ) +{ + void *sample = find_sample(id); + if(sample) + { + char *window = vevosample_construct_ui( sample ); + vevosample_construct_ui_fx_chain( sample ); + free(window); + } +} + +void veejay_add_client( veejay_t *info, char *uri ) +{ + char server_port_name[10]; +#ifdef STRICT_CHECKING + assert( uri != NULL ); +#endif + char *server = veejay_osc_server_get_addr( info->osc_server ); + int server_port= veejay_osc_server_get_port( info->osc_server ); + + sprintf( server_port_name, "%d", server_port ); + + veejay_msg(0, "Veejay server '%s' communicates with %s" ,server,uri ); + + void *ui = veejay_new_osc_sender_uri( uri ); + veejay_send_osc( ui, "/veejay", "sx", server ); + int error = vevo_property_set( info->clients, uri, VEVO_ATOM_TYPE_VOIDPTR,1,&ui ); +#ifdef STRICT_CHECKING + assert( error == VEVO_NO_ERROR ); +#endif + samplebank_send_all_samples( ui ); + + samplebank_tick_ui_client( uri ); +} + +void *veejay_get_osc_sender(veejay_t * info ) +{ + void *sender = NULL; + if(!info->current_client) + return NULL; +#ifdef STRICT_CHECKING + assert( info->current_client != NULL ); + assert( info->clients != NULL ); +#endif + int error = vevo_property_get( info->clients, info->current_client, 0, &sender ); + if( error == VEVO_NO_ERROR ) + return sender; + return NULL; +} + +void *veejay_get_osc_sender_by_uri( veejay_t *info , const char *uri ) +{ + void *sender = NULL; + int error = vevo_property_get( info->clients, uri, 0, &sender ); + if( error == VEVO_NO_ERROR ) + return sender; + return NULL; + +} + +void veejay_set_current_client( veejay_t *info, char *uri ) +{ + if(info->current_client) + free(info->current_client); + info->current_client = strdup(uri); +// veejay_msg(0, "current client is '%s'", info->current_client ); +} + +void veejay_init_ui(veejay_t * info , const char *uri) +{ +#ifdef STRICT_CHECKING + assert( info->current_sample != NULL ); +#endif + char veejaystr[100]; + sprintf(veejaystr, "Veejay-NG %s", VERSION ); +//veejay_msg(0, "%s : %s", __FUNCTION__, uri ); +// veejay_set_current_client( info,uri ); + void *sender = veejay_get_osc_sender( info ); +#ifdef STRICT_CHECKING + assert( sender != NULL ); +#endif + +/* char *window = vevosample_construct_ui(info->current_sample ); + vevosample_construct_ui_fx_all( info->current_sample ); + free(window);*/ + veejay_osc_set_window( sender , "MainWindow" ); + + veejay_ui_bundle_add( sender, + "/create/window","ssx", "MainWindow", veejaystr ); + veejay_ui_bundle_add( sender, + "/create/frame", "sssx", "MainWindow", "VeejayPanel", + " " ); + + double row = (double) samplebank_guess_row_sequence( info->current_sample ); + +/* void *msg = veejay_message_new_pulldown( sender, + "MainWindow","VeejayPanel","combobox_playlist","Play", + "/veejay/select", + row, "Click a sample to play" ); + + samplebank_push_pulldown_items( sender, msg ); + + veejay_message_pulldown_done( sender, msg ); + + void *msg2 = veejay_message_new_pulldown( sender, + "MainWindow","VeejayPanel","combobox_editlist","Edit", + "/veejay/show", + 0.0, "Click a sample to edit" ); + + samplebank_push_pulldown_items( sender, msg2 ); + veejay_message_pulldown_done( sender, msg2 );*/ + + + char tmp[128]; + sprintf(tmp, "%s", "/veejay/fullscreen" ); + vevosample_ui_new_switch( info->current_sample, "MainWindow" , "VeejayPanel","Check", "Fullscreen",0, tmp, "Toggle between window and fullscreen" ); + sprintf(tmp, "%s","/veejay/quit"); + vevosample_ui_new_button( info->current_sample,"MainWindow" , "VeejayPanel", "Quit Veejay", tmp, "Request veejay to stop processing" ); + + + veejay_ui_bundle_add( sender, + "/show/window", "sx", "MainWindow" ); +// samplebank_send_all_samples( sender ); + +} + int vj_server_setup(veejay_t * info) { int port = info->port_offset; @@ -1256,13 +1353,10 @@ int vj_server_setup(veejay_t * info) const char port_str[50]; sprintf(port_str, "%d",port ); info->osc_server = veejay_new_osc_server( (void*)info, port_str ); -#ifdef STRICT_CHECKING - info->osc_namespace = vevo_port_new( VEVO_ANONYMOUS_PORT, __FUNCTION__, __LINE__ ); -#else - info->osc_namespace = vevo_port_new( VEVO_ANONYMOUS_PORT ); -#endif + info->osc_namespace = vpn( VEVO_ANONYMOUS_PORT ); veejay_osc_namespace_events( (void*) info, "/veejay"); + // info->mcast_socket = // vj_server_alloc(port, info->settings->vims_group_name, V_CMD ); // GoMultiCast( info->settings->group_name ); @@ -1343,6 +1437,7 @@ veejay_t *veejay_malloc() info->settings->first_frame = 1; info->settings->state = VEEJAY_STATE_STOP; info->port_offset = 3490;// VJ_PORT; + info->clients = vpn( VEVO_ANONYMOUS_PORT); samplebank_init(); available_diskspace(); @@ -1383,6 +1478,7 @@ int veejay_main(veejay_t * info) { video_playback_setup *settings = (video_playback_setup *) info->settings; + veejay_msg(VEEJAY_MSG_INFO, "Flushing buffers"); /* Flush the Linux File buffers to disk */ sync(); @@ -1392,6 +1488,8 @@ int veejay_main(veejay_t * info) ret = pthread_attr_setdetachstate( &(settings->qtattr), PTHREAD_CREATE_DETACHED );*/ + pthread_mutex_init( &(info->vevo_mutex), NULL ); + /* fork ourselves to return control to the main app */ if (pthread_create(&(settings->playback_thread), NULL, //&(settings->qtattr), diff --git a/veejay-ng/veejay/libveejay.h b/veejay-ng/veejay/libveejay.h index 8dadc528..14ede191 100644 --- a/veejay-ng/veejay/libveejay.h +++ b/veejay-ng/veejay/libveejay.h @@ -52,4 +52,12 @@ int vj_server_setup(veejay_t *info); int veejay_init_project_from_args( veejay_t *info, int w, int h, float fps, int inter, int norm, int fmt, int audio, int rate, int n_chan, int bits, int display ); + + + +void veejay_lock( veejay_t *info, const char *f ); + +void veejay_unlock( veejay_t *info, const char *f ); + + #endif diff --git a/veejay-ng/veejay/oscevents.c b/veejay-ng/veejay/oscevents.c index 23dfec39..f62bf163 100644 --- a/veejay-ng/veejay/oscevents.c +++ b/veejay-ng/veejay/oscevents.c @@ -30,18 +30,19 @@ #include #include #include +#include #include #include +#include #include #include #ifdef STRICT_CHECKING #include #endif -void osc_sample_edl_paste_at( void *ptr,const char *path, const char *types, void **dargv ) +void osc_sample_edl_paste_at( void *ptr,const char *path, const char *types, void **dargv, void *raw ) { lo_arg **argv = (lo_arg**) dargv; - if(sample_edl_paste_from_buffer( ptr, (uint64_t) argv[0]->h )) veejay_msg( VEEJAY_MSG_INFO, "Pasted frames from buffer to position %lld", argv[0]->h ); @@ -49,37 +50,34 @@ void osc_sample_edl_paste_at( void *ptr,const char *path, const char *types, voi veejay_msg(VEEJAY_MSG_INFO, "Unable to paste frames at position %lld", argv[0]->h ); } -void osc_sample_edl_cut( void *sample,const char *path, const char *types, void **dargv ) +void osc_sample_edl_cut( void *sample,const char *path, const char *types, void **dargv, void *raw ) { lo_arg **argv = (lo_arg**) dargv; - if(sample_edl_cut_to_buffer( sample, (uint64_t) argv[0]->h, (uint64_t) argv[1]->h )) veejay_msg(VEEJAY_MSG_INFO, "Cut frames %lld - %lld to buffer",argv[0]->h,argv[1]->h); else veejay_msg(VEEJAY_MSG_ERROR, "Unable to cut frames %lld - %lld",argv[0]->h,argv[1]->h); } -void osc_sample_edl_copy(void *sample,const char *path, const char *types, void **dargv ) +void osc_sample_edl_copy(void *sample,const char *path, const char *types, void **dargv, void *raw ) { lo_arg **argv = (lo_arg**) dargv; - if( sample_edl_copy( sample, (uint64_t) argv[0]->h,(uint64_t) argv[1]->h )) veejay_msg(VEEJAY_MSG_INFO, "Copied frames %lld - %lld to buffer",argv[0]->h,argv[1]->h); else veejay_msg(VEEJAY_MSG_INFO, "Unable to copy frames %lld - %lld",argv[0]->h,argv[1]->h); } -void osc_sample_edl_del(void *sample,const char *path, const char *types, void **dargv ) +void osc_sample_edl_del(void *sample,const char *path, const char *types, void **dargv, void *raw ) { lo_arg **argv = (lo_arg**) dargv; - if( sample_edl_delete( sample, (uint64_t) argv[0]->h,(uint64_t) argv[1]->h )) veejay_msg(VEEJAY_MSG_INFO, "Deleted frames %lld - %lld to buffer",argv[0]->h,argv[1]->h); else veejay_msg(VEEJAY_MSG_INFO, "Unable to delete frames %lld - %lld",argv[0]->h,argv[1]->h); } -void osc_sample_play_forward(void *sample,const char *path, const char *types, void **dargv ) +void osc_sample_play_forward(void *sample,const char *path, const char *types, void **dargv, void *raw ) { lo_arg **argv = (lo_arg**) dargv; int speed = sample_get_speed( sample ); @@ -92,7 +90,7 @@ void osc_sample_play_forward(void *sample,const char *path, const char *types, sample_set_property_ptr( sample, "speed", VEVO_ATOM_TYPE_INT,&speed); } } -void osc_sample_play_reverse(void *sample,const char *path, const char *types, void **dargv ) +void osc_sample_play_reverse(void *sample,const char *path, const char *types, void **dargv, void *raw ) { lo_arg **argv = (lo_arg**) dargv; int speed = sample_get_speed( sample ); @@ -105,7 +103,7 @@ void osc_sample_play_reverse(void *sample,const char *path, const char *types, sample_set_property_ptr( sample, "speed", VEVO_ATOM_TYPE_INT,&speed); } } -void osc_sample_play_pause(void *sample,const char *path, const char *types, void **dargv ) +void osc_sample_play_pause(void *sample,const char *path, const char *types, void **dargv, void *raw ) { lo_arg **argv = (lo_arg**) dargv; int speed = sample_get_speed( sample ); @@ -116,7 +114,7 @@ void osc_sample_play_pause(void *sample,const char *path, const char *types, vo } } -void osc_sample_set_frame(void *sample,const char *path, const char *types, void **dargv ) +void osc_sample_set_frame(void *sample,const char *path, const char *types, void **dargv, void *raw ) { lo_arg **argv = (lo_arg**) dargv; uint64_t pos = sample_get_current_pos( sample ); @@ -135,7 +133,7 @@ void osc_sample_set_frame(void *sample,const char *path, const char *types, voi } } } -void osc_sample_set_next_frame(void *sample,const char *path, const char *types, void **dargv ) +void osc_sample_set_next_frame(void *sample,const char *path, const char *types, void **dargv, void *raw ) { lo_arg **argv = (lo_arg**) dargv; uint64_t pos = sample_get_current_pos( sample ); @@ -155,7 +153,7 @@ void osc_sample_set_next_frame(void *sample,const char *path, const char *types } } -void osc_sample_set_prev_frame(void *sample,const char *path, const char *types, void **dargv ) +void osc_sample_set_prev_frame(void *sample,const char *path, const char *types, void **dargv, void *raw ) { lo_arg **argv = (lo_arg**) dargv; uint64_t pos = sample_get_current_pos( sample ); @@ -175,26 +173,25 @@ void osc_sample_set_prev_frame(void *sample,const char *path, const char *types } } -void osc_sample_goto_start(void *sample, const char *path, const char *types, void **dargv ) +void osc_sample_goto_start(void *sample, const char *path, const char *types, void **dargv, void *raw ) { uint64_t pos = sample_get_start_pos( sample ); sample_set_property_ptr( sample, "current_pos", VEVO_ATOM_TYPE_UINT64, &pos ); - veejay_msg(VEEJAY_MSG_INFO, "Position changed to %lld", pos); } -void osc_sample_goto_end(void *sample, const char *path, const char *types, void **dargv ) +void osc_sample_goto_end(void *sample, const char *path, const char *types, void **dargv , void *raw) { uint64_t pos = sample_get_end_pos( sample ); sample_set_property_ptr( sample, "current_pos", VEVO_ATOM_TYPE_UINT64, &pos ); - veejay_msg(VEEJAY_MSG_INFO, "Position changed to %lld", pos); + // veejay_msg(VEEJAY_MSG_INFO, "Position changed to %lld", pos); } -void osc_sample_reset_fx(void *sample,const char *path, const char *types, void **dargv ) +void osc_sample_reset_fx(void *sample,const char *path, const char *types, void **dargv, void *raw ) { sample_fx_chain_reset( sample ); } -void osc_sample_reset_fx_entry( void *sample,const char *path, const char *types, void **dargv) +void osc_sample_reset_fx_entry( void *sample,const char *path, const char *types, void **dargv, void *raw) { int fx_id = sample_extract_fx_entry_from_path(sample, path ); if( fx_id < 0 ) @@ -205,10 +202,9 @@ void osc_sample_reset_fx_entry( void *sample,const char *path, const char *type if(sample_fx_chain_entry_clear( sample, fx_id ) ) veejay_msg(VEEJAY_MSG_INFO, "Cleared FX slot %d",fx_id ); } -void osc_sample_alpha_fx_entry( void *sample,const char *path, const char *types, void **dargv) +void osc_sample_alpha_fx_entry( void *sample,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; - int fx_id = sample_extract_fx_entry_from_path(sample, path ); if( fx_id < 0 ) { @@ -219,11 +215,16 @@ void osc_sample_alpha_fx_entry( void *sample,const char *path, const char *type double alpha = argv[0]->d; sample_set_fx_alpha( sample, fx_id, alpha ); } - -void osc_sample_channel_fx_entry( void *sample,const char *path, const char *types, void **dargv) +void osc_sample_status_fx_entry( void *sample,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; + int fx_id = sample_extract_fx_entry_from_path(sample, path ); + sample_set_fx_status( sample, fx_id, argv[0]->i ); +} +void osc_sample_channel_fx_entry( void *sample,const char *path, const char *types, void **dargv, void *raw) +{ + lo_arg **argv = (lo_arg**) dargv; int fx_id = sample_extract_fx_entry_from_path(sample, path ); if( fx_id < 0 ) { @@ -241,10 +242,9 @@ void osc_sample_channel_fx_entry( void *sample,const char *path, const char *ty veejay_msg(VEEJAY_MSG_ERROR, "Input channel %d set to sample %d", seq, id ); } } -void osc_sample_set_fx_entry( void *sample,const char *path, const char *types, void **dargv) +void osc_sample_set_fx_entry( void *sample,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; - int fx_id = sample_extract_fx_entry_from_path(sample, path ); if( fx_id < 0 ) { @@ -264,10 +264,9 @@ void osc_sample_set_fx_entry( void *sample,const char *path, const char *types, s,fx_id); } } -void osc_sample_bind_fx_entry( void *sample, const char *path, const char *types, void **dargv) +void osc_sample_bind_fx_entry( void *sample, const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; - int fx_id = sample_extract_fx_entry_from_path(sample, path ); if( fx_id < 0 ) { @@ -288,10 +287,10 @@ void osc_sample_bind_fx_entry( void *sample, const char *path, const char *type fx_id,argv[0]->i,argv[1]->i,argv[2]->i); } } -void osc_sample_release_fx_entry( void *sample, const char *path, const char *types, void **dargv) + +void osc_sample_del_bind( void *sample, const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; - int fx_id = sample_extract_fx_entry_from_path(sample, path ); if( fx_id < 0 ) { @@ -304,13 +303,41 @@ void osc_sample_release_fx_entry( void *sample, const char *path, const char *t veejay_msg(0,"Invalid fx entry"); return; } - int error = sample_del_bind( sample, src_entry, argv[0]->i ); + veejay_msg(0, "sample_del_bind on FX %d, Parameter %d, RFX %d, RIP %d", + fx_id, argv[0]->i, argv[1]->i, argv[2]->i); + int error = sample_del_bind( sample, src_entry, fx_id, argv[0]->i,argv[1]->i, argv[2]->i ); if( error == VEVO_NO_ERROR ) { veejay_msg(0, "Detached output parameter %d on entry %d", argv[0]->i,fx_id ); } } -void osc_sample_bind_osc_fx_entry( void *sample, const char *path, const char *types, void **dargv) + +void osc_sample_release_fx_entry( void *sample, const char *path, const char *types, void **dargv, void *raw) +{ + lo_arg **argv = (lo_arg**) dargv; + int fx_id = sample_extract_fx_entry_from_path(sample, path ); + if( fx_id < 0 ) + { + veejay_msg(VEEJAY_MSG_ERROR, "Outside chain boundary"); + return; + } + void *src_entry = sample_get_fx_port_ptr( sample,fx_id ); + if(src_entry == NULL ) + { + veejay_msg(0,"Invalid fx entry"); + return; + } + +//@ delete entire port! + + int error = sample_del_bind_occ( sample, src_entry,argv[0]->i,fx_id); + if( error == VEVO_NO_ERROR ) + { + veejay_msg(0, "Detached output parameter %d on entry %d", argv[0]->i,fx_id ); + } +} + +/*void osc_sample_bind_osc_fx_entry( void *sample, const char *path, const char *types, void **dargv) { lo_arg **argv = (lo_arg**) dargv; @@ -345,57 +372,182 @@ void osc_sample_parameter_sender_start( void *sample,const char *path, const ch void osc_sample_parameter_sender_stop( void *sample,const char *path, const char *types, void **dargv) { sample_close_osc_sender( sample ); -} +}*/ -void osc_sample_config_record(void *sample,const char *path, const char *types, void **dargv) +void osc_sample_config_record(void *sample,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; - int error = sample_configure_recorder( sample, argv[0]->i, (char*) &(argv[2]->s), argv[1]->i ); if( error ) veejay_msg(0, "Unable to configure the recorder"); } -void osc_sample_record_start(void *sample,const char *path, const char *types, void **dargv) +void osc_sample_record_start(void *sample,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; - int error = sample_start_recorder( sample ); if( error ) veejay_msg(0, "Unable to start the sample recorder"); } -void osc_sample_record_stop(void *sample,const char *path, const char *types, void **dargv) +void osc_sample_record_stop(void *sample,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; - int error = sample_stop_recorder( sample ); if( error ) veejay_msg(0, "Unable to stop the sample recorder"); } -void osc_veejay_quit(void *info,const char *path, const char *types, void **dargv) +void osc_veejay_ui_create_sample( void *info,const char *path, const char *types, void **dargv, void *raw) +{ + lo_arg **argv = (lo_arg**) dargv; + int id = argv[0]->i; + veejay_t *v = (veejay_t*) info; + if( id == 0 ) + id = sample_get_key_ptr(v->current_sample); + + veejay_create_sample_ui( info, id ); +} + +void osc_veejay_ui_init( void *info,const char *path, const char *types, void **dargv, void *raw) +{ + lo_arg **argv = (lo_arg**) dargv; + char *uri = osc_get_uri( raw ); +#ifdef STRICT_CHECKING + assert( uri != NULL ); +#endif + veejay_add_client( info, uri ); + + veejay_init_ui( info, uri ); + + free(uri); +} +void osc_veejay_setup_preview( void *info, const char *path, const char *types, void **dargv, void *raw ) +{ + lo_arg **argv = (lo_arg**) dargv; + + veejay_t *v = (veejay_t*) info; + if( performer_setup_preview( v, argv[0]->i, argv[1]->i ) ) + veejay_msg(0, "Configured preview , reduce by factor %d, mode %d",argv[0]->i,argv[1]->i ); +} +void osc_veejay_ui_tick( void *info, const char *path, const char *types, void **dargv, void *raw ) +{ + char *uri = osc_get_uri( raw ); + + samplebank_tick_ui_client( uri ); + + free(uri); + +} +void osc_veejay_ui_blreq_window( void *info, const char *path, const char *types, void **dargv, void *raw ) +{ + veejay_t *v = (veejay_t*) info; + lo_arg **argv = (lo_arg**) dargv; + void *sample = find_sample( argv[0]->i ); + if(!sample) + { + veejay_msg(0,"sample %d does not exist",argv[0]->i); + return; + } + vevosample_ui_get_bind_list( sample, (char*) &argv[1]->s ); +} + + +void osc_veejay_ui_ipreq_window( void *info, const char *path, const char *types, void **dargv, void *raw ) +{ + veejay_t *v = (veejay_t*) info; + lo_arg **argv = (lo_arg**) dargv; + void *sample = find_sample( argv[0]->i ); + if(!sample) + { + veejay_msg(0,"sample %d does not exist",argv[0]->i); + return; + } + if( sample_has_fx( sample, argv[1]->i )) + { + vevosample_ui_get_input_parameter_list( sample, argv[1]->i, (char*) &argv[2]->s ); + + } +} + +void osc_veejay_ui_bindreq_window( void *info, const char *path, const char *types, void **dargv, void *raw ) +{ + veejay_t *v = (veejay_t*) info; + lo_arg **argv = (lo_arg**) dargv; + void *sample = find_sample( argv[0]->i ); + if(!sample) + { + veejay_msg(0,"sample %d does not exist",argv[0]->i); + return; + } + if( sample_has_fx( sample, argv[1]->i )) + { + vevosample_ui_construct_fx_bind_window( sample, argv[1]->i, argv[2]->i ); + } + else + veejay_msg(0, "FX %d on sample %d not active", argv[0]->i, + argv[1]->i); +} + +void osc_veejay_clone_sample( void *info, const char *path, const char *types, void **dargv, void *raw ) +{ + veejay_t *v = (veejay_t*) info; + lo_arg **argv = (lo_arg**) dargv; + void *sample = find_sample( argv[0]->i ); + if(!sample) + { + veejay_msg(0,"sample %d does not exist",argv[0]->i); + return; + } + + if( sample_clone_from( v, sample, v->video_info )) + { + veejay_msg(0, "Cloned sample %d" ); + } + +} + +void osc_veejay_ui_request_window( void *info, const char *path, const char *types, void **dargv, void *raw ) +{ + veejay_t *v = (veejay_t*) info; + lo_arg **argv = (lo_arg**) dargv; + void *sample = find_sample( argv[0]->i ); + if(!sample) + { + veejay_msg(0,"sample %d does not exist",argv[0]->i); + return; + } + if( sample_has_fx( sample, argv[1]->i )) + { + vevosample_ui_construct_fx_window( sample, argv[1]->i ); + veejay_msg(0,"constructed fx panel"); + } + else + veejay_msg(0, "FX %d on sample %d not active", argv[0]->i, + argv[1]->i); +} + +void osc_veejay_quit(void *info,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; veejay_change_state( info, VEEJAY_STATE_STOP ); } -void osc_veejay_resize(void *info,const char *path, const char *types, void **dargv) +void osc_veejay_resize(void *info,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; veejay_resize_screen( info, argv[0]->i,argv[1]->i,argv[2]->i,argv[3]->i); } -void osc_veejay_fullscreen(void *info,const char *path, const char *types, void **dargv) +void osc_veejay_fullscreen(void *info,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; veejay_fullscreen( info, argv[0]->i ); } -void osc_veejay_select( void *info,const char *path, const char *types, void **dargv) +void osc_veejay_select( void *info,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; int id = argv[0]->i; veejay_t *v = (veejay_t*) info; void *sample = v->current_sample; void *res = sample; - if( id > 0 ) { res = find_sample( id ); @@ -411,17 +563,20 @@ void osc_veejay_select( void *info,const char *path, const char *types, void ** } else { - sample_save_cache_data( v->current_sample ); + veejay_msg(VEEJAY_MSG_INFO, "Play sample %d", id ); + // sample_save_cache_data( v->current_sample ); v->current_sample = res; } } -void osc_veejay_new_sample(void *info,const char *path, const char *types, void **dargv) +void osc_veejay_new_sample(void *info,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; int type = argv[0]->i; int token = argv[1]->i; char *str = &(argv[2]->s); veejay_t *v = (veejay_t*) info; + + void *sample = sample_new( type ); if(!sample) { @@ -443,12 +598,14 @@ void osc_veejay_new_sample(void *info,const char *path, const char *types, void } } -void osc_veejay_del_sample(void *info,const char *path, const char *types, void **dargv) +void osc_veejay_del_sample(void *info,const char *path, const char *types, void **dargv, void *raw) { lo_arg **argv = (lo_arg**) dargv; int id = argv[0]->i; veejay_t *v = (veejay_t*) info; + void *sample = find_sample(id); + if(sample == v->current_sample) veejay_msg(0, "Cannot delete current playing sample"); else @@ -456,16 +613,16 @@ void osc_veejay_del_sample(void *info,const char *path, const char *types, void veejay_msg(0, "Deleted sample %d", id ); } -void osc_sample_print( void *sample,const char *path, const char *types, void **dargv) +void osc_sample_print( void *sample,const char *path, const char *types, void **dargv, void *raw) { sample_osc_namespace( sample ); } - +/* void osc_sample_khagan( void *sample,const char *path, const char *types, void **dargv) { sample_produce_khagan_file( sample ); -} +}*/ static struct @@ -478,6 +635,7 @@ static struct } fx_events_[] = { { "clear", NULL, {NULL,NULL,NULL,NULL }, "Delete plugin" , osc_sample_reset_fx_entry }, { "alpha", "d", {"Alpha value 0.0 - 1.0",NULL,NULL,NULL }, "Opacity", osc_sample_alpha_fx_entry }, + { "status", "i", {"On=1, Off=0",NULL,NULL,NULL }, "Status", osc_sample_status_fx_entry }, { "input_channel","ii", {"Input Channel", "Sample ID", NULL,NULL}, "Set a plugin's input channel", osc_sample_channel_fx_entry }, { "set", "s", {"FX plugin name", NULL,NULL,NULL }, "Initialize a plugin", @@ -487,12 +645,16 @@ static struct "Input Parameter ID", NULL }, "Bind output parameter to some input parameter", osc_sample_bind_fx_entry }, - { "release", NULL, { NULL,NULL,NULL }, "Release bind between output and input parameter", + { "release", "i", { NULL,NULL,NULL }, "Release bind between output and input parameter", osc_sample_release_fx_entry }, - { "bind_osc", "s", { "OSC message", NULL,NULL,NULL }, "Bind an OSC Path to an output parameter", + { "unbind", "iii", { "Output parameter ID", + "Bind to FX entry", + "Input Parameter ID",NULL }, "Release a single bind", + osc_sample_del_bind }, + /*{ "bind_osc", "s", { "OSC message", NULL,NULL,NULL }, "Bind an OSC Path to an output parameter", osc_sample_bind_osc_fx_entry }, { "release_osc", NULL, { NULL,NULL,NULL,NULL}, "Release OSC Path", - osc_sample_release_osc_fx_entry }, + osc_sample_release_osc_fx_entry }, */ { NULL, NULL, { NULL,NULL,NULL,NULL}, NULL, NULL } }; @@ -506,11 +668,11 @@ static struct } sample_generic_events_[] = { { "reset_fx", NULL, { NULL,NULL,NULL,NULL }, "Delete all plugins", osc_sample_reset_fx }, - { "register_param_sender","ss", { "Address" , "Port Number",NULL,NULL }, +/* { "register_param_sender","ss", { "Address" , "Port Number",NULL,NULL }, "Initialize a new OSC sender", osc_sample_parameter_sender_start }, { "unregister_param_sender", NULL, { NULL, NULL,NULL,NULL },"Close OSC sender", - osc_sample_parameter_sender_stop }, + osc_sample_parameter_sender_stop },*/ { "rec/config", "iis", { "Format", "Frames", "Filename" , NULL },"Configure sample recorder", osc_sample_config_record }, { "rec/start", NULL, { NULL,NULL,NULL,NULL },"Start recording from sample", @@ -518,7 +680,7 @@ static struct { "rec/stop", NULL, { NULL,NULL,NULL,NULL },"Stop recording from sample", osc_sample_record_stop }, { "print", NULL, { NULL,NULL,NULL,NULL },"Print OSC namespace", osc_sample_print }, - { "khagan", NULL, { NULL,NULL,NULL,NULL },"Write XML file for khagan", osc_sample_khagan }, +// { "khagan", NULL, { NULL,NULL,NULL,NULL },"Write XML file for khagan", osc_sample_khagan }, { NULL, NULL, { NULL,NULL,NULL,NULL },NULL, NULL }, }; @@ -564,7 +726,16 @@ static struct { "select", "i", { "Sample ID", NULL,NULL,NULL },"Select a sample", osc_veejay_select }, { "new" , "iis", { "Sample Type", "Numeric value", "Filename" , NULL }, "Create a new sample", osc_veejay_new_sample }, { "del" , "i", { "Sample ID", NULL, NULL, NULL },"Delete sample", osc_veejay_del_sample }, - { NULL, NULL, { NULL,NULL,NULL,NULL }, NULL }, + { "ui" , NULL, { NULL,NULL , NULL,NULL}, "Remote is UI ", osc_veejay_ui_init }, + { "show" , "i", { "Sample ID", NULL, NULL, NULL }, "View a sample", osc_veejay_ui_create_sample }, + { "request", "ii", { "Sample ID" , "FX Id",NULL,NULL }, "Request fx panel", osc_veejay_ui_request_window }, + { "bindreq", "iii", { "Sample ID" , "FX Id","Parameter ID",NULL }, "Request a bind panel", osc_veejay_ui_bindreq_window }, + { "ipreq", "iis", { "Sample ID" , "FX Id","Window Name",NULL }, "Request a parameter list",osc_veejay_ui_ipreq_window }, + { "blreq", "is", { "Sample ID" , "Window Name",NULL,NULL }, "Request a bind list",osc_veejay_ui_blreq_window }, + { "tick", NULL, { NULL,NULL,NULL,NULL }, "UI is still alive", osc_veejay_ui_tick }, + { "previewconfig","ii", { "Reduce Factor", "Preview Mode",NULL,NULL }, "Configure preview", osc_veejay_setup_preview }, + { "clone", "i", { "Sample ID", NULL, NULL,NULL }, "Clone sample", osc_veejay_clone_sample }, + { NULL, NULL, { NULL,NULL,NULL,NULL }, NULL, NULL }, }; diff --git a/veejay-ng/veejay/oscsend.c b/veejay-ng/veejay/oscsend.c index 64a2327a..346eed96 100644 --- a/veejay-ng/veejay/oscsend.c +++ b/veejay-ng/veejay/oscsend.c @@ -37,15 +37,33 @@ typedef struct lo_address addr; char *addr_str; char *port_str; + lo_bundle bundle; + char *window; } oscclient_t; +void *veejay_new_osc_sender_uri( const char *uri ) +{ + oscclient_t *osc = (oscclient_t*) vj_malloc(sizeof(oscclient_t)); + memset(osc,0,sizeof(oscclient_t)); + osc->addr = lo_address_new_from_url( uri ); + + osc->addr_str = strdup(lo_address_get_hostname( osc->addr )); + osc->port_str = strdup(lo_address_get_port ( osc->addr )); + veejay_msg(0,"New OSC sender from uri '%s', Host %s, Port %s", + uri, osc->addr_str, osc->port_str ); + return (void*) osc; +} + void *veejay_new_osc_sender( const char *addr, const char *port ) { oscclient_t *osc = (oscclient_t*) vj_malloc(sizeof(oscclient_t)); + memset(osc,0,sizeof(oscclient_t)); osc->addr = lo_address_new( addr, port ); osc->addr_str = strdup( addr ); osc->port_str = port ? strdup( port ) : NULL; + veejay_msg(0,"New OSC sender Host %s, Port %s", + osc->addr_str, osc->port_str ); return (void*) osc; } @@ -53,11 +71,14 @@ void *veejay_new_osc_sender( const char *addr, const char *port ) void veejay_free_osc_sender( void *dosc ) { oscclient_t *osc = (oscclient_t*) dosc; - - lo_address_free( osc->addr ); + if(osc->addr) + lo_address_free( osc->addr ); if( osc->port_str ) free( osc->port_str); - free(osc->addr_str); + if( osc->addr_str) + free(osc->addr_str); + if( osc->window ) + free(osc->window); free(osc); osc = NULL; } @@ -65,27 +86,28 @@ void veejay_free_osc_sender( void *dosc ) static void veejay_add_arguments_ ( lo_message lmsg, const char *format, va_list ap ) { //http://liblo.sourceforge.net/docs/group__liblolowlevel.html#g31ac1e4c0ec6c61f665ce3f9bbdc53c3 - while( *format != 'x' ) + while( *format != 'x' && *format != '\0' ) { switch(*format) { case 'i': - lo_message_add_int32( lmsg, (int32_t) *(va_arg( ap, int*))); + lo_message_add_int32( lmsg, (int32_t) va_arg( ap, int)); break; case 'h': - lo_message_add_int64( lmsg, (int64_t) *(va_arg( ap, int64_t*))); + lo_message_add_int64( lmsg, (int64_t) va_arg( ap, int64_t)); break; - case 'c': - lo_message_add_string( lmsg, (char*) va_arg( ap, char*) ); - break; - case 'f': - lo_message_add_float( lmsg, (float) *(va_arg( ap, float*))); + case 's': + { char *str = (char*) va_arg(ap,char*); + lo_message_add_string( lmsg, str ); } break; case 'd': - lo_message_add_double( lmsg, (double) *(va_arg(ap, double*))); + // double g = (double) *(va_arg(ap, double*)); + { double g = (double) va_arg(ap,double); + lo_message_add_double( lmsg, g); } break; default: #ifdef STRICT_CHECKING + veejay_msg(0, "Invalid format : '%c' %x",*format,*format); assert(0); #endif break; @@ -94,6 +116,28 @@ static void veejay_add_arguments_ ( lo_message lmsg, const char *format, va_list } } + +void veejay_osc_set_window( void *osc, char *window ) +{ + oscclient_t *c = (oscclient_t*) osc; + if(c->window) free(c->window); + c->window = strdup(window); +} + +int veejay_send_osc_strargs( void *osc, const char *msg, int n_str, char **strs ) +{ + oscclient_t *c = (oscclient_t*) osc; + lo_message lmsg = lo_message_new(); + int i; + for( i = 0; i < n_str; i ++ ) + { + lo_message_add_string( lmsg, strs[i] ); + } + int result = lo_send_message( c->addr, msg, lmsg ); + lo_message_free( lmsg ); + return result; +} + int veejay_send_osc( void *osc ,const char *msg, const char *format, ... ) { oscclient_t *c = (oscclient_t*) osc; @@ -101,9 +145,12 @@ int veejay_send_osc( void *osc ,const char *msg, const char *format, ... ) va_list ap; - va_start( ap, format ); - veejay_add_arguments_( lmsg, format, ap ); - va_end(ap); + if( format ) + { + va_start( ap, format ); + veejay_add_arguments_( lmsg, format, ap ); + va_end(ap); + } int result = lo_send_message( c->addr, msg, lmsg ); @@ -209,3 +256,482 @@ int veejay_vevo_send_osc( void *osc, const char *msg, void *vevo_port ) return VEVO_NO_ERROR; } +void veejay_xbundle_add( void *osc, const char *window, const char *widget, const char *format, ... ) +{ + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } +#ifdef STRICT_CHECKING + assert( c->bundle != NULL ); +#endif + lo_message lmsg = lo_message_new(); + + if(!window) + lo_message_add_string(lmsg, c->window ); + else + lo_message_add_string(lmsg, window ); + lo_message_add_string(lmsg, widget ); + + if( format ) + { + va_list ap; + va_start( ap, format ); + veejay_add_arguments_( lmsg, format, ap ); + va_end(ap); + } + lo_bundle_add_message( c->bundle, "/update/tegdiw", lmsg ); +} +void veejay_bundle_add_blobs( void *osc, const char *msg, void *blub, void *blab, void *blib ) +{ + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } +#ifdef STRICT_CHECKING + assert( c->bundle != NULL ); +#endif + lo_message lmsg = lo_message_new(); + lo_blob blob = (lo_blob) blub; + lo_blob blob2 = (lo_blob) blab; + lo_blob blob3 = (lo_blob) blib; + lo_message_add_blob( lmsg, blob ); + lo_message_add_blob( lmsg, blob2 ); + lo_message_add_blob( lmsg, blob3 ); + + lo_bundle_add_message( c->bundle, msg, lmsg ); +} + +void veejay_bundle_add_blob( void *osc, const char *msg, void *blub ) +{ + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } +#ifdef STRICT_CHECKING + assert( c->bundle != NULL ); +#endif + lo_message lmsg = lo_message_new(); + lo_blob blob = (lo_blob) blub; + lo_message_add_blob( lmsg, blob ); + lo_bundle_add_message( c->bundle, msg, lmsg ); +} + +void veejay_bundle_add( void *osc, const char *msg, const char *format, ... ) +{ + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } +#ifdef STRICT_CHECKING + assert( c->bundle != NULL ); +#endif + lo_message lmsg = lo_message_new(); + + lo_message_add_string(lmsg, c->window ); + lo_message_add_string(lmsg, msg ); + + va_list ap; + + if( format ) + { + va_start( ap, format ); + veejay_add_arguments_( lmsg, format, ap ); + va_end(ap); + } + + lo_bundle_add_message( c->bundle, "/update/widget", lmsg ); +} + +void *veejay_message_new_linked_pulldown( void *osc, const char *str1,const char *str2, const char *str3, + const char *str4, const char *format , const char *tooltip) +{ + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } + lo_message lmsg = lo_message_new(); + lo_message_add_string( lmsg, str1 ); + lo_message_add_string( lmsg, str2 ); + lo_message_add_string( lmsg, str3 ); + lo_message_add_string( lmsg, str4 ); + lo_message_add_string( lmsg, format ); + lo_message_add_string( lmsg, tooltip ); + + return (void*) lmsg; +} + +void *veejay_message_new_pulldown( void *osc, const char *str1,const char *str2, const char *id, const char *str3, + const char *str4, double dv, const char *tooltip ) +{ + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } + lo_message lmsg = lo_message_new(); + lo_message_add_string( lmsg, str1 ); + lo_message_add_string( lmsg, str2 ); + lo_message_add_string( lmsg, id ); + lo_message_add_string( lmsg, str3 ); + lo_message_add_string( lmsg, str4 ); + lo_message_add_double( lmsg, dv ); + lo_message_add_string( lmsg, tooltip ); + + return (void*) lmsg; +} + +void *veejay_message_new_widget( void *osc, const char *str1,const char *str2, int n_names ) +{ + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } + lo_message lmsg = lo_message_new(); + lo_message_add_string( lmsg, str1 ); + lo_message_add_string( lmsg, str2 ); + lo_message_add_int32( lmsg, n_names ); + + return (void*) lmsg; +} + +void veejay_message_widget_done( void *osc, void *msg ) +{ + oscclient_t *c = (oscclient_t*) osc; +#ifdef STRICT_CHECKING + assert( c->bundle != NULL ); +#endif + lo_message *lmsg = (lo_message*) msg; + lo_bundle_add_message( c->bundle, "/create/channels", lmsg ); +} + +void veejay_message_add_argument( void *osc, void *msg, const char *format, ... ) +{ + oscclient_t *c = (oscclient_t*) osc; +#ifdef STRICT_CHECKING + assert( c->bundle != NULL ); +#endif + lo_message *lmsg = (lo_message*) msg; + + va_list ap; + va_start( ap, format ); + veejay_add_arguments_( lmsg, format, ap ); + va_end(ap); +} +void veejay_message_pulldown_done( void *osc, void *msg ) +{ + oscclient_t *c = (oscclient_t*) osc; +#ifdef STRICT_CHECKING + assert( c->bundle != NULL ); +#endif + lo_message *lmsg = (lo_message*) msg; + lo_bundle_add_message( c->bundle, "/create/pulldown", lmsg ); +} +void veejay_message_pulldown_done_update( void *osc, void *msg ) +{ + oscclient_t *c = (oscclient_t*) osc; +#ifdef STRICT_CHECKING + assert( c->bundle != NULL ); +#endif + lo_message *lmsg = (lo_message*) msg; + lo_bundle_add_message( c->bundle, "/update/pulldown", lmsg ); +} +void veejay_message_linked_pulldown_done( void *osc, void *msg ) +{ + oscclient_t *c = (oscclient_t*) osc; +#ifdef STRICT_CHECKING + assert( c->bundle != NULL ); +#endif + lo_message *lmsg = (lo_message*) msg; + lo_bundle_add_message( c->bundle, "/create/fxpulldown", lmsg ); +} + + +void veejay_bundle_plugin_add( void *osc, const char *window, const char *path, const char *format, void *value ) +{ + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + + lo_message lmsg = lo_message_new(); + + lo_message_add_string(lmsg, window ); + lo_message_add_string(lmsg, path ); + + int n_elem = strlen( format ); +#ifdef STRICT_CHECKING + assert( n_elem == 1 ); +#endif + + int ival; + char *str; + double gval; + uint64_t val; + + switch(*format) + { + case 's': + str = (char*) *( (char*) value); + lo_message_add_string( lmsg, str ); + break; + case 'i': + ival = (int) *( (int*) value ); + lo_message_add_int32( lmsg, ival ); + break; + case 'd': + gval = (double) *( (double*) value ); + lo_message_add_double( lmsg, gval ); + break; + case 'h': + val = (uint64_t) *( (uint64_t*) value ); + lo_message_add_int64( lmsg, (int64_t) val ); + break; + default: + lo_message_free( lmsg ); + return; + break; + } + + lo_bundle_add_message( c->bundle,"/update/widget", lmsg ); +} + + +void veejay_bundle_sample_fx_add( void *osc, int id, int entry, const char *word, const char *format, ... ) +{ + char osc_path[256]; + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } + + sprintf(osc_path, "/sample_%d/fx_%d/%s", id, entry, word ); + lo_message lmsg = lo_message_new(); + + char realwin[128]; + sprintf(realwin, "%sFX%d", c->window, entry ); + lo_message_add_string(lmsg, realwin ); + + lo_message_add_string(lmsg, osc_path ); + va_list ap; + if( format ) + { + va_start( ap, format ); + veejay_add_arguments_( lmsg, format, ap ); + va_end(ap); + } + lo_bundle_add_message( c->bundle,"/update/widget", lmsg ); + +} +void veejay_bundle_sample_add( void *osc, int id, const char *word, const char *format, ... ) +{ + char osc_path[256]; + oscclient_t *c = (oscclient_t*) osc; +#ifdef STRICT_CHECKING + assert( c->window != NULL ); +#endif + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } + + sprintf(osc_path, "/sample_%d/%s", id, word ); + lo_message lmsg = lo_message_new(); + lo_message_add_string(lmsg, c->window ); + lo_message_add_string(lmsg, osc_path ); + + va_list ap; + if( format ) + { + va_start( ap, format ); + veejay_add_arguments_( lmsg, format, ap ); + va_end(ap); + } + + + lo_bundle_add_message( c->bundle, "/update/widget", lmsg ); +} +void veejay_bundle_sample_add_fx_atom( void *osc, int id,int entry, const char *word, const char *format, int type, void *value ) +{ + char osc_path[256]; + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } + + sprintf(osc_path, "/sample_%d/fx_%d/%s", id, entry,word ); + lo_message lmsg = lo_message_new(); + char realwin[128]; + sprintf(realwin, "%sFX%d", c->window, entry ); + lo_message_add_string(lmsg, realwin ); + lo_message_add_string(lmsg, osc_path ); + + int ival; + char *str; + double gval; + uint64_t val; + switch(type) + { + case VEVO_ATOM_TYPE_STRING: + str = (char*) *( (char*) value); + lo_message_add_string( lmsg, str ); + break; + case VEVO_ATOM_TYPE_BOOL: + case VEVO_ATOM_TYPE_INT: + ival = (int) *( (int*) value ); + lo_message_add_int32( lmsg, ival ); + break; + case VEVO_ATOM_TYPE_DOUBLE: + gval = (double) *( (double*) value ); + lo_message_add_double( lmsg, gval ); + break; + case VEVO_ATOM_TYPE_UINT64: + val = (uint64_t) *( (uint64_t*) value ); + lo_message_add_int64( lmsg, (int64_t) val ); + break; + default: + lo_message_free( lmsg ); + return; + break; + } + + lo_bundle_add_message( c->bundle,"/update/widget", lmsg ); + +} +void veejay_bundle_add_atom( void *osc, const char *osc_path, const char *format, int type, void *value ) +{ + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } + + lo_message lmsg = lo_message_new(); + lo_message_add_string( lmsg,c->window ); + lo_message_add_string( lmsg,osc_path ); + + int ival; + char *str; + double gval; + uint64_t val; + switch(type) + { + case VEVO_ATOM_TYPE_STRING: + str = (char*) *( (char*) value); + lo_message_add_string( lmsg, str ); + break; + case VEVO_ATOM_TYPE_BOOL: + case VEVO_ATOM_TYPE_INT: + ival = (int) *( (int*) value ); + lo_message_add_int32( lmsg, ival ); + break; + case VEVO_ATOM_TYPE_DOUBLE: + gval = (double) *( (double*) value ); + lo_message_add_double( lmsg, gval ); + break; + case VEVO_ATOM_TYPE_UINT64: + val = (uint64_t) *( (uint64_t*) value ); + lo_message_add_int64( lmsg, (int64_t) val ); + break; + default: + lo_message_free( lmsg ); + return; + break; + } + + lo_bundle_add_message( c->bundle, "/update/widget", lmsg ); + +} + + + +void veejay_bundle_sample_add_atom( void *osc, int id, const char *word, const char *format, int type, void *value ) +{ + char osc_path[256]; + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } + + sprintf(osc_path, "/sample_%d/%s", id, word ); + lo_message lmsg = lo_message_new(); + lo_message_add_string(lmsg, c->window ); + lo_message_add_string(lmsg, osc_path ); + + int ival; + char *str; + double gval; + uint64_t val; + switch(type) + { + case VEVO_ATOM_TYPE_STRING: + str = (char*) *( (char*) value); + lo_message_add_string( lmsg, str ); + break; + case VEVO_ATOM_TYPE_BOOL: + case VEVO_ATOM_TYPE_INT: + ival = (int) *( (int*) value ); + lo_message_add_int32( lmsg, ival ); + break; + case VEVO_ATOM_TYPE_DOUBLE: + gval = (double) *( (double*) value ); + lo_message_add_double( lmsg, gval ); + break; + case VEVO_ATOM_TYPE_UINT64: + val = (uint64_t) *( (uint64_t*) value ); + lo_message_add_int64( lmsg, (int64_t) val ); + break; + default: + lo_message_free( lmsg ); + return; + break; + } + + lo_bundle_add_message( c->bundle, "/update/widget", lmsg ); + +} + +void veejay_bundle_send( void *osc ) +{ + oscclient_t *c = (oscclient_t*) osc; + if(c->bundle) + lo_send_bundle( c->addr, c->bundle ); +} + +void veejay_bundle_destroy(void *osc ) +{ + oscclient_t *c = (oscclient_t*) osc; + lo_bundle_free(c->bundle); + c->bundle = NULL; +} +void veejay_ui_bundle_add( void *osc, const char *msg, const char *format, ... ) +{ + oscclient_t *c = (oscclient_t*) osc; + if(!c->bundle) + { + c->bundle = lo_bundle_new( LO_TT_IMMEDIATE ); + } +#ifdef STRICT_CHECKING + assert( c->bundle != NULL ); +#endif + lo_message lmsg = lo_message_new(); + + va_list ap; + + if( format ) + { + va_start( ap, format ); + veejay_add_arguments_( lmsg, format, ap ); + va_end(ap); + } + + lo_bundle_add_message( c->bundle, msg, lmsg ); +} diff --git a/veejay-ng/veejay/oscsend.h b/veejay-ng/veejay/oscsend.h index 013f8759..8b5fca62 100644 --- a/veejay-ng/veejay/oscsend.h +++ b/veejay-ng/veejay/oscsend.h @@ -18,8 +18,38 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +void *veejay_new_osc_sender_uri( const char *uri ); void *veejay_new_osc_sender( const char *addr, const char *port ); void veejay_free_osc_sender( void *dosc ); + +void veejay_osc_set_window( void *osc, char *window ); int veejay_send_osc( void *osc ,const char *msg, const char *format, ... ); int veejay_vevo_send_osc( void *osc, const char *msg, void *vevo_port ); +int veejay_send_osc_strargs( void *osc, const char *msg, int n_str, char **strs ); +void veejay_message_add_argument( void *osc, void *msg, const char *format, ... ); + +void *veejay_message_new_pulldown( void *osc, const char *str0,const char *str1,const char *id, const char *str2, + const char *str3, double dv , const char *str ); +void *veejay_message_new_widget( void *osc, const char *str1,const char *str2, int n_names ); +void veejay_message_linked_pulldown_done( void *osc, void *msg ); +void veejay_message_widget_done( void *osc, void *msg ); +void *veejay_message_new_linked_pulldown( void *osc, const char *str0,const char *str1, const char *str2, + const char *str3, const char *str4 , const char *str5 ); +void veejay_message_pulldown_done( void *osc, void *msg ); +void veejay_message_pulldown_done_update( void *osc, void *msg ); +void veejay_bundle_sample_add( void *osc, int id, const char *msg, const char *format, ... ); +void veejay_bundle_add( void *osc, const char *msg, const char *format, ... ); +void veejay_bundle_send( void *osc ); +void veejay_bundle_destroy(void *osc ); +void veejay_bundle_add_blob( void *osc, const char *msg, void *blub ); +void veejay_bundle_add_blobs( void *osc, const char *msg, void *blub, void *blab, void *blib ); +void veejay_xbundle_add( void *osc, const char *window, const char *widget, const char *format, ... ); +void veejay_bundle_plugin_add( void *osc, const char *window, const char *path, const char *format, void *value ); +void veejay_bundle_sample_fx_add( void *osc, int id, int entry, const char *word, const char *format, ... ); + +void veejay_bundle_sample_add_fx_atom( void *osc, int id,int entry, const char *word, const char *format, int type, void *value ); +void veejay_bundle_add_atom( void *osc, const char *osc_path, const char *format, int type, void *value ); +void veejay_bundle_sample_add_atom( void *osc, int id, const char *word, const char *format, int type, void *value ); +void veejay_ui_bundle_add( void *osc, const char *msg, const char *format, ... ); + #endif diff --git a/veejay-ng/veejay/oscservit.c b/veejay-ng/veejay/oscservit.c index f7c306a8..225d42ed 100644 --- a/veejay-ng/veejay/oscservit.c +++ b/veejay-ng/veejay/oscservit.c @@ -10,7 +10,7 @@ * (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 +a/. * 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. * @@ -48,6 +48,8 @@ typedef struct { typedef struct { lo_server_thread st; + char *url; + int port; // void *events; } osc_recv_t; @@ -166,6 +168,13 @@ int osc_rest_handler( const char *path, const char *types, } +char *osc_get_uri(void *data) +{ + lo_address a = lo_message_get_source(data); + char *uri = lo_address_get_url(a); + return uri; +} + //@ plugin handler! int osc_plugin_handler( const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data ) @@ -173,13 +182,22 @@ int osc_plugin_handler( const char *path, const char *types, plugin_data_t *pd = (plugin_data_t*) user_data; veejay_t *info = pd->caller; - pthread_mutex_lock( &(info->vevo_mutex) ); + veejay_lock(info,__FUNCTION__); + char *uri = osc_get_uri( data ); +free(uri); + + veejay_msg(0, "%s: client '%s', %s" , __FUNCTION__, uri,path ); + +// char *uri = osc_get_uri( data ); +// veejay_set_current_client( info, uri ); +// free(uri); + char *required_format = plug_get_osc_format( pd->instance, pd->seq ); if( strcmp( required_format , types ) != 0 ) { veejay_msg(0, "Plugin Path %s wrong format '%s' , need '%s'", path,types, required_format ); - pthread_mutex_unlock( &(info->vevo_mutex) ); + veejay_unlock(info,__FUNCTION__ ); return 0; } int n_elem = strlen(required_format); @@ -194,7 +212,7 @@ int osc_plugin_handler( const char *path, const char *types, elements[k] = argv[k]->i32; plug_set_parameter( pd->instance, pd->seq, n_elem, (void*)elements ); free(elements); - pthread_mutex_unlock( &(info->vevo_mutex) ); + veejay_unlock( info ,__FUNCTION__ ); return 0; } else if( types[0] == 'd' ) @@ -204,7 +222,8 @@ int osc_plugin_handler( const char *path, const char *types, elements[k] = argv[k]->d; plug_set_parameter( pd->instance, pd->seq, n_elem, (void*) elements ); free(elements); - pthread_mutex_unlock( &(info->vevo_mutex) ); + veejay_unlock( info ,__FUNCTION__ ); + return 0; } else if( types[0] == 's' ) @@ -215,11 +234,13 @@ int osc_plugin_handler( const char *path, const char *types, plug_set_parameter( pd->instance,pd->seq, n_elem, (void*) strs ); for( k = 0; k < n_elem; k ++ ) if(strs[k]) free(strs[k]); - pthread_mutex_unlock( &(info->vevo_mutex) ); + veejay_unlock( info ,__FUNCTION__ ); + return 0; } - pthread_mutex_unlock( &(info->vevo_mutex)); + veejay_unlock( info ,__FUNCTION__ ); + return 1; //@ try another method } @@ -228,19 +249,30 @@ int osc_veejay_handler( const char *path, const char *types, { plugin_data_t *pd = (plugin_data_t*) user_data; veejay_t *info = pd->caller; - pthread_mutex_lock( &(info->vevo_mutex) ); + veejay_lock( info ,__FUNCTION__ ); + + + char *uri = osc_get_uri( data ); + veejay_set_current_client( info, uri ); + + veejay_msg(0, "%s: client '%s', %s" , __FUNCTION__, uri,path ); // format of KEY in path!! - + free(uri); + + if( veejay_osc_property_calls_event( pd->instance, path, types, - argv )) + argv, + data )) { - pthread_mutex_unlock( &(info->vevo_mutex)); + veejay_unlock( info ,__FUNCTION__ ); + return 0; } - pthread_mutex_unlock( &(info->vevo_mutex)); + veejay_unlock( info ,__FUNCTION__ ); + return 1; //@ try another method } @@ -249,29 +281,44 @@ int osc_sample_handler( const char *path, const char *types, { plugin_data_t *pd = (plugin_data_t*) user_data; veejay_t *info = pd->caller; - pthread_mutex_lock( &(info->vevo_mutex) ); + veejay_lock( info ,__FUNCTION__ ); + char *uri = osc_get_uri( data ); + veejay_set_current_client( info, uri ); + veejay_msg(0, "%s: client '%s', path %s" , __FUNCTION__, uri ,path); + // format of KEY in path!! + free(uri); + + if( sample_osc_property_calls_event( pd->instance, path, types, - argv )) + argv, + data )) { - pthread_mutex_unlock( &(info->vevo_mutex) ); + veejay_unlock( info ,__FUNCTION__ ); + return 0; } + veejay_msg(0, "%s: %s continues", __FUNCTION__, path ); + char *required_format = sample_property_format_osc( pd->instance, path ); if(required_format == NULL ) { veejay_msg(0, "Plugin Path %s wrong format '%s' , need '%s'", path,types, required_format ); - pthread_mutex_unlock( &(info->vevo_mutex) ); + veejay_unlock( info ,__FUNCTION__ ); + + return 0; } if( strcmp( required_format , types ) != 0 ) { veejay_msg(0, "Sample Path %s wrong format '%s' , need '%s'", path,types, required_format ); - pthread_mutex_unlock( &(info->vevo_mutex) ); + veejay_unlock( info ,__FUNCTION__ ); + + return 0; } @@ -288,9 +335,11 @@ int osc_sample_handler( const char *path, const char *types, int32_t *elements = (int32_t*) vj_malloc(sizeof(int32_t) * n_elem ); for( k = 0; k < n_elem; k ++ ) elements[k] = argv[k]->i32; - sample_set_property_from_path( pd->instance, path, (void*)elements ); + sample_set_property_from_path( pd->instance, path,n_elem, (void*)elements ); free(elements); - pthread_mutex_unlock(&(info->vevo_mutex)); + veejay_unlock( info ,__FUNCTION__ ); + + return 0; } else if( types[0] == 'd' ) @@ -298,9 +347,11 @@ int osc_sample_handler( const char *path, const char *types, double *elements = (double*) vj_malloc(sizeof(double) * n_elem ); for( k = 0; k < n_elem; k ++ ) elements[k] = argv[k]->d; - sample_set_property_from_path( pd->instance, path, (void*)elements ); + sample_set_property_from_path( pd->instance, path,n_elem, (void*)elements ); free(elements); - pthread_mutex_unlock(&(info->vevo_mutex)); + veejay_unlock( info ,__FUNCTION__ ); + + return 0; } @@ -309,10 +360,12 @@ int osc_sample_handler( const char *path, const char *types, char **strs = vj_malloc(sizeof(char*) * n_elem ); for( k = 0; k < n_elem; k ++ ) strs[k] = strdup( (char*) &argv[k]->s ); - sample_set_property_from_path( pd->instance, path, (void*)strs ); + sample_set_property_from_path( pd->instance, path, n_elem, (void*)strs ); for( k = 0; k < n_elem; k ++ ) if(strs[k]) free(strs[k]); - pthread_mutex_unlock(&(info->vevo_mutex)); + veejay_unlock( info ,__FUNCTION__ ); + + return 0; } else if( types[0] == 'h' ) @@ -320,14 +373,16 @@ int osc_sample_handler( const char *path, const char *types, uint64_t *elements = vj_malloc(sizeof(uint64_t) * n_elem ); for( k = 0; k < n_elem; k ++ ) elements[k] = argv[k]->h; - sample_set_property_from_path( pd->instance, path, (void*) elements ); - pthread_mutex_unlock(&(info->vevo_mutex)); + sample_set_property_from_path( pd->instance, path, n_elem,(void*) elements ); + veejay_unlock( info ,__FUNCTION__ ); + + return 0; } - - pthread_mutex_unlock( &(info->vevo_mutex)); + veejay_unlock( info ,__FUNCTION__ ); + return 1; } @@ -359,13 +414,27 @@ void *veejay_new_osc_server( void *data, const char *port ) s->st = lo_server_thread_new( port, error_handler ); lo_server_thread_start( s->st ); -// lo_server_thread_add_method( s->st, NULL,NULL, osc_rest_handler,NULL ); + s->url = lo_server_thread_get_url( s->st ); + s->port = lo_server_thread_get_port( s->st ); + + veejay_msg( 0, "OSC server '%s' ready",s->url ); - - veejay_msg( 0, "OSC server ready at UDP port %d", lo_server_thread_get_port(s->st) ); return (void*) s; } +char *veejay_osc_server_get_addr( void *data ) +{ + osc_recv_t *s = (osc_recv_t*) data; + return s->url; +} + +int veejay_osc_server_get_port( void *data ) +{ + osc_recv_t *s = (osc_recv_t*) data; + return s->port; +} + + static int servit_new_event( void *userdata, void *osc_space, @@ -547,6 +616,7 @@ void veejay_free_osc_server( void *dosc ) osc_recv_t *s = (osc_recv_t*) dosc; lo_server_thread_stop( s->st ); lo_server_thread_free( s->st ); + free(s->url); // vevo_port_free( s->events ); free(s); s = NULL; diff --git a/veejay-ng/veejay/oscservit.h b/veejay-ng/veejay/oscservit.h index 7eef921a..8aefc3df 100644 --- a/veejay-ng/veejay/oscservit.h +++ b/veejay-ng/veejay/oscservit.h @@ -20,6 +20,8 @@ */ void *veejay_new_osc_server( void *data, const char *port ); void veejay_free_osc_server( void *dosc ); +char *veejay_osc_server_get_addr( void *data ); +int veejay_osc_server_get_port( void *data ); void veejay_osc_del_methods( void *user_data, void *osc_space,void *vevo_port, void *fx_instance ); diff --git a/veejay-ng/veejay/performer.c b/veejay-ng/veejay/performer.c index 7333259b..10b9cfb2 100644 --- a/veejay-ng/veejay/performer.c +++ b/veejay-ng/veejay/performer.c @@ -31,6 +31,7 @@ #include #include #include +#include #ifdef STRICT_CHECKING #include #endif @@ -352,6 +353,8 @@ long performer_audio_start( veejay_t *info ) assert( rate > 0 ); assert( bits > 0 ); #endif + + int res = vj_jack_init( bits, chans, rate ); if( res <= 0 ) { @@ -363,7 +366,12 @@ long performer_audio_start( veejay_t *info ) { info->audio = AUDIO_PLAY; p->resampler = vj_audio_init( PERFORM_AUDIO_SIZE * 32 , chans,1 ); - + veejay_msg(0, "Playing Audio %d, %d channels, %d bits, %d bps", + rate,chans,bits,bps ); +#ifdef STRICT_CHECKING + veejay_msg(0, "Audio support is broken"); + assert(0); +#endif } return rate; @@ -430,7 +438,11 @@ void performer_audio_restart( veejay_t *info ) void performer_destroy( veejay_t *info ) { performer_t *p = (performer_t*) info->performer; - subsample_free( p->sampler ); +#ifdef STRICT_CHECKING + assert( p != NULL ); +#endif + if(p->sampler) + subsample_free( p->sampler ); if(p->in_frames) vevo_port_free( p->in_frames ); int i; @@ -504,12 +516,15 @@ static uint8_t *performer_fetch_audio_frames( veejay_t *info, int *gen_samples ) { n_samples = 0; } + + veejay_msg("%s: has_audio=%d, n_samples=%d, speed=%d",__FUNCTION__,has_audio,n_samples, speed ); + if( n_samples == 0 ) { sample_get_property_ptr(info->current_sample, "audio_spas", &n_samples ); if(!has_audio) { - veejay_msg(0, "%s: Not playing audio, faking samples to 1764"); + veejay_msg(0, "%s: Not playing audio, faking samples to 1764", __FUNCTION__); *gen_samples = 1764; memset( f->data,0 , PERFORM_AUDIO_SIZE); return f->data; @@ -523,11 +538,26 @@ static uint8_t *performer_fetch_audio_frames( veejay_t *info, int *gen_samples ) else { res = sample_get_audio_frame( info->current_sample,f, abs(speed) ); + veejay_msg(0, "\tsample_get_audio_frame: %d result to buf %p", res, f->data); +#ifdef STRICT_CHECKING + assert( f->rate == 44100 ); + assert( f->num_chans = 2 ); + assert( f->bps = 4 ); + assert( f->bits = 16 ); +#endif } uint8_t *out = (speed == 1 || speed == -1 ? f->data : k->data ); + + k->rate = f->rate; + k->num_chans = f->num_chans; + k->bps = f->bps; + k->bits = f->bits; + uint8_t *in = f->data; + veejay_msg(0, "\tOut buffer is %p, inbuffer is %p", out, in); + if( speed < 0 ) { vj_audio_sample_reverse( in, q->data, n_samples, f->bps ); @@ -538,6 +568,12 @@ static uint8_t *performer_fetch_audio_frames( veejay_t *info, int *gen_samples ) int slow = sample_get_repeat( info->current_sample ); if( (speed > 1 || speed < -1 || slow) && has_audio) { + int b_samples = n_samples; + + veejay_msg(0, "\tInput buffer: %x,%x,%x,%x,%x", + f->data[0],f->data[1],f->data[2],f->data[3],f->data[4]); + + n_samples = vj_audio_resample_data( p->resampler, in, k->data, @@ -545,9 +581,16 @@ static uint8_t *performer_fetch_audio_frames( veejay_t *info, int *gen_samples ) f->num_chans, abs(speed), slow, - f->samples, + res, n_samples ); out = k->data; + veejay_msg(0, "\tOutput buffer: %x,%x,%x,%x,%x", + out[0],out[1],out[2],out[3],out[4]); + + + + veejay_msg(0, "\tn_samples: %d, f->bps=%d, f->chans=%d, f->samples=%d, n_samples=%d", + n_samples, f->bps, f->num_chans, f->samples, b_samples ); } *gen_samples = n_samples; @@ -594,6 +637,10 @@ void performer_save_frame( veejay_t *info ) */ int performer_queue_audio_frame( veejay_t *info, int skipa ) { + if(info->audio != AUDIO_PLAY || skipa) + return 1; + + static uint8_t *buffer_ = NULL; static int j_samples_ = 0; static int samples_played_ =0; @@ -607,26 +654,28 @@ int performer_queue_audio_frame( veejay_t *info, int skipa ) AFrame *q = p->audio_buffers[2]; int res = 0; int n_samples_ = 0; - if(info->audio != AUDIO_PLAY) - return 1; - int frame_repeat = sample_get_repeat_count( info->current_sample ); int nf = sample_get_repeat( info->current_sample ); - if( frame_repeat == 0 && !skipa) + if( frame_repeat == 0 ) { buffer_ = performer_fetch_audio_frames( info, &n_samples_ ); j_samples_ = (nf>0 ? n_samples_ / (nf+1) : n_samples_); samples_played_ = 0; } + + veejay_msg(0, "\tSkipa=%d,nf=%d,j_samples=%d, n_samples_=%d,samples_played=%d", + skipa,nf,j_samples_, n_samples_, samples_played_ ); + if(nf == 0) { - if(!skipa) vj_jack_play( buffer_, f->bps * n_samples_ ); + veejay_msg(0,"\tplaying %d samples, %d bytes, buffer %p", n_samples_, f->bps * n_samples_, buffer_ ); + vj_jack_play( buffer_, f->bps * n_samples_ ); } if( nf > 0) { - if(!skipa) vj_jack_play( buffer_ + (samples_played_ * f->bps), f->bps * j_samples_ ); + vj_jack_play( buffer_ + (samples_played_ * f->bps), f->bps * j_samples_ ); samples_played_ += j_samples_; } #endif @@ -667,6 +716,7 @@ static int performer_fetch_frames( veejay_t *info, void *samples_needed) sprintf(key,"%p", Sk ); vevo_property_set( p->in_frames, key, VEVO_ATOM_TYPE_VOIDPTR, 1, &value ); } + n_fetched++; free(fetch_list[k]); @@ -709,12 +759,15 @@ static void performer_preview_frame_greyscale( VJFrame *src, VJFrame *dst, int r { case PREVIEW_50: performer_down_scale_plane1x2( src->data[0], src->len, dst->data[0]); + dst->len = src->len / 2; break; case PREVIEW_25: performer_down_scale_plane1x4( src->data[0], src->len, dst->data[0]); + dst->len = src->len / 4; break; case PREVIEW_125: performer_down_scale_plane1x8( src->data[0], src->len, dst->data[0]); + dst->len = src->len / 8; break; default: break; @@ -729,17 +782,22 @@ static void performer_preview_frame_color( VJFrame *src, VJFrame *dst, int reduc performer_down_scale_plane1x2( src->data[0], src->len, dst->data[0]); performer_down_scale_plane1x2( src->data[1], src->uv_len, dst->data[1]); performer_down_scale_plane1x2( src->data[2], src->uv_len, dst->data[2]); + dst->len = src->len / 2; + dst->uv_len = src->uv_len / 2; break; case PREVIEW_25: performer_down_scale_plane1x4( src->data[0], src->len, dst->data[0]); performer_down_scale_plane1x4( src->data[1], src->uv_len, dst->data[1]); performer_down_scale_plane1x4( src->data[2], src->uv_len, dst->data[2]); - + dst->len = src->len / 4; + dst->uv_len = src->uv_len / 4; break; case PREVIEW_125: performer_down_scale_plane1x8( src->data[0], src->len, dst->data[0]); performer_down_scale_plane1x8( src->data[1], src->uv_len, dst->data[1]); performer_down_scale_plane1x8( src->data[2], src->uv_len, dst->data[2]); + dst->len = src->len / 8; + dst->uv_len = src->uv_len / 8; break; default: @@ -756,11 +814,12 @@ static void performer_preview_frame_color( VJFrame *src, VJFrame *dst, int reduc \return Error code */ -int performer_setup_preview( veejay_t *info, performer_t *p, int reduce, int preview_mode ) +int performer_setup_preview( veejay_t *info,int reduce, int preview_mode ) { //@ use LZO for fast compression video_playback_setup *settings = info->settings; - + performer_t *p = info->performer; + switch( preview_mode ) { case PREVIEW_NONE: @@ -808,25 +867,17 @@ static int performer_push_out_frames( void *sample, performer_t *p, int i ) static int performer_push_in_frames( void *sample, performer_t *p, int i ) { - int ni = 0; + int ni = 0,k; int error = 0; + int n_channels = 0; + void *channels = sample_scan_in_channels( sample, i,&n_channels ); + if(!channels || n_channels <= 0) + return 0; -// void *channels = sample_get_fx_port_channels_ptr( sample,i ); - void *channels = sample_scan_in_channels( sample, i ); -#ifdef STRICT_CHECKING - assert( channels != NULL ); -#endif char **list = vevo_list_properties( channels ); if( list == NULL ) return 0; - int tmp1 = 0, tmp2= 0; - error = vevo_property_get( channels , "n_in_channels" , 0, &tmp1 ); -#ifdef STRICT_CHECKING - assert(error == VEVO_NO_ERROR); -#endif - - int k; for( k = 0; list[k] != NULL ; k ++ ) { char key[64]; @@ -854,11 +905,14 @@ static int performer_push_in_frames( void *sample, performer_t *p, int i ) } free(list); - return tmp1; + return n_channels; } static int performer_render_entry( veejay_t *info, void *sample, performer_t *p, int i) { +#ifdef STRICT_CHECKING + assert( sample != NULL ); +#endif double opacity = sample_get_fx_alpha( sample, i ); char key[64]; int error = 0; @@ -922,11 +976,14 @@ static int performer_render_entry( veejay_t *info, void *sample, performer_t *p, static void performer_render_frame( veejay_t *info, int i ) { void *cs = info->current_sample; +#ifdef STRICT_CHECKING + assert( cs != NULL ); +#endif performer_t *p = (performer_t*) info->performer; p->display = p->ref_buffer[0]; for( i = 0; i < SAMPLE_CHAIN_LEN; i ++ ) { - if( sample_process_entry( cs, i )) + if( sample_get_fx_status( cs, i )) { if(performer_render_entry( info, cs,p, i )) p->display = p->out_buffers[p->last]; @@ -934,6 +991,40 @@ static void performer_render_frame( veejay_t *info, int i ) } } +static void performer_render_preview( veejay_t *info ) +{ + performer_t *p = (performer_t*) info->performer; + video_playback_setup *settings = info->settings; + int n_planes = 0; + lo_blob planes[3]; + + void *sender = veejay_get_osc_sender( info ); + if(!sender) + return; + + switch(settings->preview ) + { + case PREVIEW_NONE: + return; + case PREVIEW_GREYSCALE: + performer_preview_frame_greyscale( + p->display, p->preview_bw, info->preview_size ); + planes[0] = lo_blob_new( p->preview_bw->len, p->preview_bw->data[0] ); + veejay_bundle_add_blob( sender, "/update/preview", planes[0] ); + break; + case PREVIEW_COLOR: + performer_preview_frame_color( p->display, p->preview_col, info->preview_size ); + planes[0] = lo_blob_new( p->preview_col->len, p->preview_col->data[0] ); + planes[1] = lo_blob_new( p->preview_col->uv_len, p->preview_col->data[1] ); + planes[2] = lo_blob_new( p->preview_col->uv_len, p->preview_col->data[2] ); + veejay_bundle_add_blobs( sender, "/update/preview", planes[0],planes[1],planes[2]); + break; + } + + + +} + //! Build a list of frames to fetch and fetch it /**! \param info Veejay Object @@ -941,29 +1032,24 @@ static void performer_render_frame( veejay_t *info, int i ) */ int performer_queue_frame( veejay_t *info, int skip_incr ) { + video_playback_setup *settings = info->settings; + performer_t *p = (info->performer); #ifdef STRICT_CHECKING assert( info->current_sample != NULL ); #endif - -#ifdef STRICT_CHECKING - void *queue_list = vevo_port_new( VEVO_ANONYMOUS_PORT, __FUNCTION__ , __LINE__ ); - assert( queue_list != NULL ); -#else + veejay_lock( info,__FUNCTION__ ); + void *queue_list = - vevo_port_new( VEVO_ANONYMOUS_PORT );//ll -#endif + vpn( VEVO_ANONYMOUS_PORT );//ll int i; int error = 0; + int dummy = 0; - - pthread_mutex_lock( &(info->vevo_mutex)); - if(!skip_incr) { char key[64]; sprintf(key, "%p", info->current_sample ); - // sprintf(key, "slot0", info->current_sample ); error = vevo_property_set( queue_list, key, VEVO_ATOM_TYPE_VOIDPTR,1,&(info->current_sample)); #ifdef STRICT_CHECKING assert( error == VEVO_NO_ERROR ); @@ -973,33 +1059,36 @@ int performer_queue_frame( veejay_t *info, int skip_incr ) //@ lock for( i = 0; i < SAMPLE_CHAIN_LEN; i ++ ) { - if( sample_process_entry( info->current_sample, i )) + if( sample_get_fx_status( info->current_sample, i )) { - void *channels = sample_scan_in_channels( info->current_sample, i ); - error = vevo_special_union_ports( channels, queue_list ); + void *channels = sample_scan_in_channels( info->current_sample, i , &dummy); + if(channels) + { + error = vevo_special_union_ports( channels, queue_list ); #ifdef STRICT_CHECKING - assert( error == VEVO_NO_ERROR ); + if( error != VEVO_NO_ERROR ) + veejay_msg(0,"Internal error while intersecting ports: %d", error ); + assert( error == VEVO_NO_ERROR ); #endif + } } } -#ifdef STRICT_CHECKING - p->in_frames = vevo_port_new( VEVO_ANONYMOUS_PORT, __FUNCTION__ , __LINE__ ); -#else /* Build reference list */ - p->in_frames = vevo_port_new( VEVO_ANONYMOUS_PORT ); -#endif + p->in_frames = vpn( VEVO_ANONYMOUS_PORT ); performer_fetch_frames( info, queue_list ); performer_render_frame(info, p); - - pthread_mutex_unlock( &(info->vevo_mutex)); - - //@ unlock + + performer_render_preview( info ); + + samplebank_flush_osc(info, info->clients); vevo_port_free( queue_list ); vevo_port_free( p->in_frames ); + p->in_frames = NULL; - + + veejay_unlock( info, __FUNCTION__); return 0; } diff --git a/veejay-ng/veejay/veejay.c b/veejay-ng/veejay/veejay.c index 4d4f8c1e..83de8a4b 100644 --- a/veejay-ng/veejay/veejay.c +++ b/veejay-ng/veejay/veejay.c @@ -238,7 +238,7 @@ static int check_command_line_options(int argc, char *argv[]) } } - if (optind > argc) + if (optind > argc || argc <= 1) nerr++; if (nerr) @@ -409,6 +409,8 @@ int main(int argc, char **argv) return 0; } + veejay_msg(VEEJAY_MSG_INFO, "Entering veejay"); + if(!veejay_main(info)) { veejay_msg(VEEJAY_MSG_ERROR, "Cannot start main playback cycle"); diff --git a/veejay-ng/veejay/veejay.h b/veejay-ng/veejay/veejay.h index b28b242e..a4bf0f9e 100644 --- a/veejay-ng/veejay/veejay.h +++ b/veejay-ng/veejay/veejay.h @@ -121,6 +121,8 @@ typedef struct // void *mcast_socket; void *osc_server; void *osc_namespace; + void *clients; + char *current_client; int current_link; int port_offset; int use_display; diff --git a/veejay-ng/veejay/vj-pjack.c b/veejay-ng/veejay/vj-pjack.c index a98a2633..07141864 100644 --- a/veejay-ng/veejay/vj-pjack.c +++ b/veejay-ng/veejay/vj-pjack.c @@ -31,7 +31,6 @@ static int bits_per_sample = 0; static unsigned long audio_rate = 0; static int audio_channels = 0; static int audio_bps = 0; -static int buffer_len = 0; static unsigned long v_rate = 0; extern void veejay_msg(int type, const char format[], ...); @@ -46,6 +45,10 @@ static int _vj_jack_start(int *dri) const char *port_name = NULL; unsigned long port_flags = JackPortIsPhysical; unsigned int port_count=0; + +veejay_msg(0, "Opening JACK %d bps, %d rate, %d channels", + bits_per_sample, audio_rate, audio_channels ); + int err = JACK_OpenEx(dri, bits_per_sample,&audio_rate,0,audio_channels, &port_name, port_count, port_flags); switch(err) { @@ -86,7 +89,6 @@ int vj_jack_init(int bits_ps, int audio_chans, int rate) audio_rate = rate; audio_channels = audio_chans; bits_per_sample = bits_ps; - buffer_len = vj_jack_get_space(); if( !_vj_jack_start(&driver) ) return 0; @@ -127,7 +129,6 @@ int vj_jack_reset() { veejay_msg(0, "%s: RESET",__FUNCTION__ ); JACK_Reset(driver); - buffer_len = 0; return 1; } @@ -138,7 +139,9 @@ int vj_jack_c_play(void *data, int len, int entry) int vj_jack_play(void *data, int len) { - return JACK_Write(driver,data,len); + int res; + res = JACK_Write(driver,data,len); + veejay_msg(0, "\tWrote %d/%d bytes to jack",res,len); } int vj_jack_set_volume(int volume) @@ -160,16 +163,11 @@ int vj_jack_resume() return 1; } -int vj_jack_get_space() -{ - return JACK_GetBytesFreeSpace(driver); -} - long vj_jack_get_status(long int *sec, long int *usec) { //JACK_GetPosition(int deviceID, enum pos_enum position, int type); - return JACK_OutputStatus( driver , sec, usec ) + JACK_GetJackOutputLatency( driver ) + (JACK_GetJackBufferedBytes(driver) * 2); + return JACK_OutputStatus( driver , sec, usec ); + JACK_GetJackOutputLatency( driver ) + (JACK_GetJackBufferedBytes(driver) * 2); } #endif