From 23fec4a67f95d403f647be6143e17e059fd76945 Mon Sep 17 00:00:00 2001 From: c0ntrol Date: Wed, 18 May 2016 19:48:42 +0200 Subject: [PATCH] issue #111, fix sequence slot indicator in reloaded, fix crash on deleting tag when it was mixing with a sample (and vice versa), fix leak in yuvconv, fix leak in plugin description cleanup, change status behaviour for current sequence slot; MAX_SEQUENCES indicates sequencer is turned off, any other value is a valid sequence index. --- veejay-current/veejay-client/src/vj-api.c | 13 ++++++----- .../veejay-server/libsample/sampleadm.c | 22 +++++++++++++++++++ .../veejay-server/libstream/vj-tag.c | 21 ++++++++++++++++++ .../veejay-server/libvje/effects/common.h | 3 +-- .../veejay-server/libvje/vj-effect.c | 12 ++++++---- veejay-current/veejay-server/libvje/vje.h | 2 +- veejay-current/veejay-server/libyuv/yuvconv.c | 13 ++++++++++- .../veejay-server/veejay/liblavplayvj.c | 5 +++-- 8 files changed, 75 insertions(+), 16 deletions(-) diff --git a/veejay-current/veejay-client/src/vj-api.c b/veejay-current/veejay-client/src/vj-api.c index 79be9a3c..8381af94 100644 --- a/veejay-current/veejay-client/src/vj-api.c +++ b/veejay-current/veejay-client/src/vj-api.c @@ -6537,17 +6537,18 @@ static void update_globalinfo(int *history, int pm, int last_pm) if( info->status_tokens[SEQ_CUR] != history[SEQ_CUR] ) { int in = info->status_tokens[SEQ_CUR]; - if( in ) + if( in < MAX_SEQUENCES ) { set_toggle_button( "seqactive" , 1 ); - } else + indicate_sequence( FALSE, info->sequencer_view->gui_slot[ info->sequence_playing ] ); + info->sequence_playing = in; + indicate_sequence( TRUE, info->sequencer_view->gui_slot[ info->sequence_playing ] ); + } + else { + indicate_sequence( FALSE, info->sequencer_view->gui_slot[ info->sequence_playing ] ); set_toggle_button( "seqactive" , 0 ); } - if(info->sequence_playing >= 0) - indicate_sequence( FALSE, info->sequencer_view->gui_slot[ info->sequence_playing ] ); - info->sequence_playing = in; - indicate_sequence( TRUE, info->sequencer_view->gui_slot[ info->sequence_playing ] ); } total_frames_ = (pm == MODE_STREAM ? info->status_tokens[SAMPLE_MARKER_END] : info->status_tokens[TOTAL_FRAMES] ); diff --git a/veejay-current/veejay-server/libsample/sampleadm.c b/veejay-current/veejay-server/libsample/sampleadm.c index 8b651e9e..563db41a 100644 --- a/veejay-current/veejay-server/libsample/sampleadm.c +++ b/veejay-current/veejay-server/libsample/sampleadm.c @@ -959,9 +959,11 @@ int sample_verify_delete( int sample_id, int sample_type ) { int i,j; int n = sample_highest(); + for( i = 1; i <= n; i ++ ) { sample_info *s = sample_get(i); + if(s) { for( j = 0 ; j < SAMPLE_MAX_EFFECTS; j ++ ) @@ -975,6 +977,26 @@ int sample_verify_delete( int sample_id, int sample_type ) } } } + + n = vj_tag_highest(); + for( i = 1; i <= n; i ++ ) + { + vj_tag *s = vj_tag_get(i); + if(s) + { + for( j = 0 ; j < SAMPLE_MAX_EFFECTS; j ++ ) + { + if(s->effect_chain[j]->channel == sample_id && + s->effect_chain[j]->source_type == sample_type ) + { + s->effect_chain[j]->channel = i; + s->effect_chain[j]->source_type = 1; + } + } + } + } + + return 1; } diff --git a/veejay-current/veejay-server/libstream/vj-tag.c b/veejay-current/veejay-server/libstream/vj-tag.c index c794f4f3..81e6d576 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.c +++ b/veejay-current/veejay-server/libstream/vj-tag.c @@ -1191,9 +1191,11 @@ int vj_tag_verify_delete(int id, int type ) { int i,j; int n = vj_tag_highest(); + for( i = 1; i <= n; i ++ ) { vj_tag *s = vj_tag_get(i); + if(s) { for( j = 0 ; j < SAMPLE_MAX_EFFECTS; j ++ ) @@ -1207,6 +1209,25 @@ int vj_tag_verify_delete(int id, int type ) } } } + + n = sample_highest(); + for( i = 1; i <= n; i ++ ) + { + sample_info *s = sample_get(i); + if(s) + { + for( j = 0 ; j < SAMPLE_MAX_EFFECTS; j ++ ) + { + if(s->effect_chain[j]->channel == id && + s->effect_chain[j]->source_type == type ) + { + s->effect_chain[j]->channel = i; + s->effect_chain[j]->source_type = 0; + } + } + } + } + return 1; } diff --git a/veejay-current/veejay-server/libvje/effects/common.h b/veejay-current/veejay-server/libvje/effects/common.h index c9de0b6f..fd244904 100644 --- a/veejay-current/veejay-server/libvje/effects/common.h +++ b/veejay-current/veejay-server/libvje/effects/common.h @@ -24,9 +24,9 @@ #include #include #include +#include #include #include -#include #define MAX_SCRATCH_FRAMES 50 #define GREY_LEVELS 256 #define func_opacity(a,b,p,q) ( ((a * p) + (b * q)) >> 8 ) @@ -76,7 +76,6 @@ extern void veejay_msg(int type, const char format[], ...); #define FEATHER( P, op0, aB, Q, op1 ) \ ( ( P * op0 ) + ALPHA_BLEND( aB, P, Q) * op1 ) >> 8; - #ifdef HAVE_ASM_3DNOW #define do_emms __asm__ __volatile__( "femms" :::"memory" ) #else diff --git a/veejay-current/veejay-server/libvje/vj-effect.c b/veejay-current/veejay-server/libvje/vj-effect.c index fb3449ff..cabaa3bd 100644 --- a/veejay-current/veejay-server/libvje/vj-effect.c +++ b/veejay-current/veejay-server/libvje/vj-effect.c @@ -728,11 +728,12 @@ void vj_effect_initialize(int width, int height, int full_range) n_ext_plugs_ = plug_sys_detect_plugins(); int p = 0; - int p_stop = VJ_PLUGIN + n_ext_plugs_; + const int p_stop = VJ_PLUGIN + n_ext_plugs_; - - for( p = VJ_PLUGIN; p < p_stop; p ++ ) + for( p = VJ_PLUGIN; p < p_stop; p ++ ) { vj_effects[p] = plug_get_plugin( p - VJ_PLUGIN ); + vj_effects[p]->is_plugin = 1; //@ to free description field in vj_effect_free + } } @@ -769,7 +770,10 @@ static void vj_effect_free(vj_effect *ve) { if(ve->limits[0]) free(ve->limits[0]); if(ve->limits[1]) free(ve->limits[1]); if(ve->defaults) free(ve->defaults); - if(ve->param_description) vj_effect_free_parameters( ve ); + if(ve->is_plugin) { + if(ve->description) free(ve->description); + } + if(ve->param_description) vj_effect_free_parameters( ve ); free(ve); } diff --git a/veejay-current/veejay-server/libvje/vje.h b/veejay-current/veejay-server/libvje/vje.h index 49d34c05..ae719b6d 100644 --- a/veejay-current/veejay-server/libvje/vje.h +++ b/veejay-current/veejay-server/libvje/vje.h @@ -99,13 +99,13 @@ typedef struct vj_effect_t { int n_out; int instance; void *user_data; - char padding[4]; int parallel; int rgba_only; int motion; int alpha; int global; int is_gen; + int is_plugin; } vj_effect; extern unsigned int get_pixel_range_min_Y(); diff --git a/veejay-current/veejay-server/libyuv/yuvconv.c b/veejay-current/veejay-server/libyuv/yuvconv.c index 6581775b..d970fab3 100644 --- a/veejay-current/veejay-server/libyuv/yuvconv.c +++ b/veejay-current/veejay-server/libyuv/yuvconv.c @@ -1364,7 +1364,18 @@ void yuv_free_swscaler(void *sws) sws_freeContext( s->sws ); s->sws = NULL; } - if(s) free(s); + if(s) { + if(s->dst_filter) + { + sws_freeFilter( s->dst_filter ); + s->dst_filter = NULL; + } + if(s->src_filter) { + sws_freeFilter( s->src_filter ); + s->src_filter = NULL; + } + free(s); + } sws = NULL; } } diff --git a/veejay-current/veejay-server/veejay/liblavplayvj.c b/veejay-current/veejay-server/veejay/liblavplayvj.c index 51f0a434..bc2cc66b 100644 --- a/veejay-current/veejay-server/veejay/liblavplayvj.c +++ b/veejay-current/veejay-server/veejay/liblavplayvj.c @@ -1105,6 +1105,7 @@ static void veejay_pipe_write_status(veejay_t * info) int mstatus = vj_event_macro_status(); int curfps = (int) ( 100.0f / settings->spvf ); int total_slots = n_samples; + int seq_cur = (info->seq->active ? info->seq->current : MAX_SEQUENCES ); if(tags>0) total_slots+=tags; @@ -1116,7 +1117,7 @@ static void veejay_pipe_write_status(veejay_t * info) pm = VJ_PLAYBACK_MODE_PATTERN; if( sample_chain_sprint_status - (info->uc->sample_id, tags,cache_used,info->seq->size,info->seq->active,info->real_fps,settings->current_frame_num, pm, total_slots,info->seq->rec_id,curfps,settings->cycle_count[0],settings->cycle_count[1],mstatus,info->status_what ) != 0) + (info->uc->sample_id, tags,cache_used,info->seq->size,seq_cur,info->real_fps,settings->current_frame_num, pm, total_slots,info->seq->rec_id,curfps,settings->cycle_count[0],settings->cycle_count[1],mstatus,info->status_what ) != 0) { veejay_msg(VEEJAY_MSG_ERROR, "Fatal error, tried to collect properties of invalid sample"); veejay_change_state( info, LAVPLAY_STATE_STOP ); @@ -1161,7 +1162,7 @@ static void veejay_pipe_write_status(veejay_t * info) } break; case VJ_PLAYBACK_MODE_TAG: - if( vj_tag_sprint_status( info->uc->sample_id,n_samples,cache_used,info->seq->size,info->seq->active, info->real_fps, + if( vj_tag_sprint_status( info->uc->sample_id,n_samples,cache_used,info->seq->size,seq_cur, info->real_fps, settings->current_frame_num, info->uc->playback_mode,total_slots,info->seq->rec_id,curfps,settings->cycle_count[0],settings->cycle_count[1],mstatus, info->status_what ) != 0 ) { veejay_msg(VEEJAY_MSG_ERROR, "Invalid status!");