mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-14 03:39:58 +01:00
count size of hash when value changes
This commit is contained in:
@@ -71,7 +71,8 @@
|
||||
#define VJ_IMAGE_EFFECT_MAX vj_effect_get_max_i()
|
||||
#define VJ_VIDEO_EFFECT_MIN vj_effect_get_min_v()
|
||||
#define VJ_VIDEO_EFFECT_MAX vj_effect_get_max_v()
|
||||
|
||||
static int recount_hash = 1;
|
||||
static unsigned int sample_count = 0;
|
||||
static int this_sample_id = 0; /* next available sample id */
|
||||
static int next_avail_num = 0; /* available sample id */
|
||||
static int initialized = 0; /* whether we are initialized or not */
|
||||
@@ -89,8 +90,11 @@ extern int veejay_sprintf( char *s, size_t size, const char *format, ... );
|
||||
|
||||
unsigned int sample_size()
|
||||
{
|
||||
// return this_sample_id;
|
||||
return (unsigned int) hash_count( SampleHash );
|
||||
if(recount_hash) {
|
||||
sample_count = (unsigned int) hash_count( SampleHash );
|
||||
recount_hash = 0;
|
||||
}
|
||||
return sample_count;
|
||||
}
|
||||
|
||||
int sample_highest()
|
||||
@@ -384,6 +388,8 @@ sample_info *sample_skeleton_new(long startFrame, long endFrame)
|
||||
|
||||
si->macro = vj_macro_new();
|
||||
|
||||
recount_hash = 1;
|
||||
|
||||
return si;
|
||||
}
|
||||
|
||||
@@ -503,10 +509,6 @@ int sample_copy(int sample_id)
|
||||
|
||||
for (i = 0; i < SAMPLE_MAX_EFFECTS; i++)
|
||||
{
|
||||
// copy->effect_chain[i] =
|
||||
// (sample_eff_chain *) vj_malloc(sizeof(sample_eff_chain));
|
||||
//
|
||||
|
||||
copy->effect_chain[i] = &b[i];
|
||||
|
||||
if (copy->effect_chain[i] == NULL)
|
||||
@@ -529,6 +531,8 @@ int sample_copy(int sample_id)
|
||||
if (sample_store(copy) != 0)
|
||||
return 0;
|
||||
|
||||
recount_hash = 1;
|
||||
|
||||
return copy->sample_id;
|
||||
}
|
||||
|
||||
@@ -1077,6 +1081,8 @@ int sample_del(int sample_id)
|
||||
|
||||
free(si);
|
||||
|
||||
recount_hash = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@
|
||||
#define SOURCE_NAME_LEN 255
|
||||
|
||||
#include <libplugger/plugload.h>
|
||||
static int recount_hash = 1;
|
||||
static unsigned int sample_count = 0;
|
||||
static veejay_t *_tag_info = NULL;
|
||||
static hash_t *TagHash = NULL;
|
||||
static int this_tag_id = 0;
|
||||
@@ -168,8 +170,11 @@ int vj_tag_highest_valid_id()
|
||||
|
||||
unsigned int vj_tag_size()
|
||||
{
|
||||
// return this_tag_id;
|
||||
return (unsigned int) hash_count( TagHash );
|
||||
if(recount_hash) {
|
||||
sample_count = (unsigned int) hash_count( TagHash );
|
||||
recount_hash = 0;
|
||||
}
|
||||
return sample_count;
|
||||
}
|
||||
|
||||
void vj_tag_set_veejay_t(void *info) {
|
||||
@@ -1170,6 +1175,7 @@ int vj_tag_new(int type, char *filename, int stream_nr, editlist * el, int pix_f
|
||||
tag->macro = vj_macro_new();
|
||||
|
||||
tag_cache[ tag->id ] = (void*) tag;
|
||||
recount_hash = 1;
|
||||
|
||||
return (int)(tag->id);
|
||||
}
|
||||
@@ -1383,6 +1389,7 @@ int vj_tag_del(int id)
|
||||
next_avail_tag++;
|
||||
|
||||
tag_cache[ id ] = NULL;
|
||||
recount_hash = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user