mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-20 14:50:01 +01:00
fix memory leaks, bump version
git-svn-id: svn://code.dyne.org/veejay/trunk@837 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
@@ -148,6 +148,8 @@ typedef struct jack_driver_s
|
||||
/* variables used for trying to restart the connection to jack */
|
||||
bool jackd_died; /* true if jackd has died and we should try to restart it */
|
||||
struct timeval last_reconnect_attempt;
|
||||
|
||||
char *wave_buffer;
|
||||
} jack_driver_t;
|
||||
|
||||
|
||||
@@ -514,7 +516,8 @@ static int JACK_callback (nframes_t nframes, void *arg)
|
||||
TRACE("numFramesToWrite == inputFramesAvailable, advancing to next header\n");
|
||||
#endif
|
||||
|
||||
free(this->pPlayPtr->pData); /* free the data we've played */
|
||||
// free(this->pPlayPtr->pData); /* free the data we've played */
|
||||
this->pPlayPtr->size = 0;
|
||||
this->playptr_offset = 0;
|
||||
pOldHeader = this->pPlayPtr;
|
||||
this->pPlayPtr = this->pPlayPtr->pNext;
|
||||
@@ -619,7 +622,7 @@ static int JACK_callback (nframes_t nframes, void *arg)
|
||||
while(wh)
|
||||
{
|
||||
wh = wh->pNext;
|
||||
free(this->pPlayPtr->pData); /* free up the app data */
|
||||
// free(this->pPlayPtr->pData); /* free up the app data */
|
||||
free(this->pPlayPtr); /* free the structure itself */
|
||||
this->pPlayPtr = wh;
|
||||
}
|
||||
@@ -787,6 +790,8 @@ static int JACK_OpenDevice(jack_driver_t* this)
|
||||
this->buffer_size = 0;
|
||||
this->playptr_offset = 0;
|
||||
|
||||
this->wave_buffer = (char*) vj_calloc( 16384 * 4 * sizeof(char));
|
||||
|
||||
/* set up an error handler */
|
||||
jack_set_error_function(JACK_Error);
|
||||
|
||||
@@ -1182,6 +1187,10 @@ int JACK_Close(int deviceID)
|
||||
|
||||
first_free_device--; /* decrement device count */
|
||||
|
||||
if(this->wave_buffer)
|
||||
free(this->wave_buffer);
|
||||
this->wave_buffer = NULL;
|
||||
|
||||
releaseDriver(this);
|
||||
return 0;
|
||||
}
|
||||
@@ -1221,7 +1230,8 @@ long JACK_Write(int deviceID, char *data, unsigned long bytes)
|
||||
//ERR("error allocating memory for newWaveHeader\n");
|
||||
}
|
||||
|
||||
newWaveHeader->pData = (char*)vj_malloc(sizeof(char) * bytes); /* allocate memory for the data */
|
||||
// newWaveHeader->pData = (char*)vj_malloc(sizeof(char) * bytes); /* allocate memory for the data */
|
||||
newWaveHeader->pData = this->wave_buffer;
|
||||
veejay_memcpy(newWaveHeader->pData, data, sizeof(char) * bytes); /* copy in the data */
|
||||
newWaveHeader->size = bytes; /* update the size */
|
||||
newWaveHeader->pNext = 0; /* setup the next pointer to point to null */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl AC_INIT
|
||||
AC_INIT([veejay],[0.9.26],[veejay-users@lists.sourceforge.net])
|
||||
AC_INIT([veejay],[0.9.27],[veejay-users@lists.sourceforge.net])
|
||||
AC_PREREQ(2.57)
|
||||
AC_CONFIG_SRCDIR([veejay/veejay.c])
|
||||
|
||||
VEEJAY_MAJOR_VERSION=0
|
||||
VEEJAY_MINOR_VERSION=9
|
||||
VEEJAY_MICRO_VERSION=26
|
||||
VEEJAY_MICRO_VERSION=27
|
||||
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])
|
||||
|
||||
@@ -113,20 +113,18 @@ void *init_cache( unsigned int n_slots )
|
||||
{
|
||||
if(n_slots <= 0)
|
||||
return NULL;
|
||||
|
||||
cache_t *v = (cache_t*) vj_malloc(sizeof(cache_t));
|
||||
cache_t *v = (cache_t*) vj_calloc(sizeof(cache_t));
|
||||
v->len = n_slots;
|
||||
v->cache = (cache_slot_t**) vj_malloc(sizeof(cache_slot_t*) * v->len );
|
||||
v->cache = (cache_slot_t**) vj_calloc(sizeof(cache_slot_t*) * v->len );
|
||||
if(!v->cache)
|
||||
{
|
||||
free(v);
|
||||
return NULL;
|
||||
}
|
||||
veejay_memset( v->cache, 0, sizeof(cache_slot_t*) * v->len );
|
||||
|
||||
v->index = (long*) malloc(sizeof(long) * v->len );
|
||||
veejay_memset( v->index, -1, sizeof(long) * v->len );
|
||||
|
||||
v->index = (long*) vj_malloc(sizeof(long) * v->len );
|
||||
int n;
|
||||
for( n = 0; n < v->len ; n ++ )
|
||||
v->index[n] = -1;
|
||||
return (void*) v;
|
||||
}
|
||||
|
||||
@@ -135,9 +133,9 @@ void reset_cache(void *cache)
|
||||
int i = 0;
|
||||
cache_t *v = (cache_t*) cache;
|
||||
|
||||
veejay_memset( v->index, -1, sizeof(long) * v->len );
|
||||
for( i = 0; i < v->len; i ++ )
|
||||
{
|
||||
v->index[i] = -1;
|
||||
if( v->cache[i] )
|
||||
{
|
||||
total_mem_used_ -= v->cache[i]->size;
|
||||
@@ -145,7 +143,7 @@ void reset_cache(void *cache)
|
||||
free(v->cache[i]->buffer);
|
||||
free(v->cache[i]);
|
||||
v->cache[i] = NULL;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,6 +160,7 @@ void free_cache(void *cache)
|
||||
free(v->cache);
|
||||
free(v->index);
|
||||
free(v);
|
||||
v = NULL;
|
||||
}
|
||||
|
||||
void cache_frame( void *cache, uint8_t *linbuf, int buflen, long frame_num , int decoder_id)
|
||||
@@ -194,6 +193,10 @@ uint8_t *get_cached_frame( void *cache, long frame_num, int *buf_len, int *decod
|
||||
return NULL;
|
||||
|
||||
cache_slot_t *data = v->cache[ slot ];
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( data->size > 0 );
|
||||
assert( data->buffer != NULL );
|
||||
#endif
|
||||
|
||||
*buf_len = data->size;
|
||||
*decoder_id = data->fmt;
|
||||
|
||||
@@ -337,13 +337,20 @@ void vj_el_break_cache( editlist *el )
|
||||
{
|
||||
if( el->cache )
|
||||
free_cache( el->cache );
|
||||
el->cache = NULL;
|
||||
}
|
||||
|
||||
static int never_cache_ = 0;
|
||||
void vj_el_set_caching(int status)
|
||||
{
|
||||
never_cache_ = status;
|
||||
}
|
||||
|
||||
//@ iterateovers over sample fx chain
|
||||
void vj_el_setup_cache( editlist *el )
|
||||
{
|
||||
if(!el->cache)
|
||||
//@ FIXME: user setting to prevent cache setup!
|
||||
if(!el->cache && !never_cache_)
|
||||
{
|
||||
int n_slots = mem_chunk_ / el->max_frame_size;
|
||||
if( n_slots < (el->video_frames - 1) )
|
||||
@@ -454,7 +461,6 @@ vj_decoder *_el_new_decoder( int id , int width, int height, float fps, int pixe
|
||||
|
||||
veejay_memset( d->deinterlace_buffer[0], 0, width * height * 3 );
|
||||
|
||||
d->ref = 1;
|
||||
return d;
|
||||
}
|
||||
|
||||
@@ -1527,28 +1533,6 @@ editlist *vj_el_dummy(int flags, int deinterlace, int chroma, char norm, int wid
|
||||
return el;
|
||||
}
|
||||
|
||||
void vj_el_close( editlist *el )
|
||||
{
|
||||
int i;
|
||||
for ( i = 0; i < el->num_video_files; i ++ )
|
||||
{
|
||||
if(!el->ref[i])
|
||||
{
|
||||
if( el->lav_fd[i] )
|
||||
{
|
||||
lav_close( el->lav_fd[i] );
|
||||
}
|
||||
}
|
||||
if( el->video_file_list[i]) free(el->video_file_list[i]);
|
||||
}
|
||||
if( el->cache )
|
||||
free_cache( el->cache );
|
||||
|
||||
if( el->frame_list )
|
||||
free(el->frame_list );
|
||||
free(el);
|
||||
}
|
||||
|
||||
editlist *vj_el_init_with_args(char **filename, int num_files, int flags, int deinterlace, int force ,char norm , int fmt)
|
||||
{
|
||||
editlist *el = vj_malloc(sizeof(editlist));
|
||||
@@ -1796,34 +1780,38 @@ editlist *vj_el_init_with_args(char **filename, int num_files, int flags, int de
|
||||
|
||||
void vj_el_free(editlist *el)
|
||||
{
|
||||
if(el)
|
||||
#ifndef STRICT_CHECKING
|
||||
if(!el)
|
||||
return;
|
||||
#else
|
||||
assert( el != NULL );
|
||||
#endif
|
||||
int i;
|
||||
if(el->is_clone)
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < MAX_EDIT_LIST_FILES ; i++ )
|
||||
for( i = 0; i < el->num_video_files; i ++ )
|
||||
{
|
||||
if( el->video_file_list[i] && el->lav_fd[i])
|
||||
free(el->video_file_list[i]);
|
||||
/* close fd if ref counter is zero */
|
||||
if(!el->ref && el->lav_fd[i])
|
||||
lav_close( el->lav_fd[i]);
|
||||
if( el->video_file_list[i])
|
||||
free(el->video_file_list[i] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( i = 0; i < el->num_video_files; i ++ )
|
||||
{
|
||||
if( el->lav_fd[i] )
|
||||
lav_close( el->lav_fd[i] );
|
||||
if( el->video_file_list[i]) free(el->video_file_list[i]);
|
||||
}
|
||||
if(el->frame_list)
|
||||
free(el->frame_list);
|
||||
if(el->cache)
|
||||
free_cache(el->cache);
|
||||
free(el);
|
||||
el = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void vj_el_ref(editlist *el, int n)
|
||||
{
|
||||
el->ref[n]++;
|
||||
}
|
||||
void vj_el_unref(editlist *el, int n)
|
||||
{
|
||||
if(el->ref[n])
|
||||
el->ref[n]--;
|
||||
if( el->cache )
|
||||
free_cache( el->cache );
|
||||
if( el->frame_list )
|
||||
free(el->frame_list );
|
||||
free(el);
|
||||
|
||||
el = NULL;
|
||||
}
|
||||
|
||||
void vj_el_print(editlist *el)
|
||||
@@ -2104,10 +2092,9 @@ void vj_el_frame_cache(int n )
|
||||
|
||||
editlist *vj_el_soft_clone(editlist *el)
|
||||
{
|
||||
editlist *clone = (editlist*) vj_malloc(sizeof(editlist));
|
||||
veejay_memset( clone, 0, sizeof(editlist));
|
||||
editlist *clone = (editlist*) vj_calloc(sizeof(editlist));
|
||||
if(!clone)
|
||||
return 0;
|
||||
return NULL;
|
||||
clone->is_empty = el->is_empty;
|
||||
clone->has_video = el->has_video;
|
||||
clone->video_width = el->video_width;
|
||||
@@ -2125,15 +2112,12 @@ editlist *vj_el_soft_clone(editlist *el)
|
||||
clone->num_video_files = el->num_video_files;
|
||||
clone->max_frame_size = el->max_frame_size;
|
||||
clone->MJPG_chroma = el->MJPG_chroma;
|
||||
|
||||
clone->frame_list = NULL;
|
||||
clone->last_afile = el->last_afile;
|
||||
clone->last_apos = el->last_apos;
|
||||
clone->auto_deinter = el->auto_deinter;
|
||||
clone->pixel_format = el->pixel_format;
|
||||
// int n_slots = mem_chunk_ / el->max_frame_size;
|
||||
// clone->cache = init_cache( n_slots );
|
||||
// veejay_msg(VEEJAY_MSG_DEBUG, "EditList caches at most %d frames", n_slots );
|
||||
clone->is_clone = 1;
|
||||
int i;
|
||||
for( i = 0; i < MAX_EDIT_LIST_FILES; i ++ )
|
||||
{
|
||||
@@ -2145,7 +2129,6 @@ editlist *vj_el_soft_clone(editlist *el)
|
||||
{
|
||||
clone->video_file_list[i] = strdup( el->video_file_list[i] );
|
||||
clone->lav_fd[i] = el->lav_fd[i];
|
||||
clone->ref[i] = 1; // clone starts with ref count of 1
|
||||
clone->num_frames[i] = el->num_frames[i];
|
||||
clone->yuv_taste[i] =el->yuv_taste[i];
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ typedef struct
|
||||
|
||||
char *(video_file_list[MAX_EDIT_LIST_FILES]);
|
||||
lav_file_t *(lav_fd[MAX_EDIT_LIST_FILES]);
|
||||
int ref[MAX_EDIT_LIST_FILES];
|
||||
int yuv_taste[MAX_EDIT_LIST_FILES];
|
||||
|
||||
long num_frames[MAX_EDIT_LIST_FILES];
|
||||
@@ -73,6 +72,8 @@ typedef struct
|
||||
|
||||
int pixel_format;
|
||||
void *cache;
|
||||
|
||||
int is_clone;
|
||||
} editlist;
|
||||
|
||||
int test_video_frame( lav_file_t *lav,int out_pix_fmt);
|
||||
@@ -118,10 +119,6 @@ void vj_el_frame_cache(int n);
|
||||
|
||||
void vj_el_show_formats(void);
|
||||
|
||||
void vj_el_ref(editlist *el, int num);
|
||||
|
||||
void vj_el_unref(editlist *el, int num);
|
||||
|
||||
editlist *vj_el_dummy(int flags, int deinterlace, int chroma, char norm, int width, int height, float fps, int fmt);
|
||||
|
||||
int vj_el_get_file_entry( editlist *el,long *start_pos, long *end_pos, long entry );
|
||||
@@ -144,5 +141,6 @@ void vj_el_set_image_output_size(editlist *el);
|
||||
|
||||
int open_video_file(char *filename, editlist * el, int preserve_pathname, int deinter, int force, char override_norm);
|
||||
|
||||
void vj_el_set_caching(int status);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -69,7 +69,7 @@ static int next_avail_num = 0; /* available sample id */
|
||||
static int initialized = 0; /* whether we are initialized or not */
|
||||
static hash_t *SampleHash; /* hash of sample information structs */
|
||||
static int avail_num[SAMPLE_MAX_SAMPLES]; /* an array of freed sample id's */
|
||||
|
||||
static void *sample_font_ = NULL;
|
||||
static int sampleadm_state = SAMPLE_PEEK; /* default state */
|
||||
|
||||
typedef struct
|
||||
@@ -174,7 +174,7 @@ void *sample_get_dict( int sample_id )
|
||||
* call before using any other function as sample_skeleton_new
|
||||
*
|
||||
****************************************************************************************************/
|
||||
void sample_init(int len)
|
||||
void sample_init(int len, void *font)
|
||||
{
|
||||
if (!initialized) {
|
||||
int i;
|
||||
@@ -191,6 +191,8 @@ void sample_init(int len)
|
||||
chain_cache_ = vpn( 2000 ); //@ fx cache lines
|
||||
|
||||
}
|
||||
|
||||
sample_font_ = font;
|
||||
}
|
||||
|
||||
void sample_free()
|
||||
@@ -853,38 +855,46 @@ int sample_del(int sample_id)
|
||||
sample_info *si;
|
||||
si = sample_get(sample_id);
|
||||
if (!si)
|
||||
return -1;
|
||||
#ifdef HAVE_FREETYPE
|
||||
vj_font_dictionary_destroy( si->dict );
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
sample_node = hash_lookup(SampleHash, (void *) si->sample_id);
|
||||
if (sample_node) {
|
||||
int i;
|
||||
|
||||
|
||||
vj_el_clear_cache( si->edit_list );
|
||||
for(i=0; i < SAMPLE_MAX_EFFECTS; i++)
|
||||
{
|
||||
int i;
|
||||
vj_el_break_cache( si->edit_list ); //@ destroy cache, if any
|
||||
for(i=0; i < SAMPLE_MAX_EFFECTS; i++)
|
||||
{
|
||||
vevo_port_free( si->effect_chain[i]->kf );
|
||||
if (si->effect_chain[i])
|
||||
free(si->effect_chain[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// better not do this
|
||||
// if(si->edit_list)
|
||||
// vj_el_free(si->edit_list);
|
||||
if (si)
|
||||
free(si);
|
||||
/* store freed sample_id */
|
||||
avail_num[next_avail_num] = sample_id;
|
||||
next_avail_num++;
|
||||
hash_delete(SampleHash, sample_node);
|
||||
if(si->edit_list)
|
||||
vj_el_free(si->edit_list);
|
||||
|
||||
return 1;
|
||||
if(si->encoder_base )
|
||||
free(si->encoder_base );
|
||||
if(si->encoder_destination )
|
||||
free(si->encoder_destination );
|
||||
if(si->edit_list_file)
|
||||
free( si->edit_list_file );
|
||||
#ifdef HAVE_FREETYPE
|
||||
//font ?
|
||||
if( si->dict )
|
||||
vj_font_dictionary_destroy( sample_font_,si->dict );
|
||||
#endif
|
||||
free(si);
|
||||
|
||||
/* store freed sample_id */
|
||||
avail_num[next_avail_num] = sample_id;
|
||||
next_avail_num++;
|
||||
hash_delete(SampleHash, sample_node);
|
||||
|
||||
veejay_msg(VEEJAY_MSG_DEBUG, "Deleted sample %d",sample_id );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1245,10 +1255,10 @@ int sample_set_chain_channel(int s1, int position, int input)
|
||||
{
|
||||
sample_info *old = sample_get( sample->effect_chain[position]->channel );
|
||||
if(old)
|
||||
vj_el_clear_cache( old->edit_list );
|
||||
vj_el_break_cache( old->edit_list ); // no longer needed
|
||||
|
||||
if(new)
|
||||
vj_el_setup_cache( new->edit_list );
|
||||
if(new)
|
||||
vj_el_setup_cache( new->edit_list ); // setup new cache
|
||||
}
|
||||
}
|
||||
sample->effect_chain[position]->channel = input;
|
||||
@@ -1256,24 +1266,72 @@ int sample_set_chain_channel(int s1, int position, int input)
|
||||
return ( sample_update(sample,s1));
|
||||
}
|
||||
|
||||
int sample_stop_playing(int s1)
|
||||
static int sample_sample_used(sample_info *a, int b )
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < SAMPLE_MAX_EFFECTS; i ++ )
|
||||
{
|
||||
int src_type = a->effect_chain[i]->source_type;
|
||||
int id = a->effect_chain[i]->channel;
|
||||
if( src_type == 0 && id == b )
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sample_stop_playing(int s1, int new_s1)
|
||||
{
|
||||
sample_info *sample = sample_get(s1);
|
||||
sample_info *newsample = NULL;
|
||||
if( new_s1 )
|
||||
newsample = sample_get(new_s1);
|
||||
if (!sample)
|
||||
return -1;
|
||||
int i;
|
||||
vj_el_clear_cache( sample->edit_list );
|
||||
for( i = 0; i < SAMPLE_MAX_EFFECTS;i++ )
|
||||
return 0;
|
||||
if (new_s1 && !newsample)
|
||||
return 0;
|
||||
unsigned int i,j;
|
||||
|
||||
//@ stop playing, if new_s1
|
||||
|
||||
if( new_s1 == s1 )
|
||||
return 1;
|
||||
|
||||
int destroy_s1 = 1;
|
||||
|
||||
if( new_s1 )
|
||||
{
|
||||
int src_type = sample->effect_chain[i]->source_type;
|
||||
int id = sample->effect_chain[i]->channel;
|
||||
if( src_type == 0 && id > 0 )
|
||||
for( i = 0; i < SAMPLE_MAX_EFFECTS ; i ++ )
|
||||
{
|
||||
sample_info *second = sample_get( id );
|
||||
if(second)
|
||||
vj_el_clear_cache( second->edit_list );
|
||||
}
|
||||
}
|
||||
int src_type = newsample->effect_chain[i]->source_type;
|
||||
int id = newsample->effect_chain[i]->channel;
|
||||
if( src_type == 0 && id == s1 )
|
||||
destroy_s1 = 0; // no need to destroy cache, used by newsample
|
||||
}
|
||||
}
|
||||
|
||||
if(destroy_s1)
|
||||
vj_el_break_cache( sample->edit_list ); // break the cache
|
||||
|
||||
|
||||
if( new_s1 )
|
||||
{
|
||||
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 ID is not in newsample,
|
||||
if( !sample_sample_used( newsample, id ))
|
||||
{
|
||||
sample_info *second = sample_get( id );
|
||||
if(second) //@ get and destroy its cache
|
||||
vj_el_break_cache( second->edit_list );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ extern int sample_chain_malloc(int sample_id);
|
||||
extern int sample_chain_free(int sample_id);
|
||||
extern int sample_size();
|
||||
extern int sample_verify();
|
||||
extern void sample_init(int len);
|
||||
extern void sample_init(int len, void *font);
|
||||
extern int sample_update(sample_info *sample, int s1);
|
||||
#ifdef HAVE_XML2
|
||||
extern int sample_readFromFile(char *, void *ptr, void *font, void *el, int *id, int *mode);
|
||||
@@ -329,7 +329,7 @@ extern void sample_set_project(int fmt, int deinterlace, int flags, int f
|
||||
extern int sample_cache_used( int s1 );
|
||||
extern void sample_free();
|
||||
|
||||
extern int sample_stop_playing(int s1);
|
||||
extern int sample_stop_playing(int s1, int new_s1);
|
||||
extern int sample_start_playing(int s1, int no_cache);
|
||||
extern int sample_get_kf_tokens( int s1, int entry, int id, int *start,int *end, int *type);
|
||||
extern unsigned char *UTF8toLAT1(unsigned char *in);
|
||||
|
||||
@@ -83,6 +83,17 @@ void vj_tag_free(void)
|
||||
free( _temp_buffer[i] );
|
||||
_temp_buffer[i] = NULL;
|
||||
}
|
||||
|
||||
vj_tag_close_all();
|
||||
|
||||
if( vj_tag_input)
|
||||
free(vj_tag_input);
|
||||
|
||||
if( tag_encoder_buf )
|
||||
free( tag_encoder_buf );
|
||||
|
||||
vj_unicap_deinit(unicap_data_);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -325,6 +336,7 @@ int _vj_tag_new_net(vj_tag *tag, int stream_nr, int w, int h,int f, char *host,
|
||||
int _vj_tag_new_unicap( vj_tag * tag, int stream_nr, int width, int height,
|
||||
int norm, int palette, int freq, int channel)
|
||||
{
|
||||
char refname[100];
|
||||
veejay_msg(VEEJAY_MSG_DEBUG, "%s: %dx%d, channel=%d, stream id=%d",__FUNCTION__,width,height, channel,stream_nr );
|
||||
if (stream_nr < 0 || stream_nr > vj_tag_num_devices())
|
||||
{
|
||||
@@ -337,7 +349,7 @@ int _vj_tag_new_unicap( vj_tag * tag, int stream_nr, int width, int height,
|
||||
veejay_msg(0,"Unable to open device %d", channel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if(!vj_unicap_configure_device( vj_tag_input->unicap[stream_nr] ,
|
||||
palette, width,height))
|
||||
{
|
||||
@@ -347,6 +359,8 @@ int _vj_tag_new_unicap( vj_tag * tag, int stream_nr, int width, int height,
|
||||
}
|
||||
else
|
||||
veejay_msg(VEEJAY_MSG_DEBUG, "Configured device %d", channel);
|
||||
sprintf(refname, "%d",channel );
|
||||
tag->extra = strdup(refname);
|
||||
|
||||
|
||||
char **props = vj_unicap_get_list(
|
||||
@@ -596,7 +610,7 @@ int vj_tag_new(int type, char *filename, int stream_nr, editlist * el,
|
||||
switch (type) {
|
||||
case VJ_TAG_TYPE_V4L:
|
||||
sprintf(tag->source_name, "%s", filename );
|
||||
|
||||
|
||||
if (!_vj_tag_new_unicap
|
||||
(tag, stream_nr, w, h,el->video_norm, pix_fmt, extra,channel ))
|
||||
{
|
||||
@@ -752,7 +766,7 @@ int vj_tag_del(int id)
|
||||
if(!tag)
|
||||
return 0;
|
||||
#ifdef HAVE_TRUETYPE
|
||||
vj_font_dictionary_destroy(tag->dict);
|
||||
vj_font_dictionary_destroy(_tag_info->font ,tag->dict);
|
||||
#endif
|
||||
|
||||
if(tag->extra)
|
||||
@@ -813,7 +827,10 @@ int vj_tag_del(int id)
|
||||
if (tag->effect_chain[i])
|
||||
free(tag->effect_chain[i]);
|
||||
|
||||
if(tag) free(tag);
|
||||
if(tag->socket_frame)
|
||||
free(tag->socket_frame);
|
||||
|
||||
free(tag);
|
||||
avail_tag[ next_avail_tag] = id;
|
||||
next_avail_tag++;
|
||||
hash_delete(TagHash, tag_node);
|
||||
@@ -2652,6 +2669,7 @@ void tagParseStreamFX(char *sampleFile, xmlDocPtr doc, xmlNodePtr cur, void *fon
|
||||
|
||||
int fx_on=0, id=0, source_id=0, source_type=0;
|
||||
char *source_file = NULL;
|
||||
char *extra_data = NULL;
|
||||
int col[3] = {0,0,0};
|
||||
int fader_active=0, fader_val=0, fader_dir=0, opacity=0, nframes=0;
|
||||
#ifdef STRICT_CHECKING
|
||||
@@ -2676,6 +2694,9 @@ void tagParseStreamFX(char *sampleFile, xmlDocPtr doc, xmlNodePtr cur, void *fon
|
||||
source_type = tag_get_int_xml(doc,cur,"source_type" );
|
||||
if( !xmlStrcmp(cur->name, (const xmlChar*) "source_file" ) )
|
||||
source_file = tag_get_char_xml(doc,cur, "source_file");
|
||||
if( !xmlStrcmp(cur->name, (const xmlChar*) "extra_data" ))
|
||||
extra_data = tag_get_char_xml(doc,cur, "extra_data");
|
||||
|
||||
if(! xmlStrcmp(cur->name, (const xmlChar*) "red" ) )
|
||||
col[0] = tag_get_int_xml( doc,cur, "red" );
|
||||
if(! xmlStrcmp(cur->name, (const xmlChar*) "green" ) )
|
||||
@@ -2709,8 +2730,8 @@ void tagParseStreamFX(char *sampleFile, xmlDocPtr doc, xmlNodePtr cur, void *fon
|
||||
{
|
||||
int zer = 0;
|
||||
|
||||
if( source_type == VJ_TAG_TYPE_V4L && source_file )
|
||||
sscanf( source_file, "video%d",&zer );
|
||||
if( source_type == VJ_TAG_TYPE_V4L && extra_data )
|
||||
sscanf( extra_data, "%d",&zer );
|
||||
|
||||
vj_tag_del( id );
|
||||
|
||||
@@ -2882,6 +2903,9 @@ void tagCreateStream(xmlNodePtr node, vj_tag *tag, void *font)
|
||||
sprintf(buffer, "%s", tag->source_name );
|
||||
xmlNewChild(node,NULL,(const xmlChar*) "source_file", (const xmlChar*) buffer );
|
||||
|
||||
sprintf(buffer, "%s", tag->extra );
|
||||
xmlNewChild(node, NULL,(const xmlChar) "extra_data", (const xmlChar*) buffer );
|
||||
|
||||
sprintf(buffer, "%d", tag->color_r );
|
||||
xmlNewChild(node,NULL,(const xmlChar*) "red", (const xmlChar*) buffer );
|
||||
sprintf(buffer, "%d", tag->color_g );
|
||||
|
||||
@@ -175,9 +175,9 @@ typedef struct {
|
||||
|
||||
|
||||
//! \var port_ref_ Book keeping of allocated and freed ports
|
||||
#ifdef STRICT_CHECKING
|
||||
/*#ifdef STRICT_CHECKING
|
||||
static vevo_port_t *port_ref_ = NULL;
|
||||
#endif
|
||||
#endif*/
|
||||
static size_t atom_sizes_[100];
|
||||
|
||||
//! Check if an object is soft referenced
|
||||
@@ -372,8 +372,9 @@ for( i = 0; i < t->num_elements ; i ++ )\
|
||||
\return vevo_storage_t a new vevo_storage_t object
|
||||
*/
|
||||
static vevo_storage_t *vevo_new_storage(__vevo_port_t *port );
|
||||
|
||||
/*
|
||||
static int vevo_port_ref_verify( vevo_port_t *p) ;
|
||||
*/
|
||||
//! Copy a value into a new atom
|
||||
/*!
|
||||
\param port port
|
||||
@@ -513,6 +514,7 @@ static void vevo_port_add_property( vevo_port_t *p,int finalize, const char *key
|
||||
*/
|
||||
static void vevo_port_finalize( vevo_port_t *port, int port_type )
|
||||
{
|
||||
/*
|
||||
#ifdef STRICT_CHECKING
|
||||
if( port_type != VEVO_PORT_REFERENCES )
|
||||
{
|
||||
@@ -521,7 +523,8 @@ static void vevo_port_finalize( vevo_port_t *port, int port_type )
|
||||
sprintf(ref_key,"%p",port );
|
||||
vevo_property_set( port_ref_, ref_key, VEVO_ATOM_TYPE_INT, 1, &ref );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
if( port_type <= 1024 && port_type > 0 )
|
||||
vevo_port_add_property( port, 1,"type",VEVO_ATOM_TYPE_INT,1, &port_type );
|
||||
}
|
||||
@@ -1037,9 +1040,11 @@ vevo_port_t *vevo_port_new(int port_type, const char *func, int line_num)
|
||||
//! Initialize VeVo. Set up bookkeeping information to track Port construction and destruction
|
||||
void vevo_strict_init()
|
||||
{
|
||||
/*
|
||||
#ifdef STRICT_CHECKING
|
||||
port_ref_ = vevo_port_new( VEVO_PORT_REFERENCES, __FUNCTION__,__LINE__ );
|
||||
#endif
|
||||
*/
|
||||
memset( atom_sizes_,0,sizeof(atom_sizes_) );
|
||||
atom_sizes_[1] = sizeof(int32_t);
|
||||
atom_sizes_[2] = sizeof(double);
|
||||
@@ -1110,7 +1115,7 @@ static void vevo_port_free_(vevo_port_t * p)
|
||||
\return error code
|
||||
*/
|
||||
int vevo_port_verify( vevo_port_t *port )
|
||||
{
|
||||
{/*
|
||||
#ifdef STRICT_CHECKING
|
||||
if( port == port_ref_ )
|
||||
return 1;
|
||||
@@ -1139,6 +1144,7 @@ int vevo_port_verify( vevo_port_t *port )
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1161,6 +1167,7 @@ void vevo_port_free( vevo_port_t *port )
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
/*
|
||||
#ifdef STRICT_CHECKING
|
||||
char pkey[32];
|
||||
sprintf(pkey, "%p",port);
|
||||
@@ -1193,8 +1200,11 @@ void vevo_port_free( vevo_port_t *port )
|
||||
vevo_port_free_( port );
|
||||
}
|
||||
#else
|
||||
*/
|
||||
vevo_port_free_(port );
|
||||
/*
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
//! Check if a Property is soft referenced
|
||||
@@ -1592,6 +1602,7 @@ static vevo_storage_t **vevo_list_nodes_(vevo_port_t * p, int atype)
|
||||
//! Report statistics and free bookkeeping information
|
||||
void vevo_report_stats()
|
||||
{
|
||||
/*
|
||||
#ifdef STRICT_CHECKING
|
||||
if( port_ref_ )
|
||||
{
|
||||
@@ -1600,7 +1611,7 @@ void vevo_report_stats()
|
||||
veejay_msg(0,"%d VEVO ports are still referenced",errs);
|
||||
vevo_port_free( port_ref_ );
|
||||
}
|
||||
#endif
|
||||
#endif*/
|
||||
}
|
||||
|
||||
static int vevo_port_get_port( void *port, vevo_storage_t *item, void *res )
|
||||
@@ -1974,6 +1985,7 @@ static void vevo_port_recurse_free( vevo_port_t *sorted_port, vevo_port_t *p )
|
||||
static int vevo_port_ref_verify( vevo_port_t *p)
|
||||
{
|
||||
int err = 0;
|
||||
/*
|
||||
#ifdef STRICT_CHECKING
|
||||
char **item = NULL;
|
||||
int i;
|
||||
@@ -2016,6 +2028,8 @@ static int vevo_port_ref_verify( vevo_port_t *p)
|
||||
free(item);
|
||||
#endif
|
||||
return err;
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
static char *vevo_property_get_str( vevo_port_t *port, const char *key )
|
||||
{
|
||||
|
||||
@@ -80,7 +80,7 @@ void bathroom_verti_apply(VJFrame *frame, int width, int height, int val)
|
||||
{
|
||||
unsigned int i;
|
||||
const unsigned int len = frame->len;
|
||||
const unsigned int y_val = val;
|
||||
unsigned int y_val = val;
|
||||
unsigned int x,y;
|
||||
uint8_t *Y = frame->data[0];
|
||||
uint8_t *Cb = frame->data[1];
|
||||
@@ -90,6 +90,9 @@ void bathroom_verti_apply(VJFrame *frame, int width, int height, int val)
|
||||
veejay_memcpy( bathroom_frame[1], Cb, len);
|
||||
veejay_memcpy( bathroom_frame[2], Cr, len);
|
||||
|
||||
if( y_val <= 0 )
|
||||
y_val = 1;
|
||||
|
||||
for(y=0; y < height;y++) {
|
||||
for(x=0; x <width; x++) {
|
||||
i = (x + (x % y_val) - (y_val>>1)) + (y*width);
|
||||
@@ -108,7 +111,7 @@ void bathroom_hori_apply(VJFrame *frame, int width, int height, int val)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int len = (width * height);
|
||||
const unsigned int y_val = val;
|
||||
unsigned int y_val = val;
|
||||
uint8_t *Y = frame->data[0];
|
||||
uint8_t *Cb = frame->data[1];
|
||||
uint8_t *Cr = frame->data[2];
|
||||
@@ -118,6 +121,9 @@ void bathroom_hori_apply(VJFrame *frame, int width, int height, int val)
|
||||
veejay_memcpy( bathroom_frame[1], Cb, len);
|
||||
veejay_memcpy( bathroom_frame[2], Cr, len);
|
||||
|
||||
if( y_val <= 0 )
|
||||
y_val = 1;
|
||||
|
||||
for(y=0; y < height;y++) {
|
||||
for(x=0; x <width; x++) {
|
||||
i = ((y*width) + (y % y_val) - (y_val>>1)) + x;
|
||||
|
||||
@@ -36,7 +36,7 @@ static int g_map_width = 0;
|
||||
static int g_map_height = 0;
|
||||
static int g_cube_size = 0;
|
||||
static int g_cube_bits = 0;
|
||||
static uint8_t *g_dicemap;
|
||||
static uint8_t *g_dicemap=NULL;
|
||||
|
||||
void dice_create_map(int w, int h);
|
||||
|
||||
@@ -62,8 +62,6 @@ vj_effect *dices_init(int width, int height)
|
||||
ve->sub_format = 1;
|
||||
ve->extra_frame = 0;
|
||||
ve->has_user = 0;
|
||||
g_dicemap = (uint8_t *) vj_calloc(sizeof(uint8_t) * width * height);
|
||||
dice_create_map(width, height);
|
||||
return ve;
|
||||
}
|
||||
// FIXME: private
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <math.h>
|
||||
#include "widthmirror.h"
|
||||
|
||||
static int *plasma_table;
|
||||
static int *plasma_table = NULL;
|
||||
static int plasma_pos1 = 0;
|
||||
static int plasma_pos2 = 0;
|
||||
|
||||
@@ -62,6 +62,12 @@ void distortion_free() {
|
||||
if(plasma_table) free(plasma_table);
|
||||
}
|
||||
|
||||
void distortion_destroy()
|
||||
{
|
||||
if(plasma_table)
|
||||
free( plasma_table );
|
||||
}
|
||||
|
||||
/* the distortion effect comes originally from the demo effects collection,
|
||||
it is the plasma effect */
|
||||
|
||||
|
||||
@@ -28,4 +28,5 @@ vj_effect *distortion_init(int w, int h);
|
||||
void distortion_apply( VJFrame *frame, int width, int height, int n,
|
||||
int type);
|
||||
void distort_free();
|
||||
void distortion_destroy();
|
||||
#endif
|
||||
|
||||
@@ -119,12 +119,20 @@ vj_effect *rotozoom_init(int width, int height)
|
||||
test_roto2[8][i] = c * 4096.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return ve;
|
||||
}
|
||||
|
||||
void rotozoom_destroy()
|
||||
{
|
||||
int j;
|
||||
for (j = 0; j < 9; j++) {
|
||||
if( test_roto[j] )
|
||||
free(test_roto[j]);
|
||||
if( test_roto2[j]);
|
||||
free(test_roto2[j]);
|
||||
}
|
||||
}
|
||||
|
||||
int rotozoom_malloc(int width, int height)
|
||||
{
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
vj_effect *rotozoom_init(int width, int height);
|
||||
int rotozoom_malloc(int w, int h);
|
||||
void rotozoom_destroy();
|
||||
void rotozoom_free();
|
||||
void rotozoom_apply( VJFrame *frame, int width, int height, int mode,
|
||||
int rot, int zoom, int autom);
|
||||
|
||||
@@ -555,6 +555,10 @@ extern void colorhis_apply( VJFrame *frame, int w, int h, int v, int m, int i, i
|
||||
|
||||
extern void diff_destroy();
|
||||
|
||||
extern void distortion_destroy();
|
||||
|
||||
extern void rotozoom_destroy();
|
||||
|
||||
extern void timedistort_apply( VJFrame *frame, int w, int h, int val );
|
||||
|
||||
extern void chameleon_apply( VJFrame *frame, int w, int h, int mode, int refresh );
|
||||
|
||||
@@ -621,6 +621,8 @@ void vj_effect_shutdown() {
|
||||
}
|
||||
|
||||
diff_destroy();
|
||||
rotozoom_destroy();
|
||||
distortion_destroy();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ extern void vj_mem_init(void);
|
||||
|
||||
extern char *get_memcpy_descr( void );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
/*#ifdef STRICT_CHECKING
|
||||
extern void *vj_strict_malloc(unsigned int size, const char *f, int line );
|
||||
extern void *vj_strict_calloc(unsigned int size, const char *f, int line );
|
||||
#define vj_malloc(i) vj_strict_malloc(i, __FUNCTION__,__LINE__)
|
||||
@@ -25,7 +25,14 @@ extern void *vj_malloc_(unsigned int size);
|
||||
#define vj_malloc(i) vj_malloc_(i)
|
||||
extern void *vj_calloc_(unsigned int size );
|
||||
#define vj_calloc(i) vj_calloc_(i)
|
||||
#endif
|
||||
#endif*/
|
||||
|
||||
extern void *vj_malloc_(unsigned int size);
|
||||
#define vj_malloc(i) vj_malloc_(i)
|
||||
extern void *vj_calloc_(unsigned int size );
|
||||
#define vj_calloc(i) vj_calloc_(i)
|
||||
|
||||
|
||||
extern void *vj_yuvalloc( unsigned int w, unsigned int h );
|
||||
|
||||
extern void fast_memset_dirty(void * to, int val, size_t len);
|
||||
|
||||
@@ -47,10 +47,10 @@ typedef struct
|
||||
int r_index;
|
||||
int w_index;
|
||||
} vj_msg_hist;
|
||||
|
||||
/*
|
||||
static vj_msg_hist _message_history;
|
||||
static int _message_his_status = 0;
|
||||
|
||||
*/
|
||||
void veejay_set_debug_level(int level)
|
||||
{
|
||||
if(level)
|
||||
@@ -104,13 +104,13 @@ void veejay_msg(int type, const char format[], ...)
|
||||
// parse arguments
|
||||
va_start(args, format);
|
||||
vsnprintf(buf, sizeof(buf) - 1, format, args);
|
||||
|
||||
/*
|
||||
if(!_message_his_status)
|
||||
{
|
||||
veejay_memset( &_message_history , 0 , sizeof(vj_msg_hist));
|
||||
_message_his_status = 1;
|
||||
}
|
||||
|
||||
*/
|
||||
if(_color_level)
|
||||
{
|
||||
switch (type) {
|
||||
@@ -134,7 +134,7 @@ void veejay_msg(int type, const char format[], ...)
|
||||
fprintf(out,"%s %s %s\n", prefix, buf, TXT_END);
|
||||
else
|
||||
fprintf(out,"%s%s%s", TXT_GRE, buf, TXT_END );
|
||||
|
||||
/*
|
||||
if( _message_history.w_index < MAX_LINES )
|
||||
{
|
||||
if(type == 3)
|
||||
@@ -142,7 +142,7 @@ void veejay_msg(int type, const char format[], ...)
|
||||
else
|
||||
sprintf( sline, "%s\n", buf );
|
||||
_message_history.msg[_message_history.w_index ++ ] = strndup(sline,200);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -168,14 +168,14 @@ void veejay_msg(int type, const char format[], ...)
|
||||
else
|
||||
fprintf(out,"%s", buf );
|
||||
|
||||
if( _message_history.w_index < MAX_LINES )
|
||||
/* if( _message_history.w_index < MAX_LINES )
|
||||
{
|
||||
if(type == 3 )
|
||||
sprintf(sline, "%s", buf );
|
||||
else
|
||||
sprintf(sline, "%s\n", buf );
|
||||
_message_history.msg[_message_history.w_index ++ ] = strdup(sline);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ void veejay_msg(int type, const char format[], ...)
|
||||
char *veejay_pop_messages(int *num_lines, int *total_len)
|
||||
{
|
||||
char *res = NULL;
|
||||
if( _message_his_status == 0 )
|
||||
/* if( _message_his_status == 0 )
|
||||
return res;
|
||||
if( _message_history.w_index == 0 )
|
||||
return res;
|
||||
@@ -207,20 +207,23 @@ char *veejay_pop_messages(int *num_lines, int *total_len)
|
||||
}
|
||||
*total_len = len;
|
||||
_message_history.r_index ++;
|
||||
*/
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
int veejay_keep_messages(void)
|
||||
{
|
||||
if( _message_history.r_index )
|
||||
/* if( _message_history.r_index )
|
||||
return 0;
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
void veejay_reap_messages(void)
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < _message_history.w_index ; i ++ )
|
||||
/* for( i = 0; i < _message_history.w_index ; i ++ )
|
||||
{
|
||||
if( _message_history.msg[i] )
|
||||
{
|
||||
@@ -231,7 +234,7 @@ void veejay_reap_messages(void)
|
||||
|
||||
_message_his_status = 0;
|
||||
_message_history.w_index = 0;
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
int veejay_get_file_ext( char *file, char *dst, int dlen)
|
||||
|
||||
@@ -430,6 +430,8 @@ int veejay_free(veejay_t * info)
|
||||
|
||||
vj_event_stop();
|
||||
|
||||
sample_del_all();
|
||||
|
||||
vj_effect_shutdown();
|
||||
|
||||
vj_tag_free();
|
||||
@@ -470,6 +472,10 @@ int veejay_free(veejay_t * info)
|
||||
free(info->status_what);
|
||||
free(info->homedir);
|
||||
free(info->uc);
|
||||
if(info->cpumask)
|
||||
free(info->cpumask);
|
||||
if(info->mask)
|
||||
free(info->mask);
|
||||
free(settings);
|
||||
free(info);
|
||||
return 1;
|
||||
@@ -597,199 +603,199 @@ int veejay_init_editlist(veejay_t * info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void veejay_change_playback_mode( veejay_t *info, int new_pm, int sample_id )
|
||||
static int veejay_stop_playing_sample( veejay_t *info, int new_sample_id )
|
||||
{
|
||||
// if current is stream and playing network stream, close connection
|
||||
if( info->uc->playback_mode == VJ_PLAYBACK_MODE_SAMPLE )
|
||||
if(!sample_stop_playing( info->uc->sample_id, new_sample_id ) )
|
||||
{
|
||||
int cur_id = info->uc->sample_id;
|
||||
if( new_pm != info->uc->playback_mode ||
|
||||
( new_pm == VJ_PLAYBACK_MODE_SAMPLE && sample_id != cur_id ) )
|
||||
{
|
||||
sample_stop_playing( cur_id );
|
||||
}
|
||||
}
|
||||
|
||||
if( info->uc->playback_mode == VJ_PLAYBACK_MODE_TAG )
|
||||
{
|
||||
int cur_id = info->uc->sample_id;
|
||||
if( cur_id != sample_id )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_DEBUG, "Stop playing stream %d", cur_id);
|
||||
vj_tag_disable(cur_id);
|
||||
}
|
||||
}
|
||||
|
||||
if(new_pm == VJ_PLAYBACK_MODE_PLAIN )
|
||||
{
|
||||
int n = 0;
|
||||
if(info->uc->playback_mode==VJ_PLAYBACK_MODE_TAG)
|
||||
n = vj_tag_chain_free( info->uc->sample_id );
|
||||
if(info->uc->playback_mode == VJ_PLAYBACK_MODE_SAMPLE )
|
||||
n = sample_chain_free( info->uc->sample_id);
|
||||
info->uc->playback_mode = new_pm;
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Playing plain video now");
|
||||
info->edit_list = info->current_edit_list;
|
||||
video_playback_setup *settings = info->settings;
|
||||
settings->min_frame_num = 0;
|
||||
settings->max_frame_num = info->edit_list->video_frames-1;
|
||||
/*#ifdef HAVE_FREETYPE
|
||||
if(info->font)
|
||||
{
|
||||
void *dict = vj_font_get_plain_dict( info->font );
|
||||
vj_font_set_constraints_and_dict( info->font, settings->min_frame_num,
|
||||
settings->max_frame_num, info->edit_list->video_fps, dict );
|
||||
}
|
||||
#endif*/
|
||||
|
||||
}
|
||||
if(new_pm == VJ_PLAYBACK_MODE_TAG)
|
||||
{
|
||||
int tmp=0;
|
||||
// new mode is stream, see if sample_id is a network stream (if so, connect!)
|
||||
|
||||
if(!vj_tag_exists(sample_id ))
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "There is no stream with #%d", sample_id );
|
||||
return;
|
||||
}
|
||||
if( vj_tag_get_type( sample_id ) == VJ_TAG_TYPE_NET ||
|
||||
vj_tag_get_type( sample_id) == VJ_TAG_TYPE_MCAST ||
|
||||
vj_tag_get_type( sample_id) == VJ_TAG_TYPE_V4L )
|
||||
{
|
||||
if(vj_tag_enable( sample_id )<= 0 )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Unable to activate network stream!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(info->uc->playback_mode==VJ_PLAYBACK_MODE_SAMPLE)
|
||||
tmp = sample_chain_free(info->uc->sample_id);
|
||||
if( info->uc->playback_mode == VJ_PLAYBACK_MODE_TAG)
|
||||
{
|
||||
if(sample_id == info->uc->sample_id) return;
|
||||
tmp = vj_tag_chain_free(info->uc->sample_id);
|
||||
}
|
||||
tmp = vj_tag_chain_malloc( sample_id);
|
||||
info->uc->playback_mode = new_pm;
|
||||
veejay_set_sample(info,sample_id);
|
||||
}
|
||||
if(new_pm == VJ_PLAYBACK_MODE_SAMPLE)
|
||||
{
|
||||
int tmp =0;
|
||||
|
||||
if(info->uc->playback_mode==VJ_PLAYBACK_MODE_TAG)
|
||||
tmp = vj_tag_chain_free(info->uc->sample_id);
|
||||
if(info->uc->playback_mode==VJ_PLAYBACK_MODE_SAMPLE)
|
||||
{
|
||||
if(sample_id != info->uc->sample_id)
|
||||
tmp = sample_chain_free( info->uc->sample_id );
|
||||
}
|
||||
tmp = sample_chain_malloc( sample_id );
|
||||
info->uc->playback_mode = new_pm;
|
||||
veejay_set_sample(info, sample_id);
|
||||
veejay_msg(0, "There is no sample %d", new_sample_id );
|
||||
return 0;
|
||||
}
|
||||
int n = sample_chain_free( info->uc->sample_id );
|
||||
veejay_reset_el_buffer(info);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void veejay_set_sample(veejay_t * info, int sampleid)
|
||||
static void veejay_stop_playing_stream( veejay_t *info, int new_stream_id )
|
||||
{
|
||||
int start,end,speed,looptype;
|
||||
|
||||
|
||||
if ( info->uc->playback_mode == VJ_PLAYBACK_MODE_TAG)
|
||||
{
|
||||
vj_tag_disable( info->uc->sample_id );
|
||||
vj_tag_chain_free( info->uc->sample_id );
|
||||
}
|
||||
static int veejay_start_playing_sample( veejay_t *info, int sample_id )
|
||||
{
|
||||
int looptype,speed,start,end;
|
||||
video_playback_setup *settings = info->settings;
|
||||
if(!sample_exists(sample_id) )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Sample %d does not exist", sample_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!vj_tag_exists(sampleid))
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Stream %d does not exist", sampleid);
|
||||
return;
|
||||
}
|
||||
info->edit_list = sample_get_editlist( sample_id );
|
||||
veejay_reset_el_buffer(info);
|
||||
|
||||
// info->last_tag_id = sampleid;
|
||||
// info->uc->sample_id = sampleid;
|
||||
sample_start_playing( sample_id, info->no_caching );
|
||||
int tmp = sample_chain_malloc( sample_id );
|
||||
|
||||
if(info->settings->current_playback_speed==0)
|
||||
veejay_set_speed(info, 1);
|
||||
sample_get_short_info( sample_id , &start,&end,&looptype,&speed);
|
||||
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Playing Stream %d",sampleid);
|
||||
|
||||
vj_tag_set_active( sampleid, 1 );
|
||||
|
||||
info->uc->render_changed = 1;
|
||||
settings->min_frame_num = 0;
|
||||
settings->max_frame_num = vj_tag_get_n_frames( sampleid );
|
||||
settings->min_frame_num = 0;
|
||||
settings->max_frame_num = info->edit_list->video_frames - 1;
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
if(info->font && sampleid != info->uc->sample_id)
|
||||
{
|
||||
void *dict = vj_tag_get_dict( sampleid );
|
||||
vj_font_set_constraints_and_dict( info->font, settings->min_frame_num,
|
||||
settings->max_frame_num, info->edit_list->video_fps, dict );
|
||||
veejay_msg(VEEJAY_MSG_DEBUG, "Subtitling tag %d: %ld - %ld", sampleid,
|
||||
settings->min_frame_num, settings->max_frame_num );
|
||||
}
|
||||
#endif
|
||||
info->last_tag_id = sampleid;
|
||||
info->uc->sample_id = sampleid;
|
||||
|
||||
info->edit_list = info->current_edit_list;
|
||||
veejay_reset_el_buffer(info);
|
||||
}
|
||||
else if( info->uc->playback_mode == VJ_PLAYBACK_MODE_SAMPLE)
|
||||
{
|
||||
video_playback_setup *settings = info->settings;
|
||||
|
||||
if(!sample_exists(sampleid))
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Sample %d does not exist", sampleid);
|
||||
return;
|
||||
}
|
||||
|
||||
info->edit_list = sample_get_editlist( sampleid );
|
||||
if( info->uc->sample_id != sampleid)
|
||||
sample_stop_playing(sampleid);//@pfff
|
||||
veejay_reset_el_buffer(info);
|
||||
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 */
|
||||
settings->min_frame_num = 0;
|
||||
settings->max_frame_num = info->edit_list->video_frames - 1;
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
if(info->font && sampleid != info->uc->sample_id)
|
||||
{
|
||||
video_playback_setup *settings = info->settings;
|
||||
|
||||
void *dict = sample_get_dict( sampleid );
|
||||
vj_font_set_constraints_and_dict(
|
||||
if(info->font && info->uc->sample_id != sample_id)
|
||||
{
|
||||
void *dict = sample_get_dict( sample_id );
|
||||
vj_font_set_constraints_and_dict(
|
||||
info->font,
|
||||
settings->min_frame_num,
|
||||
settings->max_frame_num,
|
||||
info->edit_list->video_fps,
|
||||
dict
|
||||
);
|
||||
);
|
||||
|
||||
veejay_msg(VEEJAY_MSG_DEBUG, "Subtitling Sample %d: %ld - %ld", sampleid,
|
||||
settings->min_frame_num, settings->max_frame_num );
|
||||
veejay_msg(VEEJAY_MSG_DEBUG, "Subtitling sample %d: %ld - %ld", sample_id,
|
||||
settings->min_frame_num, settings->max_frame_num );
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Playing sample %d",
|
||||
sampleid );
|
||||
info->uc->sample_id = sample_id;
|
||||
info->last_sample_id = sample_id;
|
||||
|
||||
info->uc->sample_id = sampleid;
|
||||
info->last_sample_id = sampleid;
|
||||
info->sfd = sample_get_framedup(sampleid);
|
||||
info->sfd = sample_get_framedup(sample_id);
|
||||
|
||||
info->uc->render_changed = 1; /* different render list */
|
||||
sample_reset_offset( sampleid ); /* reset mixing offsets */
|
||||
veejay_set_frame(info, start);
|
||||
veejay_set_speed(info, speed);
|
||||
}
|
||||
info->uc->render_changed = 1; /* different render list */
|
||||
|
||||
sample_reset_offset( sample_id ); /* reset mixing offsets */
|
||||
veejay_set_frame(info, start);
|
||||
veejay_set_speed(info, speed);
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Playing sample %d (FX=%x, Sl=%d, Speed=%d, Start=%d, Loop=%d)",
|
||||
sample_id, tmp,info->sfd, speed, start, looptype );
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int veejay_start_playing_stream(veejay_t *info, int stream_id )
|
||||
{
|
||||
video_playback_setup *settings = info->settings;
|
||||
if(!vj_tag_exists(stream_id))
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Stream %d does not exist", stream_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(vj_tag_enable( stream_id ) <= 0 )
|
||||
{
|
||||
veejay_msg(0, "Unable to activate stream ?");
|
||||
return 0;
|
||||
}
|
||||
|
||||
vj_tag_set_active( stream_id, 1 );
|
||||
|
||||
int tmp = vj_tag_chain_malloc( stream_id);
|
||||
|
||||
info->uc->render_changed = 1;
|
||||
settings->min_frame_num = 0;
|
||||
settings->max_frame_num = vj_tag_get_n_frames( stream_id );
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
if(info->font && info->uc->sample_id != stream_id )
|
||||
{
|
||||
void *dict = vj_tag_get_dict( stream_id );
|
||||
vj_font_set_constraints_and_dict( info->font, settings->min_frame_num,
|
||||
settings->max_frame_num, info->edit_list->video_fps, dict );
|
||||
veejay_msg(VEEJAY_MSG_DEBUG, "Subtitling stream %d: %ld - %ld", stream_id,
|
||||
settings->min_frame_num, settings->max_frame_num );
|
||||
}
|
||||
#endif
|
||||
info->last_tag_id = stream_id;
|
||||
info->uc->sample_id = stream_id;
|
||||
|
||||
veejay_msg(VEEJAY_MSG_INFO,"Playing stream %d (FX=%x) (Ff=%d)", stream_id, tmp,
|
||||
settings->max_frame_num );
|
||||
|
||||
//@ use edl of plain/dummy
|
||||
info->edit_list = info->current_edit_list;
|
||||
veejay_reset_el_buffer(info);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void veejay_change_playback_mode( veejay_t *info, int new_pm, int sample_id )
|
||||
{
|
||||
if( info->uc->playback_mode == VJ_PLAYBACK_MODE_SAMPLE )
|
||||
{
|
||||
int cur_id = info->uc->sample_id;
|
||||
if( cur_id == sample_id && new_pm == VJ_PLAYBACK_MODE_SAMPLE )
|
||||
{
|
||||
int start = sample_get_startFrame( cur_id );
|
||||
veejay_set_frame(info,start);
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Sample %d starts playing from frame %d",sample_id,start);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!veejay_stop_playing_sample(info, sample_id ))
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( info->uc->playback_mode == VJ_PLAYBACK_MODE_TAG )
|
||||
{
|
||||
int cur_id = info->uc->sample_id;
|
||||
if( cur_id == sample_id && new_pm == VJ_PLAYBACK_MODE_TAG )
|
||||
{
|
||||
veejay_msg(0, "Already playing stream %d", cur_id );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
veejay_stop_playing_stream(info, sample_id );
|
||||
}
|
||||
}
|
||||
|
||||
if(new_pm == VJ_PLAYBACK_MODE_PLAIN )
|
||||
{
|
||||
if(info->uc->playback_mode==VJ_PLAYBACK_MODE_TAG)
|
||||
veejay_stop_playing_stream( info , 0);
|
||||
if(info->uc->playback_mode == VJ_PLAYBACK_MODE_SAMPLE )
|
||||
veejay_stop_playing_sample( info, 0 );
|
||||
info->uc->playback_mode = new_pm;
|
||||
info->edit_list = info->current_edit_list;
|
||||
video_playback_setup *settings = info->settings;
|
||||
settings->min_frame_num = 0;
|
||||
settings->max_frame_num = info->edit_list->video_frames-1;
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Playing plain video, frames %d - %d",
|
||||
(int)settings->min_frame_num, (int)settings->max_frame_num );
|
||||
}
|
||||
if(new_pm == VJ_PLAYBACK_MODE_TAG)
|
||||
{
|
||||
info->uc->playback_mode = new_pm;
|
||||
veejay_start_playing_stream(info,sample_id);
|
||||
}
|
||||
if(new_pm == VJ_PLAYBACK_MODE_SAMPLE)
|
||||
{
|
||||
info->uc->playback_mode = new_pm;
|
||||
veejay_start_playing_sample(info,sample_id );
|
||||
}
|
||||
}
|
||||
|
||||
void veejay_set_sample(veejay_t * info, int sampleid)
|
||||
{
|
||||
if ( info->uc->playback_mode == VJ_PLAYBACK_MODE_TAG)
|
||||
{
|
||||
veejay_start_playing_stream(info,sampleid );
|
||||
}
|
||||
else if( info->uc->playback_mode == VJ_PLAYBACK_MODE_SAMPLE)
|
||||
{
|
||||
if( info->uc->sample_id == sampleid )
|
||||
{
|
||||
int start = sample_get_startFrame( info->uc->sample_id );
|
||||
veejay_set_frame(info,start);
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Sample %d starts playing from frame %d",sampleid,start);
|
||||
}
|
||||
else
|
||||
veejay_start_playing_sample(info,sampleid );
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
@@ -1809,13 +1815,36 @@ int veejay_init(veejay_t * info, int x, int y,char *arg, int def_tags, int full_
|
||||
"Cannot initialize the EditList");
|
||||
return -1;
|
||||
}
|
||||
vj_tag_set_veejay_t(info);
|
||||
|
||||
if (vj_tag_init(info->current_edit_list->video_width, info->current_edit_list->video_height, info->pixel_format) != 0) {
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Error while initializing Stream Manager");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
info->font = vj_font_init( info->current_edit_list->video_width,
|
||||
info->current_edit_list->video_height,
|
||||
info->current_edit_list->video_fps,0 );
|
||||
|
||||
sample_init( (info->current_edit_list->video_width * info->current_edit_list->video_height) );
|
||||
|
||||
if(info->settings->composite)
|
||||
{
|
||||
info->osd = vj_font_init( info->video_output_width,info->video_output_height,
|
||||
info->current_edit_list->video_fps ,1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
info->osd = vj_font_init( info->current_edit_list->video_width,
|
||||
info->current_edit_list->video_height,
|
||||
info->current_edit_list->video_fps,1 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
sample_init( (info->current_edit_list->video_width * info->current_edit_list->video_height) ,
|
||||
info->font );
|
||||
|
||||
sample_set_project( info->pixel_format,
|
||||
info->auto_deinterlace,
|
||||
@@ -1841,27 +1870,7 @@ int veejay_init(veejay_t * info, int x, int y,char *arg, int def_tags, int full_
|
||||
info->current_edit_list->video_width,
|
||||
info->current_edit_list->video_height);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
info->font = vj_font_init( info->current_edit_list->video_width,
|
||||
info->current_edit_list->video_height,
|
||||
info->current_edit_list->video_fps,0 );
|
||||
|
||||
|
||||
if(info->settings->composite)
|
||||
{
|
||||
info->osd = vj_font_init( info->video_output_width,info->video_output_height,
|
||||
info->current_edit_list->video_fps ,1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
info->osd = vj_font_init( info->current_edit_list->video_width,
|
||||
info->current_edit_list->video_height,
|
||||
info->current_edit_list->video_fps,1 );
|
||||
}
|
||||
|
||||
#endif
|
||||
if(!vj_perform_init(info, use_vp))
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Unable to initialize Veejay Performer");
|
||||
@@ -2212,6 +2221,11 @@ int veejay_init(veejay_t * info, int x, int y,char *arg, int def_tags, int full_
|
||||
editlist *el = veejay_edit_copy_to_new(
|
||||
info,info->current_edit_list,
|
||||
start,end );
|
||||
if(!el)
|
||||
{
|
||||
veejay_msg(0, "Unable to start from file, Abort");
|
||||
return -1;
|
||||
}
|
||||
sample_info *skel = sample_skeleton_new( 0,el->video_frames-1 );
|
||||
if(skel)
|
||||
{
|
||||
@@ -2227,13 +2241,13 @@ int veejay_init(veejay_t * info, int x, int y,char *arg, int def_tags, int full_
|
||||
* effective user id to the real user id
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
if (info->current_edit_list->has_audio && info->audio == AUDIO_PLAY)
|
||||
{
|
||||
if (!vj_perform_audio_start(info)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
if (seteuid(getuid()) < 0)
|
||||
@@ -2287,46 +2301,43 @@ static void veejay_schedule_fifo(veejay_t *info, int pid )
|
||||
|
||||
static int veejay_pin_cpu( veejay_t *info, int cpu_num )
|
||||
{
|
||||
static unsigned long* mask = NULL;
|
||||
static unsigned long* cpumask = NULL;
|
||||
static int sz = 0;
|
||||
static int ncpus = 0;
|
||||
uint32_t st = sizeof(cpu_set_t);
|
||||
|
||||
int i,j,retval;
|
||||
if( cpumask == NULL )
|
||||
if( info->cpumask == NULL )
|
||||
{
|
||||
sz = 1 + (2 * sched_ncpus()) / (8 * sizeof(unsigned long));
|
||||
mask = (unsigned long*) vj_calloc( 8 * sz * sizeof( unsigned long ));
|
||||
cpumask = (unsigned long*) vj_calloc( 8 * sz * sizeof( unsigned long ));
|
||||
|
||||
retval = sched_getaffinity(0, sz * sizeof(unsigned long), cpumask );
|
||||
info->sz = 1 + (2 * sched_ncpus()) / (8 * sizeof(unsigned long));
|
||||
info->mask = (unsigned long*) vj_calloc( st );
|
||||
info->cpumask = (unsigned long*) vj_calloc( st);
|
||||
retval = sched_getaffinity(0, st, info->cpumask );
|
||||
if( retval < 0 )
|
||||
{
|
||||
veejay_msg(0,"sched_getaffinity()");
|
||||
return retval;
|
||||
}
|
||||
|
||||
for( i = 0; i < sz * 8 * sizeof(unsigned long); ++ i )
|
||||
for( i = 0; i < st; ++ i )
|
||||
{
|
||||
int word = i / (8 * sizeof(unsigned long));
|
||||
int bit = i % (8 * sizeof(unsigned long));
|
||||
if( cpumask[word] & (1 << bit))
|
||||
ncpus++;
|
||||
if( info->cpumask[word] & (1 << bit))
|
||||
info->ncpus++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cpu_num %= ncpus;
|
||||
cpu_num %= info->ncpus;
|
||||
|
||||
veejay_memset( mask, 0, sz * sizeof( unsigned long ));
|
||||
veejay_memset( info->mask, 0, st );
|
||||
|
||||
for ( i = 0, j = 0; i < sz * 8 * sizeof(unsigned long); ++ i )
|
||||
for ( i = 0, j = 0; i < st; ++ i )
|
||||
{
|
||||
int word = i / (8 * sizeof(unsigned long));
|
||||
int bit = i % (8 * sizeof(unsigned long));
|
||||
if( cpumask[word] & (1 << bit ))
|
||||
if( info->cpumask[word] & (1 << bit ))
|
||||
{
|
||||
if( j >= cpu_num ) {
|
||||
mask[word] |= ( 1 << bit );
|
||||
info->mask[word] |= ( 1 << bit );
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
@@ -2335,7 +2346,7 @@ static int veejay_pin_cpu( veejay_t *info, int cpu_num )
|
||||
|
||||
int pi = (int) getpid();
|
||||
|
||||
retval = sched_setaffinity( pi, sz * sizeof( unsigned long ), mask );
|
||||
retval = sched_setaffinity( pi, st, info->mask );
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -2368,6 +2379,13 @@ static void veejay_playback_cycle(veejay_t * info)
|
||||
if( info->settings->late[1] )
|
||||
veejay_change_playback_mode(info,info->settings->late[0],info->settings->late[1]);
|
||||
|
||||
if (info->current_edit_list->has_audio && info->audio == AUDIO_PLAY)
|
||||
{
|
||||
if (!vj_perform_audio_start(info)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vj_perform_queue_audio_frame(info,0);
|
||||
vj_perform_queue_video_frame(info,0,0);
|
||||
@@ -3003,52 +3021,52 @@ editlist *veejay_edit_copy_to_new(veejay_t * info, editlist *el, long start, lon
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint64_t k, i;
|
||||
uint64_t n1 = (uint64_t) start;
|
||||
uint64_t n2 = (uint64_t) end;
|
||||
uint64_t k, i;
|
||||
uint64_t n1 = (uint64_t) start;
|
||||
uint64_t n2 = (uint64_t) end;
|
||||
|
||||
uint64_t len = n2 - n1 + 1;
|
||||
uint64_t len = n2 - n1 + 1;
|
||||
|
||||
if( n1 < 0 || n2 > el->video_frames-1)
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Sample start and end are outside of editlist");
|
||||
return NULL;
|
||||
}
|
||||
if( n1 < 0 || n2 > el->video_frames-1)
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Sample start and end are outside of editlist");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(len <= 0 )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Sample too short");
|
||||
return NULL;
|
||||
}
|
||||
if(len <= 0 )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Sample too short");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Copy edl */
|
||||
/* Copy edl */
|
||||
editlist *new_el = vj_el_soft_clone( el );
|
||||
|
||||
if(!new_el)
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Cannot soft clone EDL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* copy edl frames */
|
||||
new_el->frame_list =
|
||||
(uint64_t *) vj_malloc( sizeof(uint64_t) * len );
|
||||
new_el->frame_list = (uint64_t *) vj_malloc( sizeof(uint64_t) * len );
|
||||
|
||||
if (!new_el->frame_list)
|
||||
if (!new_el->frame_list)
|
||||
{
|
||||
veejay_msg(0, "Out of memory, unable to allocate editlist of %lld bytes", len);
|
||||
veejay_change_state_save(info, LAVPLAY_STATE_STOP);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
k = 0;
|
||||
k = 0;
|
||||
|
||||
for (i = n1; i <= n2; i++)
|
||||
for (i = n1; i <= n2; i++)
|
||||
new_el->frame_list[k++] = el->frame_list[i];
|
||||
veejay_msg(VEEJAY_MSG_DEBUG, "Copied %d frames to EDL", k);
|
||||
// set length
|
||||
new_el->video_frames = k;
|
||||
|
||||
// set length
|
||||
new_el->video_frames = k;
|
||||
|
||||
return new_el;
|
||||
return new_el;
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
|
||||
@@ -2362,6 +2362,8 @@ void vj_event_no_caching(void *ptr, const char format[], va_list ap)
|
||||
vj_el_setup_cache( v->current_edit_list );
|
||||
veejay_msg(VEEJAY_MSG_INFO,"Sample FX Cache enabled : Recycling identicial samples in FX chain (default)");
|
||||
}
|
||||
|
||||
vj_el_set_caching(v->no_caching);
|
||||
}
|
||||
|
||||
void vj_event_debug_level(void *ptr, const char format[], va_list ap)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <veejay/vims.h>
|
||||
#include <veejay/vevo.h>
|
||||
#include <libvjmsg/vj-common.h>
|
||||
|
||||
#include <libvjmem/vjmem.h>
|
||||
#ifdef STRICT_CHECKING
|
||||
#include <assert.h>
|
||||
#endif
|
||||
@@ -179,7 +179,6 @@ void vj_event_vevo_inline_fire_default( void *super, int vims_id, const char *f
|
||||
vj_event_vevo_inline_fire( super, vims_id, format, &dval[0],&dval[1],&dval[2],&dval[3]);
|
||||
}
|
||||
|
||||
|
||||
static vevo_port_t *_new_event(
|
||||
const char *format,
|
||||
int vims_id,
|
||||
@@ -217,8 +216,6 @@ static vevo_port_t *_new_event(
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, flags);
|
||||
// veejay_msg(VEEJAY_MSG_DEBUG,
|
||||
// "VIMS %03d: '%s' '%s' %d arguments", vims_id, name, format, n_arg );
|
||||
|
||||
for( n = 0; n < n_arg ; n ++)
|
||||
{
|
||||
@@ -365,8 +362,8 @@ void vj_event_vevo_free(void)
|
||||
|
||||
void vj_init_vevo_events(void)
|
||||
{
|
||||
index_map_ = (vevo_port_t*) malloc(sizeof(vevo_port_t*) * MAX_INDEX );
|
||||
memset( index_map_, 0, sizeof( vevo_port_t *) * MAX_INDEX );
|
||||
index_map_ = (vevo_port_t*) vj_malloc(sizeof(vevo_port_t*) * MAX_INDEX );
|
||||
veejay_memset( index_map_, 0, sizeof( vevo_port_t *) * MAX_INDEX );
|
||||
|
||||
index_map_[VIMS_VIDEO_PLAY_FORWARD] = _new_event(
|
||||
NULL,
|
||||
|
||||
@@ -31,7 +31,7 @@ int vj_font_save_srt( void *font , const char *filename );
|
||||
char *vj_font_get_sequence( void *font, int seq );
|
||||
void *vj_font_get_plain_dict( void *font );
|
||||
void vj_font_set_constraints_and_dict( void *font, long lo, long hi, float fps, void *dict );
|
||||
void vj_font_dictionary_destroy(void *dict);
|
||||
void vj_font_dictionary_destroy(void *font,void *dict);
|
||||
int vj_font_clear_text( void *font );
|
||||
int vj_font_new_text( void *font, char *text, long s1,long s2, int seq);
|
||||
void vj_font_del_text( void *font, int seq );
|
||||
|
||||
@@ -325,6 +325,10 @@ typedef struct {
|
||||
int which_vp;
|
||||
int frontback;
|
||||
int out_buf;
|
||||
unsigned long *mask;
|
||||
unsigned long *cpumask;
|
||||
int ncpus;
|
||||
int sz;
|
||||
} veejay_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -895,6 +895,10 @@ void vj_osc_free(void *d)
|
||||
{
|
||||
if(!d) return;
|
||||
vj_osc *c = (vj_osc*) d;
|
||||
void *addr = OSCPacketBufferGetClientAddr(c->packet );
|
||||
if(addr)
|
||||
free(addr);
|
||||
if(c->osc_args) free(c->osc_args);
|
||||
if(c->leaves) free(c->leaves);
|
||||
if(c) free(c);
|
||||
c = NULL;
|
||||
|
||||
@@ -93,7 +93,7 @@ static void *lzo_;
|
||||
static void *effect_sampler = NULL;
|
||||
static void *crop_sampler = NULL;
|
||||
static VJFrame *crop_frame = NULL;
|
||||
static ycbcr_frame **video_output_buffer; /* scaled video output */
|
||||
static ycbcr_frame **video_output_buffer = NULL; /* scaled video output */
|
||||
static int video_output_buffer_convert = 0;
|
||||
static ycbcr_frame **frame_buffer; /* chain */
|
||||
static ycbcr_frame **primary_buffer; /* normal */
|
||||
@@ -106,14 +106,14 @@ static int cached_sample_frames[CACHE_SIZE];
|
||||
static int frame_info[64][SAMPLE_MAX_EFFECTS]; /* array holding frame lengths */
|
||||
static uint8_t *audio_buffer[SAMPLE_MAX_EFFECTS]; /* the audio buffer */
|
||||
static uint8_t *lin_audio_buffer_ = NULL;
|
||||
static uint8_t *top_audio_buffer;
|
||||
static uint8_t *resample_audio_buffer;
|
||||
static uint8_t *audio_render_buffer;
|
||||
static uint8_t *down_sample_buffer;
|
||||
static uint8_t *top_audio_buffer = NULL;
|
||||
static uint8_t *resample_audio_buffer = NULL;
|
||||
static uint8_t *audio_render_buffer = NULL;
|
||||
static uint8_t *down_sample_buffer = NULL;
|
||||
static uint8_t *temp_buffer[4];
|
||||
static uint8_t *socket_buffer;
|
||||
static ycbcr_frame *record_buffer; // needed for recording invisible streams
|
||||
static VJFrame *helper_frame;
|
||||
static uint8_t *socket_buffer = NULL;
|
||||
static ycbcr_frame *record_buffer = NULL; // needed for recording invisible streams
|
||||
static VJFrame *helper_frame = NULL;
|
||||
static int vj_perform_record_buffer_init();
|
||||
static void vj_perform_record_buffer_free();
|
||||
#ifdef HAVE_JACK
|
||||
@@ -884,9 +884,13 @@ void vj_perform_free(veejay_t * info)
|
||||
free(video_output_buffer[c]->Cb );
|
||||
if(video_output_buffer[c]->Cr )
|
||||
free(video_output_buffer[c]->Cr );
|
||||
free(video_output_buffer[c]);
|
||||
}
|
||||
|
||||
free(video_output_buffer);
|
||||
free(helper_frame);
|
||||
|
||||
if(lzo_)
|
||||
lzo_free(lzo_);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
||||
Reference in New Issue
Block a user