mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-21 07:10:14 +01:00
added vevo from veejay-ng to veejay-current
git-svn-id: svn://code.dyne.org/veejay/trunk@656 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
8
veejay-current/libvevo/Makefile.am
Normal file
8
veejay-current/libvevo/Makefile.am
Normal file
@@ -0,0 +1,8 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)/libvevo -I$(includedir) -I$(top_srcdir)/libhash -I$(top_srcdir)/libvjmem -I$(top_srcdir)/libvjmsg
|
||||
|
||||
VEVO_LIB_FILE = libvevo.la
|
||||
noinst_LTLIBRARIES = $(VEVO_LIB_FILE)
|
||||
|
||||
libvevo_la_SOURCES = pool.c vevo.c
|
||||
|
||||
123
veejay-current/libvevo/libvevo.h
Normal file
123
veejay-current/libvevo/libvevo.h
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
Copyright (c) 2004-2005 N.Elburg <nelburg@looze.net>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef LIBVEVO
|
||||
#define LIBVEVO
|
||||
|
||||
#include <config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef void vevo_port_t;
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
#define vpn(type) vevo_port_new( type, __FUNCTION__ , __LINE__ )
|
||||
#else
|
||||
#define vpn(type) vevo_port_new( type )
|
||||
#endif
|
||||
|
||||
int vevo_property_num_elements( vevo_port_t *p, const char *key);
|
||||
|
||||
int vevo_property_atom_type( vevo_port_t *p, const char *key);
|
||||
|
||||
size_t vevo_property_element_size( vevo_port_t * p, const char *key, const int idx);
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
vevo_port_t *vevo_port_new( int port_type, const char *func, int line_no );
|
||||
#else
|
||||
vevo_port_t *vevo_port_new(int port_type);
|
||||
#endif
|
||||
int vevo_property_soft_reference(vevo_port_t * p, const char *key);
|
||||
|
||||
void vevo_strict_init();
|
||||
|
||||
int vevo_port_verify( vevo_port_t *port );
|
||||
|
||||
void vevo_port_free( vevo_port_t *port );
|
||||
|
||||
int vevo_property_set(vevo_port_t * p, const char *key, int atom_type, int num_elements, void *src);
|
||||
|
||||
int vevo_property_get(vevo_port_t * p, const char *key, int idx, void *dst);
|
||||
|
||||
char **vevo_list_properties(vevo_port_t * p);
|
||||
|
||||
void vevo_port_recursive_free(vevo_port_t *p );
|
||||
|
||||
void vevo_port_dump( vevo_port_t *p );
|
||||
|
||||
void vevo_report_stats();
|
||||
|
||||
char *vevo_sprintf_property( vevo_port_t *port, const char *key );
|
||||
|
||||
int vevo_sscanf_property( vevo_port_t *port, const char *s);
|
||||
|
||||
char **vevo_sprintf_port( vevo_port_t *port );
|
||||
|
||||
int vevo_sscanf_port( vevo_port_t *port, const char *s );
|
||||
|
||||
int vevo_special_union_ports( void *port_a, void *port_b );
|
||||
|
||||
int vevo_property_from_string( vevo_port_t *port, const char *s, const char *key, int n_elem, int type);
|
||||
|
||||
char *vevo_sprintf_property_value( vevo_port_t *port, const char *key);
|
||||
|
||||
char *vevo_property_get_string( void *port, const char *key );
|
||||
|
||||
#define VEVO_ATOM_TYPE_VOIDPTR 65
|
||||
#define VEVO_ATOM_TYPE_INT 1
|
||||
#define VEVO_ATOM_TYPE_DOUBLE 2
|
||||
#define VEVO_ATOM_TYPE_STRING 4
|
||||
#define VEVO_ATOM_TYPE_BOOL 3
|
||||
#define VEVO_ATOM_TYPE_PORTPTR 66
|
||||
#define VEVO_ATOM_TYPE_HIDDEN 50
|
||||
#define VEVO_ATOM_TYPE_UINT64 5
|
||||
|
||||
#define VEVO_NO_ERROR 0
|
||||
#define VEVO_ERROR_MEMORY_ALLOCATION 1
|
||||
#define VEVO_ERROR_PROPERTY_READONLY 2
|
||||
#define VEVO_ERROR_NOSUCH_ELEMENT 3
|
||||
#define VEVO_ERROR_NOSUCH_PROPERTY 4
|
||||
#define VEVO_ERROR_WRONG_ATOM_TYPE 5
|
||||
#define VEVO_ERROR_TOO_MANY_INSTANCES 6
|
||||
#define VEVO_ERROR_HARDWARE 7
|
||||
#define VEVO_ERROR_PROPERTY_EMPTY 8
|
||||
|
||||
|
||||
#define VEVO_PORT_POOL 1041
|
||||
#define VEVO_ANONYMOUS_PORT -1
|
||||
|
||||
#define VEVO_PROPERTY_READONLY (1<<1)
|
||||
#define VEVO_PROPERTY_SOFTREF (1<<2)
|
||||
#define VEVO_PROPERTY_PROTECTED (1<<10)
|
||||
|
||||
#endif
|
||||
36
veejay-current/libvevo/lowlevel.h
Normal file
36
veejay-current/libvevo/lowlevel.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
Copyright (c) 2004-2005 N.Elburg <nelburg@looze.net>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef VEVO_LOW_LEVEL_H
|
||||
#define VEVO_LOW_LEVEL_H
|
||||
/* Mediation layer structures, provided by this host */
|
||||
typedef struct {
|
||||
int type;
|
||||
void *value;
|
||||
size_t size;
|
||||
} atom_t;
|
||||
#endif
|
||||
291
veejay-current/libvevo/pool.c
Normal file
291
veejay-current/libvevo/pool.c
Normal file
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
Copyright (c) 2004-2005 N.Elburg <nelburg@looze.net>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/** \defgroup mem_pool Efficient Object Caching
|
||||
*
|
||||
* To reduce the overhead of malloc/free when allocating and freeing many small objects
|
||||
* I keep a linked list of Spaces. Each Space holds a continuous
|
||||
* memory area that is of size ROUNDS_PER_MAG * sizeof(type). This area is divided
|
||||
* into ROUND_PER_MAG chunks. The malloc() replacement pops a round from the stack,
|
||||
* whilst the free() replacement pushes a round back to the stack.
|
||||
* The stack size is limited to ROUNDS_PER_MAG
|
||||
* When the stack is full, a new magazine is allocated and added to the linked list
|
||||
* of magazines.
|
||||
*
|
||||
* This is basically how the slab allocator works in a linux kernel
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libvjmem/vjmem.h>
|
||||
#include "pool.h"
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
//! \typedef space_t structure
|
||||
/*! The space_t structure is a linked list of spaces.
|
||||
Each space has a magazine that can hold up to ROUNDS_PER_MAG rounds.
|
||||
The magazine is a stack.
|
||||
Each round in the magazine is of a fixed size
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void *area; /*!< Pointer to memory space containing ROUNDS_PER_MAG objects */
|
||||
void **mag; /*!< A magazine is a ROUNDS_PER_MAG-element array of pointers to objects */
|
||||
int rounds; /*!< Available rounds*/
|
||||
void *next; /*!< Pointer to next space */
|
||||
} space_t;
|
||||
|
||||
//! \typedef pool_t structure
|
||||
/*! The pool_t structure is a pool of spaces
|
||||
* Each pool has 1 or more spaces.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
space_t **spaces; /*!< array of spaces */
|
||||
space_t *space; /*!< single space */
|
||||
} pool_t;
|
||||
|
||||
//!Allocate a new space of a fixed size
|
||||
/*!
|
||||
\param bs size in bytes
|
||||
\return New space that holds ROUNDS_PER_MAG rounds
|
||||
*/
|
||||
static space_t *alloc_space( size_t bs )
|
||||
{
|
||||
int k;
|
||||
void *p;
|
||||
space_t *s;
|
||||
s = (space_t*) vj_malloc(sizeof(space_t));
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( s != NULL );
|
||||
#endif
|
||||
s->area = vj_malloc(bs * ROUNDS_PER_MAG);
|
||||
s->mag = vj_malloc( sizeof(void*) * (ROUNDS_PER_MAG + 1) );
|
||||
p = s->area;
|
||||
for( k = 0; k <= ROUNDS_PER_MAG ;k ++ )
|
||||
{
|
||||
s->mag[k] = p;
|
||||
p += bs;
|
||||
}
|
||||
s->rounds = ROUNDS_PER_MAG;
|
||||
s->next = NULL;
|
||||
return s;
|
||||
}
|
||||
|
||||
//! Allocate a new pool with spaces of various fixed sizes
|
||||
/*!
|
||||
\param prop_size size in bytes of vevo_property_t
|
||||
\param stor_size size in bytes of vevo_storage_t
|
||||
\param atom_size size in bytes of atom_t
|
||||
\param index_size size in bytes of prop_node_t
|
||||
\return A new pool that holds various fixed sized Spaces
|
||||
*/
|
||||
void *vevo_pool_init(size_t prop_size,size_t stor_size, size_t atom_size, size_t index_size)
|
||||
{
|
||||
unsigned int Msize = Mend + 1;
|
||||
pool_t *p = (pool_t*) vj_malloc(sizeof(pool_t));
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( p != NULL );
|
||||
#endif
|
||||
p->space = NULL;
|
||||
p->spaces = (space_t**) vj_malloc(sizeof(space_t*) * Msize );
|
||||
p->spaces[M4b] = alloc_space( sizeof(int32_t) );
|
||||
p->spaces[M8b] = alloc_space( sizeof(double) );
|
||||
p->spaces[Mpb] = alloc_space( sizeof(void*) );
|
||||
p->spaces[M64b] = alloc_space(sizeof(uint64_t) );
|
||||
p->spaces[Mprop] = alloc_space( prop_size );
|
||||
p->spaces[Mstor] = alloc_space( stor_size );
|
||||
p->spaces[Matom] = alloc_space( atom_size );
|
||||
p->spaces[Midx] = alloc_space( index_size );
|
||||
p->spaces[Mend] = NULL;
|
||||
return (void*)p;
|
||||
}
|
||||
|
||||
//! Allocate a new pool with a single space of a fixed size
|
||||
/*!
|
||||
\param node_size size in bytes of a single block
|
||||
\return A new pool with a single space
|
||||
*/
|
||||
void *vevo_pool_slice_init( size_t node_size )
|
||||
{
|
||||
pool_t *p = (pool_t*) malloc(sizeof(pool_t));
|
||||
p->spaces = NULL;
|
||||
p->space = alloc_space( node_size );
|
||||
return p;
|
||||
}
|
||||
|
||||
//! Get a pointer to the starting address of an unused block. Pops a round from the magazine and creates a new space if magazine is empty.
|
||||
/*!
|
||||
\param p pointer to pool_t structure
|
||||
\param bs size of block to allocate
|
||||
\param k base type of block to allocate
|
||||
\return pointer to free block
|
||||
*/
|
||||
void *vevo_pool_alloc( void *p, size_t bs, unsigned int k )
|
||||
{
|
||||
pool_t *pool = (pool_t*) p;
|
||||
space_t *space = pool->spaces[k];
|
||||
if( space->rounds == 0 )
|
||||
{ // no more rounds to fire, create a new magazine and add it to the list
|
||||
space_t *m = alloc_space( bs );
|
||||
m->next = space;
|
||||
pool->spaces[k] = m;
|
||||
space = m;
|
||||
}
|
||||
void **mag = pool->spaces[k]->mag;
|
||||
return mag[ --space->rounds ];
|
||||
}
|
||||
|
||||
//! Pushes a round to a magazine that is not full
|
||||
/*!
|
||||
\param p pointer to pool_t structure
|
||||
\param ptr pointer to address of block
|
||||
\param k base type of block to allocate
|
||||
*/
|
||||
void vevo_pool_free( void *p, void *ptr, unsigned int k )
|
||||
{
|
||||
pool_t *pool = (pool_t*) p;
|
||||
unsigned int n = pool->spaces[k]->rounds;
|
||||
space_t *space = pool->spaces[k];
|
||||
void **mag = space->mag;
|
||||
if( n == ROUNDS_PER_MAG )
|
||||
{
|
||||
space_t *l = space;
|
||||
while( l != NULL )
|
||||
{
|
||||
if( l->rounds < ROUNDS_PER_MAG )
|
||||
{
|
||||
mag = l->mag;
|
||||
mag[ l->rounds ++ ] = ptr;
|
||||
return;
|
||||
}
|
||||
l = l->next;
|
||||
}
|
||||
}
|
||||
mag[ space->rounds++ ] = ptr;
|
||||
}
|
||||
|
||||
//! Destroy a pool and all spaces. Frees all used memory
|
||||
/*!
|
||||
\param p pointer to pool_t structure
|
||||
*/
|
||||
void vevo_pool_destroy( void *p )
|
||||
{
|
||||
pool_t *pool = (pool_t*) p;
|
||||
space_t **nS = pool->spaces;
|
||||
int i ;
|
||||
for( i = 0 ; nS[i] != NULL ; i ++ )
|
||||
{
|
||||
space_t *n = pool->spaces[i];
|
||||
space_t *k = NULL;
|
||||
while( n != NULL )
|
||||
{
|
||||
k = n;
|
||||
free( k->area );
|
||||
free( k->mag );
|
||||
n = k->next;
|
||||
free( k );
|
||||
}
|
||||
}
|
||||
free( nS );
|
||||
free( pool );
|
||||
}
|
||||
|
||||
//! Destroy a pool and the space it holds. Frees all used memory
|
||||
/*!
|
||||
\param p pointer to pool_t structure
|
||||
*/
|
||||
void vevo_pool_slice_destroy( void *p )
|
||||
{
|
||||
pool_t *pool = (pool_t*) p;
|
||||
space_t *s = pool->space;
|
||||
space_t *n = NULL;
|
||||
while( s != NULL )
|
||||
{
|
||||
n = s;
|
||||
free( n->area );
|
||||
free( n->mag );
|
||||
s = n->next;
|
||||
free( n );
|
||||
}
|
||||
free( pool->space );
|
||||
free( pool );
|
||||
}
|
||||
|
||||
//! Get a pointer to the starting address of an unused block. Pops a round from the magazine and creates a new space if magazine is empty.
|
||||
/*!
|
||||
\param p pointer to pool_t structure
|
||||
\param bs size of block to allocate
|
||||
\return pointer to free block
|
||||
*/
|
||||
void *vevo_pool_slice_alloc( void *p, size_t bs )
|
||||
{
|
||||
pool_t *pool = (pool_t*) p;
|
||||
space_t *space = pool->space;
|
||||
if( space->rounds == 0 )
|
||||
{ // no more rounds to fire, create a new magazine and add it to the list
|
||||
space_t *m = alloc_space( bs );
|
||||
m->next = space;
|
||||
pool->space = m;
|
||||
space = m;
|
||||
}
|
||||
void **mag = pool->space->mag;
|
||||
return mag[ --space->rounds ];
|
||||
}
|
||||
|
||||
//! Pushes a round to a magazine that is not full
|
||||
/*!
|
||||
\param p pointer to pool_t structure
|
||||
\param ptr pointer to address of block
|
||||
*/
|
||||
void vevo_pool_slice_free( void *p, void *ptr )
|
||||
{
|
||||
pool_t *pool = (pool_t*) p;
|
||||
unsigned int n = pool->space->rounds;
|
||||
space_t *space = pool->space;
|
||||
void **mag = space->mag;
|
||||
if( n == ROUNDS_PER_MAG )
|
||||
{
|
||||
space_t *l = space;
|
||||
while( l != NULL )
|
||||
{
|
||||
if( l->rounds < ROUNDS_PER_MAG )
|
||||
{
|
||||
mag = l->mag;
|
||||
mag[ l->rounds ++ ] = ptr;
|
||||
return;
|
||||
}
|
||||
l = l->next;
|
||||
}
|
||||
}
|
||||
mag[ space->rounds++ ] = ptr;
|
||||
}
|
||||
70
veejay-current/libvevo/pool.h
Normal file
70
veejay-current/libvevo/pool.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/*Copyright (c) 2004-2005 N.Elburg <nelburg@looze.net>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef POOLM
|
||||
#define POOLM
|
||||
#define ROUNDS_PER_MAG 32
|
||||
|
||||
#define M4b 0
|
||||
#define M8b 1
|
||||
#define Mpb 2
|
||||
#define Mstor 3
|
||||
#define Matom 4
|
||||
#define Midx 5
|
||||
#define Mprop 6
|
||||
#define M64b 7
|
||||
#define Mend 8
|
||||
|
||||
void *vevo_pool_alloc( void *pool, size_t bs, unsigned int k );
|
||||
void vevo_pool_free( void *pool, void *ptr, unsigned int k );
|
||||
void *vevo_pool_init(size_t property_size, size_t stor_size, size_t atom_size, size_t index_size);
|
||||
void vevo_pool_destroy( void *p );
|
||||
void vevo_pool_slice_destroy( void *p );
|
||||
void *vevo_pool_slice_init( size_t node_size );
|
||||
void *vevo_pool_slice_alloc( void *pool, size_t bs);
|
||||
void vevo_pool_slice_free( void *pool, void *ptr );
|
||||
|
||||
#define vevo_pool_alloc_property(type,pool) vevo_pool_alloc(pool,sizeof(type),Mprop )
|
||||
#define vevo_pool_alloc_storage(type,pool) vevo_pool_alloc( pool, sizeof(type),Mstor )
|
||||
#define vevo_pool_alloc_atom(type,pool) vevo_pool_alloc( pool, sizeof(type), Matom )
|
||||
#define vevo_pool_alloc_node(type,pool) vevo_pool_alloc( pool, sizeof(type), Midx )
|
||||
#define vevo_pool_alloc_int(type,pool) vevo_pool_alloc( pool,sizeof(type), M4b )
|
||||
#define vevo_pool_alloc_ptr(type,pool) vevo_pool_alloc( pool,sizeof(type), Mpb )
|
||||
#define vevo_pool_alloc_dbl(type,pool) vevo_pool_alloc( pool,sizeof(type), M8b )
|
||||
#define vevo_pool_alloc_64b(type,pool) vevo_pool_alloc( pool,sizeof(type), M64b )
|
||||
|
||||
#define vevo_pool_free_property(pool,ptr) vevo_pool_free(pool,ptr,Mprop )
|
||||
#define vevo_pool_free_storage( pool,ptr ) vevo_pool_free( pool, ptr, Mstor )
|
||||
#define vevo_pool_free_atom( pool,ptr ) vevo_pool_free( pool, ptr, Matom )
|
||||
#define vevo_pool_free_node( pool,ptr ) vevo_pool_free( pool, ptr, Midx )
|
||||
#define vevo_pool_free_int( pool,ptr ) vevo_pool_free( pool,ptr, M4b )
|
||||
#define vevo_pool_free_ptr( pool,ptr ) vevo_pool_free( pool,ptr, Mpb )
|
||||
#define vevo_pool_free_dbl( pool,ptr ) vevo_pool_free( pool,ptr,M8b )
|
||||
#define vevo_pool_free_64b( pool,ptr ) vevo_pool_free( pool,ptr,M64b )
|
||||
|
||||
|
||||
#endif
|
||||
2766
veejay-current/libvevo/vevo.c
Normal file
2766
veejay-current/libvevo/vevo.c
Normal file
File diff suppressed because it is too large
Load Diff
74
veejay-current/libvevo/vevo.h
Normal file
74
veejay-current/libvevo/vevo.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
Copyright (c) 2004-2005 N.Elburg <nelburg@looze.net>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
# ifndef VEVO_H_INCLUDED
|
||||
# define VEVO_H_INCLUDED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <libvevo/libvevo.h>
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#define VEVO_FF_PORT 10 // free frame port
|
||||
#define VEVO_FF_PARAM_PORT 11 // free frame parameter port
|
||||
|
||||
#define VEVO_FR_PORT 20 // frei0r port
|
||||
#define VEVO_FR_PARAM_PORT 21 // frei0r parameter port
|
||||
|
||||
#define VEVO_LIVIDO_PORT 30 // livido port
|
||||
#define VEVO_LIVIDO_PARAM_PORT 31 // livido parameter port
|
||||
#define VEVO_ILLEGAL 100
|
||||
|
||||
#define VEVO_EVENT_PORT 321
|
||||
|
||||
#define VEVO_VJE_PORT 32
|
||||
|
||||
|
||||
#define VEVO_CACHE_PORT 40 // linked list
|
||||
#define VEVO_PORT_REFERENCES 1040 // hash
|
||||
#define VEVO_SAMPLE_PORT 2035 // sample
|
||||
#define VEVO_SAMPLE_BANK_PORT 2036 // bank
|
||||
|
||||
#define VEVO_VJE_INSTANCE_PORT 33
|
||||
|
||||
#define HAVE_LIVIDO_PORT_T
|
||||
typedef void livido_port_t;
|
||||
# endif
|
||||
|
||||
|
||||
#define LIVIDO_ATOM_TYPE_INT VEVO_ATOM_TYPE_INT
|
||||
#define LIVIDO_ATOM_TYPE_DOUBLE VEVO_ATOM_TYPE_DOUBLE
|
||||
#define LIVIDO_ATOM_TYPE_BOOLEAN VEVO_ATOM_TYPE_BOOL
|
||||
#define LIVIDO_ATOM_TYPE_STRING VEVO_ATOM_TYPE_STRING
|
||||
#define LIVIDO_ATOM_TYPE_VOIDPTR VEVO_ATOM_TYPE_VOIDPTR
|
||||
#define LIVIDO_ATOM_TYPE_PORTPTR VEVO_ATOM_TYPE_PORTPTR
|
||||
|
||||
Reference in New Issue
Block a user