diff --git a/veejay-current/INSTALL b/veejay-current/INSTALL index 56b077d6..54caf7c1 100644 --- a/veejay-current/INSTALL +++ b/veejay-current/INSTALL @@ -1,16 +1,13 @@ -Installation Instructions -************************* +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free -Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives + This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== -These are generic installation instructions. + These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses @@ -70,9 +67,9 @@ The simplest way to compile this package is: Compilers and Options ===================== -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here @@ -85,7 +82,7 @@ is an example: Compiling For Multiple Architectures ==================================== -You can compile the package for more than one kind of computer at the + You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the @@ -102,19 +99,19 @@ for another architecture. Installation Names ================== -By default, `make install' will install the package's files in + By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PREFIX'. +option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PREFIX', the package will -use PREFIX as the prefix for installing programs and libraries. +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular +options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. @@ -125,7 +122,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= -Some packages pay attention to `--enable-FEATURE' options to + Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The @@ -140,11 +137,11 @@ you can use the `configure' options `--x-includes=DIR' and Specifying the System Type ========================== -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: @@ -170,9 +167,9 @@ eventually be run) with `--host=TYPE'. Sharing Defaults ================ -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. @@ -181,7 +178,7 @@ A warning: not all `configure' scripts look for a site script. Defining Variables ================== -Variables not defined in a site shell script can be set in the + Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set @@ -189,18 +186,14 @@ them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: - - /bin/bash ./configure CONFIG_SHELL=/bin/bash - -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). `configure' Invocation ====================== -`configure' recognizes the following options to control how it operates. + `configure' recognizes the following options to control how it +operates. `--help' `-h' diff --git a/veejay-current/configure.ac b/veejay-current/configure.ac index 19346c05..8cf8f1d8 100644 --- a/veejay-current/configure.ac +++ b/veejay-current/configure.ac @@ -510,7 +510,7 @@ fi AC_MSG_CHECKING(whether to compile in debugging information) debugCFLAGS="" if test "x$enable_debug" = "xyes" ; then - debugCFLAGS="-g" + debugCFLAGS="-g -Wstack-protector -fstack-protector-all" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) diff --git a/veejay-current/depcomp b/veejay-current/depcomp index ffcd540c..25bdb188 100755 --- a/veejay-current/depcomp +++ b/veejay-current/depcomp @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2005-02-09.22 +scriptversion=2004-04-25.13 -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -43,18 +43,17 @@ Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF - exit $? + exit 0 ;; -v | --v*) echo "depcomp $scriptversion" - exit $? + exit 0 ;; esac @@ -62,10 +61,18 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" @@ -287,43 +294,33 @@ tru64) base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mecanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + # Dependencies are output in .lo.d with libtool 1.4. + # They are output in .o.d with libtool 1.5. + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.o.d" + tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + elif test -f "$tmpdepfile2"; then + tmpdepfile="$tmpdepfile2" + else + tmpdepfile="$tmpdepfile3" + fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. diff --git a/veejay-current/gveejay-reloaded/callback.c b/veejay-current/gveejay-reloaded/callback.c index 0a7d3d17..108c56fd 100644 --- a/veejay-current/gveejay-reloaded/callback.c +++ b/veejay-current/gveejay-reloaded/callback.c @@ -48,6 +48,11 @@ void text_defaults() } +void on_no_caching_clicked( GtkWidget *widget, gpointer user_data) +{ + single_vims( VIMS_NO_CACHING ); +} + void on_button_085_clicked(GtkWidget *widget, gpointer user_data) { single_vims(VIMS_VIDEO_SKIP_SECOND); @@ -2304,7 +2309,9 @@ void on_previewbw_toggled( GtkWidget *w , gpointer user_data) void on_previewtoggle_toggled(GtkWidget *w, gpointer user_data) { - multitrack_preview_master( info->mt, is_button_toggled("previewtoggle")); + multitrack_toggle_preview( info->mt, -1, is_button_toggled("previewtoggle"), + glade_xml_get_widget(info->main_window, "imageA") ); + setup_samplebank( NUM_SAMPLES_PER_COL, NUM_SAMPLES_PER_ROW ); } @@ -2320,43 +2327,30 @@ void on_previewlarge_clicked( GtkWidget *widget, gpointer user_data ) void on_previewspeed_value_changed( GtkWidget *widget, gpointer user_data) { + veejay_msg(0, "%s", __FUNCTION__); + double val = GTK_ADJUSTMENT(GTK_RANGE(widget)->adjustment)->value; double fps = (val * 100.0) / (double)info->el.fps ; - multitrack_set_preview_speed( info->mt , fps ); + //multitrack_set_preview_speed( info->mt , fps ); //sprintf(speed,"%2.2f " } void on_previewscale_value_changed( GtkWidget *widget, gpointer user_data) { - int w = info->el.width; - int h = info->el.height; - - if(w == 0 || h == 0 ) - return; - - double value = GTK_ADJUSTMENT(GTK_RANGE(widget)->adjustment)->value; - - int nw = (w * value); - int nh = (h * value); - - if( nw == 0 && nh == 0 ) - { - set_toggle_button( "previewtoggle", 0 ); - } - else - { - // @@@ MT! -// multitrack_resize( info->mt, nw,nh); - } + veejay_msg(0, "%s", __FUNCTION__); } + void on_preview_width_value_changed( GtkWidget *w, gpointer user_data) { + veejay_msg(0, "%s", __FUNCTION__); } void on_preview_height_value_changed( GtkWidget *w, gpointer user_data) { + veejay_msg(0, "%s", __FUNCTION__); + } void on_previewsmall_clicked( GtkWidget *widget, gpointer user_data) @@ -2369,6 +2363,9 @@ void on_previewsmall_clicked( GtkWidget *widget, gpointer user_data) else h = h / 3; update_spin_value( "preview_width", w ); update_spin_value( "preview_height", h ); + + veejay_msg(0, "%s", __FUNCTION__); + } void on_multitrack_activate( GtkWidget *w, gpointer user_data) @@ -2397,12 +2394,12 @@ void on_mt_delete_activate( GtkWidget *w, gpointer user_data) void on_mt_sync_start_clicked( GtkWidget *w, gpointer user_data) { - multitrack_sync_start( info->mt ); + //multitrack_sync_start( info->mt ); } void on_mtwindow_delete_event( GtkWidget *w , gpointer user_data) { - on_multitrack_deactivate(w, user_data); + //on_multitrack_deactivate(w, user_data); } void on_mtwindow_destroy_event( GtkWidget *w, gpointer user_data) @@ -2412,7 +2409,7 @@ void on_mtwindow_destroy_event( GtkWidget *w, gpointer user_data) void on_mt_sync_stop_clicked( GtkWidget *w , gpointer user_data) { - multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_PLAY_STOP,0 ); + //multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_PLAY_STOP,0 ); } void on_mt_sync_play_clicked( GtkWidget *w, gpointer user_data) { @@ -2435,7 +2432,7 @@ void on_mt_sync_decspeed_clicked( GtkWidget *w, gpointer user_data) int n = info->status_tokens[SAMPLE_SPEED]; if( n < 0 ) n += 1; if( n > 0 ) n -= 1; - multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_SET_SPEED, n ); + //multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_SET_SPEED, n ); } void on_mt_sync_incspeed_clicked( GtkWidget *w, gpointer user_data) @@ -2443,15 +2440,15 @@ void on_mt_sync_incspeed_clicked( GtkWidget *w, gpointer user_data) int n = info->status_tokens[SAMPLE_SPEED]; if( n < 0 ) n -= 1; if( n > 0 ) n += 1; - multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_SET_SPEED, n ); + //multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_SET_SPEED, n ); } void on_mt_sync_prev_clicked( GtkWidget *w , gpointer user_data) { - multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_PREV_FRAME ,0 ); + //multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_PREV_FRAME ,0 ); } void on_mt_sync_next_clicked( GtkWidget *w, gpointer user_data) { - multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_SKIP_FRAME, 0 ); + //multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_SKIP_FRAME, 0 ); } void on_delete1_activate(GtkWidget *w, gpointer user_data) @@ -3461,16 +3458,21 @@ void on_seqactive_toggled( GtkWidget *w, gpointer data ) void on_bq_button_clicked( GtkWidget *w, gpointer data ) { info->quality = 2; - multitrack_set_hlq( info->mt, info->el.fps, info->el.ratio, 2 ); + multitrack_set_quality( info->mt, 2 ); } void on_hqbutton_clicked( GtkWidget *w, gpointer data ) { info->quality = 1; - multitrack_set_hlq( info->mt, info->el.fps, info->el.ratio, 1 ); + multitrack_set_quality( info->mt, 1 ); } void on_lqbutton_clicked( GtkWidget *w, gpointer data ) { info->quality = 0; - multitrack_set_hlq( info->mt, info->el.fps, info->el.ratio, 0 ); + multitrack_set_quality( info->mt, 0 ); +} +void on_uq_button_clicked( GtkWidget *w, gpointer data ) +{ + info->quality = 3; + multitrack_set_quality( info->mt, 3 ); } diff --git a/veejay-current/gveejay-reloaded/multitrack.c b/veejay-current/gveejay-reloaded/multitrack.c index fd35b50e..bb63d70a 100644 --- a/veejay-current/gveejay-reloaded/multitrack.c +++ b/veejay-current/gveejay-reloaded/multitrack.c @@ -1,5 +1,5 @@ /* Gveejay Reloaded - graphical interface for VeeJay - * (C) 2002-2005 Niels Elburg + * (C) 2002-2006 Niels Elburg * * * This program is free software; you can redistribute it and/or modify @@ -35,21 +35,10 @@ #ifdef STRICT_CHECKING #include #endif -#include #include #include #include -#define WTIME 50000 -#define G_ERRORCHECK_MUTEXES 1 -#define G_DEBUG_LOCKS 1 -G_LOCK_DEFINE(mt_lock); - -extern int _Xdebug; -static float ratio_ = 1.0; -static int video_wid_ = 0; -static int video_hei_ = 0; -static float fps_ = 1.0; #define __MAX_TRACKS 64 typedef struct @@ -73,35 +62,17 @@ typedef struct GtkWidget *buttons2[8]; void *tracks; gint dim[2]; + int num; + int status_lock; + void *backlink; + int status_cache[32]; + int history[4][32]; } sequence_view_t; typedef struct { - int num; - sequence_view_t *view; - void *sequence; - char *hostname; - int port_num; - void *backlink; - int preview; - int active; - int used; - gint timeout; - int status_lock; - int history[4][20]; - int status_cache[20]; - char *tracks[__MAX_TRACKS]; -} mt_priv_t; - -typedef struct -{ - mt_priv_t *pt[__MAX_TRACKS+1]; - int stop_mt; - GThread *thread; -} all_priv_t; - -typedef struct -{ + sequence_view_t **view; + void *preview; GtkWidget *main_window; GtkWidget *main_box; GtkWidget *status_bar; @@ -109,38 +80,23 @@ typedef struct void *data; int selected; int sensitive; - int quit; + float fps; + int width; + int height; + int master_track; + GdkPixbuf *logo; } multitracker_t; -static int (*img_cb)(GdkPixbuf *p, GdkPixbuf *b, GtkImage *img); -static void (*gui_cb)(int, char*, int); -static int mt_new_connection_dialog(multitracker_t *mt, char *hostname,int len, int *port_num); -static void add_buttons( mt_priv_t *p, sequence_view_t *seqv , GtkWidget *w); -static void add_buttons2( mt_priv_t *p, sequence_view_t *seqv , GtkWidget *w); -static int num_tracks_active( multitracker_t * mt ); -void *mt_preview( gpointer user_data ); -static void set_logo(GtkWidget *area); -static sequence_view_t *new_sequence_view( mt_priv_t *p,gint w, gint h, gint last, GtkWidget *main_area ); -static int find_track( multitracker_t *mt, const char *host, int port ); - -static int preview_width_ = 0; -static int preview_height_ = 0; - -static int preview_quality_ = 0; - -static int mpreview_width_ = 0; -static int mpreview_height_ = 0; - static volatile int MAX_TRACKS = 4; -static volatile int LAST_TRACK = 0; -static int sta_w = 112; -static int sta_h = 96; -static GdkPixbuf *logo_img_ = NULL; -static float logo_step_ = 0.1; -static float logo_value_ = 1.0; -static void update_pos( mt_priv_t *p, gint total, gint current ); +static int mt_new_connection_dialog(multitracker_t *mt, char *hostname,int len, int *port_num); +static void add_buttons( sequence_view_t *p, sequence_view_t *seqv , GtkWidget *w); +static void add_buttons2( sequence_view_t *p, sequence_view_t *seqv , GtkWidget *w); +static sequence_view_t *new_sequence_view( void *vp, int num ); +static void update_pos( void *data, gint total, gint current ); +static gboolean seqv_mouse_press_event ( GtkWidget *w, GdkEventButton *event, gpointer user_data); + static void gtk_image_set_from_pixbuf__( GtkImage *w, GdkPixbuf *p, const char *f, int l ) { @@ -163,36 +119,6 @@ static void gtk_widget_set_sensitive__( GtkWidget *w, gboolean state, const char #define gtk_image_set_from_pixbuf_(w,p) gtk_image_set_from_pixbuf(w,p) #define gtk_widget_set_sensitive_( w,p ) gtk_widget_set_sensitive(w,p) #endif - -void multitrack_preview_master(void *data, int status) -{ - multitracker_t *mt = (multitracker_t*) data; - all_priv_t *pt = (all_priv_t*) mt->data; - mt_priv_t *last = pt->pt[LAST_TRACK]; - - -// veejay_toggle_image_loader( last->sequence, status ); - - - if( status == 1 && veejay_sequence_active_preview( last->sequence ) == 0) - veejay_toggle_image_loader( last->sequence, 1 ); - - - G_LOCK( mt_lock ); - - last->preview = status; - -/* int n = find_track( mt, last->hostname, last->port_num ); - if ( n >= 0 ) - { - mt_priv_t *p = pt->pt[ n ]; - gtk_toggle_button_set_active( - GTK_TOGGLE_BUTTON( p->view->toggle ), status == 0 ? FALSE: TRUE); - }*/ - - G_UNLOCK(mt_lock); -} - static void status_print(multitracker_t *mt, const char format[], ... ) { char buf[1024]; @@ -208,172 +134,167 @@ static void status_print(multitracker_t *mt, const char format[], ... ) va_end(args); } +static GdkPixbuf *load_logo_image( ) +{ + char path[1024]; + bzero(path,1024); + get_gd(path,NULL, "veejay-logo.png"); + return gdk_pixbuf_new_from_file( path,NULL ); +} + +int multitrack_get_sequence_view_id( void *data ) +{ + sequence_view_t *s = (sequence_view_t*) data; + return s->num; +} + +static void set_logo(GtkWidget *area) +{ +/* GdkPixbuf *buf2 = gdk_pixbuf_scale_simple( logo_img_,114,96, GDK_INTERP_BILINEAR ); + gtk_image_set_from_pixbuf_( GTK_IMAGE(area), buf2 ); + gdk_pixbuf_unref( buf2 );*/ +} + void multitrack_sync_start(void *data) { multitracker_t *mt = (multitracker_t*)data; - all_priv_t *pt = (all_priv_t*)mt->data; - gint i; - G_LOCK(mt_lock); - for( i = 0;i < MAX_TRACKS; i ++ ) - { - mt_priv_t *p = pt->pt[i]; - if(p->active) - { - veejay_sequence_send( p->sequence,VIMS_VIDEO_PLAY_STOP, NULL,NULL); - veejay_sequence_send( p->sequence,VIMS_VIDEO_GOTO_START , NULL ,NULL); - veejay_sequence_send(p->sequence, VIMS_VIDEO_PLAY_FORWARD, NULL ,NULL); - } - } - G_UNLOCK(mt_lock); -} -void multitrack_sync_simple_cmd(void *data, int vims_id, int value) -{ - multitracker_t *mt = (multitracker_t*)data; - all_priv_t *pt = (all_priv_t*)mt->data; - gint i; - G_LOCK(mt_lock); - for( i = 0;i < MAX_TRACKS; i ++ ) - { - mt_priv_t *p = pt->pt[i]; - if(p->active) - veejay_sequence_send( p->sequence, vims_id, (value > 0 ? "%d": NULL), - (value > 0 ? value :NULL)); - } - G_UNLOCK(mt_lock); + gvr_queue_vims( mt->preview,-1,VIMS_VIDEO_PLAY_STOP ); + gvr_queue_vims( mt->preview,-1,VIMS_VIDEO_GOTO_START ); + gvr_queue_vims( mt->preview,-1,VIMS_VIDEO_PLAY_FORWARD ); } -int sequence_get_track_id(void *priv) +static void seq_gotostart(GtkWidget *w, gpointer data ) { - mt_priv_t *p = (mt_priv_t*) priv; - return p->num; + sequence_view_t *v = (sequence_view_t*) data; + multitracker_t *mt = (multitracker_t*)v->backlink; + + gvr_queue_vims( mt->preview, v->num ,VIMS_VIDEO_GOTO_START ); } -int * sequence_get_track_status(void *priv) -{ - mt_priv_t *p = (mt_priv_t*) priv; - multitracker_t *mt = (multitracker_t*) p->backlink; - all_priv_t *a = (all_priv_t*) mt->data; - gint i; - int *result = (int*) vj_calloc(sizeof(int) * MAX_TRACKS ); - - for( i = 0;i < MAX_TRACKS ; i ++ ) - { - mt_priv_t *q = a->pt[i]; - result[i] = 0; // reset it - if(q->active) - { - // find in tracklist - gint j; - gint num = -1; - for( j = 0; j < MAX_TRACKS; j ++ ) - { - if(p->tracks[j]) - { - char hostname[255]; - int port_num = 0; - char *str = p->tracks[j]; - int tag_id = 0; - if(sscanf(str, "%s %d %d", hostname, &port_num, &tag_id )) - { - if(strncasecmp( hostname, q->hostname,strlen(hostname)) == 0 && port_num == - q->port_num ) - { - num = i; - break; - } - } - } - } - if( num >= 0 ) - result[i] = 1; - } - } - return result; -} - -static void seq_gotostart(GtkWidget *w, gpointer user_data ) -{ - mt_priv_t *p = (mt_priv_t*) user_data; - if(p->active) - veejay_sequence_send( p->sequence,VIMS_VIDEO_GOTO_START , NULL ,NULL); -} -static void seq_reverse(GtkWidget *w, gpointer user_data) +static void seq_reverse(GtkWidget *w, gpointer data) { - mt_priv_t *p = (mt_priv_t*) user_data; - if(p->active) - veejay_sequence_send(p->sequence, VIMS_VIDEO_PLAY_BACKWARD, NULL ,NULL); -} -static void seq_pause(GtkWidget *w, gpointer user_data) -{ - mt_priv_t *p = (mt_priv_t*) user_data; - if(p->active) - veejay_sequence_send(p->sequence, VIMS_VIDEO_PLAY_STOP, NULL ,NULL); + sequence_view_t *v = (sequence_view_t*) data; + multitracker_t *mt = (multitracker_t*)v->backlink; + + gvr_queue_vims( mt->preview, v->num ,VIMS_VIDEO_PLAY_BACKWARD ); } -static void seq_play( GtkWidget *w, gpointer user_data) + +static void seq_pause(GtkWidget *w, gpointer data) { - mt_priv_t *p = (mt_priv_t*) user_data; - if(p->active) - veejay_sequence_send(p->sequence, VIMS_VIDEO_PLAY_FORWARD, NULL ,NULL); + sequence_view_t *v = (sequence_view_t*) data; + multitracker_t *mt = (multitracker_t*)v->backlink; + + gvr_queue_vims( mt->preview, v->num ,VIMS_VIDEO_PLAY_STOP ); } -static void seq_gotoend(GtkWidget *w, gpointer user_data) + +static void seq_play( GtkWidget *w, gpointer data) { - mt_priv_t *p = (mt_priv_t*) user_data; - if(p->active) - veejay_sequence_send(p->sequence, VIMS_VIDEO_GOTO_END , NULL,NULL ); + sequence_view_t *v = (sequence_view_t*) data; + multitracker_t *mt = (multitracker_t*)v->backlink; + + gvr_queue_vims( mt->preview, v->num ,VIMS_VIDEO_PLAY_FORWARD ); } -static void seq_speeddown(GtkWidget *w, gpointer user_data) + +static void seq_gotoend(GtkWidget *w, gpointer data) { - mt_priv_t *p = (mt_priv_t*) user_data; - int n = p->status_cache[SAMPLE_SPEED]; + sequence_view_t *v = (sequence_view_t*) data; + multitracker_t *mt = (multitracker_t*)v->backlink; + + gvr_queue_vims( mt->preview, v->num ,VIMS_VIDEO_GOTO_END ); +} + +static void seq_speeddown(GtkWidget *w, gpointer data) +{ + sequence_view_t *v = (sequence_view_t*) data; + multitracker_t *mt = (multitracker_t*)v->backlink; + + gint n = v->status_cache[ SAMPLE_SPEED ]; + if( n < 0 ) n += 1; if( n > 0 ) n -= 1; - if(p->active) - veejay_sequence_send( p->sequence, VIMS_VIDEO_SET_SPEED, "%d", n ); + + gvr_queue_mvims( mt->preview, v->num ,VIMS_VIDEO_SET_SPEED , n ); } -static void seq_speedup(GtkWidget *w, gpointer user_data) + +static void seq_speedup(GtkWidget *w, gpointer data) { - mt_priv_t *p = (mt_priv_t*) user_data; - int n = p->status_cache[SAMPLE_SPEED]; + sequence_view_t *v = (sequence_view_t*) data; + multitracker_t *mt = (multitracker_t*)v->backlink; + + gint n = v->status_cache[ SAMPLE_SPEED ]; + if( n < 0 ) n -= 1; if( n > 0 ) n += 1; - if(p->active) - veejay_sequence_send( p->sequence, VIMS_VIDEO_SET_SPEED, "%d", n ); -} -static void seq_prevframe(GtkWidget *w, gpointer user_data) -{ - mt_priv_t *p = (mt_priv_t*) user_data; - if(p->active) - veejay_sequence_send( p->sequence, VIMS_VIDEO_PREV_FRAME, NULL,NULL ); -} -static void seq_nextframe(GtkWidget *w, gpointer user_data) -{ - mt_priv_t *p = (mt_priv_t*) user_data; - if(p->active) - veejay_sequence_send( p->sequence, VIMS_VIDEO_SKIP_FRAME, NULL,NULL ); + + gvr_queue_mvims( mt->preview, v->num ,VIMS_VIDEO_SET_SPEED , n ); } -static void seq_speed( GtkWidget *w, gpointer user_data) +static void seq_prevframe(GtkWidget *w, gpointer data) { - mt_priv_t *p = (mt_priv_t*) user_data; + sequence_view_t *v = (sequence_view_t*) data; + multitracker_t *mt = (multitracker_t*)v->backlink; + + gvr_queue_vims( mt->preview, v->num ,VIMS_VIDEO_PREV_FRAME ); - if(p->status_lock) +} + +static void seq_nextframe(GtkWidget *w, gpointer data) +{ + sequence_view_t *v = (sequence_view_t*) data; + multitracker_t *mt = (multitracker_t*)v->backlink; + + gvr_queue_vims( mt->preview, v->num ,VIMS_VIDEO_SKIP_FRAME ); +} + +static void seq_speed( GtkWidget *w, gpointer data) +{ + sequence_view_t *v = (sequence_view_t*) data; + multitracker_t *mt = v->backlink; + if(v->status_lock) return; + gdouble value = GTK_ADJUSTMENT( GTK_RANGE(w)->adjustment )->value; gint speed = (gint) value; - if(p->active && speed != 0) - veejay_sequence_send( p->sequence, VIMS_VIDEO_SET_SPEED, "%d", speed ); + gvr_queue_mvims( mt->preview, v->num ,VIMS_VIDEO_SET_SPEED , speed ); } -static void seq_opacity( GtkWidget *w, gpointer user_data) +static void seq_opacity( GtkWidget *w, gpointer data) { - mt_priv_t *p = (mt_priv_t*) user_data; + sequence_view_t *v = (sequence_view_t*) data; + multitracker_t *mt = v->backlink; - if(p->status_lock) + if(v->status_lock) return; + gdouble value = GTK_ADJUSTMENT( GTK_RANGE(w)->adjustment )->value; gint opacity = (gint)( value * 255.0); - if(p->active) - veejay_sequence_send( p->sequence, VIMS_CHAIN_MANUAL_FADE, "%d %d",0, opacity ); + gvr_queue_mmvims( mt->preview, v->num ,VIMS_CHAIN_MANUAL_FADE, 0, opacity ); +} + + +static void update_pos( void *user_data, gint total, gint current ) +{ + sequence_view_t *v = (sequence_view_t*) user_data; + multitracker_t *mt = v->backlink; + if(v->status_lock) + return; + + gtk_adjustment_set_value( + GTK_ADJUSTMENT(GTK_RANGE(v->timeline_)->adjustment), 1.0 / (gdouble) total * current ); + + char *now = format_time( current , mt->fps); + gtk_label_set_text( v->labels_[0], now ); + g_free(now); +} + +static void update_speed( void *user_data, gint speed ) +{ + sequence_view_t *v = (sequence_view_t*) user_data; + multitracker_t *mt = v->backlink; + if(v->status_lock) + return; + + gtk_adjustment_set_value( GTK_ADJUSTMENT( GTK_RANGE( v->sliders_[0] )->adjustment), (gdouble) speed ); } #define FIRST_ROW_END 5 @@ -398,7 +319,7 @@ static struct { NULL , 0 , NULL }, }; -static void add_buttons( mt_priv_t *p, sequence_view_t *seqv , GtkWidget *w) +static void add_buttons( sequence_view_t *p, sequence_view_t *seqv , GtkWidget *w) { int i; for( i = 0; i < FIRST_ROW_END;i ++ ) @@ -412,16 +333,15 @@ static void add_buttons( mt_priv_t *p, sequence_view_t *seqv , GtkWidget *w) gtk_button_set_image( GTK_BUTTON(seqv->buttons[i]), seqv->icons[i] ); gtk_widget_set_size_request( seqv->buttons[i],24,20 ); - // gtk_container_add( GTK_CONTAINER( w ), seqv->buttons[i] ); gtk_box_pack_start( GTK_BOX(w), seqv->buttons[i], TRUE,TRUE, 0 ); g_signal_connect( G_OBJECT( seqv->buttons[i] ), "clicked", G_CALLBACK( button_template_t[i].f), - (gpointer*)p ); + (gpointer)p ); gtk_widget_show( seqv->buttons[i] ); } -// gtk_widget_set_sensitive_( w, FALSE ); } -static void add_buttons2( mt_priv_t *p, sequence_view_t *seqv , GtkWidget *w) + +static void add_buttons2( sequence_view_t *p, sequence_view_t *seqv , GtkWidget *w) { int i; for( i = FIRST_ROW_END; button_template_t[i].name != NULL ;i ++ ) @@ -441,98 +361,51 @@ static void add_buttons2( mt_priv_t *p, sequence_view_t *seqv , GtkWidget *w) gtk_widget_show( seqv->buttons2[i] ); } -// gtk_widget_set_sensitive_( w, FALSE ); -} - -static void update_pos( mt_priv_t *p, gint total, gint current ) -{ -// timeline_set_pos( p->view->timeline_, current ); - gtk_adjustment_set_value( - GTK_ADJUSTMENT(GTK_RANGE(p->view->timeline_)->adjustment), 1.0 / (gdouble) total * current ); - - char *now = format_time( current , fps_); - gtk_label_set_text( p->view->labels_[0], now ); - g_free(now); -} -static void update_speed( mt_priv_t *p, gint speed ) -{ - gtk_adjustment_set_value( GTK_ADJUSTMENT( GTK_RANGE( p->view->sliders_[0] )->adjustment), (gdouble) speed ); -} - -static gboolean update_track_list( mt_priv_t *p ) -{ - if(p->active) - { - int len = 0; - unsigned char *buf = veejay_sequence_get_track_list( p->sequence, 5, &len ); - int i = 0; - int it = 0; - unsigned char *ptr = buf; - // clear existing buffer - for( i = 0; i < MAX_TRACKS ; i ++ ) - { - if( p->tracks[i] ) - free(p->tracks[i]); - p->tracks[i] = NULL; - } - - if( !buf ) - return FALSE; - - i = 0; - while( i < len ) - { - int dlen = 0; - unsigned char tmp_len[4]; - bzero( tmp_len, 4 ); - strncpy( tmp_len, ptr , 3 ); - sscanf( tmp_len , "%d", &dlen ); - if(dlen>0) - { - ptr += 3; - p->tracks[it] = strndup( ptr, dlen ); - it++; - - ptr += dlen; - } - i += ( 3 + dlen ); - } - free( buf ); - return TRUE; - } - return FALSE; } -static void playmode_sensitivity( mt_priv_t *p, gint pm ) +static void playmode_sensitivity( sequence_view_t *p, gint pm ) { + int i; if( pm == MODE_STREAM ) { - gtk_widget_set_sensitive_( GTK_WIDGET( p->view->button_box2 ), FALSE ); - gtk_widget_set_sensitive_( GTK_WIDGET( p->view->button_box ), FALSE ); - gtk_widget_set_sensitive_( GTK_WIDGET( p->view->sliders_[0] ), FALSE ); - gtk_widget_set_sensitive_( GTK_WIDGET( p->view->timeline_ ), FALSE ); - gtk_widget_set_sensitive_( GTK_WIDGET( p->view->sliders_[1] ), TRUE ); + gtk_widget_set_sensitive_( GTK_WIDGET( p->button_box2 ), FALSE ); + gtk_widget_set_sensitive_( GTK_WIDGET( p->button_box ), FALSE ); + gtk_widget_set_sensitive_( GTK_WIDGET( p->sliders_[0] ), FALSE ); + gtk_widget_set_sensitive_( GTK_WIDGET( p->timeline_ ), FALSE ); + gtk_widget_set_sensitive_( GTK_WIDGET( p->sliders_[1] ), TRUE ); + for( i = 0; i < FIRST_ROW_END;i ++ ) + { + gtk_widget_set_sensitive_( GTK_WIDGET( p->buttons[i] ), FALSE ); + + } } else { if( pm == MODE_SAMPLE || pm == MODE_PLAIN ) { - gtk_widget_set_sensitive_( GTK_WIDGET( p->view->button_box2 ), TRUE ); - gtk_widget_set_sensitive_( GTK_WIDGET( p->view->button_box ), TRUE ); - gtk_widget_set_sensitive_( GTK_WIDGET( p->view->sliders_[0] ), TRUE ); - gtk_widget_set_sensitive_( GTK_WIDGET( p->view->timeline_ ), TRUE ); + gtk_widget_set_sensitive_( GTK_WIDGET( p->button_box2 ), TRUE ); + gtk_widget_set_sensitive_( GTK_WIDGET( p->button_box ), TRUE ); + gtk_widget_set_sensitive_( GTK_WIDGET( p->sliders_[0] ), TRUE ); + gtk_widget_set_sensitive_( GTK_WIDGET( p->timeline_ ), TRUE ); + for( i = 0; i < FIRST_ROW_END;i ++ ) + { + gtk_widget_set_sensitive_( GTK_WIDGET( p->buttons[i] ), TRUE ); + } + } if( pm == MODE_SAMPLE ) - gtk_widget_set_sensitive_( GTK_WIDGET( p->view->sliders_[1] ), TRUE ); + gtk_widget_set_sensitive_( GTK_WIDGET( p->sliders_[1] ), TRUE ); else - gtk_widget_set_sensitive_( GTK_WIDGET( p->view->sliders_[1] ), FALSE ); + gtk_widget_set_sensitive_( GTK_WIDGET( p->sliders_[1] ), FALSE ); } } -static void update_widgets(int *status, mt_priv_t *p, int pm) + +static void update_widgets(int *status, sequence_view_t *p, int pm) { + multitracker_t *mt = (multitracker_t*) p->backlink; int *h = p->history[pm]; if( h[PLAY_MODE] != pm ) playmode_sensitivity( p, pm ); @@ -553,11 +426,33 @@ static void update_widgets(int *status, mt_priv_t *p, int pm) if( h[TOTAL_SLOTS] != status[TOTAL_SLOTS]) { - if(update_track_list( p )) - update_track_view( MAX_TRACKS, get_track_tree( p->view->tracks ), (void*)p ); + gvr_need_track_list( mt->preview, p->num ); + update_track_view( MAX_TRACKS, get_track_tree( p->tracks ), (void*)p ); } } + +int update_multitrack_widgets( void *data, int *array, int track ) +{ + multitracker_t *mt = (multitracker_t*) data; + sequence_view_t *p = mt->view[ track ]; + + p->status_lock = 1; + int pm = array[PLAY_MODE]; + int i; + for( i = 0; i < 20; i ++ ) + p->status_cache[i] = array[i]; + update_widgets(array, p, pm); + + int *his = p->history[ pm ]; + for( i = 0; i < 20; i ++ ) + his[i] = array[i]; + p->status_lock = 0; +} + +/* + + static gboolean update_sequence_widgets( gpointer data ) { mt_priv_t *p = (mt_priv_t*) data; @@ -566,18 +461,10 @@ static gboolean update_sequence_widgets( gpointer data ) if( !p->active ) return TRUE; + + p->status_lock = 1; - veejay_get_status( p->sequence, status ); - int n = status_to_arr( status, array ); - if( n<= 0 ) - { - p->status_lock = 0; - veejay_msg(0, "error reading status"); - return TRUE; - } -#ifdef STRICT_CHECKING - assert( n == 20 ); -#endif + int pm = array[PLAY_MODE]; int i; @@ -591,88 +478,233 @@ static gboolean update_sequence_widgets( gpointer data ) his[i] = array[i]; p->status_lock = 0; return TRUE; -} +}*/ -static int free_slot(void *data) +static void sequence_preview_cb(GtkWidget *widget, gpointer user_data) { - int i = 0; - all_priv_t *pt = (all_priv_t*)data; - for( i = 0; i < MAX_TRACKS; i ++ ) - { - mt_priv_t *p = pt->pt[i]; - if(p->used == 0) - return i; - } - return -1; -} + sequence_view_t *v = (sequence_view_t*) user_data; + multitracker_t *mt = v->backlink; + int status = (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget) ) == TRUE ? 1 : 0 ); -static void store_data( void *data, int index,char *hostname, int port_num ) -{ - all_priv_t *pt = (all_priv_t*) data; - if(pt->pt[index]->hostname) free(pt->pt[index]->hostname); - pt->pt[index]->hostname = strdup(hostname); - pt->pt[index]->port_num = port_num; -} + if(v->status_lock) + return; -static void free_data( mt_priv_t *p ) -{ - sequence_view_t *v = p->view; - void *b = p->backlink; - int n = p->num; - - veejay_abort_sequence( p->sequence ); + gvr_track_toggle_preview( mt->preview, v->num,status ); - if( p->hostname ) - free( p->hostname ); - - memset( p, 0,sizeof(mt_priv_t)); - p->view = v; - p->backlink = b; - p->num = n; -} + float ratio = mt->width / (float)mt->height; + int w = 80; + int h = ( (int)( (float)w/ratio ))/16*16; -static void delete_data( void *data, int index ) -{ - all_priv_t *pt = (all_priv_t*)data; - char track_title[100]; - mt_priv_t *p = pt->pt[index]; - - if(p->used) + if(!gvr_track_configure( mt->preview, v->num,w,h ) ) { -// gtk_widget_set_sensitive_( GTK_WIDGET(p->view->toggle), FALSE ); - gtk_widget_set_sensitive_( GTK_WIDGET(p->view->panel),FALSE); - if(index!=LAST_TRACK) set_logo( p->view->area ); - free_data( p ); + veejay_msg(0, "Unable to configure preview %d x %d",w , h ); + status = 0; } + + + if( !status ) + { + float ratio = mt->width / (float) mt->height; + int w = 160; + int h = ( (int)( (float)w / ratio)) /16*16; + GdkPixbuf *logo = gdk_pixbuf_scale_simple( mt->logo, w,h, GDK_INTERP_BILINEAR ); + gtk_image_set_from_pixbuf_( + GTK_IMAGE( v->area ), logo ); + veejay_msg(2, "Set GVeejayReloaded logo %d x %d",w,h); + gdk_pixbuf_unref( logo ); + } +} + +static void sequence_set_current_frame(GtkWidget *w, gpointer user_data) +{ + + sequence_view_t *v = (sequence_view_t*) user_data; + multitracker_t *mt = v->backlink; + if(v->status_lock) + return; + + gdouble pos = GTK_ADJUSTMENT(GTK_RANGE(w)->adjustment)->value; + gint frame = pos * v->status_cache[TOTAL_FRAMES]; + + gvr_queue_mvims( mt->preview, v->num, VIMS_VIDEO_SET_FRAME, frame ); +} + +static sequence_view_t *new_sequence_view( void *vp, int num ) +{ + sequence_view_t *seqv = (sequence_view_t*) vj_calloc(sizeof(sequence_view_t)); + + seqv->num = num; + seqv->backlink = vp; + + seqv->event_box = gtk_event_box_new(); + gtk_event_box_set_visible_window( seqv->event_box, TRUE ); + GTK_WIDGET_SET_FLAGS( seqv->event_box, GTK_CAN_FOCUS ); + + g_signal_connect( G_OBJECT( seqv->event_box ), + "button_press_event", + G_CALLBACK( seqv_mouse_press_event ), + (gpointer*) seqv ); + gtk_widget_show( GTK_WIDGET( seqv->event_box ) ); + + + gchar *track_title = g_new0( gchar, 20 ); + sprintf(track_title, "Track %d", num ); + seqv->frame = gtk_frame_new( track_title ); + g_free(track_title); + gtk_container_set_border_width( GTK_CONTAINER( seqv->frame) , 1 ); + gtk_widget_show( GTK_WIDGET( seqv->frame ) ); + gtk_container_add( GTK_CONTAINER( seqv->event_box), seqv->frame ); + + seqv->main_vbox = gtk_vbox_new(FALSE,0); + gtk_container_add( GTK_CONTAINER( seqv->frame ), seqv->main_vbox ); + gtk_widget_show( GTK_WIDGET( seqv->main_vbox ) ); + + seqv->area = gtk_image_new(); + + + gtk_box_pack_start( GTK_BOX(seqv->main_vbox),GTK_WIDGET( seqv->area), FALSE,FALSE,0); + gtk_widget_set_size_request( seqv->area, 176,176 ); + seqv->panel = gtk_frame_new(NULL); + + if( num > 0 ) + { + seqv->toggle = gtk_toggle_button_new_with_label( "preview" ); + + gtk_toggle_button_set_active( + GTK_TOGGLE_BUTTON(seqv->toggle), FALSE ); + g_signal_connect( G_OBJECT( seqv->toggle ), "toggled", G_CALLBACK(sequence_preview_cb), + (gpointer)seqv ); + gtk_box_pack_start( GTK_BOX(seqv->main_vbox), seqv->toggle,FALSE,FALSE, 0 ); + gtk_widget_show( seqv->toggle ); + } + + GtkWidget *vvbox = gtk_vbox_new(FALSE, 0); + seqv->button_box = gtk_hbox_new(FALSE,0); + gtk_box_pack_start( GTK_BOX(vvbox), seqv->button_box ,FALSE,FALSE, 0 ); + add_buttons( seqv,seqv,seqv->button_box ); + + gtk_widget_show( seqv->button_box ); + gtk_container_add( GTK_CONTAINER( seqv->main_vbox ), seqv->panel ); + + seqv->button_box2 = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start( GTK_BOX(vvbox), seqv->button_box2, FALSE,FALSE, 0 ); + add_buttons2( seqv,seqv,seqv->button_box2 ); + gtk_widget_show( seqv->button_box2 ); + gtk_container_add( GTK_CONTAINER( seqv->panel ), vvbox ); + gtk_widget_show(vvbox); + + GtkWidget *box = gtk_vbox_new(FALSE,0); + seqv->timeline_ = gtk_hscale_new_with_range( 0.0,1.0,0.1 ); + gtk_scale_set_draw_value( seqv->timeline_, FALSE ); + gtk_widget_set_size_request( seqv->panel,180 ,180); + gtk_adjustment_set_value( + GTK_ADJUSTMENT(GTK_RANGE(seqv->timeline_)->adjustment), 0.0 ); + gtk_widget_show( seqv->panel ); + gtk_box_pack_start( GTK_BOX( box ), seqv->timeline_, FALSE,FALSE, 0 ); + gtk_box_pack_start( GTK_BOX( vvbox ), box , FALSE,FALSE,0); + gtk_widget_show(seqv->timeline_); + g_signal_connect( seqv->timeline_, "value_changed", + (GCallback) sequence_set_current_frame, (gpointer*) seqv ); + + GtkWidget *scroll = gtk_scrolled_window_new(NULL,NULL); + gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_ETCHED_IN ); + gtk_widget_set_size_request(scroll,30,70); + gtk_container_set_border_width(GTK_CONTAINER(scroll),0); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scroll),GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); + GtkWidget *vvvbox = gtk_hbox_new(FALSE,0); + seqv->tracks = create_track_view(seqv->num, MAX_TRACKS, (void*) seqv ); + gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( get_track_tree(seqv->tracks)) , FALSE ); + gtk_widget_set_size_request( get_track_tree(seqv->tracks),20,80 ); + gtk_widget_show(scroll); + + gtk_scrolled_window_add_with_viewport( + GTK_SCROLLED_WINDOW( scroll ), get_track_tree(seqv->tracks) ); + gtk_widget_show( get_track_tree(seqv->tracks)); + gtk_box_pack_start( GTK_BOX(vvvbox), scroll, TRUE,TRUE, 0); + + GtkWidget *hhbox = gtk_hbox_new(FALSE,0); + + seqv->sliders_[0] = gtk_vscale_new_with_range( -12.0,12.0,1.0 ); + seqv->sliders_[1] = gtk_vscale_new_with_range( 0.0, 1.0, 0.01 ); + + gtk_adjustment_set_value( + GTK_ADJUSTMENT(GTK_RANGE(seqv->sliders_[0])->adjustment), 1.0 ); + gtk_adjustment_set_value( + GTK_ADJUSTMENT(GTK_RANGE(seqv->sliders_[1])->adjustment), 0.0 ); + + + gtk_scale_set_digits( GTK_SCALE(seqv->sliders_[1]), 2 ); + g_signal_connect( G_OBJECT( seqv->sliders_[0] ), "value_changed", G_CALLBACK( seq_speed ), + (gpointer*)seqv ); + g_signal_connect( G_OBJECT( seqv->sliders_[1] ), "value_changed", G_CALLBACK( seq_opacity ), + (gpointer*)seqv ); + + gtk_box_pack_start( GTK_BOX( hhbox ), seqv->sliders_[0], TRUE, TRUE, 0 ); + gtk_box_pack_start( GTK_BOX( hhbox ), seqv->sliders_[1], TRUE, TRUE, 0 ); + gtk_widget_show( seqv->sliders_[0] ); + gtk_widget_show( seqv->sliders_[1] ); + gtk_box_pack_start( GTK_BOX(vvvbox), hhbox, TRUE,TRUE, 0 ); + gtk_widget_show( hhbox ); + gtk_container_add( GTK_CONTAINER( box ), vvvbox ); + gtk_widget_show( vvvbox ); + gtk_widget_show( box ); + + + GtkWidget *hbox = gtk_hbox_new(FALSE,0); + gtk_box_set_spacing( hbox, 10 ); + seqv->labels_[0] = gtk_label_new( "00:00:00:00" ); + seqv->labels_[1] = gtk_label_new( "00:00:00:00" ); + gtk_box_pack_start( GTK_BOX( hbox ), seqv->labels_[0], FALSE, FALSE, 0 ); + gtk_box_pack_start( GTK_BOX( hbox ), seqv->labels_[1], FALSE, FALSE, 0 ); + gtk_widget_show( seqv->labels_[0] ); + gtk_widget_show( seqv->labels_[1] ); + gtk_box_pack_start( GTK_BOX(seqv->main_vbox), hbox, FALSE,FALSE, 0 ); + gtk_widget_show( hbox ); + + + gtk_widget_set_sensitive_(GTK_WIDGET(seqv->panel), FALSE ); + + gtk_widget_show( GTK_WIDGET( seqv->area ) ); + + return seqv; } -static GdkPixbuf *load_logo_image( ) + +static int vt__[16]; +static int vt___ = 0; +sync_info *multitrack_sync( void * mt ) { - char path[1024]; - bzero(path,1024); - get_gd(path,NULL, "veejay-logo.png"); - return gdk_pixbuf_new_from_file( path,NULL ); -} + multitracker_t *m = (multitracker_t*) mt; + sync_info *s = gvr_sync( m->preview ); + if(!vt___) + { + veejay_memset(vt__,0,sizeof(vt__)); + vt___ = 1; + } -static void set_logo(GtkWidget *area) -{ - GdkPixbuf *buf2 = gdk_pixbuf_scale_simple( logo_img_,114,96, GDK_INTERP_BILINEAR ); - gtk_image_set_from_pixbuf_( GTK_IMAGE(area), buf2 ); - gdk_pixbuf_unref( buf2 ); + int i; + for( i =0; i < MAX_TRACKS ;i ++ ) + { + if(!vt__[i] && s->status_list[i] == NULL ) + { + gtk_widget_set_sensitive_(GTK_WIDGET(m->view[i]), FALSE ); + vt__[i] = 1; + } + else if( s->status_list[i] && vt__[i] ) + { + gtk_widget_set_sensitive_(GTK_WIDGET(m->view[i]), TRUE ); + vt__[i] = 0; + } + } + s->master = m->master_track; + return s; } -static sequence_view_t *get_sequence_view(void *data,int index) -{ - all_priv_t *pt = (all_priv_t*)data; - return pt->pt[index]->view; -} - - static int mt_new_connection_dialog(multitracker_t *mt, char *hostname,int len, int *port_num) { GtkWidget *dialog = gtk_dialog_new_with_buttons( - "New Track", + "Connect to a Veejay", GTK_WINDOW( mt->main_box ), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, @@ -687,10 +719,12 @@ static int mt_new_connection_dialog(multitracker_t *mt, char *hostname,int len, gtk_editable_set_editable( GTK_ENTRY(text_entry), TRUE ); gtk_dialog_set_default_response( GTK_DIALOG(dialog), GTK_RESPONSE_REJECT ); gtk_window_set_resizable( GTK_WINDOW( dialog ), FALSE ); - gint base = 3490; - gint dport = base + (1000 * num_tracks_active( mt )); - GtkObject *adj = gtk_adjustment_new( dport,1024,65535,5,10,0); + gint base = 3490; + + gint p = (1000 * (mt->selected)) + base; + + GtkObject *adj = gtk_adjustment_new( p,1024,65535,5,10,0); GtkWidget *num_entry = gtk_spin_button_new( adj, 5.0, 0 ); GtkWidget *text_label = gtk_label_new( "Hostname" ); @@ -721,58 +755,7 @@ static int mt_new_connection_dialog(multitracker_t *mt, char *hostname,int len, return res; } -void setup_geometry( int w, int h, int n_tracks,int pw, int ph ) -{ - LAST_TRACK = n_tracks + 1; - MAX_TRACKS = n_tracks; - sta_w = pw; - sta_h = ph; -} - -void multitrack_set_hlq( void *data, float fps,float ratio, int quality ) -{ - multitracker_t *mt = (multitracker_t*) data; - all_priv_t *a = (all_priv_t*)mt->data; - - G_LOCK(mt_lock); - - mt_priv_t *last_track = a->pt[LAST_TRACK]; - - ratio_ = ratio; - preview_quality_ = quality; - fps_ = fps; - switch( quality ) - { - case 0: - preview_width_ = 176; - preview_height_ = ( (float)preview_width_ / ratio_ ); - break; - case 1: - preview_width_ = 352; - preview_height_ = ( (float)preview_width_ / ratio_ ); - break; - default: - preview_width_ = 100; - preview_height_ = ((float) preview_width_ / ratio_ ); - break; - } - - mpreview_width_ = preview_width_/2; - mpreview_height_ = preview_height_/2; - - veejay_msg(VEEJAY_MSG_INFO, "Reconfigured preview %d x %d", preview_width_,preview_height_); - - veejay_configure_sequence( last_track->sequence, preview_width_, preview_height_ , fps); - - G_UNLOCK(mt_lock); - -} - -void multitrack_configure_preview(int w, int h, int hw, int hh ) -{ -} - void *multitrack_new( void (*f)(int,char*,int), int (*g)(GdkPixbuf *, GdkPixbuf *, GtkImage *), @@ -784,38 +767,17 @@ void *multitrack_new( GtkWidget *main_preview_area) { multitracker_t *mt = NULL; - all_priv_t *pt = NULL; - - _Xdebug = 1; - - - logo_img_ = load_logo_image(); - - mt = (multitracker_t*) malloc(sizeof(multitracker_t)); - memset( mt, 0, sizeof(multitracker_t)); + mt = (multitracker_t*) vj_calloc(sizeof(multitracker_t)); + mt->view = (sequence_view_t*) vj_calloc(sizeof(sequence_view_t*) * MAX_TRACKS ); + mt->preview = NULL; mt->main_window = win; mt->main_box = box; - mt->status_bar = msg; - gui_cb = f; - img_cb = g; + mt->status_bar = msg; + mt->logo = load_logo_image(); - pt = (all_priv_t*) malloc(sizeof(all_priv_t)); - memset(pt,0,sizeof(pt)); - -#ifdef STRICT_CHECKING - assert( max_w > 0 && max_w < 1024 ); - assert( max_h > 0 && max_h < 1024 ); -#endif - mt->scroll = gtk_scrolled_window_new(NULL,NULL); - - int minw = 240; -// GtkWidget *pan = glade_xml_get_widget( win, "panels"); -// GtkRequisition req; -// gtk_widget_size_request( pan, &req ); gtk_widget_set_size_request(mt->scroll,450, 300); - gtk_container_set_border_width(GTK_CONTAINER(mt->scroll),1); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(mt->scroll),GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS ); GtkWidget *table = gtk_table_new( 1, MAX_TRACKS, FALSE ); @@ -825,162 +787,54 @@ void *multitrack_new( int c = 0; for( c = 0; c < MAX_TRACKS; c ++ ) { - mt_priv_t *p = (mt_priv_t*) vj_calloc(sizeof( mt_priv_t)); - p->num = c; - p->view = new_sequence_view( p,0,0,0, main_preview_area ); - p->backlink = (void*) mt; - p->tracks[c] = NULL; - pt->pt[c] = p; - gtk_table_attach_defaults( table, p->view->event_box, c, c+1, 0, 1 ); - // gtk_table_attach_defaults( table, p->view->event_box, 0, 1, c, c+1 ); + mt->view[c] = new_sequence_view( mt, c ); + gtk_table_attach_defaults( table, mt->view[c]->event_box, c, c+1, 0, 1 ); } - max_w = 352; - max_h = 288; - gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( mt->scroll ), table ); gtk_widget_show(table); + mt->master_track = 0; - mt_priv_t *lt = (mt_priv_t*) malloc(sizeof( mt_priv_t)); - memset( lt, 0, sizeof(mt_priv_t)); - lt->num = LAST_TRACK; - lt->backlink = (void*) mt; - lt->view = new_sequence_view( lt, 0, 0,1 , main_preview_area); - pt->pt[LAST_TRACK] = lt; - gtk_container_add( GTK_CONTAINER( mt->main_box ), lt->view->event_box ); - mt->data = (void*) pt; - GError *err = NULL; - pt->thread = g_thread_create( (GThreadFunc) mt_preview, (gpointer*) mt ,FALSE,&err); - if(!pt->thread) - { - status_print( mt, "%s while starting image thread", err->message); - return NULL; - } + mt->preview = gvr_preview_init( MAX_TRACKS ); + - return (void*) mt; } -void multitrack_open(void *data) -{ - multitracker_t *mt = (multitracker_t*) data; - all_priv_t *a = (all_priv_t*)mt->data; - - G_LOCK(mt_lock); - mt->sensitive = 1; - G_UNLOCK(mt_lock); -} - -void multitrack_close( void *data ) -{ - multitracker_t *mt = (multitracker_t*) data; - all_priv_t *a = (all_priv_t*)mt->data; - - G_LOCK(mt_lock); - mt->sensitive = 0; - G_UNLOCK(mt_lock); -} - -void multitrack_quit( void *data ) -{ - multitracker_t *mt = (multitracker_t*) data; - - G_LOCK(mt_lock); - mt->quit = 1; - G_UNLOCK(mt_lock); - all_priv_t *a = (all_priv_t*) mt->data; - int i; - for( i = 0; i pt[i]; - if(p) free_data(p); - } -} - int multitrack_add_track( void *data ) { multitracker_t *mt = (multitracker_t*) data; - if(!mt) - return 0; int res = 0; - // open input dialog, query hostname and postnum etc - char *hostname = g_new0(char , 100 ); + char *hostname = vj_calloc( 100 ); int port_num = 0; + if( mt_new_connection_dialog( mt, hostname, 100, &port_num ) == GTK_RESPONSE_ACCEPT ) { - G_LOCK(mt_lock); - all_priv_t *pt = (all_priv_t*)mt->data; - int track = free_slot( mt->data ); - if( track == -1 ) - { - status_print(mt, "No free Tracks available!"); - g_free(hostname); - G_UNLOCK(mt_lock); - return 0; + int track = 0; + + if( gvr_track_connect( mt->preview, hostname, port_num, &track ) ) + { + status_print( mt, "Connection established with veejay runnning on %s port %d", + hostname, port_num ); + + gtk_widget_set_sensitive_(GTK_WIDGET(mt->view[track]->panel), TRUE ); + } + else + { + status_print( mt, "Unable to open connection with %s : %d", hostname, port_num ); } - int i; - int found = 0; - for( i = 0; i < MAX_TRACKS ; i ++ ) - { - mt_priv_t *p = pt->pt[i]; - if(p->active) - { - if(strncasecmp(hostname,p->hostname,strlen(hostname)) == 0 && port_num == p->port_num ) - { - found = 1; - break; - } - } - } - - void *seq = NULL; - if(found) - { - status_print( mt, "Track %d: '%s' '%d' already in Track %d\n", - track, hostname,port_num, i ); - g_free(hostname); - G_UNLOCK( mt_lock ); - return 0; - } - seq = veejay_sequence_init( port_num, hostname, 512, 512, 0.0 ); - if(seq == NULL ) - { - status_print( mt, "Error while connecting to '%s' : '%d'", hostname, port_num ); - g_free(hostname); - pt->pt[track]->sequence = NULL; - pt->pt[track]->active = 0; - pt->pt[track]->used = 0; - G_UNLOCK( mt_lock ); - return 0; - } - - //@ use 128x128 for now, as soon as veejay is fully up the sequence will - // be re-configured - veejay_configure_sequence( seq, 128, 128,0.0); - - pt->pt[track]->sequence = seq; - pt->pt[track]->active = 1; - pt->pt[track]->used = 1; - store_data( mt->data, track, hostname, port_num ); - mt_priv_t *p = pt->pt[track]; - // gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( p->view->toggle ), 1 ); - status_print( mt, "Track %d: Connection established with '%s' port %d\n", - track, hostname, port_num ); - // pt->pt[track]->timeout = - // gtk_timeout_add( 300, update_sequence_widgets, (gpointer*) pt->pt[track] ); - - gtk_widget_set_sensitive_( GTK_WIDGET(p->view->panel),TRUE); res = 1; } - g_free(hostname); - G_UNLOCK(mt_lock); + + free( hostname ); + return res; } @@ -988,768 +842,197 @@ void multitrack_close_track( void *data ) { multitracker_t *mt = (multitracker_t*) data; + if( mt->selected > 0 && mt->selected < MAX_TRACKS ) + { + gvr_track_disconnect( mt->preview, mt->selected ); + mt->view[mt->selected]->status_lock = 1; + gtk_toggle_button_set_active( + GTK_TOGGLE_BUTTON(mt->view[mt->selected]->toggle), FALSE ); + + gtk_widget_set_sensitive_(GTK_WIDGET(mt->view[mt->selected]->panel), FALSE ); + mt->view[mt->selected]->status_lock = 0; + + } + } -int multrack_audoadd( void *data, char *hostname, int port_num, float ratio ) +int multrack_audoadd( void *data, char *hostname, int port_num ) { multitracker_t *mt = (multitracker_t*) data; - all_priv_t *a = (all_priv_t*)mt->data; - G_LOCK(mt_lock); - int track = free_slot( mt->data ); - void *seq = veejay_sequence_init( port_num, hostname, 512, 512 , 0.0 ); - - if(seq == NULL ) - { - status_print( mt, "Error while connecting to '%s' : '%d'", hostname, port_num ); - g_free(hostname); - a->pt[track]->sequence = NULL; - a->pt[track]->active = 0; - a->pt[track]->used = 0; - G_UNLOCK(mt_lock); - return 0; - } - -// a->pt[track]->timeout = gtk_timeout_add( 300, update_sequence_widgets, (gpointer*) a->pt[track] ); -// veejay_configure_sequence( seq, 176, 176 / ratio, 0.0 ); + int track = 0; - a->pt[track]->sequence = seq; - a->pt[track]->active = 1; - a->pt[track]->used = 1; + if(!gvr_track_connect( mt->preview, hostname, port_num, &track ) ) + return -1; - store_data( mt->data, track, hostname, port_num ); + mt->master_track = track; + + veejay_msg(VEEJAY_MSG_INFO, "Master is Track %d, Veejay Host %s: %d", + mt->master_track, hostname, port_num ); + + gtk_widget_set_sensitive_(GTK_WIDGET(mt->view[track]->panel), TRUE ); - multitrack_set_current( data, hostname, port_num , 176 /2 , (176/ratio)/2); -// gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( a->pt[track]->view->toggle ), 1 ); - status_print( mt, "Track %d: Connection established with '%s' port %d\n", - track, hostname, port_num ); - gtk_widget_set_sensitive_( GTK_WIDGET(a->pt[track]->view->panel),TRUE); -// gtk_widget_set_sensitive_( GTK_WIDGET(a->pt[track]->view->toggle),TRUE); - - G_UNLOCK(mt_lock); return track; } -/* -int multitrack_autoload( void *data, char *hostname, int port_num ) -{ - multitrack_set_current( data, hostname, port_num , mpreview_width_, mpreview_height_); - return 1; -}*/ -void multitrack_set_current2( void *data, char *hostname, int port_num , int width, int height) +void multitrack_configure( void *data, float fps, int video_width, int video_height ) { -} + multitracker_t *mt = (multitracker_t*) data; + mt->fps = fps; + mt->width = video_width; + mt->height = video_height; -static int num_tracks_active( multitracker_t * mt ) -{ - int i; - int sum = 0; - all_priv_t *a = (all_priv_t*) mt->data; - for( i = 0; i < MAX_TRACKS ; i ++ ) + + if(mt->width > 360 || mt->height > 288 ) { - mt_priv_t *p = a->pt[i]; - if(p->active) - sum ++; + veejay_msg(2, "Maximum preview resolution clipped to 352x288" ); + mt->width = 352; + mt->height = 288; } - return sum; + veejay_msg(2, "Multitrack %d x %d, %2.2f", mt->width,mt->height,mt->fps ); } -static int find_track( multitracker_t *mt, const char *host, int port ) +void multitrack_set_quality( void *data , int quality ) { - int i; - all_priv_t *a = (all_priv_t*) mt->data; - if(!host || port <= 0 || port > 65535 ) - return -1; + multitracker_t *mt = (multitracker_t*) data; - for( i = 0; i < MAX_TRACKS ; i ++ ) + int w = 0; + int h = 0; + + float ratio = mt->width / (float) mt->height; + switch( quality ) { - mt_priv_t *p = a->pt[i]; - if(p->active) + case 1: + w = (mt->width/16)*16; + h = (w / ratio)/16*16; + break; + case 0: + w = (mt->width / 2)/16*16; + h = (w / ratio)/16*16; + break; + case 2: + w = (mt->width / 4)/16*16; + h = (w/ ratio)/16*16; + break; + case 3: + w = (mt->width / 8)/16*16; + h = (w/ ratio)/16*16; + break; + } + + if(!gvr_track_configure( mt->preview, mt->master_track,w,h ) ) + { + veejay_msg(0, "Unable to configure preview %d x %d",w , h ); + } +} + +void multitrack_toggle_preview( void *data, int track_id, int status, GtkWidget *img ) +{ + multitracker_t *mt = (multitracker_t*) data; + if(track_id == -1) + { + gvr_track_toggle_preview( mt->preview, mt->master_track, status ); + veejay_msg(2, "Veejay Master Preview %s", (status ? "Enabled" : "Disabled") ); + + if(!status) { - if(strncasecmp( p->hostname, host, strlen(host)) == 0 && port == - p->port_num ) - return i; + float ratio = mt->width / (float) mt->height; + int w = 160; + int h = ( (int)( (float)w / ratio)) /16*16; + GdkPixbuf *logo = gdk_pixbuf_scale_simple( mt->logo, w,h, GDK_INTERP_BILINEAR ); + gtk_image_set_from_pixbuf_( + GTK_IMAGE( mt->view[mt->master_track]->area ), logo ); + + gtk_image_set_from_pixbuf_( + GTK_IMAGE(img), mt->logo ); + + + veejay_msg(0, "Set track %d preview logo", mt->master_track); + gdk_pixbuf_unref( logo ); } } - return -1; -} - -static int find_sequence( all_priv_t *a ) -{ - mt_priv_t *c = a->pt[LAST_TRACK]; - if(!c->active) - return -1; - int i; - for( i= 0; i < MAX_TRACKS; i ++ ) - {// if( c == a->pt[i]->sequence ) return i; - if(a->pt[i]->active) - { - if(strncasecmp(c->hostname, a->pt[i]->hostname, strlen(a->pt[i]->hostname) ) == 0 && - c->port_num == a->pt[i]->port_num ) - return i; - } - } - return -1; -} - -static int find_vtrack_id( mt_priv_t *p, mt_priv_t *q, int *got_tag_id ) -{ - if(!q->active) - return -1; - if(!p->active) - return -1; - char hostname[255]; - int port_num = 0; - int tag_id = 0; - int i; - for( i = 0; i < MAX_TRACKS; i++ ) - { - if(p->tracks[i]) - { - char *str = p->tracks[ i ]; - if(sscanf(str, "%s %d %d", hostname, &port_num, &tag_id )) - { - if(strncasecmp( q->hostname,hostname,strlen(hostname) ) == 0 && - port_num == q->port_num ) - { - *got_tag_id = tag_id; - return i; - } - } - } - } - return -1; } void multitrack_release_track(void *data, int id, int release_this ) { - char hostname[255]; - int port_num = 0; - int tag_id = 0; - - if( release_this < 0 || release_this > MAX_TRACKS ) - return; - - if( id < 0 || id > MAX_TRACKS ) - return; - G_LOCK(mt_lock); - multitracker_t *mt = (multitracker_t*) data; - all_priv_t *a = (all_priv_t*) mt->data; - mt_priv_t *p = a->pt[id]; - mt_priv_t *q = a->pt[release_this]; + int stream_id = 0; - int stream_id = find_vtrack_id( p,q, &tag_id ); - if( stream_id >= 0 ) - veejay_sequence_send( p->sequence , VIMS_STREAM_DELETE, "%d", tag_id); - G_UNLOCK(mt_lock); + //release this: track um + + gvr_ext_lock(mt->preview); + stream_id = gvr_get_stream_id( mt->preview, release_this ); + gvr_ext_unlock(mt->preview); + if(stream_id > 0) + gvr_queue_mvims( mt->preview, id, VIMS_STREAM_DELETE,stream_id ); } void multitrack_bind_track( void *data, int id, int bind_this ) { + multitracker_t *mt = (multitracker_t*) data; + if( bind_this < 0 || bind_this > MAX_TRACKS ) return; if( id < 0 || id > MAX_TRACKS ) return; + gvr_ext_lock(mt->preview); + char *host = gvr_track_get_hostname( mt->preview, bind_this ); + int port = gvr_track_get_portnum ( mt->preview, bind_this ); + gvr_ext_unlock(mt->preview); - G_LOCK(mt_lock); - - multitracker_t *mt = (multitracker_t*) data; - all_priv_t *a = (all_priv_t*) mt->data; - mt_priv_t *p = a->pt[id]; - - mt_priv_t *q = a->pt[bind_this]; - - if(!q->active) - { - G_UNLOCK(mt_lock); - status_print(mt,"Track %d is empty\n", bind_this ); - return; - } - if(!p->active) - { - //@@@ fatal - G_UNLOCK(mt_lock); - return; - } - - if( strncasecmp( q->hostname, p->hostname, strlen(q->hostname)) == 0 && - q->port_num == p->port_num ) - { - G_UNLOCK(mt_lock); - status_print(mt, "Track %d: Cannot bind to myself", bind_this); - return; - } - - // connect q to p - veejay_sequence_send( p->sequence, VIMS_STREAM_NEW_UNICAST, "%d %s", q->port_num,q->hostname ); - - G_UNLOCK(mt_lock); - - status_print(mt, "Veejay '%s:%d' retrieving frames from Veejay '%s:%d", - p->hostname,p->port_num,q->hostname,q->port_num ); - + if( host != NULL && port > 0 ) + gvr_queue_cxvims( mt->preview, id, VIMS_STREAM_NEW_UNICAST, port,host ); } -void multitrack_set_preview_speed( void *data , double value ) +void multitrack_update_sequence_image( void *data , int track, GdkPixbuf *img ) { multitracker_t *mt = (multitracker_t*) data; - all_priv_t *a = (all_priv_t*) mt->data; - mt_priv_t *lt = a->pt[LAST_TRACK]; - if(lt->active) - veejay_sequence_preview_delay( lt->sequence, value ); + + float ratio = mt->width / (float) mt->height; + int w = 160; + int h = ((int) (float )w / ratio )/16 *16; + + GdkPixbuf *scaled = gdk_pixbuf_scale_simple( img, w, h, GDK_INTERP_BILINEAR ); + gtk_image_set_from_pixbuf( mt->view[track]->area, scaled); + + gdk_pixbuf_unref( scaled ); } -// set_current opens Main preview -void multitrack_set_current( void *data, char *hostname, int port_num , int width, int height) -{ - multitracker_t *mt = (multitracker_t*)data; - - all_priv_t *a = (all_priv_t*) mt->data; - mt_priv_t *last_track = a->pt[LAST_TRACK]; - if( last_track->active && mpreview_width_ > 0 && mpreview_height_ > 0) - { - // make sure to reset width/height back to small - veejay_configure_sequence( last_track->sequence, mpreview_width_, mpreview_height_ , 0.0); - } - - int id = find_track( mt, hostname, port_num ); - if(id >= 0 ) - { - last_track->used = 1; - last_track->active = 1; - last_track->sequence = a->pt[id]->sequence; - if(last_track->hostname) - free(last_track->hostname); - last_track->hostname = strdup(hostname); - last_track->port_num = port_num; -#ifdef STRICT_CHECKING - assert( last_track->sequence != NULL ); -#endif - if( mpreview_width_ > 0 && mpreview_height_ > 0 ) - veejay_configure_sequence( last_track->sequence, mpreview_width_, mpreview_height_ , 0.0); - // gtk_widget_set_size_request( GTK_WIDGET( last_track->view->area ), 360,290 ); - } - else - { - all_priv_t *a = (all_priv_t*) mt->data; - mt_priv_t *last_track = a->pt[LAST_TRACK]; - last_track->active = 0; - } -} - -void multitrack_restart(void *data) -{ -} static gboolean seqv_mouse_press_event ( GtkWidget *w, GdkEventButton *event, gpointer user_data) { - mt_priv_t *p = (mt_priv_t*) user_data; - multitracker_t *mt = (multitracker_t*) p->backlink; - all_priv_t *a = (all_priv_t*) mt->data; - - if( p == NULL) - { - status_print((multitracker_t*)p->backlink,"Track %d is empty\n", p->num); - return FALSE; - } - if( gveejay_busy() ) - { - status_print( (multitracker_t*)p->backlink, - "Already connecting to Track %d", mt->selected ); - return FALSE; - } - if( !p->active || !p->hostname || !p->port_num ) - { - status_print((multitracker_t*)p->backlink,"Track %d is not active\n", p->num); - return FALSE; - } - -// mt->selected = p->num; + sequence_view_t *v = (sequence_view_t*) user_data; + multitracker_t *mt = v->backlink; if(event->type == GDK_2BUTTON_PRESS) { - mt->selected = p->num; -/*G_LOCK(mt_lock); - int tmp[MAX_TRACKS],i; - for( i = 0; i < MAX_TRACKS ; i ++ ) - { - mt_priv_t *p = a->pt[i]; - tmp[i] = p->preview; - p->preview = 0; - } -G_UNLOCK(mt_lock);*/ - + mt->selected = v->num; vj_gui_disable(); - gui_cb( 0, strdup(p->hostname), p->port_num ); + // hostname, port_num from gvr + gvr_ext_lock(mt->preview); + char *host = gvr_track_get_hostname( mt->preview, v->num ); + int port = gvr_track_get_portnum ( mt->preview, v->num ); + gvr_ext_unlock(mt->preview); + vj_gui_cb( 0, host, port ); -//G_LOCK(mt_lock); - - multitrack_set_current( (void*) mt, p->hostname, p->port_num ,mpreview_width_,mpreview_height_ ); - - vj_gui_enable(); - - /* - all_priv_t *a = (all_priv_t*) mt->data; - mt_priv_t *last_track = a->pt[LAST_TRACK]; - last_track->used = 1; - last_track->active = 1; - last_track->sequence = p->sequence; - assert( last_track->sequence != NULL ); - veejay_configure_sequence( last_track->sequence, 352, 288 );*/ -/*G_LOCK(mt_lock); - - for( i = 0; i < MAX_TRACKS ; i ++ ) - { - mt_priv_t *p = a->pt[i]; - p->preview = tmp[i]; - } -G_UNLOCK(mt_lock);*/ } if( event->type == GDK_BUTTON_PRESS ) { - status_print((multitracker_t*)p->backlink,"Selected Track %d\n", p->num); - mt->selected = p->num; + mt->selected = v->num; } + return FALSE; } -static void sequence_preview_cb(GtkWidget *widget, gpointer user_data) -{ - mt_priv_t *p = (mt_priv_t*) user_data; - gint status = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - veejay_toggle_image_loader( p->sequence, status ); - - G_LOCK(mt_lock); - p->preview = status; - G_UNLOCK( mt_lock ); -} - -static gint seqv_image_expose( GtkWidget *w, gpointer user_data ) -{ - mt_priv_t *p = (mt_priv_t*) user_data; - return FALSE; -} - -static void sequence_set_current_frame(GtkWidget *w, gpointer user_data) -{ - mt_priv_t *p = (mt_priv_t*) user_data; - if(!p->status_lock) - { - // gdouble pos = timeline_get_pos( TIMELINE_SELECTION(w) ); - gdouble pos = GTK_ADJUSTMENT(GTK_RANGE(w)->adjustment)->value; - gint frame = pos * p->status_cache[TOTAL_FRAMES]; - veejay_sequence_send(p->sequence, VIMS_VIDEO_SET_FRAME, "%d" , frame); - } -} - -static sequence_view_t *new_sequence_view( mt_priv_t *p,gint w, gint h, gint last, GtkWidget *main_area ) -{ - sequence_view_t *seqv = (sequence_view_t*) malloc(sizeof(sequence_view_t)); - memset( seqv, 0,sizeof( sequence_view_t )); - - - if(!last || main_area == NULL) - { - seqv->event_box = gtk_event_box_new(); - gtk_event_box_set_visible_window( seqv->event_box, TRUE ); - GTK_WIDGET_SET_FLAGS( seqv->event_box, GTK_CAN_FOCUS ); - if( w == 0 && h == 0 ) - g_signal_connect( G_OBJECT( seqv->event_box ), - "button_press_event", - G_CALLBACK( seqv_mouse_press_event ), - (gpointer*) p ); - gtk_widget_show( GTK_WIDGET( seqv->event_box ) ); - - - gchar *track_title = g_new0( gchar, 20 ); - sprintf(track_title, "Track %d", p->num ); - seqv->frame = gtk_frame_new( track_title ); - g_free(track_title); - gtk_container_set_border_width( GTK_CONTAINER( seqv->frame) , 1 ); - gtk_widget_show( GTK_WIDGET( seqv->frame ) ); - gtk_container_add( GTK_CONTAINER( seqv->event_box), seqv->frame ); - seqv->main_vbox = gtk_vbox_new(FALSE,0); - gtk_container_add( GTK_CONTAINER( seqv->frame ), seqv->main_vbox ); - gtk_widget_show( GTK_WIDGET( seqv->main_vbox ) ); - seqv->area = gtk_image_new(); - set_logo( seqv->area ); - } - else - seqv->area = main_area; - - -/* g_signal_connect( G_OBJECT( seqv->area ), - "expose_event", - G_CALLBACK( seqv_image_expose ), - (gpointer*) p );*/ - - if(!last || !main_area) - { - gtk_box_pack_start( GTK_BOX(seqv->main_vbox),GTK_WIDGET( seqv->area), FALSE,FALSE,0); - gtk_widget_set_size_request( seqv->area, 176,176 ); - } - - if(!last) - { - seqv->panel = gtk_frame_new(NULL); - seqv->toggle = gtk_toggle_button_new_with_label( "preview" ); - gtk_toggle_button_set_active( - GTK_TOGGLE_BUTTON(seqv->toggle), FALSE ); - g_signal_connect( G_OBJECT( seqv->toggle ), "toggled", G_CALLBACK(sequence_preview_cb), - (gpointer*)p ); - gtk_box_pack_start( GTK_BOX(seqv->main_vbox), seqv->toggle,FALSE,FALSE, 0 ); - gtk_widget_show( seqv->toggle ); - - GtkWidget *vvbox = gtk_vbox_new(FALSE, 0); - - seqv->button_box = gtk_hbox_new(FALSE,0); - gtk_box_pack_start( GTK_BOX(vvbox), seqv->button_box ,FALSE,FALSE, 0 ); - if( w== 0 && h == 0 ) - add_buttons( p,seqv,seqv->button_box ); - gtk_widget_show( seqv->button_box ); - gtk_container_add( GTK_CONTAINER( seqv->main_vbox ), seqv->panel ); - - seqv->button_box2 = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start( GTK_BOX(vvbox), seqv->button_box2, FALSE,FALSE, 0 ); - if( w== 0 && h == 0) - add_buttons2( p,seqv,seqv->button_box2 ); - gtk_widget_show( seqv->button_box2 ); - gtk_container_add( GTK_CONTAINER( seqv->panel ), vvbox ); - gtk_widget_show(vvbox); - - GtkWidget *box = gtk_vbox_new(FALSE,0); - // seqv->timeline_ = timeline_new(); - seqv->timeline_ = gtk_hscale_new_with_range( 0.0,1.0,0.1 ); - gtk_scale_set_draw_value( seqv->timeline_, FALSE ); - gtk_widget_set_size_request( seqv->panel,preview_width_ ,180); - gtk_adjustment_set_value( - GTK_ADJUSTMENT(GTK_RANGE(seqv->timeline_)->adjustment), 0.0 ); - gtk_widget_show( seqv->panel ); - gtk_box_pack_start( GTK_BOX( box ), seqv->timeline_, FALSE,FALSE, 0 ); - //gtk_container_add( GTK_CONTAINER(seqv->panel), box ); - gtk_box_pack_start( GTK_BOX( vvbox ), box , FALSE,FALSE,0); - gtk_widget_show(seqv->timeline_); - g_signal_connect( seqv->timeline_, "value_changed", - (GCallback) sequence_set_current_frame, (gpointer*) p ); - - /* tree */ - GtkWidget *scroll = gtk_scrolled_window_new(NULL,NULL); - // gtk_srolled_window_set_placement( GTK_SCROLLED_WINDOW(scroll), GTK_CORNER_TOP_RIGHT ); - gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_ETCHED_IN ); - gtk_widget_set_size_request(scroll,30,70); - gtk_container_set_border_width(GTK_CONTAINER(scroll),0); - gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scroll),GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); - GtkWidget *vvvbox = gtk_hbox_new(FALSE,0); - seqv->tracks = create_track_view(p->num, MAX_TRACKS, (void*) p ); - gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( get_track_tree(seqv->tracks)) , FALSE ); - gtk_widget_set_size_request( get_track_tree(seqv->tracks),20,80 ); - gtk_widget_show(scroll); - - gtk_scrolled_window_add_with_viewport( - GTK_SCROLLED_WINDOW( scroll ), get_track_tree(seqv->tracks) ); - gtk_widget_show( get_track_tree(seqv->tracks)); - gtk_box_pack_start( GTK_BOX(vvvbox), scroll, TRUE,TRUE, 0); - - GtkWidget *hhbox = gtk_hbox_new(FALSE,0); - seqv->sliders_[0] = gtk_vscale_new_with_range( -12.0,12.0,1.0 ); - seqv->sliders_[1] = gtk_vscale_new_with_range( 0.0, 1.0, 0.01 ); - gtk_adjustment_set_value( - GTK_ADJUSTMENT(GTK_RANGE(seqv->sliders_[0])->adjustment), 1.0 ); - gtk_adjustment_set_value( - GTK_ADJUSTMENT(GTK_RANGE(seqv->sliders_[1])->adjustment), 0.0 ); - - - gtk_scale_set_digits( GTK_SCALE(seqv->sliders_[1]), 2 ); - g_signal_connect( G_OBJECT( seqv->sliders_[0] ), "value_changed", G_CALLBACK( seq_speed ), - (gpointer*)p ); - g_signal_connect( G_OBJECT( seqv->sliders_[1] ), "value_changed", G_CALLBACK( seq_opacity ), - (gpointer*)p ); - - gtk_box_pack_start( GTK_BOX( hhbox ), seqv->sliders_[0], TRUE, TRUE, 0 ); - gtk_box_pack_start( GTK_BOX( hhbox ), seqv->sliders_[1], TRUE, TRUE, 0 ); - gtk_widget_show( seqv->sliders_[0] ); - gtk_widget_show( seqv->sliders_[1] ); -// gtk_container_add( GTK_CONTAINER( vvvbox ), hhbox ); - gtk_box_pack_start( GTK_BOX(vvvbox), hhbox, TRUE,TRUE, 0 ); - gtk_widget_show( hhbox ); - - gtk_container_add( GTK_CONTAINER( box ), vvvbox ); - gtk_widget_show( vvvbox ); - gtk_widget_show( box ); - - - GtkWidget *hbox = gtk_hbox_new(FALSE,0); - gtk_box_set_spacing( hbox, 10 ); - seqv->labels_[0] = gtk_label_new( "00:00:00:00" ); - seqv->labels_[1] = gtk_label_new( "00:00:00:00" ); - gtk_box_pack_start( GTK_BOX( hbox ), seqv->labels_[0], FALSE, FALSE, 0 ); - gtk_box_pack_start( GTK_BOX( hbox ), seqv->labels_[1], FALSE, FALSE, 0 ); - gtk_widget_show( seqv->labels_[0] ); - gtk_widget_show( seqv->labels_[1] ); - gtk_box_pack_start( GTK_BOX(seqv->main_vbox), hbox, FALSE,FALSE, 0 ); - gtk_widget_show( hbox ); - - - gtk_widget_set_sensitive_(GTK_WIDGET(seqv->panel), FALSE ); - - - gtk_widget_show( GTK_WIDGET( seqv->area ) ); - } - - seqv->dim[0] = w; - seqv->dim[1] = h; - - return seqv; -} - -GdkPixbuf *dummy_image() -{ - GdkPixbuf *src = logo_img_; -#ifdef STRICT_CHECKING - assert( logo_img_ != NULL ); -#endif - GdkPixbuf *dst = gdk_pixbuf_copy(src); - -/* float val = logo_value_; - if( val > 2.0 || val <= 0.0) - logo_step_ *= -1; - val += logo_step_; - logo_value_ = val; - - gdk_pixbuf_saturate_and_pixelate(src,dst, val, FALSE ); - - g_usleep( 100000 );*/ -// g_usleep( 500000 ); - return dst; -} - - -void *mt_preview( gpointer user_data ) -{ - multitracker_t *mt = (multitracker_t*) user_data; - all_priv_t *a = (all_priv_t*) mt->data; - gint i = 0; - GdkPixbuf *cache[MAX_TRACKS+2]; - - GdkPixbuf *nopreview = dummy_image(); - GdkPixbuf *logo = gdk_pixbuf_scale_simple( nopreview,176,176 , GDK_INTERP_NEAREST); - long sleepy = 34000; - char tmp_key[32]; - void *pixp = vevo_port_new( VEVO_ANONYMOUS_PORT ); - int logos[32]; - int logo_done=0; - GdkPixbuf *ir = NULL; - veejay_memset(logos,0, sizeof(logos)); - for( ;; ) - { - int scale_track_0 = -1; - G_LOCK( mt_lock ); - mt_priv_t *lt = a->pt[LAST_TRACK]; - gint error = 0; - memset( cache, 0, (MAX_TRACKS+2) * sizeof(GdkPixbuf*)); - if(mt->quit) - { - G_UNLOCK( mt_lock ); - break; - } - - - //@ clean previous pixmaps - int ref = find_sequence( a ); - char **refs = vevo_list_properties( pixp ); - if(refs) - { - for( i = 0; refs[i] != NULL ; i ++ ) - { - GdkPixbuf *buf = NULL; - if( vevo_property_get( pixp, refs[i], 0, &buf ) == VEVO_NO_ERROR ) - gdk_pixbuf_unref(buf); - free(refs[i]); - } - free(refs); - vevo_port_free( pixp ); //@FIXME: should remove property - pixp = vevo_port_new( VEVO_ANONYMOUS_PORT ); - } - - //@ preview off - if(!lt->preview ) - { - cache[LAST_TRACK] = nopreview; - ir = nopreview; -#ifdef STRICT_CHECKING - assert( cache[LAST_TRACK] != NULL ); -#endif - } - else - { - cache[LAST_TRACK] = veejay_get_image( lt->sequence, &error ); - if( error ) - { - // delete_data( mt->data, LAST_TRACK ); - cache[LAST_TRACK] = NULL; - } - else - { - sprintf(tmp_key, "%d", LAST_TRACK ); - vevo_property_set( pixp, tmp_key, VEVO_ATOM_TYPE_VOIDPTR,1, &(cache[LAST_TRACK] ) ); - } - } - - // if(ref >= 0 ) - // { - /// gdk_pixbuf_unref( cache[ref] ); - // } - - if( mt->sensitive) - { - for( i = 0; i < MAX_TRACKS ; i ++ ) - { - mt_priv_t *p = a->pt[i]; - if( p->active && ref != i || (ref ==i && lt->preview == 0 )) - { - if( p->preview ) - { - cache[i] = veejay_get_image( - p->sequence, - &error ); - if( error ) - cache[i] = NULL; - else - { - sprintf(tmp_key, "%d", i ); - vevo_property_set( pixp, tmp_key, VEVO_ATOM_TYPE_VOIDPTR,1, &(cache[i] ) ); - } - logos[i] = 0; - } - else - { - if(logos[i] == 0) - { - cache[i] = logo; - error = 0; - logos[i] = 1; - } - } - } - else if ( p->active && p->preview && ref == i ) - { - scale_track_0 = i; - cache[i] = cache[LAST_TRACK]; - } - } - } - //@ scale image - //FIXME - /* if( ref >= 0 && lt->preview && cache[LAST_TRACK] ) - { - veejay_msg(0, "\tpreview on, scale %d cache",ref); - gint w = mpreview_width_ == 0 ? 352/4 : mpreview_width_; - gint h = (gint)( (float) w / ratio_ ); - cache[ref] = gdk_pixbuf_scale_simple( //@ leaking memory - cache[LAST_TRACK], - w,h,GDK_INTERP_NEAREST ); - sprintf(tmp_key, "%d", ref ); - vevo_property_set( pixp, tmp_key, VEVO_ATOM_TYPE_VOIDPTR,1, &(cache[ref] ) ); - }*/ - - - // GdkPixbuf *ir = NULL; - if(lt->active && cache[LAST_TRACK] && lt->preview) - { - gint w = 352; - gint h = (gint)((float)w / ratio_); - //@ratio - ir = gdk_pixbuf_scale_simple( cache[LAST_TRACK], - w,h,GDK_INTERP_NEAREST ); - sprintf(tmp_key, "%p", ir ); - vevo_property_set( pixp, tmp_key, VEVO_ATOM_TYPE_VOIDPTR,1, &ir ); - } - - G_UNLOCK(mt_lock ); - - - //@ if there is no work, do not do threads_enter - int have_work = 0; - for( i = 0; i < MAX_TRACKS ; i ++ ) - { - if(logos[i] <= 1 && cache[i] ) - { - have_work ++; - break; - } - } - if( lt->active && ir && logo_done == 0 ) - have_work ++; - if( lt->active && ir && ir != nopreview ) - have_work ++; - - if( have_work ) - { - gdk_threads_enter(); - - for( i = 0; i < MAX_TRACKS ; i ++ ) - { - mt_priv_t *p = a->pt[i]; - update_sequence_widgets(p); - - if(cache[i] && logos[i] <= 1 || scale_track_0 == i) - { - GtkImage *image = GTK_IMAGE( p->view->area ); - gtk_image_set_from_pixbuf_( image, cache[i] ); - if(logos[i] ) - logos[i] ++; - } - } - - if(lt->active && ir ) - { - if( ir == nopreview ) - { - if( logo_done==0 ) - { - gtk_image_set_from_pixbuf_( GTK_IMAGE(lt->view->area), ir ); - logo_done = 1; - } - } - else - { - gtk_image_set_from_pixbuf_( GTK_IMAGE(lt->view->area), ir ); - - sleepy = img_cb( cache[LAST_TRACK], ir, GTK_IMAGE( lt->view->area ) ); - gtk_widget_queue_draw(GTK_IMAGE( lt->view->area )); - - logo_done = 0; - } - } - gdk_threads_leave(); - } - - - if( have_work == 0 ) - g_usleep( 3 * sleepy ); - else - { - if(sleepy >= 1000) - g_usleep(sleepy); - else - g_usleep( vj_gui_sleep_time() ); - } - //@ clear our buffer - } - - gdk_pixbuf_unref( nopreview ); - g_thread_exit(NULL); - return NULL; -} + diff --git a/veejay-current/gveejay-reloaded/multitrack.h b/veejay-current/gveejay-reloaded/multitrack.h index 7799bd4f..04c10fc4 100644 --- a/veejay-current/gveejay-reloaded/multitrack.h +++ b/veejay-current/gveejay-reloaded/multitrack.h @@ -1,38 +1,26 @@ -#ifndef MULTITRACK_H -#define MULTITRACK_H +#ifndef MTRACK_H +#define MTRACK_H + +void *multitrack_new( + void (*f)(int,char*,int), + int (*g)(GdkPixbuf *, GdkPixbuf *, GtkImage *), + GtkWidget *win, + GtkWidget *box, + GtkWidget *msg, + gint max_w, + gint max_h, + GtkWidget *main_preview_area); -void *multitrack_new( - void(*f)(int,char*,int), - int(*g)(GdkPixbuf *, GdkPixbuf *, GtkImage *), - GtkWidget *win, - GtkWidget *box, - GtkWidget *msg, - gint w, - gint h, - GtkWidget *area); +int multitrack_add_track( void *data ); -void multitrack_set_hlq( void *data, float fps,float ratio, int quality ); +void multitrack_close_track( void *data ); -void multitrack_open( void *data ); +int multrack_audoadd( void *data, char *hostname, int port_num ); -void multitrack_close( void *data ); +void multitrack_release_track(void *data, int id, int release_this ); -int multitrack_add_track( void *data ); +void multitrack_bind_track( void *data, int id, int bind_this ); -void multitrack_close_track( void *data ); - -void multitrack_rule_track( void *data ); - -void multitrack_set_current( void *data, char *hostname, int port_num , int w, int h); - -void multitrack_restart( void *data ); - -void multitrack_sync_start(void *data); - -void multitrack_sync_simple_cmd(void *data, int vims_id, int value); - -void multitrack_quit( void *data ); - -void multitrack_set_preview_speed( void *data , double value ); #endif + diff --git a/veejay-current/gveejay-reloaded/sequence.c b/veejay-current/gveejay-reloaded/sequence.c index 308bb53f..cedad95f 100644 --- a/veejay-current/gveejay-reloaded/sequence.c +++ b/veejay-current/gveejay-reloaded/sequence.c @@ -1,3 +1,24 @@ +/* Gveejay Reloaded - graphical interface for VeeJay + * (C) 2002-2006 Niels Elburg + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include #include #include #include @@ -5,54 +26,94 @@ #include #include #include +#include -#define DATA_ERROR 0 -#define DATA_DONE 1 -#define RETRIEVING_DATA 2 -#define DATA_READY 3 -#define MAX_BUF 2 typedef struct { - GThread *thread; - gchar *hostname; - gint port_num; - gint active; + char *hostname; + int port_num; vj_client *fd; - unsigned char status_buffer[100]; - unsigned char *data_buffers[MAX_BUF]; - uint8_t *compr_buffers[MAX_BUF]; - int data_status[MAX_BUF]; - gint frame_num; - gint wframe_num; - gint preview; - gint width; - float fps; - gint height; - gint abort; - unsigned long preview_delay; - unsigned long user_delay; - glong time_out; // in microseconds - GCond *cond; - GMutex *mutex; -// GMutex *serialize; - guchar *serialized[100]; - int sta[22]; - void *lzo; -} veejay_sequence_t; + uint8_t *data_buffer; + uint8_t *compr_buffer; //shared + uint8_t *status_buffer; + int track_list[16]; + int track_items; //shared + int status_tokens[32]; //shared + int active; + int have_frame; + int preview; + int width; + int height; + int need_track_list; + unsigned char *queue[16]; + int n_queued; +} veejay_track_t; -static unsigned long vj_get_timer() +typedef struct { - struct timeval tv; - gettimeofday(&tv, 0); - return ((long) (tv.tv_sec * 1000000) + tv.tv_usec); + void *lzo; + veejay_track_t **tracks; + int n_tracks; + GMutex *mutex; + GThread *thread; + int state; +} veejay_preview_t; + +static void *gvr_preview_thread(gpointer data); +static int sendvims( veejay_track_t *v, int vims_id, const char format[], ... ); +static int recvvims( veejay_track_t *v, gint header_len, gint *payload, guchar *buffer ); +static int veejay_get_image_data(veejay_preview_t *vp, veejay_track_t *v ); +static int track_find( veejay_preview_t *vp ); +static int veejay_process_status( veejay_preview_t *vp, veejay_track_t *v ); +static void gvr_preview_process_image( veejay_preview_t *vp, veejay_track_t *v ); +static int track_exists( veejay_preview_t *vp, const char *hostname, int port_num ); +static int gvr_preview_process_status( veejay_preview_t *vp, veejay_track_t *v ); + +void *gvr_preview_init(int max_tracks) +{ + veejay_preview_t *vp = (veejay_preview_t*) vj_calloc(sizeof( veejay_preview_t )); + GError *err = NULL; + vp->lzo = lzo_new(); + vp->mutex = g_mutex_new(); + + vp->tracks = (veejay_track_t**) vj_calloc(sizeof( veejay_track_t*) * max_tracks ); + vp->n_tracks = max_tracks; + + vp->state = 1; + + vp->thread = g_thread_create( + (GThreadFunc) gvr_preview_thread, + (gpointer*) vp, + TRUE, + &err ); + + if(!vp->thread ) + { + lzo_free(vp->lzo); + g_mutex_free( vp->mutex ); + free(vp); + return NULL; + } + + return (void*) vp; +} + +static void gvr_close_connection( veejay_track_t *v ) +{ + if(v) + { + veejay_msg(2, "Disconnectin VeejayGrabber %s:%d", + v->hostname,v->port_num ); + vj_client_close(v->fd); + if(v->hostname) free(v->hostname); + if(v->status_buffer) free(v->status_buffer); + if(v->compr_buffer) free(v->compr_buffer); + if(v->data_buffer) free(v->data_buffer); + free(v); + } } -void veejay_sequence_free( void *data ); - - // 3 second timeout -//@ Check if this works! -static int veejay_ipc_send( veejay_sequence_t *v, - int vims_id, const char format[], ... ) +static int sendvims( veejay_track_t *v, int vims_id, const char format[], ... ) { gchar block[255]; gchar tmp[255]; @@ -79,97 +140,7 @@ static int veejay_ipc_send( veejay_sequence_t *v, return n; } -int veejay_sequence_send( void *data , int vims_id, const char format[], ... ) -{ - - veejay_sequence_t *v = (veejay_sequence_t*) data; - if(!v || !v->active) return 0; - - g_mutex_lock( v->mutex ); - gint ret = 0; - gchar block[255]; - gchar tmp[255]; - va_list args; - - if( format == NULL ) - { - g_snprintf( block, sizeof(block)-1, "%03d:;", vims_id ); - ret = vj_client_send( v->fd, V_CMD, block ); - } - else - { - va_start( args, format ); - vsnprintf( tmp, sizeof(tmp)-1, format, args ); - g_snprintf( block,sizeof(block)-1, "%03d:%s;", vims_id, tmp ); - va_end( args ); - - ret = vj_client_send( v->fd, V_CMD, block ); - } - g_mutex_unlock( v->mutex ); - return ret; -} - -unsigned char *veejay_sequence_get_track_list( void *data, int slen, int *bytes_written ) -{ - veejay_sequence_t *v = (veejay_sequence_t*) data; - if(!v || !v->active) return NULL; - g_mutex_lock( v->mutex ); - - unsigned char message[10]; - int tmp_len = slen + 1; - unsigned char *tmp = vj_calloc( tmp_len ); - - sprintf(message, "%03d:;", VIMS_TRACK_LIST ); - int ret = vj_client_send( v->fd, V_CMD, message ); - if( ret <= 0) - { - free(tmp); - g_mutex_unlock(v->mutex); - return NULL; - } - - ret = vj_client_read( v->fd, V_CMD, tmp, slen ); - if( ret <= 0 ) - { - free(tmp); - g_mutex_unlock(v->mutex); - return NULL; - } - - int len = 0; - sscanf( tmp, "%d", &len ); - unsigned char *result = NULL; - - if( len <= 0 || slen <= 0) - { - free(tmp); - g_mutex_unlock( v->mutex ); - return result; - } - - result = (gchar*) vj_calloc(sizeof(gchar) * (len + 1) ); - int bytes_left = len; - *bytes_written = 0; - - while( bytes_left > 0) - { - int n = vj_client_read( v->fd, V_CMD, result + (*bytes_written), bytes_left ); - if( n <= 0 ) - { - bytes_left = 0; - } - if( n > 0 ) - { - *bytes_written +=n; - bytes_left -= n; - } - } - free(tmp); - g_mutex_unlock( v->mutex ); - return result; -} - -static int veejay_ipc_recv( veejay_sequence_t *v, gint header_len, gint *payload, guchar *buffer ) +static int recvvims( veejay_track_t *v, gint header_len, gint *payload, guchar *buffer ) { gint tmp_len = header_len + 1; unsigned char *tmp = vj_calloc( tmp_len ); @@ -184,7 +155,7 @@ static int veejay_ipc_recv( veejay_sequence_t *v, gint header_len, gint *payload return 0; } - if( sscanf( tmp, "%6d", &len )<=0) + if( sscanf( (char*)tmp, "%6d", &len )<=0) { free(tmp); veejay_msg(0, "Error reading header contents"); @@ -226,11 +197,66 @@ static int veejay_ipc_recv( veejay_sequence_t *v, gint header_len, gint *payload return 1; } -static int veejay_process_status( veejay_sequence_t *v ) + +static unsigned char *vims_track_list( veejay_track_t *v, int slen, int *bytes_written ) +{ + unsigned char message[10]; + int tmp_len = slen + 1; + unsigned char *tmp = vj_calloc( tmp_len ); + + sprintf(message, "%03d:;", VIMS_TRACK_LIST ); + int ret = vj_client_send( v->fd, V_CMD, message ); + if( ret <= 0) + { + free(tmp); + return NULL; + } + + ret = vj_client_read( v->fd, V_CMD, tmp, slen ); + if( ret <= 0 ) + { + free(tmp); + return NULL; + } + + int len = 0; + sscanf( (char*) tmp, "%d", &len ); + unsigned char *result = NULL; + + if( len <= 0 || slen <= 0) + { + free(tmp); + return result; + } + + result = (unsigned char*) vj_calloc(sizeof( unsigned char) * (len + 1) ); + int bytes_left = len; + *bytes_written = 0; + + while( bytes_left > 0) + { + int n = vj_client_read( v->fd, V_CMD, result + (*bytes_written), bytes_left ); + if( n <= 0 ) + { + bytes_left = 0; + } + if( n > 0 ) + { + *bytes_written +=n; + bytes_left -= n; + } + } + free(tmp); + return result; +} + + +static int veejay_process_status( veejay_preview_t *vp, veejay_track_t *v ) { unsigned char status_len[6]; veejay_memset( status_len, 0, sizeof(status_len) ); gint nb = vj_client_read( v->fd, V_STATUS, status_len, 5 ); + if( status_len[0] == 'V' ) { gint bytes = 0; @@ -244,334 +270,647 @@ static int veejay_process_status( veejay_sequence_t *v ) veejay_msg(0, "Error reading statusline"); return 0; } - veejay_memcpy( v->serialized, v->status_buffer, bytes ); - status_to_arr( v->status_buffer, v->sta ); + + while( vj_client_poll( v->fd, V_STATUS ) ) // is there a more recent message? + { + veejay_memset( status_len, 0, sizeof( status_len ) ); + n = vj_client_read(v->fd, V_STATUS, status_len, 5 ); + sscanf( status_len+1, "%03d", &bytes ); + if(bytes > 0 ) + vj_client_read( v->fd, V_STATUS, v->status_buffer, bytes ); + } + + g_mutex_lock( vp->mutex ); + veejay_memset( v->status_tokens,0, sizeof(sizeof(int) * 32)); + status_to_arr( v->status_buffer, v->status_tokens ); + g_mutex_unlock( vp->mutex ); return 1; } } + else + { + g_mutex_lock(vp->mutex); + gvr_close_connection( v ); + g_mutex_unlock(vp->mutex); + } return 0; } -static int veejay_get_image_data(veejay_sequence_t *v ) + +static int veejay_get_image_data(veejay_preview_t *vp, veejay_track_t *v ) { - if(!v->active ) + + if(v->have_frame ) + { +// veejay_msg(0, "Missed frame, UI too slow"); + return 1; + } + + if(!v->have_frame && v->width <= 0 || v->height <= 0 ) return 1; - gint res = veejay_ipc_send( v, VIMS_RGB24_IMAGE, "%d %d", v->width,v->height ); + gint res = sendvims( v, VIMS_RGB24_IMAGE, "%d %d", v->width,v->height ); if( res <= 0 ) { veejay_msg(0, "Error sending VIMS_RGB24_IMAGE"); return 0; } gint bw = 0; -/* - res = veejay_ipc_recv( v, 6, &bw, v->data_buffers[v->frame_num] ); - if( res <= 0 ) - { - veejay_msg(0, "Error receiving RGB24 image"); - return 0; - }*/ - res = veejay_ipc_recv( v, 6, &bw, v->compr_buffers[v->frame_num] ); + res = recvvims( v, 6, &bw, v->compr_buffer ); if( res <= 0 ) { veejay_msg(0, "Error receiving compressed RGB image"); return 0; } - bw = lzo_decompress2( v->lzo, v->compr_buffers[v->frame_num], bw, v->data_buffers[v->frame_num]); +// g_mutex_lock(vp->mutex); + bw = lzo_decompress2( vp->lzo, v->compr_buffer, bw, v->data_buffer); + v->have_frame = 1; +// g_mutex_unlock(vp->mutex); - return bw; } -void veejay_get_status( void *data, guchar *dst ) + +static int gvr_preview_process_status( veejay_preview_t *vp, veejay_track_t *v ) { - veejay_sequence_t *v = (veejay_sequence_t*) data; - if(!v->active) - return; - g_mutex_lock( v->mutex ); - veejay_memcpy( dst, v->serialized, 100); - g_mutex_unlock(v->mutex ); + if( vj_client_poll( v->fd , V_STATUS ) ) + return veejay_process_status( vp, v ); + return 0; } -GdkPixbuf *veejay_get_image( void *data, gint *error) +static void gvr_preview_process_image( veejay_preview_t *vp, veejay_track_t *v ) { - veejay_sequence_t *v = (veejay_sequence_t*) data; - if(!v || !v->active) return NULL; - - gint ret = 0; - g_mutex_lock( v->mutex ); - GTimeVal time_val; - - g_get_current_time( &time_val ); - g_time_val_add( &time_val, v->time_out ); - -// while( v->data_status[v->frame_num] == RETRIEVING_DATA ) - while( v->data_status[v->frame_num] != DATA_READY ) - + if( v->preview ) { - //@ sleeping for new frames! - if(!g_cond_timed_wait( v->cond, v->mutex, &time_val )) - { // timeout ! - v->data_status[v->frame_num] = DATA_ERROR; - g_mutex_unlock(v->mutex); - *error = 1; - return NULL; - } - if( v->abort ) + if( veejay_get_image_data( vp, v ) == 0 ) { - veejay_msg(VEEJAY_MSG_ERROR, "Abort image preview thread"); - g_mutex_unlock(v->mutex); - - return NULL; + g_mutex_lock(vp->mutex); + gvr_close_connection( v ); + g_mutex_unlock(vp->mutex); } } +} - if( v->data_status[v->frame_num] == DATA_READY ) +static int track_exists( veejay_preview_t *vp, const char *hostname, int port_num ) +{ + int i; + + for( i = 0; i < vp->n_tracks ; i++ ) { - *error = 0; - GdkPixbuf *res = gdk_pixbuf_new_from_data( - v->data_buffers[v->frame_num], - GDK_COLORSPACE_RGB, - FALSE, - 8, - v->width, - v->height, - v->width * 3, - NULL, - NULL ); - v->data_status[v->frame_num] = DATA_DONE; - v->frame_num = (v->frame_num+1)%MAX_BUF; - g_mutex_unlock( v->mutex ); - return res; + if( vp->tracks[i] ) + { + veejay_track_t *v = vp->tracks[i]; + if( strcasecmp( hostname, v->hostname ) == 0 && v->port_num == port_num ) + return 1; + } } - if( v->data_status[v->frame_num] == DATA_ERROR ) - *error = 1; + return 0; +} - g_mutex_unlock( v->mutex ); +static int track_find( veejay_preview_t *vp ) +{ + int i; + int res = -1; + for( i = 0;i < vp->n_tracks ;i ++ ) + { + if( !vp->tracks[i] ) + { + res = i; + break; + } + } + return res; +} + + +void gvr_ext_lock(void *preview) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + g_mutex_lock(vp->mutex); +} + +void gvr_ext_unlock(void *preview) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + g_mutex_unlock(vp->mutex); +} + +char* gvr_track_get_hostname( void *preview , int num ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + + if( vp->tracks[num] ) + return vp->tracks[num]->hostname; return NULL; -} +} -void veejay_configure_sequence( void *data, gint w, gint h , float fps) +int gvr_track_get_portnum( void *preview, int num) { - veejay_sequence_t *v = (veejay_sequence_t*) data; - if(!v) return; - g_mutex_lock( v->mutex ); - - while( v->data_status[v->frame_num] == RETRIEVING_DATA ) - g_cond_wait( v->cond, v->mutex ); + veejay_preview_t *vp = (veejay_preview_t*) preview; - v->width = w; - v->height = h; - if(fps>0.0) - v->fps = fps; + if( vp->tracks[num] ) + return vp->tracks[num]->port_num; + return 0; +} - veejay_msg(VEEJAY_MSG_INFO, "Configured %d x %d @ %2.2f", - w,h,fps ); +int gvr_track_connect( void *preview, const char *hostname, int port_num, int *new_track ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + + if(track_exists( vp, hostname, port_num ) ) + return 0; - g_mutex_unlock( v->mutex ); + int track_num = track_find( vp ); + + if(track_num == -1) + return 0; + + vj_client *fd = vj_client_alloc(0,0,0); + if(!vj_client_connect( fd, hostname, NULL, port_num ) ) + { + vj_client_free( fd ); + return 0; + } + + veejay_track_t *vt = (veejay_track_t*) vj_calloc( sizeof(veejay_track_t)); + vt->hostname = strdup(hostname); + vt->port_num = port_num; + vt->active = 1; + vt->fd = fd; + + + vt->status_buffer = (uint8_t*) vj_calloc(sizeof(uint8_t) * 256); + vt->compr_buffer = (uint8_t*) vj_calloc(sizeof(uint8_t) * 512 * 512 * 3 ); + vt->data_buffer = (uint8_t*) vj_calloc(sizeof(uint8_t) * 512 * 512 * 3 ); + + veejay_msg(2, "Track %d connected to Veejay %s : %d", track_num,hostname,port_num); + + g_mutex_lock( vp->mutex ); + vp->tracks[ track_num ] = vt; + g_mutex_unlock( vp->mutex ); + + *new_track = track_num; + + return 1; } -static int veejay_process_data( veejay_sequence_t *v ) +static void gvr_single_queue_vims( veejay_track_t *v, int vims_id ) { - gint ret = 0; - g_mutex_lock( v->mutex ); + char message[10]; - if( v->width <= 0 || v->height <= 0 || v->preview == 0 || v->active == 0) + sprintf(message, "%03d:;", vims_id ); + + if( v->n_queued < 16 ) { - g_mutex_unlock( v->mutex ); - return 1; + v->queue[ v->n_queued ] = strdup( message ); + v->n_queued ++; } - - if(v->data_status[v->wframe_num] == DATA_READY||v->data_status[v->wframe_num]==DATA_ERROR) - v->data_status[v->wframe_num] = DATA_DONE; - if(v->data_status[v->wframe_num] == DATA_DONE ) - { - v->data_status[v->wframe_num] = RETRIEVING_DATA; - ret = veejay_get_image_data( v ); - if(ret) - { - v->data_status[v->wframe_num] = DATA_READY; - v->wframe_num = (v->wframe_num+1) % MAX_BUF; - } - else - v->data_status[v->wframe_num] = DATA_ERROR; - g_cond_signal( v->cond ); - } - g_mutex_unlock( v->mutex ); - - return ret; } -void *veejay_sequence_thread(gpointer data) +static void gvr_multi_queue_vims( veejay_track_t *v, int vims_id, int val ) { - veejay_sequence_t *v = (veejay_sequence_t*) data; - if(!v) return NULL; - unsigned long time_now = 0; + char message[10]; - v->preview_delay = ( 1.0/ v->fps ) * 1000; + sprintf(message, "%03d:%d;", vims_id,val ); - unsigned long tn = vj_get_timer() + v->preview_delay; + if( v->n_queued < 16 ) + { + v->queue[ v->n_queued ] = strdup( message ); + v->n_queued ++; + } +} +static void gvr_multivx_queue_vims( veejay_track_t *v, int vims_id, int val1,unsigned char *val2 ) +{ + char message[300]; - for ( ;; ) - { - glong spf = (glong)(((float)1.0 / v->fps) * 1000); + sprintf(message, "%03d:%d %s;", vims_id,val1,val2 ); - time_now = vj_get_timer(); - - if( v->abort ) - { - veejay_msg(0, "Thread aborted"); - return NULL; + if( v->n_queued < 16 ) + { + v->queue[ v->n_queued ] = strdup( message ); + v->n_queued ++; + } +} + +static void gvr_multiv_queue_vims( veejay_track_t *v, int vims_id, int val1,int val2 ) +{ + char message[10]; + + sprintf(message, "%03d:%d %d;", vims_id,val1,val2 ); + + if( v->n_queued < 16 ) + { + v->queue[ v->n_queued ] = strdup( message ); + v->n_queued ++; + } +} +void gvr_queue_cxvims( void *preview, int track_id, int vims_id, int val1,unsigned char *val2 ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + int i; + + g_mutex_lock( vp->mutex ); + + if( track_id == -1 ) + { + for( i = 0; i < vp->n_tracks; i ++ ) + if( vp->tracks[i]->active ) + gvr_multivx_queue_vims( vp->tracks[i], vims_id,val1,val2 ); + } + else + { + gvr_multivx_queue_vims( vp->tracks[track_id], vims_id,val1,val2 ); + } + g_mutex_unlock( vp->mutex ); + +} + +void gvr_queue_vims( void *preview, int track_id, int vims_id ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + int i; + + g_mutex_lock( vp->mutex ); + + if( track_id == -1 ) + { + for( i = 0; i < vp->n_tracks; i ++ ) + if( vp->tracks[i]->active ) + gvr_single_queue_vims( vp->tracks[i], vims_id ); + } + else + { + gvr_single_queue_vims( vp->tracks[track_id], vims_id ); + } + g_mutex_unlock( vp->mutex ); + +} + +void gvr_queue_mvims( void *preview, int track_id, int vims_id, int val ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + int i; + + g_mutex_lock( vp->mutex ); + + if( track_id == -1 ) + { + for( i = 0; i < vp->n_tracks ; i ++ ) + if( vp->tracks[i]->active ) + gvr_multi_queue_vims( vp->tracks[i], vims_id,val ); + } + else + { + gvr_multi_queue_vims( vp->tracks[track_id], vims_id,val ); + } + g_mutex_unlock( vp->mutex ); + +} + +void gvr_need_track_list( void *preview, int track_id ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + g_mutex_lock( vp->mutex ); + veejay_track_t *v = vp->tracks[track_id]; + if(v) + v->need_track_list = 1; + g_mutex_unlock( vp->mutex ); +} + +void gvr_queue_mmvims( void *preview, int track_id, int vims_id, int val1,int val2 ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + int i; + + g_mutex_lock( vp->mutex ); + + if( track_id == -1 ) + { + for( i = 0; i < vp->n_tracks; i ++ ) + if( vp->tracks[i]->active ) + gvr_multiv_queue_vims( vp->tracks[i], vims_id,val1,val2 ); + } + else + { + gvr_multiv_queue_vims( vp->tracks[track_id], vims_id,val1,val2 ); + } + g_mutex_unlock( vp->mutex ); + +} + +void gvr_track_disconnect( void *preview, int track_num ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + g_mutex_lock( vp->mutex ); + veejay_track_t *v = vp->tracks[ track_num ]; + gvr_close_connection( v ); + vp->tracks[ track_num ] = NULL; + g_mutex_unlock( vp->mutex ); +} + +int gvr_track_configure( void *preview, int track_num, int w, int h ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + g_mutex_lock( vp->mutex ); + vp->tracks[ track_num ]->width = w; + vp->tracks[ track_num ]->height = h; + g_mutex_unlock( vp->mutex ); + veejay_msg(2, "Track %d VeejayGrabber %s:%d %dx%d image", + track_num, + vp->tracks[ track_num ]->hostname, + vp->tracks[ track_num ]->port_num, + w,h); + return 1; +} + +int gvr_track_toggle_preview( void *preview, int track_num, int status ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + g_mutex_lock( vp->mutex ); + vp->tracks[ track_num ]->preview = status; + vp->tracks[ track_num ]->have_frame = 0; + g_mutex_unlock( vp->mutex ); + veejay_msg(2, "Track %d VeejayGrabber %s:%d %s", + track_num, + vp->tracks[ track_num ]->hostname, + vp->tracks[ track_num ]->port_num, + (status ? "Active" : "Disabled") ); +} + + + +static GdkPixbuf **gvr_grab_images(void *preview) +{ + + //requires lock + veejay_preview_t *vp = (veejay_preview_t*) preview; + GdkPixbuf **list = (GdkPixbuf**) vj_calloc( sizeof(GdkPixbuf*) * vp->n_tracks ); + if(!list) + return NULL; + + int i; + for( i = 0; i < vp->n_tracks; i ++ ) + { + if( vp->tracks[i] && vp->tracks[i]->have_frame ) + { + veejay_track_t *v = vp->tracks[i]; + list[i] = gdk_pixbuf_new_from_data( v->data_buffer, GDK_COLORSPACE_RGB, FALSE, + 8, v->width,v->height,v->width * 3,NULL,NULL ); + vp->tracks[i]->have_frame = 0; } - - while( vj_client_poll( v->fd, V_STATUS )) + } + + return list; +} + +static int *int_dup( int *status ) +{ + int *res = (int*) vj_calloc( sizeof(int) * 32 ); + int i; + for(i =0; i < 32 ; i ++ ) + res[i] = status[i]; + return res; +} + +static int **gvr_grab_stati( void *preview ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + int **list = (GdkPixbuf**) vj_calloc( sizeof(int*) * vp->n_tracks ); + if(!list) + return NULL; + + int i; + for( i = 0; i < vp->n_tracks; i ++ ) + { + veejay_track_t *v = vp->tracks[i]; + if(v) + list[i] = int_dup( vp->tracks[i]->status_tokens ); + } + + return list; +} + +static int *gvr_grab_widths( void *preview ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + int *list = (GdkPixbuf**) vj_calloc( sizeof(int) * vp->n_tracks ); + if(!list) + return NULL; + + int i; + for( i = 0; i < vp->n_tracks; i ++ ) + { + veejay_track_t *v = vp->tracks[i]; + if(v) + list[i] = vp->tracks[i]->width; + } + + return list; +} +static int *gvr_grab_heights( void *preview ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + int *list = (GdkPixbuf**) vj_calloc( sizeof(int) * vp->n_tracks ); + if(!list) + return NULL; + + int i; + for( i = 0; i < vp->n_tracks; i ++ ) + { + veejay_track_t *v = vp->tracks[i]; + if(v) + list[i] = vp->tracks[i]->height; + } + + return list; +} + +sync_info *gvr_sync( void *preview ) +{ + veejay_preview_t *vp = (veejay_preview_t*) preview; + sync_info *s = (sync_info*) vj_calloc(sizeof(sync_info)); + + g_mutex_lock( vp->mutex ); + s->status_list = gvr_grab_stati( preview ); + s->img_list = gvr_grab_images( preview ); + s->tracks = vp->n_tracks; + s->widths = gvr_grab_widths( preview ); + s->heights = gvr_grab_heights( preview); + g_mutex_unlock( vp->mutex ); + + return s; +} + + +static void gvr_parse_track_list( veejay_preview_t *vp, veejay_track_t *v, unsigned char *tmp, int len ) +{ + int i = 0; + int items = 0; + unsigned char *ptr = tmp; + + unsigned char **z = vj_calloc( sizeof( unsigned char * ) * vp->n_tracks ); + + while( i < len ) + { + int k = 0; + unsigned char k_str[4]; + strncpy( (char*) k_str,(char*) ptr, 3 ); + if( k > 0 ) { - if( veejay_process_status( v ) == 0 ) - { - veejay_msg(0, "Error reading status from track"); - v->active = 0; - return NULL; - } + ptr += 3; + z[items] = strndup( (char*) ptr, k ); + items ++; + ptr += k; } - - if( time_now > tn && v->sta[0] < (v->fps * 5)) + i += ( 3 + k ); + } + + if( items > 0 ) + { + for( i = 0; i < items ; i ++ ) { - if( v->preview ) + int k; + int in_track = -1; + for( k = 0; k < vp->n_tracks ; k ++ ) { - if ( veejay_process_data( v ) == 0 ) + veejay_track_t *t = vp->tracks[k]; + if(t) { - veejay_msg(0, "Abort, data error"); - v->active = 0; - return NULL; + char hostname[255]; + int port = 0; + int stream_id = 0; + veejay_memset(hostname,0,255 ); + if( sscanf( (char*) z[i], "%s %d %d", hostname, port, &stream_id )) + { + if( strcasecmp( hostname, t->hostname ) == 0 && + port == t->port_num ) + in_track = k; + } } } - tn = time_now + v->preview_delay; + + v->track_list[i] = in_track; + + free( z[i] ); } - - glong ms_passed = v->sta[0]; - if( (spf - ms_passed) > 0 ) - g_usleep( (spf-ms_passed)*1000); + v->track_items = items; } - return NULL; + + free( z ); } -void veejay_abort_sequence( void *data ) +int gvr_get_stream_id( void *data, int id ) { - veejay_sequence_t *v = (veejay_sequence_t*) data; - if(!v || !v->active) return; + veejay_preview_t *vp = (veejay_preview_t*) data; - g_mutex_lock(v->mutex); - v->abort = 1; - g_mutex_unlock(v->mutex); + veejay_track_t *v = vp->tracks[id]; - veejay_sequence_free( data ); + if(v) + return v->track_list[id]; + return 0; } -void veejay_toggle_image_loader( void *data, gint state ) +static void gvr_parse_queue( veejay_track_t *v ) { - veejay_sequence_t *v = (veejay_sequence_t*) data; - if(!v) return; - if(!v->active) - return; - g_mutex_lock(v->mutex); - v->preview = state; - g_mutex_unlock(v->mutex); -} + int i; -int veejay_sequence_active_preview( void *data ) -{ - veejay_sequence_t *v = (veejay_sequence_t*) data; - if(!v) return 0; - return v->preview; -} - -void veejay_sequence_preview_delay( void *data, double value ) -{ - veejay_sequence_t *v = (veejay_sequence_t*) data; - if(!v) return; -/* double f = 1.0 / fps_; - double ms = f * 1000.0; - - g_mutex_lock(v->mutex); - // value 0.0 - 1.0 - v->user_delay = value; - v->preview_delay = (unsigned long)( value * (double) max); - g_mutex_unlock(v->mutex);*/ -} - -void *veejay_sequence_init(int port, char *hostname, gint max_width, gint max_height) -{ - int k = 0; - GError *err = NULL; - veejay_sequence_t *v = (veejay_sequence_t*) vj_calloc(sizeof( veejay_sequence_t )); - - v->hostname = strdup( hostname ); - v->port_num = port; - for( k = 0; k < MAX_BUF; k ++ ) + for( i = 0; i < v->n_queued ; i ++ ) { - v->data_buffers[k] = (guchar*) vj_calloc(sizeof(guchar) * max_width * max_height * 3 ); - v->compr_buffers[k] = (guchar*) vj_calloc(sizeof(guchar) * max_width * max_height*3); - v->data_status[k] = DATA_ERROR; + vj_client_send( v->fd, V_CMD, v->queue[i] ); + free( v->queue[i] ); } - - - - v->fd = vj_client_alloc(0,0,0); - if(!vj_client_connect( v->fd, v->hostname, NULL,v->port_num ) ) - { - vj_client_free( v->fd ); - if( v->hostname ) free(v->hostname ); - if( v ) free (v); - return NULL; - } - - v->lzo = lzo_new(); - v->time_out = 4500000; // Micro seconds - v->frame_num = 0; - v->wframe_num = 0; - v->abort = 0; - //v->preview_delay = 4000000; - v->mutex = g_mutex_new(); -// v->serialize = g_mutex_new(); - v->active = 1; - v->fps = 25.0; - v->cond = g_cond_new(); - v->thread = g_thread_create( - (GThreadFunc) veejay_sequence_thread, - (gpointer*) v, - TRUE, - &err ); - if(!v->thread) - { - printf("%s\n", err->message ); - if(v) free(v); - return NULL; - } - veejay_msg(2, "New connection with %s, %d (max %d x %d), lock %p", - hostname,port,max_width,max_height, v->mutex ); - return v; + v->n_queued = 0; } -void veejay_sequence_free( void *data ) +static int gvr_veejay( veejay_preview_t *vp , veejay_track_t *v ) { - veejay_sequence_t *v = (veejay_sequence_t*) data; - int k; - g_thread_join( v->thread ); - g_cond_free( v->cond ); - g_mutex_free( v->mutex ); - vj_client_close( v->fd ); - - if( v->hostname ) - free(v->hostname ); - for( k = 0; k < MAX_BUF; k ++ ) + int score = 0; + g_mutex_lock( vp->mutex ); + if( v->need_track_list || v->n_queued > 0 ) { - free( v->data_buffers[k] ); - free( v->compr_buffers[k] ); + if( v->need_track_list ) + { + int bw = 0; + unsigned char *tmp = vims_track_list( v, 5, &bw ); + gvr_parse_track_list( vp, v, tmp, bw ); + v->need_track_list = 0; + } + if( v->n_queued > 0 ) + { + gvr_parse_queue( v ); + } + score ++; } - free(v); - v = NULL; + if( v->preview ) + { + gvr_preview_process_image( vp,v ); + score ++; + } + g_mutex_unlock( vp->mutex ); + return score; +} + + +static void *gvr_preview_thread(gpointer data) +{ + veejay_preview_t *vp = (veejay_preview_t*) data; + int i; + + for( ;; ) + { + int score = 0; + for( i = 0; i < vp->n_tracks ; i ++ ) + { + if( vp->tracks[i] && vp->tracks[i]->active) + if(gvr_preview_process_status( vp, vp->tracks[i] )) + { + //after lock in status, assert + if( vp->tracks[i] ) + score += gvr_veejay( vp, vp->tracks[i] ); + } + if( vp->state == 0 ) + break; + } + +/* for( i = 0; i < vp->n_tracks ; i ++ ) + { + if( vp->tracks[i] && vp->tracks[i]->active && ( vp->tracks[i]->need_track_list || vp->tracks[i]->n_queued > 0 )) + { + g_mutex_lock( vp->mutex ); + if( vp->tracks[i]->need_track_list ) + { + int bw = 0; + unsigned char *tmp = vims_track_list( vp->tracks[i], 5, &bw ); + gvr_parse_track_list( vp, vp->tracks[i], tmp, bw ); + vp->tracks[i]->need_track_list = 0; + } + + if( vp->tracks[i]->n_queued > 0 ) + gvr_parse_queue( vp->tracks[i] ); + + g_mutex_unlock( vp->mutex ); + } + } + + for( i = 0; i < vp->n_tracks ;i ++ ) + { + if( vp->tracks[i] && vp->tracks[i]->active ) + { + if( vp->tracks[i]->preview ) + gvr_preview_process_image( vp,vp->tracks[i] ); + } + }*/ + + if( vp->state == 0 ) + break; + + if( score == 0 ) + g_usleep( 1000 * 30 ); + } + + return NULL; } diff --git a/veejay-current/gveejay-reloaded/sequence.h b/veejay-current/gveejay-reloaded/sequence.h index 90639108..e5381382 100644 --- a/veejay-current/gveejay-reloaded/sequence.h +++ b/veejay-current/gveejay-reloaded/sequence.h @@ -1,5 +1,5 @@ /* Gveejay Reloaded - graphical interface for VeeJay - * (C) 2002-2005 Niels Elburg + * (C) 2002-2006 Niels Elburg * * * This program is free software; you can redistribute it and/or modify @@ -17,22 +17,37 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -GdkPixbuf *veejay_get_image( void *data , gint *error); +#ifndef PREVIEWH +#define PREVIEWH +typedef struct +{ + int tracks; + int master; + int *widths; + int *heights; + int **status_list; + GdkPixbuf **img_list; +} sync_info; -void *veejay_sequence_init(int port, char *hostname, gint w, gint h, gfloat fps); +void *gvr_preview_init(int max_tracks); +int gvr_track_connect( void *preview, const char *hostname, int port_num, int *track_num ); +void gvr_track_disconnect( void *preview, int track_num ); +int gvr_track_configure( void *preview, int track_num, int w, int h ); +int gvr_track_toggle_preview( void *preview, int track_num, int status ); +void gvr_need_track_list( void *preview, int track_id ); -void veejay_configure_sequence( void *data, gint w, gint h, float fps ); +int gvr_get_stream_id( void *data, int id ); -void veejay_sequence_free( void *data ); +//format and queue vims messages from extern -int veejay_sequence_send( void *data , int vims_id, const char format[], ... ); +void gvr_queue_mmvims( void *preview, int track_id, int vims_id, int val1,int val2 ); +void gvr_queue_mvims( void *preview, int track_id, int vims_id, int val ); +void gvr_queue_vims( void *preview, int track_id, int vims_id ); -void veejay_toggle_image_loader( void *data, gint state ); +void gvr_queue_cxvims( void *preview, int track_id, int vims_id, int val1,unsigned char *val2 ); -void veejay_get_status( void *data, guchar *dst ); +sync_info *gvr_sync( void *preview ); -unsigned char *veejay_sequence_get_track_list( void *data, int slen, int *bytes_written ); +#endif -void veejay_abort_sequence( void *data ); -void veejay_sequence_preview_delay( void *data, double value ); diff --git a/veejay-current/gveejay-reloaded/tracksources.c b/veejay-current/gveejay-reloaded/tracksources.c index 018c3398..83648a27 100644 --- a/veejay-current/gveejay-reloaded/tracksources.c +++ b/veejay-current/gveejay-reloaded/tracksources.c @@ -85,13 +85,14 @@ void update_track_view( int n_tracks, GtkWidget *widget, void *user_data ) if(!widget) { - veejay_msg(0, "%s: %d tracks, widget invalid!", __FUNCTION__, - n_tracks ); return; } gboolean valid; int i; - int *tmp = sequence_get_track_status( user_data ); + + int tmp[16]; + +// int *tmp = sequence_get_track_status( user_data ); /* int index = 0; valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( store ), &iter ); @@ -103,13 +104,11 @@ void update_track_view( int n_tracks, GtkWidget *widget, void *user_data ) }*/ - int id = sequence_get_track_id( user_data ); - veejay_msg(0, "track %d list track source", id ); + int id = multitrack_get_sequence_view_id( user_data ); for( i = 0; i < n_tracks; i ++ ) { if(id != i) { - veejay_msg(0, "Append track %d", i ); char name[12]; sprintf(name,"Track %d", i); gtk_list_store_append( store, &iter ); @@ -122,8 +121,6 @@ void update_track_view( int n_tracks, GtkWidget *widget, void *user_data ) } - free(tmp); - gtk_tree_view_set_model( GTK_TREE_VIEW( widget ), model ); // g_object_unref( model ); @@ -132,8 +129,6 @@ void update_track_view( int n_tracks, GtkWidget *widget, void *user_data ) GtkWidget *get_track_tree( void *data) { track_view_t *t = (track_view_t*) data; - veejay_msg(0 , "%s: get track tree %d, tree:%p",__FUNCTION__, - t->track_id,t->view ); return t->view; } @@ -205,7 +200,6 @@ void *create_track_view(int track_id, int ref_tracks, void *user_data) my_view->view = view; g_assert( GTK_IS_TREE_VIEW( view ) ); - veejay_msg(0, "CREATED TRACK %d TREE %p", track_id, view ); model = GTK_TREE_MODEL( store ); gtk_tree_view_set_model ( GTK_TREE_VIEW( view ), model ); diff --git a/veejay-current/gveejay-reloaded/vj-api.c b/veejay-current/gveejay-reloaded/vj-api.c index 07f24d79..a081bd50 100644 --- a/veejay-current/gveejay-reloaded/vj-api.c +++ b/veejay-current/gveejay-reloaded/vj-api.c @@ -50,10 +50,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include //if gtk2_6 is not defined, 2.4 is assumed. @@ -600,27 +602,6 @@ static struct static int no_preview_ = 0; static int no_draw_ = 0; - -G_LOCK_DEFINE(preview_buffer__); - -static void lock_preview__() -{ - G_LOCK(preview_buffer__ ); -} -static void unlock_preview__() -{ - G_UNLOCK(preview_buffer__ ); -} - -static void lock_preview_(const char *f, int line) -{ - lock_preview__(); -} -static void unlock_preview_(const char *f, int line) -{ - unlock_preview__(); -} - static void gtk_image_set_from_pixbuf__( GtkImage *w, GdkPixbuf *p, const char *f, int l ) { #ifdef STRICT_CHECKING @@ -643,14 +624,10 @@ static void select_slot__(int pm); #ifdef STRICT_CHECKING #define gtk_widget_set_sensitive_( w,p ) gtk_widget_set_sensitive___( w,p,__FUNCTION__,__LINE__ ) #define gtk_image_set_from_pixbuf_(w,p) gtk_image_set_from_pixbuf__( w,p, __FUNCTION__,__LINE__ ) -#define lock_preview() lock_preview_( __FUNCTION__,__LINE__ ) -#define unlock_preview() unlock_preview_( __FUNCTION__,__LINE__ ) #define select_slot(a) select_slot_(a,__FUNCTION__,__LINE__ ) #else #define gtk_widget_set_sensitive_( w,p ) gtk_widget_set_sensitive( w,p ) #define gtk_image_set_from_pixbuf_(w,p) gtk_image_set_from_pixbuf( w,p ) -#define lock_preview() lock_preview__() -#define unlock_preview() unlock_preview__() #define select_slot(a) select_slot__(a) #endif @@ -1780,10 +1757,9 @@ gboolean gveejay_quit( GtkWidget *widget, gpointer user_data) if( prompt_dialog("Quit gveejay", "Are you sure?" ) == GTK_RESPONSE_REJECT) return TRUE; } - multitrack_quit( info->mt ); +// multitrack_quit( info->mt ); info->watch.w_state = STATE_DISCONNECT; -// g_usleep(40000); // vj_gui_free(); running_g_ = 0; @@ -4302,8 +4278,6 @@ void load_effectlist_info() static void select_slot__( int pm ) { - //lock_preview(); - int *history = info->history_tokens[ pm ]; if( pm != MODE_PLAIN ) { @@ -4342,7 +4316,6 @@ static void select_slot__( int pm ) info->selected_slot = NULL; info->selected_gui_slot = NULL; } -// unlock_preview(); } @@ -5865,6 +5838,48 @@ static void veejay_untick(gpointer data) } }*/ + +static void veejay_update_multitrack( vj_gui_t *gui ) +{ + sync_info *s = multitrack_sync( gui->mt ); + GtkWidget *maintrack = glade_xml_get_widget( info->main_window, "imageA"); + int i; + + for( i = 0; i < s->tracks ; i ++ ) + { + if( s->status_list[i]) + { + update_multitrack_widgets( info->mt, s->status_list[i], i ); + + free(s->status_list[i]); + } + if( s->img_list[i] ) + { + if( i == s->master ) + { + if( s->widths[i] > 350 ) + { + gtk_image_set_from_pixbuf_( GTK_IMAGE( maintrack ), s->img_list[i] ); + } + else + { + GdkPixbuf *result = gdk_pixbuf_scale_simple( s->img_list[i], 352,288,GDK_INTERP_BILINEAR ); + gtk_image_set_from_pixbuf_( GTK_IMAGE( maintrack ), result ); + gdk_pixbuf_unref(result); + } + vj_img_cb( s->img_list[i] ); + } + if(!no_preview_)multitrack_update_sequence_image( gui->mt, i, s->img_list[i] ); + gdk_pixbuf_unref( s->img_list[i] ); + } + } + free(s->status_list); + free(s->img_list ); + free(s->widths); + free(s->heights); + free(s); +} + static gboolean veejay_tick( GIOChannel *source, GIOCondition condition, gpointer data) { vj_gui_t *gui = (vj_gui_t*) data; @@ -5879,8 +5894,6 @@ static gboolean veejay_tick( GIOChannel *source, GIOCondition condition, gpointe { gui->status_lock = 1; - // lock_preview(); - int nb = 0; unsigned char sta_len[6]; bzero(sta_len,6); @@ -5889,7 +5902,6 @@ static gboolean veejay_tick( GIOChannel *source, GIOCondition condition, gpointe if(sta_len[0] != 'V' || nb <= 0 ) { gui->status_lock = 0; - // unlock_preview(); return FALSE; } int n_bytes = 0; @@ -5897,7 +5909,6 @@ static gboolean veejay_tick( GIOChannel *source, GIOCondition condition, gpointe if( n_bytes == 0 || n_bytes >= STATUS_BYTES ) { gui->status_lock = 0; - // unlock_preview(); return FALSE; } veejay_memset( gui->status_msg,0, STATUS_BYTES ); @@ -5906,7 +5917,6 @@ static gboolean veejay_tick( GIOChannel *source, GIOCondition condition, gpointe if(nb <= 0 ) { gui->status_lock = 0; - // unlock_preview(); return FALSE; } while(vj_client_poll( gui->client, V_STATUS )) @@ -5937,16 +5947,15 @@ static gboolean veejay_tick( GIOChannel *source, GIOCondition condition, gpointe gui->status_tokens[i] = history[i]; } -// veejay_msg(0, "tokens: '%d' (%s)", n, gui->status_msg ); - // lock_preview(); - - gdk_threads_enter(); - lock_preview(); +// gdk_threads_enter(); update_gui(); - gdk_threads_leave(); - unlock_preview(); + + veejay_update_multitrack( info ); + + +// gdk_threads_leave(); } gui->status_lock = 0; @@ -5963,7 +5972,6 @@ static gboolean veejay_tick( GIOChannel *source, GIOCondition condition, gpointe while(vj_client_poll( gui->client, V_STATUS )) nb = vj_client_read( gui->client,V_STATUS,tmp, 1); } -// unlock_preview(); return TRUE; } @@ -6271,27 +6279,17 @@ int vj_gui_sleep_time( void ) return (int) n; } -int vj_img_cb(GdkPixbuf *img, GdkPixbuf *ir, GtkImage *image ) +int vj_img_cb(GdkPixbuf *img ) { -#ifdef STRICT_CHECKING - assert( img != NULL ); - assert( ir != NULL ); - assert( image != NULL ); - assert( GTK_IS_IMAGE(image) ); -#endif - lock_preview(); - - int ms = info->status_tokens[ ELAPSED_TIME ]; - ms *= 1000; - - if( no_preview_ || !info->selected_slot || !info->selected_gui_slot ) + int i; + if( !info->selected_slot || !info->selected_gui_slot ) { - unlock_preview(); - return ms; + return 0; } int sample_id = info->status_tokens[ CURRENT_ID ]; int sample_type = info->status_tokens[ PLAY_MODE ]; + if( sample_type == MODE_SAMPLE || sample_type == MODE_STREAM ) { int poke_slot = -1; @@ -6302,36 +6300,41 @@ int vj_img_cb(GdkPixbuf *img, GdkPixbuf *ir, GtkImage *image ) { sample_slot_t *slot = info->sample_banks[bank_num]->slot[poke_slot]; sample_gui_slot_t *gui_slot = info->sample_banks[bank_num]->gui_slot[poke_slot]; - int i; - if(slot->pixbuf) - { - gdk_pixbuf_unref( slot->pixbuf ); - slot->pixbuf = NULL; - } - for( i = 0; i < info->sequence_view->envelope_size; i ++ ) - { - sequence_gui_slot_t *g = info->sequence_view->gui_slot[i]; - if(g->pixbuf_ref && g->sample_id == sample_id && g->sample_type == sample_type) - { - gdk_pixbuf_unref(g->pixbuf_ref); - g->pixbuf_ref = NULL; - } - } - slot->pixbuf = gdk_pixbuf_scale_simple( img, info->image_dimensions[0], - info->image_dimensions[1], GDK_INTERP_NEAREST); + slot->pixbuf = gdk_pixbuf_scale_simple( + img, info->image_dimensions[0], + info->image_dimensions[1], GDK_INTERP_NEAREST); + + gtk_image_set_from_pixbuf_( GTK_IMAGE( gui_slot->image ), slot->pixbuf ); + + gdk_pixbuf_unref( slot->pixbuf ); + } + } + + for( i = 0; i < info->sequence_view->envelope_size; i ++ ) + { + sequence_gui_slot_t *g = info->sequence_view->gui_slot[i]; + sample_slot_t *s = info->selected_slot; + if(g->sample_id == info->selected_slot->sample_id && g->sample_type == info->selected_slot->sample_type && s->pixbuf) + { + g->pixbuf_ref = gdk_pixbuf_scale_simple( + img, + info->sequence_view->w, + info->sequence_view->h, + GDK_INTERP_NEAREST ); + + gtk_image_set_from_pixbuf_( GTK_IMAGE( g->image ), g->pixbuf_ref ); + + gdk_pixbuf_unref( g->pixbuf_ref ); - //gtk_image_set_from_pixbuf_( gui_slot->image , slot->pixbuf ); - gtk_widget_queue_draw( gui_slot->image ); } } //@redraw - update_cached_slots(); + //update_cached_slots(); // gtk_widget_queue_draw( image ); - unlock_preview(); - return ms; + return 1; } int gveejay_busy(void) @@ -6529,25 +6532,17 @@ void vj_gui_init(char *glade_file, int launcher, char *hostname, int port_num) int pw = default_preview_width_; int ph = default_preview_height_; - setup_geometry( pw,ph, num_tracks_, pw,ph ); GtkWidget *img_wid = glade_xml_get_widget_( info->main_window, "imageA"); - multitrack_configure_preview( pw, - ph, - pw/2, - ph/2, - 25.0 ); - gui->mt = multitrack_new( (void(*)(int,char*,int)) vj_gui_cb, - (void(*)(GdkPixbuf *)) vj_img_cb, + NULL, glade_xml_get_widget_( info->main_window, "gveejay_window" ), glade_xml_get_widget_( info->main_window, "mt_box" ), glade_xml_get_widget_( info->main_window, "statusbar") , pw, ph, img_wid); - multitrack_open( info->mt ); memset( &info->watch, 0, sizeof(watchdog_t)); info->watch.state = STATE_STOPPED; // @@ -6684,7 +6679,7 @@ int vj_gui_reconnect(char *hostname,char *group_name, int port_num) veejay_memset( info->status_msg, 0, STATUS_BYTES ); load_editlist_info(); - multitrack_set_hlq( info->mt,info->el.fps,info->el.ratio, info->quality ); + //multitrack_set_hlq( info->mt,info->el.fps,info->el.ratio, info->quality ); info->rawdata = (guchar*) vj_calloc(sizeof(guchar) * info->el.width * info->el.height * 3); veejay_memset( &vims_keys_list, 0, sizeof(vims_keys_t)); @@ -6714,10 +6709,14 @@ int vj_gui_reconnect(char *hostname,char *group_name, int port_num) update_label_str( "label_hostnamex", (hostname == NULL ? group_name: hostname ) ); update_label_i( "label_portx",port_num,0); + + multitrack_configure( info->mt, + info->el.fps, info->el.width, info->el.height ); + vj_gui_preview(); g_io_add_watch_full( info->channel, - G_PRIORITY_LOW, + G_PRIORITY_DEFAULT, G_IO_IN| G_IO_ERR | G_IO_NVAL | G_IO_HUP, veejay_tick, (gpointer*) info, @@ -6799,14 +6798,7 @@ gboolean is_alive( void ) // info->logging = g_timeout_add( G_PRIORITY_LOW, update_log,(gpointer*) info ); veejay_stop_connecting(gui); // info->watch.state = STATE_PLAYING; - if(info->watch.p_state == 0) - { - veejay_msg(0, "Audoadd"); - multrack_audoadd( info->mt, remote, port, - info->el.ratio ); - - } - veejay_msg(0, "Stopped connecting"); + multrack_audoadd( info->mt, remote, port ); info->watch.p_state = 0; info->watch.state = STATE_PLAYING; @@ -7084,7 +7076,6 @@ static int add_bank( gint bank_num ) void reset_samplebank(void) { - //lock_preview(); info->selection_slot = NULL; info->selection_gui_slot = NULL; info->selected_slot = NULL; @@ -7114,7 +7105,6 @@ void reset_samplebank(void) } } } -// unlock_preview(); } void free_samplebank(void) @@ -7304,12 +7294,9 @@ image_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer data) if(bank_nr < 0 ) return FALSE; - lock_preview(); - if ( info->sample_banks[bank_nr] == NULL ) { veejay_msg(0, "Internal error in %s", __FUNCTION__); - unlock_preview(); return FALSE; } @@ -7318,7 +7305,6 @@ image_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer data) if(!slot->pixbuf || slot->sample_id <= 0 ) { - unlock_preview(); return FALSE; } @@ -7342,7 +7328,6 @@ image_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer data) event->area.x , event->area.y ); } - unlock_preview(); return FALSE; } @@ -7356,7 +7341,6 @@ image_expose_seq_event (GtkWidget *widget, GdkEventExpose *event, gpointer data) if(no_draw_) return FALSE; - lock_preview(); sequence_gui_slot_t *g = info->sequence_view->gui_slot[j]; GdkRectangle result; @@ -7371,7 +7355,6 @@ image_expose_seq_event (GtkWidget *widget, GdkEventExpose *event, gpointer data) sequence_gui_slot_t *g = info->sequence_view->gui_slot[j]; if(!g->sample_id || !g->pixbuf_ref) { - unlock_preview(); return FALSE; } rowstride = gdk_pixbuf_get_rowstride( g->pixbuf_ref ); @@ -7387,7 +7370,6 @@ image_expose_seq_event (GtkWidget *widget, GdkEventExpose *event, gpointer data) event->area.x , event->area.y ); } - unlock_preview(); return FALSE; } @@ -7461,8 +7443,6 @@ static gboolean on_cacheslot_activated_by_mouse (GtkWidget *widget, GdkEventButt if(info->status_tokens[PLAY_MODE] == MODE_PLAIN ) return FALSE; -// lock_preview(); - slot_nr = (gint *)user_data; set_activation_of_cache_slot_in_samplebank( info->sequence_view->gui_slot[slot_nr], FALSE ); @@ -7483,7 +7463,6 @@ static gboolean on_cacheslot_activated_by_mouse (GtkWidget *widget, GdkEventButt if(g->sample_id <= 0) { vj_msg(VEEJAY_MSG_ERROR, "Memory slot %d empty, put with SHIFT + mouse button1",slot_nr); - // unlock_preview(); return FALSE; } @@ -7491,7 +7470,6 @@ static gboolean on_cacheslot_activated_by_mouse (GtkWidget *widget, GdkEventButt no_preview_ = 1; } -// unlock_preview(); return FALSE; @@ -7608,12 +7586,13 @@ static void create_ref_slots(int envelope_size) gtk_widget_show( GTK_WIDGET(gui_slot->main_vbox) ); /* The sample's image */ - gui_slot->image = gtk_drawing_area_new(); + gui_slot->image = gtk_image_new(); + // gui_slot->image = gtk_drawing_area_new(); gtk_box_pack_start (GTK_BOX (gui_slot->main_vbox), GTK_WIDGET(gui_slot->image), TRUE, TRUE, 0); gtk_widget_set_size_request( gui_slot->image, info->sequence_view->w,info->sequence_view->h ); - g_signal_connect( gui_slot->image, "expose_event", - G_CALLBACK(image_expose_seq_event), - (gpointer) row ); + // g_signal_connect( gui_slot->image, "expose_event", + // G_CALLBACK(image_expose_seq_event), + // (gpointer) row ); gtk_widget_show( GTK_WIDGET(gui_slot->image)); gtk_table_attach_defaults ( table, gui_slot->event_box, row, row+1, col, col+1); @@ -7674,15 +7653,15 @@ static void create_slot(gint bank_nr, gint slot_nr, gint w, gint h) gtk_widget_show( GTK_WIDGET(gui_slot->main_vbox) ); -// gui_slot->image = gtk_image_new(); - gui_slot->image = gtk_drawing_area_new(); + gui_slot->image = gtk_image_new(); +// gui_slot->image = gtk_drawing_area_new(); gtk_box_pack_start (GTK_BOX (gui_slot->main_vbox), GTK_WIDGET(gui_slot->image), TRUE, TRUE, 0); // gtk_widget_show(GTK_WIDGET(gui_slot->image)); gtk_widget_set_size_request( gui_slot->image, info->image_dimensions[0],info->image_dimensions[1] ); - g_signal_connect( gui_slot->image, "expose_event", +/* g_signal_connect( gui_slot->image, "expose_event", G_CALLBACK(image_expose_event), (gpointer) info->sample_banks[bank_nr]->slot[slot_nr]->slot_number ); - gtk_widget_show( GTK_WIDGET(gui_slot->image)); +*/ gtk_widget_show( GTK_WIDGET(gui_slot->image)); /* the upper container for all slot-informations */ gui_slot->upper_hbox = gtk_hbox_new(FALSE,0); @@ -7967,9 +7946,6 @@ static void add_sample_to_editlist(guint row_number, gchar *timeline, gchar *fna */ static void update_sample_slot_data(int page_num, int slot_num, int sample_id, gint sample_type, gchar *title, gchar *timecode) { - //@! -// lock_preview(); - sample_slot_t *slot = info->sample_banks[page_num]->slot[slot_num]; sample_gui_slot_t *gui_slot = info->sample_banks[page_num]->gui_slot[slot_num]; @@ -8013,7 +7989,6 @@ static void update_sample_slot_data(int page_num, int slot_num, int sample_id, g } } -// unlock_preview(); } diff --git a/veejay-current/install-sh b/veejay-current/install-sh index 1a835340..e4160c99 100755 --- a/veejay-current/install-sh +++ b/veejay-current/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2005-02-02.21 +scriptversion=2004-04-01.17 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -58,6 +58,9 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" +transformbasename= +transform_arg= +instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= @@ -67,27 +70,23 @@ mvcmd="$mvprog" src= dst= dir_arg= -dstarg= -no_target_directory= -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE +usage="Usage: $0 [OPTION]... SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... + or: $0 -d DIRECTORIES... -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. +In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. +In the second, create the directory path DIR. Options: --c (ignored) +-b=TRANSFORMBASENAME +-c copy source (using $cpprog) instead of moving (using $mvprog). -d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. +-g GROUP $chgrp installed files to GROUP. +-m MODE $chmod installed files to MODE. +-o USER $chown installed files to USER. +-s strip installed files (using $stripprog). +-t=TRANSFORM --help display this help and exit. --version display version info and exit. @@ -97,7 +96,12 @@ Environment variables override the default commands: while test -n "$1"; do case $1 in - -c) shift + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + -c) instcmd=$cpprog + shift continue;; -d) dir_arg=true @@ -109,7 +113,7 @@ while test -n "$1"; do shift continue;; - --help) echo "$usage"; exit $?;; + --help) echo "$usage"; exit 0;; -m) chmodcmd="$chmodprog $2" shift @@ -125,20 +129,14 @@ while test -n "$1"; do shift continue;; - -t) dstarg=$2 - shift - shift - continue;; + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; + --version) echo "$0 $scriptversion"; exit 0;; *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break + test -n "$dir_arg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do @@ -176,13 +174,13 @@ do src= if test -d "$dst"; then - mkdircmd=: + instcmd=: chmodcmd= else - mkdircmd=$mkdirprog + instcmd=$mkdirprog fi else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then @@ -204,16 +202,12 @@ do # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. @@ -226,8 +220,7 @@ do oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift + set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` IFS=$oIFS pathcomp= @@ -236,42 +229,51 @@ do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" + $mkdirprog "$pathcomp" || lasterr=$? # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. - test -d "$pathcomp" || exit + test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ + $doit $instcmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else - dstfile=`basename "$dst"` + # If we're going to rename the final executable, determine the name now. + if test -z "$transformarg"; then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename \ + | sed $transformarg`$transformbasename + fi + + # don't allow the sed command to completely eliminate the filename. + test -z "$dstfile" && dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && + # Move or copy the file name to the temp name + $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. + # errors from the above "$doit $instcmd $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ @@ -296,7 +298,7 @@ do || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 + (exit 1); exit } else : @@ -307,12 +309,12 @@ do $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } - fi || { (exit 1); exit 1; } + fi || { (exit 1); exit; } done # The final little trick to "correctly" pass the exit status to the exit trap. { - (exit 0); exit 0 + (exit 0); exit } # Local variables: diff --git a/veejay-current/libel/vj-el.c b/veejay-current/libel/vj-el.c index f70432a8..e484108b 100644 --- a/veejay-current/libel/vj-el.c +++ b/veejay-current/libel/vj-el.c @@ -327,14 +327,30 @@ void vj_el_prepare() // reset_cache( el->cache ); } +void vj_el_break_cache( editlist *el ) +{ + if( el->cache ) + free_cache( el->cache ); + +} + //@ iterateovers over sample fx chain void vj_el_setup_cache( editlist *el ) { if(!el->cache) { int n_slots = mem_chunk_ / el->max_frame_size; - veejay_msg(VEEJAY_MSG_DEBUG, "EditList caches at most %d slots", n_slots ); - el->cache = init_cache( n_slots ); + + if( n_slots < (el->video_frames - 1) ) + { + veejay_msg(VEEJAY_MSG_DEBUG, "Not caching this EDL to memory (Cachesize too small)"); + veejay_msg(VEEJAY_MSG_DEBUG, "try increasing cache size with -m commandline parameter"); + } + else + { + veejay_msg(VEEJAY_MSG_DEBUG, "EditList caches at most %d slots", n_slots ); + el->cache = init_cache( n_slots ); + } } } diff --git a/veejay-current/libgoom/Makefile.in b/veejay-current/libgoom/Makefile.in index 2551a3a6..7a4685d7 100644 --- a/veejay-current/libgoom/Makefile.in +++ b/veejay-current/libgoom/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -38,9 +38,7 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_triplet = @build@ host_triplet = @host@ -target_triplet = @target@ subdir = libgoom DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ AUTHORS COPYING ChangeLog NEWS TODO goomsl_lex.c goomsl_yacc.c @@ -48,7 +46,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d +mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) @@ -77,13 +75,28 @@ libgoom_a_OBJECTS = $(am_libgoom_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/config_param.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/convolve_fx.Po ./$(DEPDIR)/cpu_info.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/drawmethods.Po ./$(DEPDIR)/filters.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/flying_stars_fx.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gfontlib.Po ./$(DEPDIR)/gfontrle.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/goom_core.Po ./$(DEPDIR)/goom_tools.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/goomsl.Po ./$(DEPDIR)/goomsl_hash.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/goomsl_heap.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/goomsl_lex.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/goomsl_yacc.Po ./$(DEPDIR)/graphic.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ifs.Po ./$(DEPDIR)/lines.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/mathtools.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/plugin_info.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/sound_tester.Po ./$(DEPDIR)/surf3d.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/tentacle3d.Po ./$(DEPDIR)/v3d.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) LTLEXCOMPILE = $(LIBTOOL) --mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS) @@ -154,6 +167,7 @@ GLIB_CONFIG = @GLIB_CONFIG@ GLIB_LIBS = @GLIB_LIBS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ +GREP = @GREP@ GTKCAIRO_CFLAGS = @GTKCAIRO_CFLAGS@ GTKCAIRO_LIBS = @GTKCAIRO_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -274,13 +288,10 @@ XML2_CONFIG = @XML2_CONFIG@ XML_CPPFLAGS = @XML_CPPFLAGS@ XML_LIBS = @XML_LIBS@ YACC = @YACC@ -ac_ct_AR = @ac_ct_AR@ +YFLAGS = @YFLAGS@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ @@ -288,8 +299,6 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -297,6 +306,9 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ gveejay_datadir = @gveejay_datadir@ host = @host@ @@ -304,17 +316,21 @@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ @@ -417,21 +433,24 @@ distclean-compile: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< .l.c: @@ -454,8 +473,7 @@ distclean-compile: to=`echo "$*_H" | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ - sed -e "/^#/!b" -e "s/Y_TAB_H/$$to/g" -e "s|y\.tab\.h|$*.h|" \ - y.tab.h >$*.ht; \ + sed "/^#/ s/Y_TAB_H/$$to/g" y.tab.h >$*.ht; \ rm -f y.tab.h; \ if cmp -s $*.ht $*.h; then \ rm -f $*.ht ;\ @@ -577,14 +595,14 @@ mostlyclean-generic: clean-generic: distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -rm -f goomsl_lex.c - -rm -f goomsl_yacc.c -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -rm -f goomsl_yacc.c clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ diff --git a/veejay-current/libsample/sampleadm.c b/veejay-current/libsample/sampleadm.c index 0af0a3b6..5d4f577c 100644 --- a/veejay-current/libsample/sampleadm.c +++ b/veejay-current/libsample/sampleadm.c @@ -1204,11 +1204,11 @@ int sample_set_chain_channel(int s1, int position, int input) //sample->effect_chain[position]->channel = input; int src_type = sample->effect_chain[position]->source_type; // now, reset cache and setup - if( src_type == 0 ) + if( src_type == 0) { sample_info *new = sample_get( input ); - if( sample->effect_chain[position]->channel != input ) + if( sample->effect_chain[position]->channel != input && sample->effect_chain[position]->effect_id > 0) { sample_info *old = sample_get( sample->effect_chain[position]->channel ); if(old) @@ -1249,18 +1249,21 @@ int sample_cache_used( int s1 ) return cache_avail_mb(); } -int sample_start_playing(int s1) +int sample_start_playing(int s1, int no_cache) { sample_info *sample = sample_get(s1); if (!sample) return -1; - int i; - vj_el_setup_cache( sample->edit_list ); + int i; + + if(!no_cache) + vj_el_setup_cache( sample->edit_list ); + for( i = 0; i < SAMPLE_MAX_EFFECTS; i ++ ) { int src_type = sample->effect_chain[i]->source_type; int id = sample->effect_chain[i]->channel; - if( src_type == 0 && id > 0 ) + if( src_type == 0 && id > 0 && sample->effect_chain[i]->effect_id > 0 ) { sample_info *second = sample_get( id ); if(second) @@ -1291,7 +1294,8 @@ int sample_set_chain_source(int s1, int position, int input) return -1; if( sample->effect_chain[position]->source_type == 0 && - sample->effect_chain[position]->channel > 0 ) + sample->effect_chain[position]->channel > 0 && + sample->effect_chain[position]->effect_id > 0) { sample_info *second = sample_get( sample->effect_chain[position]->channel ); if(second) diff --git a/veejay-current/ltmain.sh b/veejay-current/ltmain.sh index 1a224ac2..c715b594 100644 --- a/veejay-current/ltmain.sh +++ b/veejay-current/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -17,7 +17,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,9 +43,14 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.6 -TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 224 $" +VERSION="1.5.22 Debian 1.5.22-4" +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then @@ -83,14 +88,15 @@ rm="rm -f" Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' # test EBCDIC or ASCII -case `echo A|tr A '\301'` in - A) # EBCDIC based system - SP2NL="tr '\100' '\n'" - NL2SP="tr '\r\n' '\100\100'" +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + SP2NL='tr \040 \012' + NL2SP='tr \015\012 \040\040' ;; - *) # Assume ASCII based system - SP2NL="tr '\040' '\012'" - NL2SP="tr '\015\012' '\040\040'" + *) # EBCDIC based system + SP2NL='tr \100 \n' + NL2SP='tr \r\n \100\100' ;; esac @@ -107,8 +113,9 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -: ${IFS=" -"} +lt_nl=' +' +IFS=" $lt_nl" if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -125,6 +132,8 @@ run= show="$echo" show_help= execute_dlfiles= +duplicate_deps=no +preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" @@ -132,13 +141,51 @@ o2lo="s/\\.${objext}\$/.lo/" # Shell function definitions: # This seems to be the best place for them +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $mkdir "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || { + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 + exit $EXIT_FAILURE + } + fi + + $echo "X$my_tmpdir" | $Xsed +} + + # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. -func_win32_libid () { +func_win32_libid () +{ win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in @@ -149,12 +196,11 @@ func_win32_libid () { if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi + $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac fi ;; *DLL*) @@ -178,7 +224,8 @@ func_win32_libid () { # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' -func_infer_tag () { +func_infer_tag () +{ if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do @@ -235,12 +282,116 @@ func_infer_tag () { esac fi } + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then + exit $exit_status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" +disable_libs=no + # Parse our command line options once, thoroughly. while test "$#" -gt 0 do @@ -305,10 +456,10 @@ do --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo - $echo "Copyright (C) 2003 Free Software Foundation, Inc." + $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $EXIT_SUCCESS + exit $? ;; --config) @@ -317,7 +468,7 @@ do for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done - exit $EXIT_SUCCESS + exit $? ;; --debug) @@ -342,7 +493,7 @@ do else $echo "disable static libraries" fi - exit $EXIT_SUCCESS + exit $? ;; --finish) mode="finish" ;; @@ -357,7 +508,11 @@ do preserve_args="$preserve_args $arg" ;; - --tag) prevopt="--tag" prev=tag ;; + --tag) + prevopt="--tag" + prev=tag + preserve_args="$preserve_args --tag" + ;; --tag=*) set tag "$optarg" ${1+"$@"} shift @@ -389,6 +544,18 @@ if test -n "$prevopt"; then exit $EXIT_FAILURE fi +case $disable_libs in +no) + ;; +shared) + build_libtool_libs=no + build_old_libs=yes + ;; +static) + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` + ;; +esac + # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. @@ -399,7 +566,7 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link @@ -465,7 +632,7 @@ if test -z "$show_help"; then for arg do - case "$arg_mode" in + case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" @@ -547,7 +714,10 @@ if test -z "$show_help"; then case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; @@ -621,6 +791,14 @@ if test -z "$show_help"; then esac done + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qlibobj="\"$qlibobj\"" ;; + esac + test "X$libobj" != "X$qlibobj" \ + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -693,12 +871,17 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo $srcfile > "$lockfile" + $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qsrcfile="\"$qsrcfile\"" ;; + esac $run $rm "$libobj" "${libobj}T" @@ -720,18 +903,18 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" fi if test ! -d "${xdir}$objdir"; then $show "$mkdir ${xdir}$objdir" $run $mkdir ${xdir}$objdir - status=$? - if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then - exit $status + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then + exit $exit_status fi fi @@ -803,9 +986,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" else - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -934,6 +1117,7 @@ EOF no_install=no objs= non_pic_objects= + notinst_path= # paths that contain not-installed libtool libraries precious_files_regex= prefer_static_libs=no preload=no @@ -962,14 +1146,15 @@ EOF if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi + prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi + prefer_static_libs=built fi build_libtool_libs=no build_old_libs=yes - prefer_static_libs=yes break ;; esac @@ -1144,6 +1329,11 @@ EOF if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. @@ -1227,6 +1417,13 @@ EOF prev= continue ;; + darwin_framework|darwin_framework_skip) + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; *) eval "$prev=\"\$arg\"" prev= @@ -1285,6 +1482,18 @@ EOF continue ;; + -framework|-arch|-isysroot) + case " $CC " in + *" ${arg} ${1} "* | *" ${arg} ${1} "*) + prev=darwin_framework_skip ;; + *) compiler_flags="$compiler_flags $arg" + prev=darwin_framework ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + -inst-prefix-dir) prev=inst_prefix continue @@ -1311,7 +1520,8 @@ EOF absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit $EXIT_FAILURE + absdir="$dir" + notinst_path="$notinst_path $dir" fi dir="$absdir" ;; @@ -1325,10 +1535,15 @@ EOF esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac ;; esac continue @@ -1337,15 +1552,15 @@ EOF -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in - *-*-cygwin* | *-*-pw32* | *-*-beos*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; - *-*-mingw* | *-*-os2*) + *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; - *-*-openbsd* | *-*-freebsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; @@ -1353,10 +1568,19 @@ EOF # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; esac elif test "X$arg" = "X-lc_r"; then case $host in - *-*-openbsd* | *-*-freebsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; @@ -1366,8 +1590,20 @@ EOF continue ;; + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - deplibs="$deplibs $arg" + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" continue ;; @@ -1376,13 +1612,19 @@ EOF continue ;; - # gcc -m* arguments should be passed to the linker via $compiler_flags - # in order to pass architecture information to the linker - # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. - -m*) + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -pg pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ + -t[45]*|-txscale*|@*) + # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` @@ -1393,9 +1635,7 @@ EOF esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi + compiler_flags="$compiler_flags $arg" continue ;; @@ -1633,6 +1873,11 @@ EOF if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. @@ -1738,9 +1983,9 @@ EOF if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir - status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then - exit $status + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then + exit $exit_status fi fi @@ -1803,7 +2048,6 @@ EOF newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv link" @@ -1858,7 +2102,7 @@ EOF compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - deplibs="$deplib $deplibs" + compiler_flags="$compiler_flags $deplib" fi continue ;; @@ -1977,7 +2221,22 @@ EOF fi case $linkmode in lib) - if test "$deplibs_check_method" != pass_all; then + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" @@ -2027,7 +2286,7 @@ EOF esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else - $echo "$modename: cannot find the library \`$lib'" 1>&2 + $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi @@ -2051,6 +2310,8 @@ EOF # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no + avoidtemprpath= + # Read the .la file case $lib in @@ -2149,11 +2410,19 @@ EOF dir="$libdir" absdir="$libdir" fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` @@ -2226,12 +2495,12 @@ EOF if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path - if test -n "$shlibpath_var"; then + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; + *) temp_rpath="$temp_rpath $absdir" ;; esac fi @@ -2268,8 +2537,12 @@ EOF fi link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes ; then + use_static_libs=no + fi if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes @@ -2382,11 +2655,15 @@ EOF if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in - *-*-sco3.2v5* ) add_dir="-L$dir" ;; + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then + if /usr/bin/file -L $add 2> /dev/null | + $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo @@ -2417,7 +2694,7 @@ EOF add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then - case "$libdir" in + case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; @@ -2490,7 +2767,7 @@ EOF add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then - case "$libdir" in + case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; @@ -2551,8 +2828,6 @@ EOF fi fi else - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi @@ -2670,12 +2945,12 @@ EOF *) continue ;; esac case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no @@ -2947,7 +3222,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -2956,7 +3231,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -2965,7 +3240,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -2991,7 +3266,7 @@ EOF versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) @@ -3144,9 +3419,9 @@ EOF # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` done if test -n "$xrpath"; then @@ -3197,9 +3472,14 @@ EOF *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; - *-*-openbsd* | *-*-freebsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. @@ -3243,11 +3523,11 @@ EOF int main() { return 0; } EOF $rm conftest - $LTCC -o conftest conftest.c $deplibs + $LTCC $LTCFLAGS -o conftest conftest.c $deplibs if test "$?" -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" + name=`expr $i : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test "$name" != "" && test "$name" -ne "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then @@ -3284,11 +3564,11 @@ EOF # Error occurred in the first compile. Let's try to salvage # the situation: Compile a separate program for each library. for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" + name=`expr $i : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test "$name" != "" && test "$name" != "0"; then $rm conftest - $LTCC -o conftest conftest.c $i + $LTCC $LTCFLAGS -o conftest conftest.c $i # Did it work? if test "$?" -eq 0 ; then ldd_output=`ldd conftest` @@ -3336,7 +3616,7 @@ EOF set dummy $deplibs_check_method file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" + name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test "$name" != "" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then @@ -3405,7 +3685,7 @@ EOF set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" + name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then @@ -3535,6 +3815,35 @@ EOF deplibs=$newdeplibs fi + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). library_names= old_library= @@ -3618,6 +3927,7 @@ EOF fi lib="$output_objdir/$realname" + linknames= for link do linknames="$linknames $link" @@ -3646,6 +3956,9 @@ EOF # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break fi done IFS="$save_ifs" @@ -3679,67 +3992,13 @@ EOF eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" fi fi - + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" @@ -3769,7 +4028,8 @@ EOF fi fi - if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && + if test "X$skipped_export" != "X:" && + len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else @@ -3788,6 +4048,7 @@ EOF save_libobjs=$libobjs fi save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. @@ -3797,13 +4058,13 @@ EOF delfiles= last_robj= k=1 - output=$output_objdir/$save_output-${k}.$objext + output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*"` && + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else @@ -3817,9 +4078,9 @@ EOF # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi - last_robj=$output_objdir/$save_output-${k}.$objext + last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` - output=$output_objdir/$save_output-${k}.$objext + output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi @@ -3839,13 +4100,13 @@ EOF eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi - # Set up a command to remove the reloadale object files + # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" @@ -3893,13 +4154,30 @@ EOF IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" - $run eval "$cmd" || exit $? + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + fi + fi + exit $EXIT_SUCCESS fi @@ -3977,64 +4255,10 @@ EOF eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi @@ -4135,6 +4359,35 @@ EOF ;; esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -4179,10 +4432,15 @@ EOF fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac ;; esac done @@ -4296,13 +4554,25 @@ extern \"C\" { # Prepare the list of exported symbols if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" + export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac else - $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac fi fi @@ -4353,7 +4623,26 @@ extern \"C\" { #endif /* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } @@ -4400,16 +4689,29 @@ static const void *lt_preloaded_setup() { esac # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + else + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 @@ -4434,7 +4736,7 @@ static const void *lt_preloaded_setup() { # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" - status=$? + exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then @@ -4442,7 +4744,7 @@ static const void *lt_preloaded_setup() { $run $rm "$output_objdir/${outputname}S.${objext}" fi - exit $status + exit $exit_status fi if test -n "$shlibpath_var"; then @@ -4582,10 +4884,12 @@ static const void *lt_preloaded_setup() { esac case $host in *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${output}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + output_name=`basename $output` + output_path=`dirname $output` + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource < #include #include +#include +#include +#include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX @@ -4620,15 +4927,19 @@ EOF #endif #ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) -#define HAVE_DOS_BASED_FILE_SYSTEM -#ifndef DIR_SEPARATOR_2 -#define DIR_SEPARATOR_2 '\\' -#endif +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif #endif #ifndef DIR_SEPARATOR_2 @@ -4638,17 +4949,32 @@ EOF (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) +/* -DDEBUG is fairly common in CFLAGS. */ +#undef DEBUG +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); +const char * base_name (const char *name); +char * find_executable(const char *wrapper); +int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); @@ -4658,29 +4984,51 @@ main (int argc, char *argv[]) char **newargz; int i; - program_name = (char *) xstrdup ((char *) basename (argv[0])); + program_name = (char *) xstrdup (base_name (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF - cat >> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); + cat >> $cwrappersource <<"EOF" + newargz[1] = find_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't find %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; + + for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" + cat >> $cwrappersource <<"EOF" + return 127; } void * @@ -4700,48 +5048,148 @@ xstrdup (const char *string) ; } -char * -basename (const char *name) +const char * +base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') + if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; - return (char *) base; + return base; } -char * -fnqualify(const char *path) +int +check_executable(const char * path) { - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; + struct stat st; - assert(path != NULL); + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); + if ((stat (path, &st) >= 0) && + ( + /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ +#if defined (S_IXOTH) + ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); +#if defined (S_IXGRP) + ((st.st_mode & S_IXGRP) == S_IXGRP) || +#endif + ((st.st_mode & S_IXUSR) == S_IXUSR)) + ) + return 1; + else + return 0; +} - /* prepend the current directory */ - /* doesn't handle '~' */ +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +find_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; } char * @@ -4785,16 +5233,16 @@ lt_fatal (const char *message, ...) va_end (ap); } EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL @@ -4815,7 +5263,7 @@ sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" @@ -4944,13 +5392,13 @@ else # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ - exec \$progdir\\\\\$program \${1+\"\$@\"} + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} + exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac @@ -4960,7 +5408,7 @@ else fi else # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE @@ -4992,71 +5440,73 @@ fi\ if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$gentop"; then + exit $exit_status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5070,20 +5520,7 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi + # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -5094,7 +5531,7 @@ fi\ oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*"` && + if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else @@ -5291,11 +5728,11 @@ relink_command=\"$relink_command\"" # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. - $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then + $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac @@ -5304,14 +5741,14 @@ relink_command=\"$relink_command\"" shift else install_prog= - arg="$nonopt" + arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac @@ -5329,28 +5766,31 @@ relink_command=\"$relink_command\"" do if test -n "$dest"; then files="$files $dest" - dest="$arg" + dest=$arg continue fi case $arg in -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; - -*) ;; - + -*) + ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else - dest="$arg" + dest=$arg continue fi ;; @@ -5359,7 +5799,7 @@ relink_command=\"$relink_command\"" # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac @@ -5528,11 +5968,14 @@ relink_command=\"$relink_command\"" if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi @@ -5545,7 +5988,16 @@ relink_command=\"$relink_command\"" IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" - $run eval "$cmd" || exit $? + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } done IFS="$save_ifs" fi @@ -5639,17 +6091,15 @@ relink_command=\"$relink_command\"" notinst_deplibs= relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; esac # Check the variables that should have been set. @@ -5677,34 +6127,21 @@ relink_command=\"$relink_command\"" done relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - save_umask=`umask` - umask 0077 - if $mkdir "$tmpdir"; then - umask $save_umask - else - umask $save_umask - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi + tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. @@ -5728,7 +6165,7 @@ relink_command=\"$relink_command\"" fi # remove .exe since cygwin /usr/bin/install will append another - # one anyways + # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in @@ -5828,7 +6265,7 @@ relink_command=\"$relink_command\"" # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS - $echo "----------------------------------------------------------------------" + $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" @@ -5861,7 +6298,7 @@ relink_command=\"$relink_command\"" $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" + $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; @@ -6078,9 +6515,17 @@ relink_command=\"$relink_command\"" rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - if test "$mode" = uninstall; then + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds @@ -6113,7 +6558,8 @@ relink_command=\"$relink_command\"" IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. - fi + ;; + esac fi ;; @@ -6398,7 +6844,7 @@ esac $echo $echo "Try \`$modename --help' for more information about other modes." -exit $EXIT_SUCCESS +exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting @@ -6412,12 +6858,11 @@ exit $EXIT_SUCCESS # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes +disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` +disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: diff --git a/veejay-current/missing b/veejay-current/missing index 09edd884..e7ef83a1 100755 --- a/veejay-current/missing +++ b/veejay-current/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2005-02-08.22 +scriptversion=2003-09-02.23 -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. @@ -60,6 +60,11 @@ case "$1" in msg="probably too old" fi ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in -h|--h|--he|--hel|--help) echo "\ @@ -87,12 +92,10 @@ Supported PROGRAM values: yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." - exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" - exit $? ;; -*) @@ -101,42 +104,12 @@ Send bug reports to ." exit 1 ;; -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) + aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 fi - ;; -esac -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want @@ -146,6 +119,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the @@ -155,6 +133,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want @@ -174,6 +157,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. @@ -185,6 +173,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the @@ -261,6 +254,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the @@ -281,6 +279,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file @@ -288,20 +291,20 @@ WARNING: \`$1' is $msg. You should only need it if call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error diff --git a/veejay-current/share/gveejay.reloaded.glade b/veejay-current/share/gveejay.reloaded.glade index 448ab150..f75da035 100644 --- a/veejay-current/share/gveejay.reloaded.glade +++ b/veejay-current/share/gveejay.reloaded.glade @@ -832,6 +832,33 @@ True + + + + True + Enable/Disable EDL Cache (see veejay console) + True + GTK_RELIEF_NORMAL + True + + + + + True + icon_cache.png + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + False + + 0 @@ -4659,214 +4686,227 @@ MLZO GTK_SHADOW_NONE - + True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 0 - 10 + False + 0 - + True - False - 0 + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 0 + 10 - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 0 - True - True - - - - - + True False 0 - + True - Cut entry True - GTK_RELIEF_HALF - True - + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT - + True - icon_cut.png - 0.5 - 0.5 - 0 - 0 + True + True + False + False + True + False + False + False 0 - False - False + True + True - + True - Copy entry - True - GTK_RELIEF_HALF - True - + False + 0 - + True - icon_copy.png - 0.5 - 0.5 - 0 - 0 + Cut entry + True + GTK_RELIEF_HALF + True + + + + + True + icon_cut.png + 0.5 + 0.5 + 0 + 0 + + + + 0 + False + False + - - - 0 - False - False - - - - - - True - Paste entry - True - GTK_RELIEF_HALF - True - - + True - icon_paste.png - 0.5 - 0.5 - 0 - 0 + Copy entry + True + GTK_RELIEF_HALF + True + + + + + True + icon_copy.png + 0.5 + 0.5 + 0 + 0 + + + + 0 + False + False + - - - 0 - False - False - - - - - - True - Create bundle - True - GTK_RELIEF_HALF - True - - + True - icon_bundle.png - 0.5 - 0.5 - 0 - 0 + Paste entry + True + GTK_RELIEF_HALF + True + + + + + True + icon_paste.png + 0.5 + 0.5 + 0 + 0 + + + + 0 + False + False + - - - 0 - False - False - - - - - - True - Enable/Disable all keyframes - True - GTK_RELIEF_HALF - True - False - False - - + True - icon_keyframe.png - 0.5 - 0.5 - 0 - 0 + Create bundle + True + GTK_RELIEF_HALF + True + + + + + True + icon_bundle.png + 0.5 + 0.5 + 0 + 0 + + + + 0 + False + False + - - - 0 - False - False - - - - - - True - Clear Chain - True - GTK_RELIEF_HALF - True - - + True - icon_clearall.png - 0.5 - 0.5 - 0 - 0 + Enable/Disable all keyframes + True + GTK_RELIEF_HALF + True + False + False + + + + + True + icon_keyframe.png + 0.5 + 0.5 + 0 + 0 + + + + 0 + False + False + + + + + + True + Clear Chain + True + GTK_RELIEF_HALF + True + + + + + True + icon_clearall.png + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + False + @@ -4876,13 +4916,112 @@ MLZO + + + + 0 + True + True + + + + + + True + 0 + 0.5 + GTK_SHADOW_NONE + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 0 + 0 + + + + True + False + 0 + + + + 82 + True + True + False + GTK_POS_LEFT + 1 + GTK_UPDATE_CONTINUOUS + False + 1 0 1 0.00999999977648 0.10000000149 0 + + + + 0 + False + True + + + + + + True + Toggle logarithmic scale + True + Log + True + GTK_RELIEF_HALF + True + False + False + True + + + 0 + False + False + + + + + + + + + + True + <b>Opacity</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + - 0 - False - False + label_item + + 0 + False + True + @@ -4918,7 +5057,7 @@ MLZO 0 0 0 - 10 + 0 @@ -5128,6 +5267,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -5154,6 +5295,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -5271,6 +5414,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -5297,6 +5442,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -5414,6 +5561,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -5440,6 +5589,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -5557,6 +5708,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -5583,6 +5736,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -5700,6 +5855,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -5726,6 +5883,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -5857,6 +6016,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -5883,6 +6044,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -6000,6 +6163,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -6026,6 +6191,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -6143,6 +6310,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -6169,6 +6338,8 @@ MLZO + 24 + 24 True True GTK_RELIEF_HALF @@ -6240,104 +6411,6 @@ MLZO True - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 12 - 0 - - - - True - False - 0 - - - - True - True - False - GTK_POS_LEFT - 1 - GTK_UPDATE_CONTINUOUS - False - 1 0 1 0.00999999977648 0.10000000149 0 - - - - 0 - True - True - - - - - - True - Toggle logarithmic scale - True - Log - True - GTK_RELIEF_HALF - True - False - False - True - - - 0 - False - False - - - - - - - - - - True - <b>Chain</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - True - True - - @@ -10291,12 +10364,30 @@ MLZO False 0 + + + True + Very low quality preview + True + 1/8 + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + True - Bad quality preview + Low quality preview True - BQ + 1/4 True GTK_RELIEF_NORMAL True @@ -10312,9 +10403,9 @@ MLZO True - Low quality preview + Medium quality preview True - LQ + 1/2 True GTK_RELIEF_NORMAL True @@ -10332,7 +10423,7 @@ MLZO True High quality preview True - HQ + 1/1 True GTK_RELIEF_NORMAL True diff --git a/veejay-current/share/icon_cache.png b/veejay-current/share/icon_cache.png new file mode 100644 index 00000000..e4d90492 Binary files /dev/null and b/veejay-current/share/icon_cache.png differ diff --git a/veejay-current/veejay/liblavplayvj.c b/veejay-current/veejay/liblavplayvj.c index 5b79b076..1ed01a79 100644 --- a/veejay-current/veejay/liblavplayvj.c +++ b/veejay-current/veejay/liblavplayvj.c @@ -703,7 +703,7 @@ void veejay_set_sample(veejay_t * info, int sampleid) if( info->uc->sample_id != sampleid) sample_stop_playing(sampleid);//@pfff veejay_reset_el_buffer(info); - sample_start_playing( sampleid ); + sample_start_playing( sampleid, info->no_caching ); sample_get_short_info( sampleid , &start,&end,&looptype,&speed); /* Set min/max options so that it runs like it should */ diff --git a/veejay-current/veejay/vims.h b/veejay-current/veejay/vims.h index 4c2c96c9..b1bdcff2 100644 --- a/veejay-current/veejay/vims.h +++ b/veejay-current/veejay/vims.h @@ -70,6 +70,7 @@ enum { VIMS_SET_MODE_AND_GO = 328, VIMS_RGB_PARAMETER_TYPE = 329, VIMS_SCREENSHOT = 330, + VIMS_NO_CACHING = 331, VIMS_RGB24_IMAGE = 333, /* video controls */ diff --git a/veejay-current/veejay/vj-event.c b/veejay-current/veejay/vj-event.c index 5649d79f..be99b5db 100644 --- a/veejay-current/veejay/vj-event.c +++ b/veejay-current/veejay/vj-event.c @@ -2218,6 +2218,26 @@ void vj_event_bezerk(void *ptr, const char format[], va_list ap) else veejay_msg(VEEJAY_MSG_INFO,"Bezerk Off :Sample-restart when changing input channels"); } +void vj_event_no_caching(void *ptr, const char format[], va_list ap) +{ + veejay_t *v = (veejay_t*) ptr; + if(v->no_caching) + v->no_caching = 0; + else + v->no_caching = 1; + + if(v->no_caching==1) + { + vj_el_break_cache( v->current_edit_list ); + veejay_msg(VEEJAY_MSG_INFO,"Sample FX Cache disabled: Grabbing all samples on FX chain"); + + } + else + { + vj_el_setup_cache( v->current_edit_list ); + veejay_msg(VEEJAY_MSG_INFO,"Sample FX Cache enabled : Recycling identicial samples in FX chain (default)"); + } +} void vj_event_debug_level(void *ptr, const char format[], va_list ap) { diff --git a/veejay-current/veejay/vj-event.h b/veejay-current/veejay/vj-event.h index 754deeb2..56bc27aa 100644 --- a/veejay-current/veejay/vj-event.h +++ b/veejay-current/veejay/vj-event.h @@ -230,6 +230,7 @@ void vj_event_linkclose(void *ptr, const char format[], va_list ap); void vj_event_send_track_list( void *ptr, const char format[], va_list ap); void vj_event_toggle_bw( void *ptr, const char format[], va_list ap ); +void vj_event_no_caching(void *ptr, const char format[], va_list ap); #ifdef HAVE_FREETYPE void vj_event_get_srt_list( void *ptr, const char format[], va_list ap ); diff --git a/veejay-current/veejay/vj-eventman.c b/veejay-current/veejay/vj-eventman.c index 3c394e56..c591ff6f 100644 --- a/veejay-current/veejay/vj-eventman.c +++ b/veejay-current/veejay/vj-eventman.c @@ -2145,6 +2145,17 @@ void vj_init_vevo_events(void) 0, VIMS_ALLOW_ANY, NULL ); + + index_map_[VIMS_NO_CACHING] = _new_event( + NULL, + VIMS_NO_CACHING, + "Editlist cache mode toggle", + vj_event_no_caching, + 0, + VIMS_ALLOW_ANY, + NULL ); + + index_map_[VIMS_SAMPLE_MODE] = _new_event( NULL, VIMS_SAMPLE_MODE, diff --git a/veejay-current/veejay/vj-lib.h b/veejay-current/veejay/vj-lib.h index 69143abf..318afb2e 100644 --- a/veejay-current/veejay/vj-lib.h +++ b/veejay-current/veejay/vj-lib.h @@ -310,6 +310,7 @@ typedef struct { void *osd; int use_osd; sequencer_t *seq; + int no_caching; } veejay_t; typedef struct { diff --git a/veejay-current/veejay/vj-perform.c b/veejay-current/veejay/vj-perform.c index 263a0397..3691959b 100644 --- a/veejay-current/veejay/vj-perform.c +++ b/veejay-current/veejay/vj-perform.c @@ -1131,14 +1131,14 @@ int vj_perform_send_primary_frame_s2(veejay_t *info, int mcast) const int len = info->effect_frame1->width * info->effect_frame1->height; const int uv_len = info->effect_frame1->uv_width * info->effect_frame1->uv_height; -// const int total_len = (2*uv_len) + len; int hlen =0; + int compr_len = vj_perform_compress_frame( info, socket_buffer+20 ); if( !mcast ) { /* peer to peer connection */ - unsigned char info_line[12]; + unsigned char info_line[32]; sprintf(info_line, "%04d %04d %1d %08d", info->effect_frame1->width, info->effect_frame1->height, info->edit_list->pixel_format, compr_len ); @@ -1156,6 +1156,7 @@ int vj_perform_send_primary_frame_s2(veejay_t *info, int mcast) int id = (mcast ? 2: 0); __socket_len = hlen + compr_len; + // mcast frame sender = info->vjs[2] ?? if(vj_server_send_frame( info->vjs[id], info->uc->current_link, socket_buffer, __socket_len, helper_frame, info->effect_frame_info, info->real_fps )<=0) @@ -1804,7 +1805,7 @@ static int vj_perform_apply_secundary_tag(veejay_t * info, int sample_id, case VJ_TAG_TYPE_NONE: nframe = vj_perform_get_subframe_tag(info, sample_id, chain_entry); // get exact frame number to decode centry = vj_perform_sample_is_cached(sample_id, chain_entry); - if(centry == -1) + if(centry == -1 || info->no_caching) { editlist *el = sample_get_editlist( sample_id ); if(el) @@ -1910,7 +1911,7 @@ static int vj_perform_apply_secundary(veejay_t * info, int sample_id, int type, case VJ_TAG_TYPE_PICTURE: centry = vj_perform_tag_is_cached(chain_entry, sample_id); // is it cached? - if (centry == -1) + if (centry == -1 ) { if(! vj_tag_get_active( sample_id ) ) { @@ -2962,15 +2963,6 @@ static int vj_perform_render_font( veejay_t *info, video_playback_setup *setting frame->ssm = 0; } - if( __send_frame ) - { - veejay_memcpy( primary_buffer[1]->Y, primary_buffer[0]->Y, frame->len ); - veejay_memcpy( primary_buffer[1]->Cb,primary_buffer[0]->Cb,frame->uv_len); - veejay_memcpy( primary_buffer[1]->Cr,primary_buffer[0]->Cr,frame->uv_len); -// vj_perform_send_primary_frame_s2(info, __send_frame == 2 ? 2 : 0); - __send_frame = 0; - } - return ds; } @@ -2986,7 +2978,7 @@ int vj_perform_queue_video_frame(veejay_t *info, int frame, const int skip_incr) current_sampling_fmt_ = -1; int is444 = 0; - + int res = 0; veejay_memset( &pvar_, 0, sizeof(varcache_t)); switch (info->uc->playback_mode) @@ -3012,7 +3004,7 @@ int vj_perform_queue_video_frame(veejay_t *info, int frame, const int skip_incr) if( pvar_.enc_active ) vj_perform_record_sample_frame(info,frame); - return 1; + res = 1; break; @@ -3020,7 +3012,8 @@ int vj_perform_queue_video_frame(veejay_t *info, int frame, const int skip_incr) vj_perform_plain_fill_buffer(info, frame); vj_perform_render_font(info, settings,is444); - return 1; + + res = 1; break; case VJ_PLAYBACK_MODE_TAG: @@ -3041,14 +3034,27 @@ int vj_perform_queue_video_frame(veejay_t *info, int frame, const int skip_incr) if( pvar_.enc_active ) vj_perform_record_tag_frame(info,frame); } - return 1; - + res = 1; break; default: return 0; } - return 0; + + if( __send_frame ) + { + veejay_memcpy( primary_buffer[1]->Y, primary_buffer[0]->Y, + info->effect_frame1->len ); + veejay_memcpy( primary_buffer[1]->Cb,primary_buffer[0]->Cb, + info->effect_frame1->uv_len); + veejay_memcpy( primary_buffer[1]->Cr,primary_buffer[0]->Cr, + info->effect_frame1->uv_len); + __send_frame = 0; + } + + + + return res; } @@ -3225,5 +3231,6 @@ int vj_perform_dump_ppm( veejay_t *info) fclose( fd ); free( ppm_buf ); + return 1; }