diff --git a/veejay-current/veejay-client/share/gveejay.reloaded.glade b/veejay-current/veejay-client/share/gveejay.reloaded.glade index 11833cbd..807338cf 100644 --- a/veejay-current/veejay-client/share/gveejay.reloaded.glade +++ b/veejay-current/veejay-client/share/gveejay.reloaded.glade @@ -1159,6 +1159,811 @@ + + False + GVeejay Reloaded - New input stream + 400 + 400 + icon_stream.png + + + + 340 + True + False + 0 + + + True + False + 12 + + + True + False + + + True + True + True + + + True + True + + + True + True + Double click to active, single click column for changing settings + + + + + + + True + False + <b>Device</b> + True + + + label_item + + + + + True + True + 0 + + + + + True + True + + + True + False + 2 + 4 + 4 + + + + + + True + True + 200 + localhost + False + False + True + True + + + 2 + 3 + + + + + + True + False + 0 + Remote + + + 1 + 2 + + + + + + + Use multicast + True + True + False + True + True + + + + + + + + + True + False + 0 + Port Number + + + 1 + 2 + 1 + 2 + + + + + + + True + True + False + False + True + True + 4490 1 65535 1 0 0 + 1 + + + 2 + 3 + 1 + 2 + + + + + + Try + True + True + False + True + + + + 3 + 4 + 1 + 2 + + + + + + + + + + + True + False + <b>Network</b> + True + + + label_item + + + + + False + True + 1 + + + + + True + + + True + False + 2 + 5 + 4 + + + + + + + + + + + + True + False + 0 + Filename + + + 1 + 2 + + + + + + + use YUV4MPEG + True + True + False + True + True + + + + + + + + + use FFmpeg + True + True + False + True + True + inputstream_filey4m + + + 1 + 2 + + + + + + + True + True + False + False + True + True + + + 2 + 4 + + + + + + Try + True + True + False + True + + + 4 + 5 + 1 + 2 + + + + + + + True + True + False + Load Actionfile + + + + True + False + 0 + 0 + + + True + False + 2 + + + True + False + icon_open.png + + + False + False + 0 + + + + + + + + + 4 + 5 + + + + + + + + + True + False + <b>File</b> + True + + + label_item + + + + + False + True + 2 + + + + + True + False + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + True + False + Close this window + + + + True + False + 0 + 0 + + + True + False + 2 + + + True + False + gtk-close + + + False + False + 0 + + + + + True + False + Close + True + + + False + False + 1 + + + + + + + + + 3 + 4 + + + + + + + + + + False + False + 3 + + + + + + + + + True + False + <b>Stream types</b> + True + + + label_item + + + + + 1100 740 @@ -1245,8 +2050,8 @@ False - - + + _New Yuv4Mpeg True @@ -3765,12 +4570,12 @@ - + True True False Toggle keyframing for this chain entry - + True @@ -12285,7 +13090,26 @@ YUV (current) - + + True + True + True + True + Toggle keyframing for this chain entry + + + + True + False + icon_keyframe.png + + + + + False + False + 7 + @@ -14185,805 +15009,6 @@ YUV (current) - - False - GVeejay Reloaded - New input stream - 400 - 400 - icon_stream.png - - - - 340 - True - False - 0 - - - True - False - 12 - - - True - False - - - True - True - True - - - True - True - - - True - True - Double click to active, single click column for changing settings - - - - - - - True - False - <b>Device</b> - True - - - label_item - - - - - True - True - 0 - - - - - True - True - - - True - False - 2 - 4 - 4 - - - - - - True - True - 200 - localhost - False - False - True - True - - - 2 - 3 - - - - - - True - False - 0 - Remote - - - 1 - 2 - - - - - - - Use multicast - True - True - False - True - True - - - - - - - - - True - False - 0 - Port Number - - - 1 - 2 - 1 - 2 - - - - - - - True - True - False - False - True - True - 4490 1 65535 1 0 0 - 1 - - - 2 - 3 - 1 - 2 - - - - - - Try - True - True - False - True - - - - 3 - 4 - 1 - 2 - - - - - - - - - - - True - False - <b>Network</b> - True - - - label_item - - - - - False - True - 1 - - - - - True - - - True - False - 2 - 5 - 4 - - - - - - - - - - - - True - False - 0 - Filename - - - 1 - 2 - - - - - - - use YUV4MPEG - True - True - False - True - True - - - - - - - - - use FFmpeg - True - True - False - True - True - inputstream_filey4m - - - 1 - 2 - - - - - - - True - True - False - False - True - True - - - 2 - 4 - - - - - - Try - True - True - False - True - - - 4 - 5 - 1 - 2 - - - - - - - True - True - False - Load Actionfile - - - - True - False - 0 - 0 - - - True - False - 2 - - - True - False - icon_open.png - - - False - False - 0 - - - - - - - - - 4 - 5 - - - - - - - - - True - False - <b>File</b> - True - - - label_item - - - - - False - True - 2 - - - - - True - False - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - True - False - Close this window - - - - True - False - 0 - 0 - - - True - False - 2 - - - True - False - gtk-close - - - False - False - 0 - - - - - True - False - Close - True - - - False - False - 1 - - - - - - - - - 3 - 4 - - - - - - - - - - False - False - 3 - - - - - - - - - True - False - <b>Stream types</b> - True - - - label_item - - - - - True False diff --git a/veejay-current/veejay-client/src/callback.c b/veejay-current/veejay-client/src/callback.c index 22dc66e9..c9947111 100644 --- a/veejay-current/veejay-client/src/callback.c +++ b/veejay-current/veejay-client/src/callback.c @@ -2581,7 +2581,7 @@ void on_curve_buttonstore_clicked(GtkWidget *widget, gpointer user_data ) int end = get_nums( "curve_spinend" ); int start = get_nums( "curve_spinstart" ); - + int status = is_button_toggled( "curve_toggleentry_param" ); const int length = end - start + 1; @@ -2612,16 +2612,18 @@ void on_curve_buttonstore_clicked(GtkWidget *widget, gpointer user_data ) get_points_from_curve( curve, length, data ); - char header[34]; + char header[37]; - int msg_len = 25 + (4*length); /*K00000000 */ + int msg_len = 27 + (4*length); /*K00000000 */ - snprintf(header,sizeof(header), "K%08dkey%02d%02d%08d%08d%02d",msg_len,i,j,start,end,type ); + snprintf(header,sizeof(header), "K%08dkey%02d%02d%08d%08d%02d%02d",msg_len,i,j,start,end,type,status ); + int hdr_len = strlen(header); + unsigned char *buf = (unsigned char*) vj_calloc( sizeof(unsigned char) * msg_len + 9 ); - strncpy( (char*) buf, header, sizeof(header)); + strncpy( (char*) buf, header, hdr_len); - unsigned char *ptr = buf + sizeof(header); + unsigned char *ptr = buf + hdr_len; int k; for( k = 0 ; k < length ; k++ ) { int pval = (int) ( (float) min + ( data[k] * ((float) max) )); @@ -2699,8 +2701,30 @@ void on_curve_typefreehand_toggled(GtkWidget *widget, gpointer user_data) } } +void on_curve_toggleentry_param_toggled( GtkWidget *widget, gpointer user_data) +{ + if(info->status_lock) + return; -void on_curve_toggleentry_toggled( GtkWidget *widget, gpointer user_data) + int i = info->uc.selected_chain_entry; + if( i == -1 ) { + vj_msg(VEEJAY_MSG_INFO,"No FX entry selected for animation"); + return; + } + + int j = info->uc.selected_parameter_id; + if( j == -1) { + vj_msg(VEEJAY_MSG_INFO,"No FX anim parameter selected"); + return; + } + int k = is_button_toggled( "curve_toggleentry_param" ); + + multi_vims( VIMS_SAMPLE_KF_STATUS_PARAM, "0 %d %d %d", i, j,k ); + + vj_msg(VEEJAY_MSG_INFO, "%s FX parameter %d", (k==0 ? "Disabled" : "Enabled"), i ); +} + +void curve_toggleentry_toggled( GtkWidget *widget, gpointer user_data) { if(info->status_lock) return; diff --git a/veejay-current/veejay-client/src/curve.c b/veejay-current/veejay-client/src/curve.c index 39aa5292..074134f4 100644 --- a/veejay-current/veejay-client/src/curve.c +++ b/veejay-current/veejay-client/src/curve.c @@ -41,17 +41,17 @@ void set_points_in_curve( int type, GtkWidget *curve) } -int set_points_in_curve_ext( GtkWidget *curve, unsigned char *blob, int id, int fx_entry, int *lo, int *hi, int *curve_type) +int set_points_in_curve_ext( GtkWidget *curve, unsigned char *blob, int id, int fx_entry, int *lo, int *hi, int *curve_type, int *status) { int parameter_id = 0; int start = 0, end =0,type=0; int entry = 0; - int n = sscanf( (char*) blob, "key%2d%2d%8d%8d%2d", &entry, ¶meter_id, &start, &end,&type ); + int n = sscanf( (char*) blob, "key%2d%2d%8d%8d%2d%2d", &entry, ¶meter_id, &start, &end,&type,status ); int len = end - start; int i; int min = 0, max = 0; - if(n != 5 || len <= 0 ) + if(n != 6 || len <= 0 ) { return -1; } @@ -59,7 +59,7 @@ int set_points_in_curve_ext( GtkWidget *curve, unsigned char *blob, int id, int _effect_get_minmax(id, &min, &max, parameter_id ); unsigned int k = 0; - unsigned char *in = blob + 25; + unsigned char *in = blob + 27; float *vec = (float*) vj_calloc(sizeof(float) * len ); for(i = start ; i < end; i ++ ) { diff --git a/veejay-current/veejay-client/src/curve.h b/veejay-current/veejay-client/src/curve.h index 07269131..948657ab 100644 --- a/veejay-current/veejay-client/src/curve.h +++ b/veejay-current/veejay-client/src/curve.h @@ -25,7 +25,7 @@ #define MAX_CHAIN_LEN 20 -int set_points_in_curve_ext( GtkWidget *curve, unsigned char *blob, int id, int fx_entry, int *lo, int *hi, int *ct); +int set_points_in_curve_ext( GtkWidget *curve, unsigned char *blob, int id, int fx_entry, int *lo, int *hi, int *ct, int *status); void set_points_in_curve( int type, GtkWidget *curve); void reset_curve( GtkWidget *curve ); void get_points_from_curve( GtkWidget *curve, int len, float *v ); diff --git a/veejay-current/veejay-client/src/vj-api.c b/veejay-current/veejay-client/src/vj-api.c index d98f8049..209d32bf 100644 --- a/veejay-current/veejay-client/src/vj-api.c +++ b/veejay-current/veejay-client/src/vj-api.c @@ -2387,6 +2387,7 @@ static void vj_kf_reset() reset_curve( curve ); set_toggle_button( "curve_toggleentry", 0 ); + set_toggle_button( "curve_toggleentry_param", 0); update_label_str( "curve_parameter",FX_PARAMETER_DEFAULT_NAME); } @@ -2409,6 +2410,7 @@ static void vj_kf_refresh() } else { set_toggle_button( "curve_toggleentry", 0 ); + set_toggle_button( "curve_toggleentry_param", 0 ); disable_widget( "frame_fxtree3" ); vj_kf_reset(); } @@ -2446,13 +2448,14 @@ static void update_curve_widget(const char *name) int blen = 0; int lo = 0, hi = 0, curve_type=0; int p = -1; + int status = 0; multi_vims( VIMS_SAMPLE_KF_GET, "%d %d",i,info->uc.selected_parameter_id ); unsigned char *blob = (unsigned char*) recv_vims( 8, &blen ); if( blob && blen > 0 ) { - p = set_points_in_curve_ext( curve, blob,id,i, &lo,&hi, &curve_type ); + p = set_points_in_curve_ext( curve, blob,id,i, &lo,&hi, &curve_type,&status ); if( p >= 0 ) { info->uc.selected_parameter_id = p; @@ -2467,6 +2470,7 @@ static void update_curve_widget(const char *name) default: set_toggle_button( "curve_typelinear", 1 ); break; } + set_toggle_button( "curve_toggleentry_param", status ); } } diff --git a/veejay-current/veejay-server/libstream/vj-tag.c b/veejay-current/veejay-server/libstream/vj-tag.c index e5b5ae55..c6164fcc 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.c +++ b/veejay-current/veejay-server/libstream/vj-tag.c @@ -2019,12 +2019,12 @@ void vj_tag_set_kf_type(int s1, int entry, int type ) } -int vj_tag_get_kf_tokens( int s1, int entry, int id, int *start,int *end, int *type) +int vj_tag_get_kf_tokens( int s1, int entry, int id, int *start,int *end, int *type, int *status) { vj_tag *tag = vj_tag_get(s1); if (!tag) return 0; - return keyframe_get_tokens( tag->effect_chain[entry]->kf,id, start,end,type); + return keyframe_get_tokens( tag->effect_chain[entry]->kf,id, start,end,type,status); } diff --git a/veejay-current/veejay-server/libstream/vj-tag.h b/veejay-current/veejay-server/libstream/vj-tag.h index 07d36cea..9092248a 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.h +++ b/veejay-current/veejay-server/libstream/vj-tag.h @@ -347,7 +347,7 @@ int vj_tag_true_size(); void *vj_tag_get_kf_port( int s1, int entry ); char *vj_tag_scan_devices( void ); -int vj_tag_get_kf_tokens( int s1, int entry, int id, int *start,int *end, int *type); +int vj_tag_get_kf_tokens( int s1, int entry, int id, int *start,int *end, int *type, int *status); int vj_tag_grab_blackframe(int t1, int duration, int median_radius,int mode ); int vj_tag_drop_blackframe(int t1); int vj_tag_num_devices(); diff --git a/veejay-current/veejay-server/veejay/vims.h b/veejay-current/veejay-server/veejay/vims.h index 95d60acb..5f47e7a8 100644 --- a/veejay-current/veejay-server/veejay/vims.h +++ b/veejay-current/veejay-server/veejay/vims.h @@ -170,6 +170,7 @@ enum { VIMS_SAMPLE_REC_STOP = 131, VIMS_SAMPLE_CHAIN_ENABLE = 112, VIMS_SAMPLE_CHAIN_DISABLE = 113, + VIMS_SAMPLE_KF_STATUS_PARAM = 142, VIMS_SAMPLE_UPDATE = 143, VIMS_SAMPLE_TOGGLE_LOOP = 144, VIMS_SAMPLE_KF_STATUS = 145, diff --git a/veejay-current/veejay-server/veejay/vj-event.c b/veejay-current/veejay-server/veejay/vj-event.c index 19d7defb..a0700e39 100644 --- a/veejay-current/veejay-server/veejay/vj-event.c +++ b/veejay-current/veejay-server/veejay/vj-event.c @@ -7812,8 +7812,8 @@ void vj_event_enable_audio(void *ptr, const char format[], va_list ap) void vj_event_disable_audio(void *ptr, const char format[], va_list ap) { - veejay_t *v = (veejay_t *)ptr; #ifdef HAVE_JACK + veejay_t *v = (veejay_t *)ptr; if (!v->audio_running ) { veejay_msg(0,"Veejay was started without audio."); @@ -10180,6 +10180,31 @@ void vj_event_get_keyframes( void *ptr, const char format[], va_list ap ) SEND_MSG( v, "00000000" ); } +void vj_event_set_kf_status_param( void *ptr, const char format[], va_list ap) +{ + int args[4]; + veejay_t *v = (veejay_t*)ptr; + + P_A(args,NULL,format,ap); + + if(args[0] == -1 && SAMPLE_PLAYING(v)) + args[0] = sample_size() - 1; + else if (args[0] == -1 && STREAM_PLAYING(v) ) + args[0] = vj_tag_size() - 1; + + if( args[0] == 0) + args[0] = v->uc->sample_id; + + if(SAMPLE_PLAYING(v)) + { + keyframe_set_param_status( args[0], args[1], args[2], args[3], 1 ); + } + else if (STREAM_PLAYING(v)) + { + keyframe_set_param_status( args[0], args[1], args[2], args[3], 0 ); + } +} + void vj_event_set_kf_status( void *ptr, const char format[], va_list ap ) { int args[3]; diff --git a/veejay-current/veejay-server/veejay/vj-event.h b/veejay-current/veejay-server/veejay/vj-event.h index 48d04d0a..fddc327d 100644 --- a/veejay-current/veejay-server/veejay/vj-event.h +++ b/veejay-current/veejay-server/veejay/vj-event.h @@ -291,6 +291,7 @@ void vj_event_set_macro_status( void *ptr, const char format[], va_list ap ); void vj_event_set_framerate( void *ptr, const char format[], va_list ap ); void vj_event_sync_correction( void *ptr,const char format[], va_list ap ); void vj_event_get_keyframes( void *ptr, const char format[], va_list ap ); +void vj_event_set_kf_status_param( void *ptr, const char format[], va_list ap ); void vj_event_set_kf_status( void *ptr, const char format[], va_list ap ); void vj_event_del_keyframes( void *ptr, const char format[], va_list ap ); void vj_event_reset_kf( void *ptr, const char format[], va_list ap); diff --git a/veejay-current/veejay-server/veejay/vj-eventman.c b/veejay-current/veejay-server/veejay/vj-eventman.c index 9b8541d6..7de7d14f 100644 --- a/veejay-current/veejay-server/veejay/vj-eventman.c +++ b/veejay-current/veejay-server/veejay/vj-eventman.c @@ -645,6 +645,23 @@ void vj_init_vevo_events(void) VIMS_ALLOW_ANY, NULL ); + index_map_[VIMS_SAMPLE_KF_STATUS_PARAM] = _new_event( + "%d %d %d %d", + VIMS_SAMPLE_KF_STATUS_PARAM, + "Change KF parameter status for entry X", + vj_event_set_kf_status_param, + 4, + VIMS_REQUIRE_ALL_PARAMS, + SAMPLE_ID_HELP, + 0, + "Entry ID", + 0, + "Parameter ID", + 0, + "Status", + 0, + NULL ); + index_map_[VIMS_SAMPLE_KF_STATUS] = _new_event( "%d %d %d", VIMS_SAMPLE_KF_STATUS, diff --git a/veejay-current/veejay-server/veejay/vjkf.c b/veejay-current/veejay-server/veejay/vjkf.c index 133a76ae..136fc7b5 100644 --- a/veejay-current/veejay-server/veejay/vjkf.c +++ b/veejay-current/veejay-server/veejay/vjkf.c @@ -1,7 +1,7 @@ /* * Linux VeeJay * - * Copyright(C)2002-2008 Niels Elburg < nwelburg@gmail.com> + * Copyright(C)2002-2016 Niels Elburg < nwelburg@gmail.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,7 +42,7 @@ * * * keyframe format: - * ( [frame_num1][value1][frame_num2][value2] ... [frame_numN][valueN] ) + * ( [frame_num1][value1][frame_num2][value2][status] ... [frame_numN][valueN] ) * * */ @@ -67,41 +67,46 @@ unsigned char *keyframe_pack( void *port, int parameter_id, int entry_id, int *r { int i,k=0; unsigned char *result = NULL; - - - int start = 0, end = 0, type =0; + int start = 0, end = 0, type =0, status = 0; char *k_s = extract_( "start", parameter_id ); char *k_e = extract_( "end", parameter_id ); char *k_t = extract_( "type", parameter_id ); + char *k_x = extract_( "status", parameter_id ); if( vevo_property_get( port, k_s, 0, &start ) != VEVO_NO_ERROR ) { - free(k_s); free(k_e); free(k_t); - return NULL; + free(k_s); free(k_e); free(k_t); free(k_x); + return NULL; } if( vevo_property_get( port, k_e, 0, &end ) != VEVO_NO_ERROR ) { - free(k_s); free(k_e); free(k_t); - return NULL; + free(k_s); free(k_e); free(k_t); free(k_x); + return NULL; } if( vevo_property_get( port, k_t, 0, &type ) != VEVO_NO_ERROR ) { - free(k_s); free(k_e); free(k_t); - return NULL; + free(k_s); free(k_e); free(k_t); free(k_x); + return NULL; + } + if( vevo_property_get( port, k_x, 0, &status ) != VEVO_NO_ERROR ) + { + free(k_s); free(k_e); free(k_t); free(k_x); + return NULL; } free(k_s); free(k_e); free(k_t); + free(k_x); int len = end - start; result = vj_calloc( (len*4) + 64 ); - sprintf( (char*) result,"key%02d%02d%08d%08d%02d", entry_id,parameter_id,start, end, type ); + sprintf( (char*) result,"key%02d%02d%08d%08d%02d%02d", entry_id,parameter_id,start, end, type, status ); - unsigned char *out = result + 25; + unsigned char *out = result + 27; for( i = start; i < end; i ++ ) { @@ -123,32 +128,72 @@ unsigned char *keyframe_pack( void *port, int parameter_id, int entry_id, int *r } k++; - /* else - { - unsigned char *buf = out + (4 * k); - buf[0] = 0; - buf[1] = 0; - buf[2] = 0; - buf[3] = 0; - k++; - }*/ - free(key); } - *rlen = 25 + (4 * k); + *rlen = 27 + (4 * k); - veejay_msg(VEEJAY_MSG_DEBUG, "KF %p pack: range=%d-%d, FX entry %d, P%d, type %d", - port,start,end, entry_id,parameter_id, type ); + veejay_msg(VEEJAY_MSG_DEBUG, "KF %p pack: range=%d-%d, FX entry %d, P%d, type %d status %d", + port,start,end, entry_id,parameter_id, type, status ); return result; } +int keyframe_get_param_status( int lookup, int fx_entry, int parameter_id, int is_sample ) +{ + void *port = NULL; + + if( is_sample ) { + port = sample_get_kf_port( lookup, fx_entry ); + } else { + port = vj_tag_get_kf_port( lookup, fx_entry ); + } + + if( port == NULL ) { + veejay_msg(0, "FX Entry %d does not have animated parameters", fx_entry ); + return 0; + } + + int status = 0; + char *k_x = extract_ ( "status", parameter_id ); + + vevo_property_get( port, k_x,0, &status ); + + free(k_x); + + return status; +} + + +void keyframe_set_param_status( int lookup, int fx_entry, int parameter_id, int status, int is_sample ) +{ + void *port = NULL; + int kf_status = status; + + if( is_sample ) { + port = sample_get_kf_port( lookup, fx_entry ); + } else { + port = vj_tag_get_kf_port( lookup, fx_entry ); + } + + if( port == NULL ) { + veejay_msg(0, "FX Entry %d does not have animated parameters", fx_entry ); + return; + } + + char *k_x = extract_( "status", parameter_id ); + + vevo_property_set( port, k_x, VEVO_ATOM_TYPE_INT,1, &kf_status ); + + free(k_x); +} + void keyframe_clear_entry( int lookup, int fx_entry, int parameter_id, int is_sample ) { int start = 0; int end = 0; int type = 0; + int status = 0; int i; void *port = NULL; @@ -167,10 +212,12 @@ void keyframe_clear_entry( int lookup, int fx_entry, int parameter_id, int is_sa char *k_s = extract_ ( "start", parameter_id ); char *k_e = extract_ ( "end", parameter_id ); char *k_t = extract_ ( "type", parameter_id ); + char *k_x = extract_ ( "status", parameter_id ); - vevo_property_get( port, k_s, 0, &start ); - vevo_property_get( port, k_e, 0, &end ); - vevo_property_get( port, k_t, 0,&type ); + vevo_property_get( port, k_s,0, &start ); + vevo_property_get( port, k_e,0, &end ); + vevo_property_get( port, k_t,0, &type ); + vevo_property_get( port, k_x,0, &status ); for(i = start ; i <= end; i ++ ) { @@ -182,10 +229,12 @@ void keyframe_clear_entry( int lookup, int fx_entry, int parameter_id, int is_sa vevo_property_del( port, k_s ); vevo_property_del( port, k_e ); vevo_property_del( port, k_t ); + vevo_property_del( port, k_x ); free(k_s); free(k_e); free(k_t); + free(k_x); } int keyframe_unpack( unsigned char *in, int len, int *entry, int lookup, int is_sample ) @@ -194,11 +243,12 @@ int keyframe_unpack( unsigned char *in, int len, int *entry, int lookup, int is int parameter_id = 0; int start = 0, end = 0, type = 0; int fx_entry = 0; - int n = sscanf( (char*) in, "key%2d%2d%8d%8d%2d", &fx_entry,¶meter_id, &start, &end,&type ); + int status = 0; + int n = sscanf( (char*) in, "key%2d%2d%8d%8d%2d%2d", &fx_entry,¶meter_id, &start, &end,&type,&status ); - if(n != 5 ) + if(n != 6 ) { - veejay_msg(0, "Unable to unpack parameter_id,start,end"); + veejay_msg(0, "Unable to unpack keyframe data"); return 0; } @@ -213,7 +263,7 @@ int keyframe_unpack( unsigned char *in, int len, int *entry, int lookup, int is port = vj_tag_get_kf_port( lookup, fx_entry ); } - in += (25); + in += (27); unsigned char *ptr = in; for(i = start ; i <= end; i ++ ) @@ -229,78 +279,84 @@ int keyframe_unpack( unsigned char *in, int len, int *entry, int lookup, int is char *k_s = extract_ ( "start", parameter_id ); char *k_e = extract_ ( "end", parameter_id ); char *k_t = extract_ ( "type", parameter_id ); + char *k_x = extract_ ( "status", parameter_id ); vevo_property_set( port, k_s, VEVO_ATOM_TYPE_INT,1, &start ); vevo_property_set( port, k_e, VEVO_ATOM_TYPE_INT,1, &end ); vevo_property_set( port, k_t, VEVO_ATOM_TYPE_INT,1, &type ); + vevo_property_set( port, k_x, VEVO_ATOM_TYPE_INT,1, &status ); free(k_s); free(k_e); free(k_t); - + free(k_x); + *entry = fx_entry; return 1; } -int keyframe_get_tokens( void *port, int parameter_id, int *start, int *end, int *type ) +int keyframe_get_tokens( void *port, int parameter_id, int *start, int *end, int *type, int *status ) { char *k_s = extract_ ( "start", parameter_id ); char *k_e = extract_ ( "end", parameter_id ); char *k_t = extract_ ( "type", parameter_id ); + char *k_x = extract_ ( "status", parameter_id ); if( vevo_property_get( port, k_s, 0, start ) != VEVO_NO_ERROR ) { - free(k_s); free(k_e); free(k_t); + free(k_s); free(k_e); free(k_t); free(k_x); return 0; } if( vevo_property_get( port, k_e, 0, end ) != VEVO_NO_ERROR ) { - free(k_s); free(k_e); free(k_t); + free(k_s); free(k_e); free(k_t); free(k_x); return 0; } if( vevo_property_get( port, k_t, 0, type ) != VEVO_NO_ERROR ) { - free(k_s); free(k_e); free(k_t); - return 0; + free(k_s); free(k_e); free(k_t); free(k_x); + return 0; } free(k_s); free(k_e); free(k_t); - + free(k_x); return 1; } - - - int keyframe_xml_pack( xmlNodePtr node, void *port, int parameter_id ) { int i; - - int start = 0, end = 0, type = 0; - - char *k_s = extract_ ( "start", parameter_id ); - char *k_e = extract_ ( "end", parameter_id ); - char *k_t = extract_ ( "type", parameter_id ); - + int start = 0, end = 0, type = 0, status = 0; + + char *k_s = extract_ ( "start", parameter_id ); + char *k_e = extract_ ( "end", parameter_id ); + char *k_t = extract_ ( "type", parameter_id ); + char *k_x = extract_ ( "status", parameter_id ); if( vevo_property_get( port, k_s, 0, &start ) != VEVO_NO_ERROR ) { - free(k_s); free(k_e); free(k_t); + free(k_s); free(k_e); free(k_t); free(k_x); return 0; } if( vevo_property_get( port, k_e, 0, &end ) != VEVO_NO_ERROR ) { - free(k_s); free(k_e); free(k_t); + free(k_s); free(k_e); free(k_t); free(k_x); return 0; } if( vevo_property_get( port, k_t, 0, &type ) != VEVO_NO_ERROR ) { - free(k_s); free(k_e);free(k_t); + free(k_s); free(k_e);free(k_t); free(k_x); return 0; } + if( vevo_property_get( port, k_x, 0, &status ) != VEVO_NO_ERROR ) + { + free(k_s); free(k_e);free(k_t); free(k_x); + return 0; + } + unsigned char xmlbuf[100]; @@ -310,6 +366,8 @@ int keyframe_xml_pack( xmlNodePtr node, void *port, int parameter_id ) xmlNewChild(node, NULL, (const xmlChar*) k_e, xmlbuf ); snprintf((char*)xmlbuf, 100,"%d", type ); xmlNewChild(node, NULL, (const xmlChar*) k_t, xmlbuf ); + snprintf((char*)xmlbuf, 100,"%d", status); + xmlNewChild(node, NULL, (const xmlChar*) k_x, xmlbuf ); for( i = start; i < end; i ++ ) { @@ -327,6 +385,7 @@ int keyframe_xml_pack( xmlNodePtr node, void *port, int parameter_id ) free( k_s); free( k_e); free( k_t); + free( k_x); return 1; } @@ -361,7 +420,7 @@ static int get_xml_2int( xmlDocPtr doc, xmlNodePtr node, int *second ) int keyframe_xml_unpack( xmlDocPtr doc, xmlNodePtr node, void *port ) { - int start = 0 , end = 0, type = 0; + int start = 0 , end = 0, type = 0, status = 0; int frame = 0; int nodes = 0; if(!node) @@ -385,13 +444,17 @@ int keyframe_xml_unpack( xmlDocPtr doc, xmlNodePtr node, void *port ) type = get_xml_int(doc,node); vevo_property_set(port,(char*)node->name, VEVO_ATOM_TYPE_INT,1,&type); } + else if ( !xmlStrncmp(node->name, (const xmlChar*) "status", 6)) + { + status = get_xml_int(doc,node); + vevo_property_set(port, (char*)node->name, VEVO_ATOM_TYPE_INT,1,&status); + } else if ( !xmlStrcmp(node->name, (const xmlChar*) "value" )) { int val = 0; int pid = get_xml_2int( doc, node, &val); char *key = keyframe_id( pid, start + frame ); - vevo_property_set( port, key, VEVO_ATOM_TYPE_INT, 1, &val ); free(key); @@ -411,15 +474,30 @@ int keyframe_xml_unpack( xmlDocPtr doc, xmlNodePtr node, void *port ) int get_keyframe_value(void *port, int n_frame, int parameter_id, int *result ) { + char *k_x = extract_ ( "status", parameter_id ); + int status= 0; + if( vevo_property_get( port, k_x, 0, &status ) != VEVO_NO_ERROR ) + { + free(k_x); + return 0; + } + + if( status == 0 ) { + free(k_x); + return 0; + } + char *key = keyframe_id( parameter_id, n_frame ); int error = vevo_property_get( port, key, 0, result ); if( error != VEVO_NO_ERROR ) { free(key); + free(k_x); return 0; } free(key); + free(k_x); return 1; } diff --git a/veejay-current/veejay-server/veejay/vjkf.h b/veejay-current/veejay-server/veejay/vjkf.h index 17115b14..8bb11c9e 100644 --- a/veejay-current/veejay-server/veejay/vjkf.h +++ b/veejay-current/veejay-server/veejay/vjkf.h @@ -23,15 +23,19 @@ #define VJKF_H unsigned char *keyframe_pack( void *port, int parameter_id, int entry_id, int *rlen ); -int keyframe_unpack( unsigned char *in, int len, int *entry, int lookup, int tag ); +int keyframe_unpack( unsigned char *in, int len, int *entry, int lookup, int tag ); -int keyframe_get_tokens( void *port, int parameter_id, int *start, int *end, int *type ); +int keyframe_get_tokens( void *port, int parameter_id, int *start, int *end, int *type, int *status ); -void keyframe_clear_entry( int lookup, int fx_entry, int parameter_id, int is_sample ); +void keyframe_clear_entry( int lookup, int fx_entry, int parameter_id, int is_sample ); -int keyframe_xml_pack( xmlNodePtr node, void *port, int parameter_id ); +int keyframe_xml_pack( xmlNodePtr node, void *port, int parameter_id ); -int keyframe_xml_unpack( xmlDocPtr doc, xmlNodePtr node, void *port ); +int keyframe_xml_unpack( xmlDocPtr doc, xmlNodePtr node, void *port ); -int get_keyframe_value(void *port, int n_frame, int parameter_id, int *result ); +int get_keyframe_value(void *port, int n_frame, int parameter_id, int *result ); + +int keyframe_get_param_status( int lookup, int fx_entry, int parameter_id, int is_sample ); + +void keyframe_set_param_status( int lookup, int fx_entry, int parameter_id, int status, int is_sample ); #endif