From ffe28500b761d0c82dd9d882a676cfbce2e2e413 Mon Sep 17 00:00:00 2001 From: niels Date: Tue, 6 Sep 2011 23:36:44 +0200 Subject: [PATCH]
 reloaded: added (temporary) row of buttons to
 auto-connect local running veejays in VIMS/Veejay tab (samplebank)

veejay:
delete some logging statements
fixes to peer-to-peer streaming (tcp/ip unicast)
negotiate format in peer-to-peer streaming
added stream type 'Splitter' (do not use yet)
major bugfixes to network handling code
killed bug that caused first client connecting to freeze
added lines to read network stream from LiVES (inactive)
major bugfix to shutdown
re-arrangment of veejay server startup (as late as possible)

plugins:
shm_id can be negative, fix lvd_shmin

--- veejay-current/veejay-client/configure.ac | 4 +- .../share/gveejay.reloaded.glade | 172 +++++++++- .../share/reloaded_classic.glade | 318 +++++++++++++++++- veejay-current/veejay-client/src/callback.c | 39 +++ veejay-current/veejay-server/README | 21 ++ veejay-current/veejay-server/configure.ac | 4 +- .../veejay-server/libplugger/Makefile.am | 2 +- .../veejay-server/libplugger/livido-loader.c | 2 - .../veejay-server/libplugger/plugload.c | 2 - .../veejay-server/libstream/vj-net.c | 74 ++-- .../veejay-server/libstream/vj-tag.c | 24 +- veejay-current/veejay-server/libvjnet/cmd.c | 28 +- .../veejay-server/libvjnet/vj-client.c | 277 +++++++++++---- .../veejay-server/libvjnet/vj-server.c | 22 +- .../veejay-server/livido-plugins/lvd_shmin.c | 6 +- .../veejay-server/veejay/liblavplayvj.c | 7 +- veejay-current/veejay-server/veejay/veejay.c | 5 +- .../veejay-server/veejay/vj-event.c | 41 ++- .../veejay-server/veejay/vj-perform.c | 3 +- veejay-current/veejay-server/veejay/vj-sdl.c | 5 + veejay-current/veejay-server/veejay/vj-sdl.h | 2 +- .../veejay-server/veejay/vj-share.c | 8 +- veejay-current/veejay-server/veejay/vj-shm.c | 32 +- veejay-current/veejay-server/veejay/vj-shm.h | 1 + .../veejay-server/veejay/vj-splitdisplay.c | 7 +- .../veejay-server/veejay/vj-splitdisplay.h | 2 + veejay-current/veejay-utils/configure.ac | 4 +- veejay-current/veejay-utils/src/sayVIMS.c | 8 +- 28 files changed, 923 insertions(+), 197 deletions(-) diff --git a/veejay-current/veejay-client/configure.ac b/veejay-current/veejay-client/configure.ac index 770158f3..1fe59615 100644 --- a/veejay-current/veejay-client/configure.ac +++ b/veejay-current/veejay-client/configure.ac @@ -1,12 +1,12 @@ dnl Process this file with autoconf to produce a configure script. dnl AC_INIT -AC_INIT([reloaded],[1.5.9],[nwelburg@gmail.com]) +AC_INIT([reloaded],[1.5.17],[nwelburg@gmail.com]) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/gveejay.c]) RELOADED_MAJOR_VERSION=1 RELOADED_MINOR_VERSION=5 -RELOADED_MICRO_VERSION=9 +RELOADED_MICRO_VERSION=17 RELOADED_VERSION=$VEEJAY_MAJOR_VERSION.$VEEJAY_MINOR_VERSION.$VEEJAY_MICRO_VERSION RELOADED_CODENAME="Reloaded - build $RELOADED_MAJOR_VERSION $RELOADED_MINOR_VERSION $RELOADED_MICRO_VERSION" AC_CONFIG_HEADERS([config.h]) diff --git a/veejay-current/veejay-client/share/gveejay.reloaded.glade b/veejay-current/veejay-client/share/gveejay.reloaded.glade index 83c15541..16dd51e6 100644 --- a/veejay-current/veejay-client/share/gveejay.reloaded.glade +++ b/veejay-current/veejay-client/share/gveejay.reloaded.glade @@ -15533,7 +15533,144 @@ YUV (current) - + + True + False + 0 + + + + True + shm in + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 6 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + False + 0 + + + + True + Create new input from veejay on port 3490 + True + 3490 + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + + True + Create new input from veejay on port 4490 + True + 4490 + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + + True + Create new input from veejay on port 5490 + True + 5490 + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + + True + Create new input from veejay on port 6490 + True + 6490 + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + + True + Create new input from veejay on port 7490 + True + 7490 + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + False + False + @@ -18305,4 +18442,37 @@ YUV (current) + + True + Create new input from veejay on port 3490 + True + 1 + True + GTK_RELIEF_NORMAL + True + + + + + True + Create new input from veejay on port 3490 + True + 1 + True + GTK_RELIEF_NORMAL + True + + + + + True + Create new input from veejay on port 3490 + True + 1 + True + GTK_RELIEF_NORMAL + True + + + diff --git a/veejay-current/veejay-client/share/reloaded_classic.glade b/veejay-current/veejay-client/share/reloaded_classic.glade index a61514df..1a75294c 100644 --- a/veejay-current/veejay-client/share/reloaded_classic.glade +++ b/veejay-current/veejay-client/share/reloaded_classic.glade @@ -978,7 +978,8 @@ True - False + True + True False GTK_POS_TOP False @@ -15745,6 +15746,321 @@ MLZO + + + True + True + False + 0 + + + + True + 0 + 0.5 + GTK_SHADOW_NONE + + + + True + 0.5 + 0.5 + 1 + 0.0799999982119 + 0 + 0 + 12 + 0 + + + + True + False + 0 + + + + True + veejay port + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + True + True + True + 0 + 3490 + True + * + False + + + 0 + False + True + + + + + + True + True + Create + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + + + + + + + + True + <b>SHM</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + False + True + + + + + + True + True + False + 0 + + + + True + False + 0 + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + Single click to select, then fill in optional args and press create + True + True + False + False + True + False + False + False + + + + + 0 + True + True + + + + + + True + False + 0 + + + + True + 0 + 0.5 + GTK_SHADOW_NONE + + + + True + 0.5 + 0.5 + 1 + 0.0599999986589 + 0 + 0 + 12 + 0 + + + + True + False + 0 + + + + True + args: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + True + True + True + 0 + + True + * + False + + + 0 + True + True + + + + + + True + True + Create + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + + + + + 0 + False + True + + + + + 0 + False + True + + + + + + + + True + <b>Plugins</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 + + + True diff --git a/veejay-current/veejay-client/src/callback.c b/veejay-current/veejay-client/src/callback.c index b6564992..286c3102 100644 --- a/veejay-current/veejay-client/src/callback.c +++ b/veejay-current/veejay-client/src/callback.c @@ -1004,7 +1004,46 @@ void on_spin_streamduration_value_changed(GtkWidget *widget , gpointer user_data update_label_str( "label_streamrecord_duration", time ); g_free(time); } +void on_new_shm_stream_clicked(GtkWidget *wid, gpointer data) +{ + char *port = get_text("shm_text_port"); + multi_vims( VIMS_STREAM_NEW_SHARED, "%s", port ); + gveejay_new_slot(MODE_STREAM); +} +void on_new_generator_stream_clicked(GtkWidget *wid, gpointer data) +{ + // generator_text_args optionals args + // tree_generators get selected row + // VIMS_STREAM_NEW_GENERATOR + veejay_msg(0, "implemented me"); +} + +void on_shm_3490_clicked(GtkWidget *w, gpointer data) +{ + multi_vims( VIMS_STREAM_NEW_SHARED, "%d", 3490 ); + gveejay_new_slot(MODE_STREAM); +} +void on_shm_4490_clicked(GtkWidget *w, gpointer data) +{ + multi_vims( VIMS_STREAM_NEW_SHARED, "%d", 4490 ); + gveejay_new_slot(MODE_STREAM); +} +void on_shm_5490_clicked(GtkWidget *w, gpointer data) +{ + multi_vims( VIMS_STREAM_NEW_SHARED, "%d", 5490 ); + gveejay_new_slot(MODE_STREAM); +} +void on_shm_6490_clicked(GtkWidget *w, gpointer data) +{ + multi_vims( VIMS_STREAM_NEW_SHARED, "%d", 6490 ); + gveejay_new_slot(MODE_STREAM); +} +void on_shm_7490_clicked(GtkWidget *w, gpointer data) +{ + multi_vims( VIMS_STREAM_NEW_SHARED, "%d", 7490 ); + gveejay_new_slot(MODE_STREAM); +} void on_button_sample_recordstart_clicked(GtkWidget *widget, gpointer user_data) { diff --git a/veejay-current/veejay-server/README b/veejay-current/veejay-server/README index cc090722..12b17912 100644 --- a/veejay-current/veejay-server/README +++ b/veejay-current/veejay-server/README @@ -30,6 +30,27 @@ It allows you to "play" the video like you would play a piano. While playing, you can record the resulting video directly to disk (video sampling). +====== quick install: + + order of packages: + veejay-server, veejay-client, veejay-utils + + for each package: + ./configure + make && make install + + + for plugins: + + cd veejay-sever/livido-plugins + ./RUNME.sh /tmp/plugins + + mkdir ~/.veejay # or start veejay + echo "/tmp/plugins" >> ~/.veejay/plugins.cfg + + + + FEATURE OVERVIEW diff --git a/veejay-current/veejay-server/configure.ac b/veejay-current/veejay-server/configure.ac index d40a6193..80e8cc31 100644 --- a/veejay-current/veejay-server/configure.ac +++ b/veejay-current/veejay-server/configure.ac @@ -1,12 +1,12 @@ dnl Process this file with autoconf to produce a configure script. dnl AC_INIT -AC_INIT([veejay],[1.5.16],[veejay-users@lists.sourceforge.net]) +AC_INIT([veejay],[1.5.17],[veejay-users@lists.sourceforge.net]) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([veejay/veejay.c]) VEEJAY_MAJOR_VERSION=1 VEEJAY_MINOR_VERSION=5 -VEEJAY_MICRO_VERSION=16 +VEEJAY_MICRO_VERSION=17 VEEJAY_VERSION=$VEEJAY_MAJOR_VERSION.$VEEJAY_MINOR_VERSION.$VEEJAY_MICRO_VERSION VEEJAY_CODENAME="Veejay Classic - build $VEEJAY_MINOR_VERSION $VEEJAY_MICRO_VERSION" AC_CONFIG_HEADERS([config.h]) diff --git a/veejay-current/veejay-server/libplugger/Makefile.am b/veejay-current/veejay-server/libplugger/Makefile.am index d1cab395..423aa1b3 100644 --- a/veejay-current/veejay-server/libplugger/Makefile.am +++ b/veejay-current/veejay-server/libplugger/Makefile.am @@ -7,5 +7,5 @@ AM_CFLAGS = $(CFLAGS) $(FREEFRAME_CFLAGS) LIBVJPLUG_LIB_FILE = libvjplug.la noinst_LTLIBRARIES = $(LIBVJPLUG_LIB_FILE) -libvjplug_la_SOURCES = utility.c freeframe-loader.c frei0r-loader.c livido-loader.c plugload.c +libvjplug_la_SOURCES = utility.c weed-utils.c freeframe-loader.c frei0r-loader.c livido-loader.c plugload.c diff --git a/veejay-current/veejay-server/libplugger/livido-loader.c b/veejay-current/veejay-server/libplugger/livido-loader.c index 3076d40b..0c654572 100644 --- a/veejay-current/veejay-server/libplugger/livido-loader.c +++ b/veejay-current/veejay-server/libplugger/livido-loader.c @@ -1047,8 +1047,6 @@ void *livido_plug_init(void *plugin,int w, int h, int base_fmt_ ) shmid = vj_shm_get_id(); //@ put in HOST value error = vevo_property_set( filter_instance,"HOST_shmid", VEVO_ATOM_TYPE_INT,1,&shmid ); } - veejay_msg(0, "HOST_shmid err=%d",error); - error = (*init_f)( (livido_port_t*) filter_instance ); if( error != LIVIDO_NO_ERROR ) { diff --git a/veejay-current/veejay-server/libplugger/plugload.c b/veejay-current/veejay-server/libplugger/plugload.c index aad0b4aa..16c737d7 100644 --- a/veejay-current/veejay-server/libplugger/plugload.c +++ b/veejay-current/veejay-server/libplugger/plugload.c @@ -315,8 +315,6 @@ int plug_get_idx_by_so_name( char *soname ) char *str = vevo_property_get_string( index_map_[i], "so_name" ); if( str == NULL ) continue; - veejay_msg(0, "'%s' vs '%s'", str,soname ); - if( strcmp( soname,str ) == 0 ) return i; diff --git a/veejay-current/veejay-server/libstream/vj-net.c b/veejay-current/veejay-server/libstream/vj-net.c index b28e6515..dd3702e3 100644 --- a/veejay-current/veejay-server/libstream/vj-net.c +++ b/veejay-current/veejay-server/libstream/vj-net.c @@ -104,12 +104,12 @@ void *reader_thread(void *data) lock(t); - if( t->grab && tag->source_type == VJ_TAG_TYPE_NET && retrieve == 0 ) { + if(!error && t->grab && tag->source_type == VJ_TAG_TYPE_NET && retrieve == 0 ) { ret = vj_client_send( v, V_CMD, buf ); - if( ret < 0 ) + if( ret <= 0 ) { veejay_msg(VEEJAY_MSG_DEBUG, - "%s:%d failed to query frame", + "Error sending get frame command to %s:%d", tag->source_name, tag->video_channel ); @@ -121,7 +121,7 @@ void *reader_thread(void *data) } } - if( tag->source_type == VJ_TAG_TYPE_NET ) + if(!error && tag->source_type == VJ_TAG_TYPE_NET ) { res = vj_client_poll(v, V_CMD ); if( ret ) @@ -129,7 +129,7 @@ void *reader_thread(void *data) retrieve = 1; } else if ( ret < 0 ) { veejay_msg(VEEJAY_MSG_DEBUG, - "%s:%d failed to poll frame", + "Error polling connection %s:%d", tag->source_name, tag->video_channel ); error = 1; @@ -142,7 +142,7 @@ void *reader_thread(void *data) res = 1; } - long wait_time = 20; + long wait_time = 0; if(!error && retrieve) { @@ -151,14 +151,14 @@ void *reader_thread(void *data) ret = vj_client_read_i ( v, tag->socket_frame,tag->socket_len ); if( ret <= 0 ) { - // if( tag->source_type == VJ_TAG_TYPE_NET ) - // { + if( tag->source_type == VJ_TAG_TYPE_NET ) + { veejay_msg(VEEJAY_MSG_DEBUG, - "%s:%d failed to read frame", + "Error reading video frame from %s:%d", tag->source_name, tag->video_channel ); error = 1; - // } + } // else // { // wait_time += 10; @@ -182,9 +182,9 @@ void *reader_thread(void *data) if( wait_time ) { - if ( wait_time > 40 ) - wait_time = 15; - net_delay( wait_time,0 ); + if ( wait_time > 15 ) + wait_time = 10; + //net_delay( wait_time,0 ); wait_time = 0; } @@ -249,8 +249,8 @@ int net_thread_get_frame( vj_tag *tag, uint8_t *buffer[3] ) int uv_len = len; switch(v->cur_fmt) { - case FMT_420: - case FMT_420F: + case PIX_FMT_YUV420P: + case PIX_FMT_YUVJ420P: uv_len=len/4; break; default: @@ -269,25 +269,35 @@ int net_thread_get_frame( vj_tag *tag, uint8_t *buffer[3] ) } else if(t->have_frame == 2 ) { - int b_len = v->in_width * v->in_height; - int buvlen = b_len; - switch(v->in_fmt) - { - case FMT_420: - case FMT_420F: - buvlen = b_len/4; - break; - default: - buvlen = b_len/2; - break; + VJFrame *a = NULL; + VJFrame *b = NULL; + + if( v->in_fmt == PIX_FMT_RGB24 || v->in_fmt == PIX_FMT_BGR24 || v->in_fmt == PIX_FMT_RGBA || + v->in_fmt == PIX_FMT_RGB32_1 ) { + + a = yuv_rgb_template( tag->socket_frame, v->in_width, v->in_width, v->in_fmt ); + + } else { + int b_len = v->in_width * v->in_height; + int buvlen = b_len; + + switch(v->in_fmt) + { + case PIX_FMT_YUV420P: + case PIX_FMT_YUVJ420P: + buvlen = b_len/4; + break; + default: + buvlen = b_len/2; + break; + } + + + a =yuv_yuv_template( tag->socket_frame, tag->socket_frame + b_len, tag->socket_frame+b_len+buvlen, + v->in_width,v->in_height, v->in_fmt); } - int tmp_fmt = get_ffmpeg_pixfmt( v->in_fmt ); - - VJFrame *a = yuv_yuv_template( tag->socket_frame, tag->socket_frame + b_len, tag->socket_frame+b_len+buvlen, - v->in_width,v->in_height, tmp_fmt); - VJFrame *b = yuv_yuv_template( buffer[0],buffer[1], buffer[2], - v->cur_width,v->cur_height,get_ffmpeg_pixfmt(v->cur_fmt)); + b = yuv_yuv_template( buffer[0],buffer[1], buffer[2],v->cur_width,v->cur_height,v->cur_fmt); yuv_convert_any_ac(a,b, a->format,b->format ); free(a); free(b); diff --git a/veejay-current/veejay-server/libstream/vj-tag.c b/veejay-current/veejay-server/libstream/vj-tag.c index e2352228..b841538c 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.c +++ b/veejay-current/veejay-server/libstream/vj-tag.c @@ -1093,7 +1093,7 @@ int _vj_tag_new_unicap( vj_tag * tag, int stream_nr, int width, int height, int tag->active = 1; break; case VJ_TAG_TYPE_SPLITTER: - sprintf(tag->source_name, "[SPLITTER]"); + sprintf(tag->source_name, "[Three Split]"); tag->generator = vj_split_display( el->video_width, el->video_height ); if(tag->generator==NULL ) { return -1; @@ -1384,9 +1384,12 @@ int vj_tag_del(int id) } break; case VJ_TAG_TYPE_COLOR: + break; case VJ_TAG_TYPE_SPLITTER: - // FIXME - break; + if(tag->generator) { + vj_split_destroy(tag->generator); + } + break; case VJ_TAG_TYPE_GENERATOR: if( tag->generator ) { // plug_deactivate( tag->generator ); @@ -3759,21 +3762,12 @@ int vj_tag_get_frame(int t1, uint8_t *buffer[3], uint8_t * abuffer) break; #ifdef SUPPORT_READ_DV2 - case VJ_TAG_TYPE_DV1394: - vj_dv1394_read_frame( vj_tag_input->dv1394[tag->index], buffer , abuffer,vj_tag_input->pix_fmt); - break; + case VJ_TAG_TYPE_DV1394: + vj_dv1394_read_frame( vj_tag_input->dv1394[tag->index], buffer , abuffer,vj_tag_input->pix_fmt); + break; #endif case VJ_TAG_TYPE_SPLITTER: - - tag->color_r = 7; - - - vj_split_change_screen_setup( tag->generator, tag->color_r ); - - //vj_split_set_stream_in_screen( tag->generator, tag->color_g, tag->color_b ); - vj_split_process_frame( tag->generator, buffer ); - break; case VJ_TAG_TYPE_GENERATOR: _tmp.len = len; diff --git a/veejay-current/veejay-server/libvjnet/cmd.c b/veejay-current/veejay-server/libvjnet/cmd.c index b1b6ec81..8719e708 100644 --- a/veejay-current/veejay-server/libvjnet/cmd.c +++ b/veejay-current/veejay-server/libvjnet/cmd.c @@ -33,6 +33,7 @@ vj_sock_t *alloc_sock_t(void) { vj_sock_t *s = (vj_sock_t*) malloc(sizeof(vj_sock_t)); + memset( s, 0, sizeof(vj_sock_t)); if(!s) return NULL; return s; } @@ -274,26 +275,31 @@ int sock_t_send_fd( int fd, int send_size, unsigned char *buf, int len ) assert( buf != NULL ); #endif - int length = len; - int bw = 0; - int done = 0; + unsigned int length = len; + unsigned int done = 0; + unsigned char *ptr = buf; while( length > 0 ) { - bw = length; - n = send( fd, buf, length , 0 ); + n = send( fd, ptr, length , 0 ); if( n == -1 ) { -#ifdef STRICT_CHECKING veejay_msg(0, "Error sending buffer:%s", strerror(errno)); return -1; -#endif } + if( n == 0 ) { veejay_msg(VEEJAY_MSG_DEBUG, "Remote closed connection."); return 0; } - buf += n; - length -= n; - done += n; + + ptr += n; //@ advance ptr by bytes send + length -= n; //@ decrement length by bytes send + done += n; //@ keep count of bytes done } + +#ifdef STRICT_CHECKING + assert( length == 0 ); + assert( done == len ); +#endif + return done; } @@ -303,7 +309,7 @@ void sock_t_close( vj_sock_t *s ) if(s) { close(s->sock_fd); - s->sock_fd = 0; + s->sock_fd = -1; FD_ZERO(&(s->rds)); FD_ZERO(&(s->wds)); } diff --git a/veejay-current/veejay-server/libvjnet/vj-client.c b/veejay-current/veejay-server/libvjnet/vj-client.c index c8aadeb6..fe06c2ec 100644 --- a/veejay-current/veejay-server/libvjnet/vj-client.c +++ b/veejay-current/veejay-server/libvjnet/vj-client.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -60,7 +61,7 @@ vj_client *vj_client_alloc( int w, int h, int f ) } v->cur_width = w; v->cur_height = h; - v->cur_fmt = f; + v->cur_fmt = get_ffmpeg_pixfmt(f); v->space = NULL; v->c = (conn_type_t**) malloc(sizeof(conn_type_t*) * 3); v->c[0] = (conn_type_t*) malloc(sizeof(conn_type_t)); @@ -292,12 +293,113 @@ static uint32_t getint(uint8_t *in, int len ) { free(word); return (uint32_t) v; } +/* +#define LIVES_HEADER_LENGTH 1024 +#define SALSAMAN_DATASIZE 3 +#define SALSAMAN_HSIZE 5 +#define SALSAMAN_VSIZE 6 +#define SALSAMAN_SUBSPACE 11 +static int vj_client_parse_salsaman( vj_client *v,uint8_t *partial_header, int partial_size, int *dst, uint8_t *header ) +{ + uint8_t header[LIVES_HEADER_LENGTH]; + memset( header,0,sizeof(LIVES_HEADER_LENGTH )); + memcpy( header, partial_header, partial_size ); + + uint8_t *header_ptr = header + partial_size; + + //@ read rest of LiVES header + int rest = sock_t_recv( v->c[0]->fd, header_ptr, LIVES_HEADER_LENGTH - partial_header ); + + //@ values are space seperated + gchar **tokens = g_strsplit( header, " ", -1 ); + if( tokens == NULL || tokens[0] == NULL ) { + if( tokens != NULL ) free(tokens); + return 0; + } + + //@ fetch the values into vars + dst[0] = atoi( header[0] ); + dst[1] = 0; // + + dst[2] = atoi( header[2] ); // flags uint32 + dst[SALSAMAN_DATASIZE] = atoi( header[SALSAMAN_DATASIZE] ); // dsize size_t + + dst[4] = 0; + + dst[5] = atoi( header[5] ); //@ hsize int + dst[6] = atoi( header[6] ); //@ vsize int + dst[7] = g_strtod( header[7], NULL ); // fps double + dst[8] = atoi( header[8] ); // palette int + dst[9] = atoi( header[9] ); // yuv sampling int + dst[10] = atoi( header[10] ); // clamp int + dst[11] = atoi( header[11] ); // subspace int + dst[12] = atoi( header[12] ); // compression type int + + g_strfreev( tokens ); + return 1; +} +*/ + +/* packet negotation. + * read a small portion (44 bytes for veejay, its veejay's full header size) + * and try to identify which software is sending frames + * + */ + +static int vj_client_packet_negotiate( vj_client *v, int *tokens ) +{ + uint8_t line[45]; + + //@ 1. read 44 bytes and see if its us + veejay_memset( line,0, sizeof(line)); + int plen = sock_t_recv( v->c[0]->fd, line, 44 ); + if( plen == 0 ) { + veejay_msg(VEEJAY_MSG_DEBUG, "Remote closed connection."); + return -1; + } + + if( plen < 0 ) + { + veejay_msg(VEEJAY_MSG_ERROR, "Network I/O Error while reading header: %s", strerror(errno)); + return -1; + } + + //@ there is 44 bytes read, identify producer software here, + //@ the function below parses the header in LiVES + /* + int res = vj_client_parse_salsaman( v, line, 44, tokens ); + if( res == 0 ) { + veejay_msg(0, "Error parsing salsaman header!"); + return -1; + } + return 0; + */ + + + + // default: packet is from veejay + tokens[0] = getint( line , 4 ); + tokens[1] = getint( line + 4, 4 ); + tokens[2] = getint( line + 8, 4 ); + tokens[3] = getint( line + 12, 8 ); + + tokens[4] = getint( line + 12 + 8, 8 ); + tokens[5] = getint( line + 12 + 16, 8 ); + tokens[6] = getint( line + 12 + 24, 8 ); + + + return 1; +} + int vj_client_read_i( vj_client *v, uint8_t *dst, int len ) { uint8_t line[128]; uint32_t p[4] = {0, 0,0,0 }; uint32_t strides[4] = { 0,0,0,0 }; + + int tokens[16]; + int n = 0; int plen = 0; int conv = 1; @@ -305,7 +407,6 @@ int vj_client_read_i( vj_client *v, uint8_t *dst, int len ) int uv_len = 0; if( v->c[0]->type == VMCAST_C ) { -//@FIXME uint8_t *in = mcast_recv_frame( v->c[0]->r, &p[0],&p[1], &p[2], &plen ); if( in == NULL ) return 0; @@ -318,100 +419,132 @@ int vj_client_read_i( vj_client *v, uint8_t *dst, int len ) y_len = p[0] * p[1]; switch(v->in_fmt ) { - case FMT_422: - case FMT_422F: + case PIX_FMT_YUV422P: + case PIX_FMT_YUVJ422P: uv_len = y_len / 2; break; - case FMT_420: - case FMT_420F: + case PIX_FMT_YUV420P: + case PIX_FMT_YUVJ420P: uv_len = y_len / 4;break; default: veejay_msg(VEEJAY_MSG_ERROR, "Unknown data format: %02x", v->in_fmt); break; } - if( p[0] != v->cur_width || p[1] != v->cur_height || p[2] != v->cur_fmt ) - return 2; - strides[0] = getint( in + 12 + 8, 8 ); strides[1] = getint( in + 12 + 16, 8 ); strides[2] = getint( in + 12 + 24, 8 ); vj_client_decompress( v,in, dst, p[3], y_len, uv_len , plen, strides[0],strides[1],strides[2]); - return 1; + if( p[0] != v->cur_width || p[1] != v->cur_height ) + return 2; + + + return 1; //@ caller will memcpy it to destination buffer } else if ( v->c[0]->type == VSOCK_C ) { - veejay_memset( line,0, sizeof(line)); - plen = sock_t_recv( v->c[0]->fd, line, 44 ); + //@ result returns software package id + int result = vj_client_packet_negotiate( v, tokens ); + if( result == 0 ) { //@ ids are out of thin air + + //@ header is from lives + /* + if( v->cur_width != tokens[ SALSAMAN_VSIZE ] || v->cur_height != tokens[SALSAMAN_HSIZE] ) { + //@ no changing of sizes on the fly + veejay_msg(VEEJAY_MSG_ERROR, "Unexpected video frame format"); + int n; + for( n = 0;n < 16; n ++ ) { + veejay_msg(VEEJAY_MSG_DEBUG, "%d: [%d] %02x ", n,tokens[n],tokens[n]); + } + return 0; + } - if( plen == 0 ) { - veejay_msg(VEEJAY_MSG_DEBUG, "Remote closed connection."); - return -1; - } + //@ read information from the header and figure out which pixelformat it is + v->in_fmt = weed_palette2_pixfmt( tokens[SALSAMAN_PALETTE] , tokens[SALSAMAN_SUBSPACE ] ); + if( v->in_fmt == -1 ) { + veejay_msg(VEEJAY_MSG_ERROR, "No support for weed palette %d", tokens[SALSAMAN_PALETTE]); + return 0; + } - if( plen < 0 ) - { - veejay_msg(VEEJAY_MSG_ERROR, "Network I/O Error while reading header: %s", strerror(errno)); - return -1; - } - - //vj_client_stdout_dump_recv( v->c[0]->fd, plen, line ); - - p[0] = getint( line , 4 ); - p[1] = getint( line + 4, 4 ); - p[2] = getint( line + 8, 4 ); - p[3] = getint( line + 12, 8 ); + //@ assign required values for veejay (format,width,height) + v->in_width = tokens[SALSAMAN_VSIZE]; + v->in_height= tokens[SALSAMAN_HSIZE]; + + //@ start reading rest of frame, assuming size is given by SALSAMAN_DATASIZE + int n = sock_t_recv( v->c[0]->fd,v->space, tokens[SALSAMAN_DATASIZE] ); + if( n <= 0 ) { + if( n == -1 ) { + veejay_msg(VEEJAY_MSG_ERROR, "Error '%s' while reading socket", strerror(errno)); + } else { + veejay_msg(VEEJAY_MSG_DEBUG,"Remote closed connection"); + } + return -1; + } + //@ ready + //@ vj-net.c + + //@ returning 2 means caller will scale + return 2; + */ + return 0; + } else if ( result == 1 ) { + //@ header is veejay + p[0] = tokens[0]; + p[1] = tokens[1]; + p[2] = tokens[2]; + p[3] = tokens[3]; + strides[0] = tokens[4]; + strides[1] = tokens[5]; + strides[2] = tokens[6]; - strides[0] = getint( line + 12 + 8, 8 ); - strides[1] = getint( line + 12 + 16, 8 ); - strides[2] = getint( line + 12 + 24, 8 ); + v->in_width = p[0]; + v->in_height = p[1]; + v->in_fmt = p[2]; + + uv_len = 0; + y_len = p[0] * p[1]; - if( v->cur_width != p[0] || v->cur_height != p[1] || v->cur_fmt != p[2]) { - veejay_msg(VEEJAY_MSG_ERROR, "Unexpected video frame format, %dx%d (%d) , received %dx%d(%d)", - v->cur_width,v->cur_height,v->cur_fmt,p[0],p[1],p[2]); + switch(v->in_fmt ) //@ veejay is sending compressed YUV data, calculate UV size + { + case PIX_FMT_YUV422P: + case PIX_FMT_YUVJ422P: + uv_len = y_len / 2; + break; + case PIX_FMT_YUV420P: + case PIX_FMT_YUVJ420P: + uv_len = y_len / 4;break; + default: + veejay_msg(VEEJAY_MSG_ERROR, "Unknown data format: %02x", v->in_fmt); + break; + } + + int n = sock_t_recv( v->c[0]->fd,v->space,p[3] ); + if( n <= 0 ) { + if( n == -1 ) { + veejay_msg(VEEJAY_MSG_ERROR, "Error '%s' while reading socket", strerror(errno)); + } else { + veejay_msg(VEEJAY_MSG_DEBUG,"Remote closed connection"); + } + return -1; + } + + if( n != p[3] && n > 0 ) + { + veejay_msg(VEEJAY_MSG_ERROR, "Broken video packet , got %d out of %d bytes",n, p[3] ); + return -1; + } + + //@ decompress YUV buffer + vj_client_decompress( v,NULL, dst, p[3], y_len, uv_len , plen, strides[0],strides[1],strides[2]); + + return 2; //@ caller will scale frame in dst + } else { return 0; } - v->in_width = p[0]; - v->in_height = p[1]; - v->in_fmt = p[2]; - uv_len = 0; - y_len = p[0] * p[1]; - switch(v->in_fmt ) - { - case FMT_422: - case FMT_422F: - uv_len = y_len / 2; - break; - case FMT_420: - case FMT_420F: - uv_len = y_len / 4;break; - default: - veejay_msg(VEEJAY_MSG_ERROR, "Unknown data format: %02x", v->in_fmt); - break; - } - - int n = sock_t_recv( v->c[0]->fd,v->space,p[3] ); - if( n <= 0 ) { - if( n == -1 ) { - veejay_msg(VEEJAY_MSG_ERROR, "Error '%s' while reading socket", strerror(errno)); - } else { - veejay_msg(VEEJAY_MSG_DEBUG,"Remote closed connection"); - } - return -1; - } - - if( n != p[3] && n > 0 ) - { - veejay_msg(VEEJAY_MSG_ERROR, "Broken video packet , got %d out of %d bytes",n, p[3] ); - return -1; - } - - vj_client_decompress( v,NULL, dst, p[3], y_len, uv_len , plen, strides[0],strides[1],strides[2]); - - return 2; + return 0; } return 0; } diff --git a/veejay-current/veejay-server/libvjnet/vj-server.c b/veejay-current/veejay-server/libvjnet/vj-server.c index 91daadb1..3b14df76 100644 --- a/veejay-current/veejay-server/libvjnet/vj-server.c +++ b/veejay-current/veejay-server/libvjnet/vj-server.c @@ -418,6 +418,7 @@ int vj_server_send( vj_server *vje, int link_id, uint8_t *buf, int len ) if( !vje->use_mcast) { + //@ FIXME: vje->send_size is not used in sock_t_send_fd total = sock_t_send_fd( Link[link_id]->handle, vje->send_size, buf, len); #ifdef STRICT_CHECKING if( vje->logfd ) { @@ -431,6 +432,7 @@ int vj_server_send( vj_server *vje, int link_id, uint8_t *buf, int len ) (char*)(inet_ntoa(vje->remote.sin_addr)),strerror(errno)); return -1; } + if( total < len ) return -1; } @@ -514,7 +516,7 @@ int vj_server_send_frame( vj_server *vje, int link_id, uint8_t *buf, int len, { return vj_server_send_frame_now( vje, link_id, buf, len ); } else { - veejay_msg(VEEJAY_MSG_DEBUG, "%s: not ready to write."); + veejay_msg(VEEJAY_MSG_DEBUG, "Link %d's socket not ready for immediate send: %s", link_id, strerror(errno)); } return 0; } @@ -567,7 +569,7 @@ int _vj_server_del_client(vj_server * vje, int link_id) { vj_link **Link = (vj_link**) vje->link; Link[link_id]->in_use = 0; - if(Link[link_id]->handle) + if(Link[link_id]->handle > 0) { int res = close(Link[link_id]->handle); if( res == -1 ) { @@ -583,7 +585,7 @@ int _vj_server_del_client(vj_server * vje, int link_id) #endif } - Link[link_id]->handle = 0; + Link[link_id]->handle = -1; Link[link_id]->promote = 0; Link[link_id]->n_queued = 0; Link[link_id]->n_retrieved = 0; @@ -641,7 +643,7 @@ int vj_server_poll(vj_server * vje) for( i = 0; i < VJ_MAX_CONNECTIONS; i ++ ) { vj_link **Link= (vj_link**) vje->link; - if( Link[i]->handle <= 0 ) + if( Link[i]->handle <= 0 || !Link[i]->in_use ) continue; // if( Link[i]->in_use ) // { @@ -939,16 +941,19 @@ int vj_server_new_connection(vj_server *vje) int addr_len = sizeof(vje->remote); int n = 0; int fd = accept( vje->handle, (struct sockaddr*) &(vje->remote), &addr_len ); +#ifdef STRICT_CHECKING + assert( fd != 0 ); //@ grab a beer if fd == FILENO_STDIN +#endif if(fd == -1) { veejay_msg(VEEJAY_MSG_ERROR, "Error accepting connection: %s", strerror(errno)); + return 0; } char *host = inet_ntoa( vje->remote.sin_addr ); - veejay_msg(VEEJAY_MSG_INFO, "Connection with %s on port %d", host, - vje->remote.sin_port); + if( vje->nr_of_connections < fd ) vje->nr_of_connections = fd; @@ -960,6 +965,9 @@ int vj_server_new_connection(vj_server *vje) close(fd); return 0; } + + veejay_msg(VEEJAY_MSG_INFO, "Link: %d connected with %s on port %d", n,host,vje->remote.sin_port); + #ifdef STRICT_CHECKING if( vje->logfd ) { fprintf(vje->logfd, "new connection, socket=%d, max connections=%d\n", @@ -967,6 +975,8 @@ int vj_server_new_connection(vj_server *vje) } #endif + + FD_CLR( vje->handle, &(vje->fds) ); return 1; } return 0; diff --git a/veejay-current/veejay-server/livido-plugins/lvd_shmin.c b/veejay-current/veejay-server/livido-plugins/lvd_shmin.c index df6448ab..10d40180 100644 --- a/veejay-current/veejay-server/livido-plugins/lvd_shmin.c +++ b/veejay-current/veejay-server/livido-plugins/lvd_shmin.c @@ -76,11 +76,11 @@ livido_init_f init_instance( livido_port_t *my_instance ) char *env_id = getenv( "VEEJAY_SHMID" ); if ( livido_property_get( my_instance, "HOST_shmid", 0, &shm_id ) == LIVIDO_NO_ERROR ) { - if( shm_id > 0 ) + if( shm_id != 0 ) env_id = NULL; //@ use shm_id from HOST instead. } - if( env_id == NULL && shm_id <= 0) { + if( env_id == NULL && shm_id == 0) { //@ try veejay homedir last resort. char path[1024]; char *home = getenv("HOME"); @@ -101,7 +101,7 @@ livido_init_f init_instance( livido_port_t *my_instance ) shm_id = atoi( env_id ); } - int r = shmget( shm_id, 0, 0666 ); + int r = shmget( shm_id, 0, 0400 ); if( r == -1 ) { printf("error: %s for shm_id %d\n", strerror(errno),shm_id); return LIVIDO_ERROR_HARDWARE; diff --git a/veejay-current/veejay-server/veejay/liblavplayvj.c b/veejay-current/veejay-server/veejay/liblavplayvj.c index e84f1fc6..540867e1 100644 --- a/veejay-current/veejay-server/veejay/liblavplayvj.c +++ b/veejay-current/veejay-server/veejay/liblavplayvj.c @@ -1537,11 +1537,14 @@ static void veejay_handle_callbacks(veejay_t *info) { int status_line_len = strlen( info->status_line ); int i; for( i = 0; i < VJ_MAX_CONNECTIONS ; i ++ ) { + if( !vj_server_link_can_write( info->vjs[VEEJAY_PORT_STA], i ) ) + continue; int res = vj_server_send( info->vjs[VEEJAY_PORT_STA], i, info->status_line, status_line_len); - /* if( res < 0 ) { + if( res < 0 ) { _vj_server_del_client( info->vjs[VEEJAY_PORT_CMD], i ); _vj_server_del_client( info->vjs[VEEJAY_PORT_STA], i ); - }*/ + _vj_server_del_client( info->vjs[VEEJAY_PORT_DAT], i ); + } } } diff --git a/veejay-current/veejay-server/veejay/veejay.c b/veejay-current/veejay-server/veejay/veejay.c index f593b6a3..b839abac 100644 --- a/veejay-current/veejay-server/veejay/veejay.c +++ b/veejay-current/veejay-server/veejay/veejay.c @@ -749,14 +749,13 @@ int main(int argc, char **argv) while( 1 ) { //@ until your PC stops working usleep(50000); - vj_lock(info); + current_state = veejay_get_state(info); - vj_unlock(info); + if( current_state == LAVPLAY_STATE_STOP ) break; } - veejay_quit(info); veejay_busy(info); veejay_free(info); diff --git a/veejay-current/veejay-server/veejay/vj-event.c b/veejay-current/veejay-server/veejay/vj-event.c index 9a194b41..c37d2457 100644 --- a/veejay-current/veejay-server/veejay/vj-event.c +++ b/veejay-current/veejay-server/veejay/vj-event.c @@ -1672,8 +1672,7 @@ int vj_event_parse_msg( void *ptr, char *msg, int msg_len ) return 0; } -void breaker() -{} + void vj_event_update_remote(void *ptr) { veejay_t *v = (veejay_t*)ptr; @@ -1683,17 +1682,22 @@ void vj_event_update_remote(void *ptr) int p2 = vj_server_poll( v->vjs[VEEJAY_PORT_STA] ); int p3 = vj_server_poll( v->vjs[VEEJAY_PORT_DAT] ); - int has_n=0; + int has_n=0, has_b=0; + if( p1 ) has_n += vj_server_new_connection(v->vjs[VEEJAY_PORT_CMD]); + + if( p2 ) has_n += vj_server_new_connection( v->vjs[VEEJAY_PORT_STA] ); + + if( p3 ) + has_n += vj_server_new_connection( v->vjs[VEEJAY_PORT_DAT] ); - if( has_n ) { + if( has_n ) + { return; } - has_n += vj_server_new_connection( v->vjs[VEEJAY_PORT_DAT] ); - if( v->settings->use_vims_mcast ) { int res = vj_server_update(v->vjs[VEEJAY_PORT_MAT],0 ); @@ -1788,6 +1792,8 @@ void vj_event_update_remote(void *ptr) if(!veejay_keep_messages()) veejay_reap_messages(); + + return; } void vj_event_commit_bundle( veejay_t *v, int key_num, int key_mod) @@ -6927,19 +6933,13 @@ void vj_event_tag_new_generator( void *ptr, const char format[], va_list ap ) int args[2] = { 0,0 }; P_A(args,str,format,ap); - int shm_before = vj_shm_get_id(); //@ get temporary shmid - - vj_shm_set_id( args[0] ); //@ temporary store shm id somewhere - - int id = veejay_create_tag(v, VJ_TAG_TYPE_GENERATOR, str, v->nstreams,vj_shm_get_id(),0); + int id = veejay_create_tag(v, VJ_TAG_TYPE_GENERATOR, str, v->nstreams,args[0],0); vj_event_send_new_id ( v, id ); if( id <= 0 ) { - veejay_msg(0,"No plugin '%s' was found", str ); + veejay_msg(0,"Error launching plugin '%s'.", str ); } - - vj_shm_set_id( shm_before ); } #ifdef USE_GDK_PIXBUF @@ -9773,6 +9773,7 @@ void vj_event_get_shm( void *ptr, const char format[], va_list ap ) { veejay_t *v = (veejay_t*)ptr; char tmp[64]; + memset(tmp,0,sizeof(tmp)); if(!v->shm) { snprintf(tmp,sizeof(tmp)-1,"%016d",0); SEND_MSG(v, tmp ); @@ -9823,16 +9824,20 @@ void vj_event_connect_shm( void *ptr, const char format[], va_list ap ) { veejay_t *v = (veejay_t*) ptr; int args[2]; - char str[255]; + char *str = NULL; P_A(args,str,format,ap); - //@ port, shm_id + if( args[0] == v->uc->port ) { + veejay_msg(0, "Cannot pull info from myself inside VIMS event!"); + vj_event_send_new_id( v, -1 ); + return; + } int32_t key = vj_share_pull_master( v->shm,"127.0.0.1", args[0] ); - - int id = veejay_create_tag( v, VJ_TAG_TYPE_GENERATOR, "lvd_shmin.so", v->nstreams, key,0); + vj_event_send_new_id( v, id ); + if( id <= 0 ) { veejay_msg(0, "Unable to connect to shared resource id %d", key ); } diff --git a/veejay-current/veejay-server/veejay/vj-perform.c b/veejay-current/veejay-server/veejay/vj-perform.c index ff0f6020..13a40680 100644 --- a/veejay-current/veejay-server/veejay/vj-perform.c +++ b/veejay-current/veejay-server/veejay/vj-perform.c @@ -1142,7 +1142,7 @@ int vj_perform_send_primary_frame_s2(veejay_t *info, int mcast, int to_mcast_lin snprintf(info_line, data_len + 1, //@ '\0' counts "%04d%04d%04d%08d%08d%08d%08d", info->effect_frame1->width, - info->effect_frame1->height, info->pixel_format, + info->effect_frame1->height, info->effect_frame1->format, compr_len,planes[0],planes[1],planes[2] ); veejay_memcpy( socket_buffer, info_line, sizeof(uint8_t) * data_len ); } @@ -1167,7 +1167,6 @@ int vj_perform_send_primary_frame_s2(veejay_t *info, int mcast, int to_mcast_lin if(vj_server_send_frame( info->vjs[id], info->rlinks[i], socket_buffer, __socket_len, info->effect_frame1, info->real_fps )<=0) { - veejay_msg(VEEJAY_MSG_ERROR, "Error sending frame to remote"); _vj_server_del_client( info->vjs[id], info->rlinks[i] ); } info->rlinks[i] = -1; diff --git a/veejay-current/veejay-server/veejay/vj-sdl.c b/veejay-current/veejay-server/veejay/vj-sdl.c index 4778c2aa..55a43ff6 100644 --- a/veejay-current/veejay-server/veejay/vj-sdl.c +++ b/veejay-current/veejay-server/veejay/vj-sdl.c @@ -501,6 +501,11 @@ int vj_sdl_screen_h( vj_sdl *vjsdl ) return vjsdl->screen->h; } +void vj_sdl_set_title( const char *caption ) +{ + SDL_WM_SetCaption(caption, NULL); +} + void vj_sdl_grab(vj_sdl *vjsdl, int status) { SDL_WM_GrabInput( (status==1? SDL_GRAB_ON : SDL_GRAB_OFF) ); diff --git a/veejay-current/veejay-server/veejay/vj-sdl.h b/veejay-current/veejay-server/veejay/vj-sdl.h index c343f372..3dd0c535 100644 --- a/veejay-current/veejay-server/veejay/vj-sdl.h +++ b/veejay-current/veejay-server/veejay/vj-sdl.h @@ -61,7 +61,7 @@ int vj_sdl_direct_yuv_overlay(vj_sdl * vjsdl, uint8_t * buffer, int buflen, void vj_sdl_free(vj_sdl * vjsdl); void vj_sdl_quit(); uint8_t *vj_sdl_get_yuv_overlay(vj_sdl *vjsdl ); - +void vj_sdl_set_title( const char *caption ); void vj_sdl_resize( vj_sdl *vjsdl , int scaled_width, int scaled_height, int fs ); int vj_sdl_screen_w( vj_sdl *vjsdl ); int vj_sdl_screen_h( vj_sdl *vjsdl ); diff --git a/veejay-current/veejay-server/veejay/vj-share.c b/veejay-current/veejay-server/veejay/vj-share.c index b750edb5..6e2284b5 100644 --- a/veejay-current/veejay-server/veejay/vj-share.c +++ b/veejay-current/veejay-server/veejay/vj-share.c @@ -89,22 +89,22 @@ int32_t vj_share_pull_master( void *shm, char *master_host, int master_port ) memset(tmp,0,sizeof(tmp)); vj_client_send( c, V_CMD, "425:0;" ); - + vj_client_read( c, V_CMD, tmp, 16 ); //@ get SHM id from + vj_flush(c,1); + // int32_t key = atoi(tmp); int32_t key = strtol( tmp, (char**) NULL, 10); veejay_msg(VEEJAY_MSG_DEBUG, "Veejay sister at port %d says shared resoure ID is %d",master_port,key); + vj_client_send( c, V_CMD, "025:1;" ); //@ master starts writing frames to shm vj_shm_set_id( key ); //@ temporary store - - vj_flush(c,1); - vj_client_close( c ); vj_client_free( c ); diff --git a/veejay-current/veejay-server/veejay/vj-shm.c b/veejay-current/veejay-server/veejay/vj-shm.c index 76e15466..11f5f6a7 100644 --- a/veejay-current/veejay-server/veejay/vj-shm.c +++ b/veejay-current/veejay-server/veejay/vj-shm.c @@ -62,9 +62,13 @@ typedef struct } vj_shared_data; static int just_a_shmid = 0; - +static int simply_my_shmkey = 0; static key_t simply_my_shmid = 0; +int vj_shm_get_my_shmid() { + return simply_my_shmkey; +} + int vj_shm_get_my_id() { return simply_my_shmid; } @@ -85,15 +89,15 @@ void vj_shm_free(void *vv) int res = pthread_rwlock_destroy( &data->rwlock ); - res = shmdt( data ); + res = shmdt( v->sms ); if(res ) { - veejay_msg(0, "failed to detach shared memory: %s",strerror(errno)); + veejay_msg(VEEJAY_MSG_DEBUG, "Failed to detach shared memory: %s",strerror(errno)); } res = shmctl( v->shm_id, IPC_RMID, NULL ); if( res ) { - veejay_msg(0, "failed to remove shared memory %d: %s", v->shm_id, strerror(errno)); + veejay_msg(0, "Failed to remove shared memory %d: %s", v->shm_id, strerror(errno)); } else { - veejay_msg(VEEJAY_MSG_INFO, "Removed shared segment %d", v->shm_id ); + veejay_msg(VEEJAY_MSG_INFO, "Shared resource will %d be destroyed.", v->shm_id ); } if( v->file ) { @@ -189,7 +193,7 @@ int vj_shm_write( void *vv, uint8_t *frame[3], int plane_sizes[3] ) int res = pthread_rwlock_wrlock( &data->rwlock ); if( res == -1 ) { - // veejay_msg(0, "%s",strerror(errno)); + veejay_msg(0, "SHM locking error: %s",strerror(errno)); return -1; } @@ -203,15 +207,15 @@ int vj_shm_write( void *vv, uint8_t *frame[3], int plane_sizes[3] ) res = pthread_rwlock_unlock( &data->rwlock ); if( res == -1 ) { - //veejay_msg(0, "%s",strerror(errno)); + veejay_msg(0, "SHM locking error: %s",strerror(errno)); return -1; } return 0; } - +/* void *vj_shm_new_slave(int shm_id) -{ //@ incomplete! +{ int rc = 0; if( shm_id <= 0 ) { @@ -249,7 +253,7 @@ void *vj_shm_new_slave(int shm_id) veejay_msg(VEEJAY_MSG_INFO, "Attached to shared memory segment %d", shm_id ); return v; -} +}*/ static int vj_shm_file_ref_use_this( char *path ) { struct stat inf; @@ -284,6 +288,10 @@ static int vj_shm_file_ref( vj_shm_t *v, const char *homedir ) } key_t key = ftok( path, tries ); //@ whatever + if( key == -1 ) { + veejay_msg(0,"ftok returns error: %s", strerror(errno)); + return 0; + } fprintf( f, "veejay_shm_out-%d: shm_id=%d\n", tries,key ); fclose(f ); @@ -333,7 +341,7 @@ void *vj_shm_new_master( const char *homedir, VJFrame *frame) //@ attach v->sms = shmat( v->shm_id, NULL , 0 ); - if( v->sms == NULL ) { + if( v->sms == NULL || v->sms == (uint8_t*) (-1) ) { shmctl( v->shm_id, IPC_RMID, NULL ); veejay_msg(0, "Failed to attach to shared memory:%s",strerror(errno)); failed_init_cleanup(v); @@ -396,6 +404,8 @@ void *vj_shm_new_master( const char *homedir, VJFrame *frame) simply_my_shmid = v->key; + simply_my_shmkey = v->shm_id; + return v; } diff --git a/veejay-current/veejay-server/veejay/vj-shm.h b/veejay-current/veejay-server/veejay/vj-shm.h index dea5158d..68f36e73 100644 --- a/veejay-current/veejay-server/veejay/vj-shm.h +++ b/veejay-current/veejay-server/veejay/vj-shm.h @@ -31,6 +31,7 @@ int vj_shm_get_status( void *vv ); void vj_shm_set_status( void *vv, int status ); int vj_shm_get_shm_id( void *vv ); int vj_shm_get_id(); +int vj_shm_get_my_shmid(); void vj_shm_set_id(int v); int vj_shm_get_my_id(); #endif diff --git a/veejay-current/veejay-server/veejay/vj-splitdisplay.c b/veejay-current/veejay-server/veejay/vj-splitdisplay.c index 548f60f8..5cda70ea 100644 --- a/veejay-current/veejay-server/veejay/vj-splitdisplay.c +++ b/veejay-current/veejay-server/veejay/vj-splitdisplay.c @@ -74,6 +74,11 @@ static void vj_split_change_screens(split_display_t *sd, int n) } } +void vj_split_destroy( void *s ) +{ + +} + void *vj_split_display(int w, int h) { split_display_t *sd = (split_display_t*) vj_calloc( sizeof( split_display_t)); @@ -307,7 +312,7 @@ void vj_split_process_frame( void *sd , uint8_t *dst[3]) continue; } - //@ streams only for now + //@ streams only if(! vj_tag_get_frame( sdt->samples[k]->sample_id, sdt->darea, NULL ) ) continue; diff --git a/veejay-current/veejay-server/veejay/vj-splitdisplay.h b/veejay-current/veejay-server/veejay/vj-splitdisplay.h index 57787a30..12ce4b22 100644 --- a/veejay-current/veejay-server/veejay/vj-splitdisplay.h +++ b/veejay-current/veejay-server/veejay/vj-splitdisplay.h @@ -3,6 +3,8 @@ void *vj_split_display(int w, int h); void vj_split_process_frame( void *sd, uint8_t *work_buffer[3] ); +void vj_split_destroy(void *v); + void vj_split_change_num_screens( void *sd, int n_screens ); void vj_split_change_screen_setup(void *sd, int value); diff --git a/veejay-current/veejay-utils/configure.ac b/veejay-current/veejay-utils/configure.ac index 7cbfdde4..80783c37 100644 --- a/veejay-current/veejay-utils/configure.ac +++ b/veejay-current/veejay-utils/configure.ac @@ -1,12 +1,12 @@ dnl Process this file with autoconf to produce a configure script. dnl AC_INIT -AC_INIT([veejay-utils],[1.1.2],[veejay-users@lists.sourceforge.net]) +AC_INIT([veejay-utils],[1.1.3],[veejay-users@lists.sourceforge.net]) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/sayVIMS.c]) VEEJAY_MAJOR_VERSION=1 VEEJAY_MINOR_VERSION=1 -VEEJAY_MICRO_VERSION=2 +VEEJAY_MICRO_VERSION=3 VEEJAY_VERSION=$VEEJAY_MAJOR_VERSION.$VEEJAY_MINOR_VERSION.$VEEJAY_MICRO_VERSION VEEJAY_CODENAME="Veejay Utilities - build $VEEJAY_MINOR_VERSION $VEEJAY_MICRO_VERSION" AC_CONFIG_HEADERS([config.h]) diff --git a/veejay-current/veejay-utils/src/sayVIMS.c b/veejay-current/veejay-utils/src/sayVIMS.c index 3fa2ea53..34762985 100644 --- a/veejay-current/veejay-utils/src/sayVIMS.c +++ b/veejay-current/veejay-utils/src/sayVIMS.c @@ -184,10 +184,10 @@ int main(int argc, char *argv[]) sayvims = sayvims_connect(); - vj_flush(1); - - if(!sayvims) + if(!sayvims) { + fprintf(stderr, "error connecting.\n"); return -1; + } if(single_msg || interactive ) { @@ -250,6 +250,8 @@ int main(int argc, char *argv[]) } } + + vj_flush(1); vj_client_close(sayvims); vj_client_free(sayvims);