git-svn-id: svn://code.dyne.org/veejay/trunk@53 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2004-12-01 11:26:50 +00:00
parent de713d4f94
commit 49cc8b85a7
5 changed files with 4131 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
# Makefile for veejay
INCLUDES = -I$(top_srcdir) -I$(includedir) -I$(top_srcdir)/vjmem -I$(top_srcdir)/vjmsg \
${XML_CFLAGS}
SAMPLE_LIB_FILE = libsample.la
SAMPLE_ALL_LIB_OPTS = \
-version-info $(LT_AGE):$(LT_REVISION):$(LT_AGE) \
-release $(LT_RELEASE) \
-export-dynamic
noinst_LTLIBRARIES = $(SAMPLE_LIB_FILE)
libsample_la_SOURCES = hash.c sampleadm.c
libsample_la_LDFLAGS = $(SAMPLE_ALL_LIB_OPTS) \
-L$(top_builddir)/libvjmem -lvjmem \
-L$(top_builddir)/libvjmsg -lvjmsg \
${XML_LIBS} \
-DDYNAMIC -O3 -Wall -rdynamic

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,240 @@
/*
* Hash Table Data Type
* Copyright (C) 1997 Kaz Kylheku <kaz@ashi.footprints.net>
*
* Free Software License:
*
* All rights are reserved by the author, with the following exceptions:
* Permission is granted to freely reproduce and distribute this software,
* possibly in exchange for a fee, provided that this copyright notice appears
* intact. Permission is also granted to adapt this software to produce
* derivative works, as long as the modified versions carry this copyright
* notice and additional notices stating that the work has been modified.
* This source code may be translated into executable form and incorporated
* into proprietary software; there is no requirement for such software to
* contain a copyright notice related to this source.
*
* $Id: hash.h,v 1.1.1.1 2004/10/27 23:48:59 niels Exp $
* $Name: $
*/
#ifndef HASH_H
#define HASH_H
#include <limits.h>
#ifdef KAZLIB_SIDEEFFECT_DEBUG
#include "sfx.h"
#endif
/*
* Blurb for inclusion into C++ translation units
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned long hashcount_t;
#define HASHCOUNT_T_MAX ULONG_MAX
typedef unsigned long hash_val_t;
#define HASH_VAL_T_MAX ULONG_MAX
extern int hash_val_t_bit;
#ifndef HASH_VAL_T_BIT
#define HASH_VAL_T_BIT ((int) hash_val_t_bit)
#endif
/*
* Hash chain node structure.
* Notes:
* 1. This preprocessing directive is for debugging purposes. The effect is
* that if the preprocessor symbol KAZLIB_OPAQUE_DEBUG is defined prior to the
* inclusion of this header, then the structure shall be declared as having
* the single member int __OPAQUE__. This way, any attempts by the
* client code to violate the principles of information hiding (by accessing
* the structure directly) can be diagnosed at translation time. However,
* note the resulting compiled unit is not suitable for linking.
* 2. This is a pointer to the next node in the chain. In the last node of a
* chain, this pointer is null.
* 3. The key is a pointer to some user supplied data that contains a unique
* identifier for each hash node in a given table. The interpretation of
* the data is up to the user. When creating or initializing a hash table,
* the user must supply a pointer to a function for comparing two keys,
* and a pointer to a function for hashing a key into a numeric value.
* 4. The value is a user-supplied pointer to void which may refer to
* any data object. It is not interpreted in any way by the hashing
* module.
* 5. The hashed key is stored in each node so that we don't have to rehash
* each key when the table must grow or shrink.
*/
typedef struct hnode_t {
#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) /* 1 */
struct hnode_t *hash_next; /* 2 */
const void *hash_key; /* 3 */
void *hash_data; /* 4 */
hash_val_t hash_hkey; /* 5 */
#else
int hash_dummy;
#endif
} hnode_t;
/*
* The comparison function pointer type. A comparison function takes two keys
* and produces a value of -1 if the left key is less than the right key, a
* value of 0 if the keys are equal, and a value of 1 if the left key is
* greater than the right key.
*/
typedef int (*hash_comp_t)(const void *, const void *);
/*
* The hashing function performs some computation on a key and produces an
* integral value of type hash_val_t based on that key. For best results, the
* function should have a good randomness properties in *all* significant bits
* over the set of keys that are being inserted into a given hash table. In
* particular, the most significant bits of hash_val_t are most significant to
* the hash module. Only as the hash table expands are less significant bits
* examined. Thus a function that has good distribution in its upper bits but
* not lower is preferrable to one that has poor distribution in the upper bits
* but not the lower ones.
*/
typedef hash_val_t (*hash_fun_t)(const void *);
/*
* allocator functions
*/
typedef hnode_t *(*hnode_alloc_t)(void *);
typedef void (*hnode_free_t)(hnode_t *, void *);
/*
* This is the hash table control structure. It keeps track of information
* about a hash table, as well as the hash table itself.
* Notes:
* 1. Pointer to the hash table proper. The table is an array of pointers to
* hash nodes (of type hnode_t). If the table is empty, every element of
* this table is a null pointer. A non-null entry points to the first
* element of a chain of nodes.
* 2. This member keeps track of the size of the hash table---that is, the
* number of chain pointers.
* 3. The count member maintains the number of elements that are presently
* in the hash table.
* 4. The maximum count is the greatest number of nodes that can populate this
* table. If the table contains this many nodes, no more can be inserted,
* and the hash_isfull() function returns true.
* 5. The high mark is a population threshold, measured as a number of nodes,
* which, if exceeded, will trigger a table expansion. Only dynamic hash
* tables are subject to this expansion.
* 6. The low mark is a minimum population threshold, measured as a number of
* nodes. If the table population drops below this value, a table shrinkage
* will occur. Only dynamic tables are subject to this reduction. No table
* will shrink beneath a certain absolute minimum number of nodes.
* 7. This is the a pointer to the hash table's comparison function. The
* function is set once at initialization or creation time.
* 8. Pointer to the table's hashing function, set once at creation or
* initialization time.
* 9. The current hash table mask. If the size of the hash table is 2^N,
* this value has its low N bits set to 1, and the others clear. It is used
* to select bits from the result of the hashing function to compute an
* index into the table.
* 10. A flag which indicates whether the table is to be dynamically resized. It
* is set to 1 in dynamically allocated tables, 0 in tables that are
* statically allocated.
*/
typedef struct hash_t {
#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
struct hnode_t **hash_table; /* 1 */
hashcount_t hash_nchains; /* 2 */
hashcount_t hash_nodecount; /* 3 */
hashcount_t hash_maxcount; /* 4 */
hashcount_t hash_highmark; /* 5 */
hashcount_t hash_lowmark; /* 6 */
hash_comp_t hash_compare; /* 7 */
hash_fun_t hash_function; /* 8 */
hnode_alloc_t hash_allocnode;
hnode_free_t hash_freenode;
void *hash_context;
hash_val_t hash_mask; /* 9 */
int hash_dynamic; /* 10 */
#else
int hash_dummy;
#endif
} hash_t;
/*
* Hash scanner structure, used for traversals of the data structure.
* Notes:
* 1. Pointer to the hash table that is being traversed.
* 2. Reference to the current chain in the table being traversed (the chain
* that contains the next node that shall be retrieved).
* 3. Pointer to the node that will be retrieved by the subsequent call to
* hash_scan_next().
*/
typedef struct hscan_t {
#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
hash_t *hash_table; /* 1 */
hash_val_t hash_chain; /* 2 */
hnode_t *hash_next; /* 3 */
#else
int hash_dummy;
#endif
} hscan_t;
extern hash_t *hash_create(hashcount_t, hash_comp_t, hash_fun_t);
extern void hash_set_allocator(hash_t *, hnode_alloc_t, hnode_free_t, void *);
extern void hash_destroy(hash_t *);
extern void hash_free_nodes(hash_t *);
extern void hash_free(hash_t *);
extern hash_t *hash_init(hash_t *, hashcount_t, hash_comp_t,
hash_fun_t, hnode_t **, hashcount_t);
extern void hash_insert(hash_t *, hnode_t *, const void *);
extern hnode_t *hash_lookup(hash_t *, const void *);
extern hnode_t *hash_delete(hash_t *, hnode_t *);
extern int hash_alloc_insert(hash_t *, const void *, void *);
extern void hash_delete_free(hash_t *, hnode_t *);
extern void hnode_put(hnode_t *, void *);
extern void *hnode_get(hnode_t *);
extern const void *hnode_getkey(hnode_t *);
extern hashcount_t hash_count(hash_t *);
extern hashcount_t hash_size(hash_t *);
extern int hash_isfull(hash_t *);
extern int hash_isempty(hash_t *);
extern void hash_scan_begin(hscan_t *, hash_t *);
extern hnode_t *hash_scan_next(hscan_t *);
extern hnode_t *hash_scan_delete(hash_t *, hnode_t *);
extern void hash_scan_delfree(hash_t *, hnode_t *);
extern int hash_verify(hash_t *);
extern hnode_t *hnode_create(void *);
extern hnode_t *hnode_init(hnode_t *, void *);
extern void hnode_destroy(hnode_t *);
#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
#ifdef KAZLIB_SIDEEFFECT_DEBUG
#define hash_isfull(H) (SFX_CHECK(H)->hash_nodecount == (H)->hash_maxcount)
#else
#define hash_isfull(H) ((H)->hash_nodecount == (H)->hash_maxcount)
#endif
#define hash_isempty(H) ((H)->hash_nodecount == 0)
#define hash_count(H) ((H)->hash_nodecount)
#define hash_size(H) ((H)->hash_nchains)
#define hnode_get(N) ((N)->hash_data)
#define hnode_getkey(N) ((N)->hash_key)
#define hnode_put(N, V) ((N)->hash_data = (V))
#endif
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,272 @@
/*
* Linux VeeJay
*
* Copyright(C)2002 Niels Elburg < nelburg@sourceforge.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License , or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
*/
#ifndef CLIPADM_H
#define CLIPADM_H
#include <stdint.h>
#include <config.h>
#include <libvje/vje.h>
#include <veejay/hash.h>
#include <veejay/vj-global.h>
#ifdef HAVE_XML2
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#endif
#define CLIP_MAX_RENDER 10 /* 10 at most */
#define CLIP_MAX_CLIPS 16384 /* 4096 clips at most */
#define CLIP_MAX_PARAMETERS 10 /* 10 parameters per effect at most */
#define CLIP_ARG1 0
#define CLIP_ARG2 1
#define CLIP_ARG3 2
#define CLIP_ARG4 3
#define CLIP_ARG5 4
#define CLIP_ARG6 5
#define CLIP_ARG7 6
#define CLIP_ARG8 7
#define CLIP_ARG9 8
#define CLIP_ARG10 9
#define CLIP_FREEZE_NONE 0
#define CLIP_FREEZE_PAUSE 1
#define CLIP_FREEZE_BLACK 2
#define CLIP_RENDER_START 1
#define CLIP_RENDER_STOP 0
enum {
CLIP_LOAD = 0,
CLIP_RUN = 1,
CLIP_PEEK = 2,
};
typedef struct clip_eff_t {
int effect_id; /* effect ID */
int e_flag;
int arg[CLIP_MAX_PARAMETERS]; /* array of arguments */
int frame_offset;
int frame_trimmer; /* sub frame scratcher */
/* audio settings */
int a_flag; /* audio enabled/disabled */
int volume; /* volume of 0-100 of audio */
int source_type; /* source type to mix with */
int channel; /* secundary source id */
int is_rendering; /* is rendering */
} clip_eff_chain;
typedef struct clip_info_t {
int clip_id; /* identifies a unique clip */
clip_eff_chain *effect_chain[CLIP_MAX_EFFECTS]; /* effect chain */
long first_frame[CLIP_MAX_RENDER]; /* start of clip */
long last_frame[CLIP_MAX_RENDER]; /* end of clip */
char descr[150];
int speed; /* playback speed */
int looptype; /* pingpong or loop */
int max_loops; /* max looops before going to */
int max_loops2; /* count remaining loops */
int next_clip_id; /* the next clip */
int depth; /* clip effect chain render depth */
int source; /* source or tag */
int channel; /* which channel (which tag) */
int playmode; /* various playmodes */
int playmode_frame;
int sub_audio; /* mix underlying clip yes or no */
int audio_volume; /* volume setting of this clip */
int marker_start;
int marker_end;
int dup; /* frame duplicator */
int active_render_entry;
int loop_dec;
int loop_periods;
int marker_speed;
int fader_active;
int fader_direction;
float fader_val;
float fader_inc;
int encoder_active;
unsigned long sequence_num;
unsigned long rec_total_bytes;
char *encoder_base;
unsigned long encoder_total_frames;
char *encoder_destination;
int encoder_format;
// lav_file_t *encoder_file;
void *encoder_file;
long encoder_duration; /* in seconds */
long encoder_num_frames;
long encoder_succes_frames;
int encoder_width;
int encoder_height;
int encoder_max_size;
int auto_switch;
int selected_entry;
int effect_toggle;
int offset;
} clip_info;
#define CLIP_YUV420_BUFSIZE 16
#define CLIP_MAX_DEPTH 4
#define CLIP_DEC_BIBBER 1
#define CLIP_DEC_FREEZE 2
extern int clip_chain_malloc(int clip_id);
extern int clip_chain_free(int clip_id);
extern int clip_size();
extern int clip_verify();
extern void clip_init(int len);
extern int clip_update(clip_info *clip, int s1);
#ifdef HAVE_XML2
extern int clip_readFromFile(char *);
extern int clip_writeToFile(char *);
#endif
extern int clip_update_offset(int s1, int nframe);
extern int clip_set_state(int new_state);
extern int clip_get_state();
extern clip_info *clip_skeleton_new(long startFrame, long endFrame);
extern clip_info *clip_get(int clip_id);
extern int clip_store(clip_info * skel);
extern int clip_is_deleted(int s1);
extern int clip_exists(int clip_id);
extern int clip_del(int clip_id);
extern void clip_del_all();
extern int clip_get_startFrame(int clip_id);
extern int clip_get_endFrame(int clip_id);
extern int clip_set_marker_start(int clip_id, int marker);
extern int clip_set_marker_end(int clip_id, int marker);
extern int clip_set_startframe(int s1, long frame_num);
extern int clip_set_endframe(int s1, long frame_num);
extern int clip_set_marker(int s1, int start, int end);
extern int clip_get_longest(int clip_id);
extern int clip_get_playmode(int s1);
extern int clip_set_playmode(int s1, int playmode);
extern int clip_get_loops(int s1);
extern int clip_get_loops2(int s1);
extern int clip_get_next(int s1);
extern int clip_get_depth(int s1);
extern int clip_set_depth(int s1, int n);
extern int clip_set_speed(int s1, int speed);
extern int clip_set_framedup(int s1, int n);
extern int clip_get_framedup(int s1);
extern int clip_marker_clear(int clip_id);
extern int clip_set_looptype(int s1, int looptype);
extern int clip_get_speed(int s1);
extern int clip_get_looptype(int s1);
extern int clip_set_loops(int s1, int nr_of_loops);
extern int clip_set_loops2(int s1, int nr);
extern int clip_set_next(int s1, int next_clip_id);
extern int clip_get_chain_source(int clip_id, int position);
extern int clip_set_chain_source(int clip_id, int position, int source);
extern int clip_get_sub_audio(int s1);
extern int clip_set_sub_audio(int s1, int audio);
extern int clip_get_audio_volume(int s1);
extern int clip_set_audio_volume(int s1, int volume);
extern int clip_copy(int s1);
extern int clip_get_effect(int s1, int position);
/* get effect any, even if effect is disabled (required for informational purposes)*/
extern int clip_get_effect_any(int s1, int position);
extern int clip_get_offset(int s1, int position);
/* trimmer is usefull for underlying clips in the effect chain.
you can manual adjust the video/audio sync of the underlying clip */
extern int clip_get_trimmer(int s1, int position);
extern int clip_set_trimmer(int s1, int position, int trimmer);
extern int clip_get_short_info(int clip_id, int *, int *, int *, int *) ;
extern int clip_get_chain_volume(int s1, int position);
/* set volume of audio data coming to the chain */
extern int clip_set_chain_volume(int s1, int position, int volume);
/* whether to mix underlying clip's audio */
extern int clip_get_chain_audio(int s1, int position);
extern int clip_has_extra_frame(int s1, int position);
/* mix the audio from entry from the effect chain, if any */
extern int clip_set_chain_audio(int s1, int position, int flag);
extern int clip_set_chain_status(int s1, int position, int status);
extern int clip_get_chain_status(int s1, int position);
extern int clip_set_offset(int s1, int position, int frame_offset);
extern int clip_get_effect_arg(int s1, int position, int argnr);
extern int clip_set_effect_arg(int s1, int position, int argnr, int value);
extern int clip_get_all_effect_arg(int s1, int position, int *args,
int arg_len, int n_elapsed);
extern int clip_chain_remove(int s1, int position);
extern int clip_chain_clear(int s1);
extern int clip_chain_size(int s1);
extern int clip_chain_get_free_entry(int s1);
extern int clip_chain_add(int s1, int c, int effect_nr);
/* channel depends on source , it select a channel of a certain video source */
extern int clip_get_chain_channel(int s1, int position);
extern int clip_set_chain_channel(int s1, int position, int channel);
//int clip_chain_replace(int s1, int position, int effect_id);
extern int clip_chain_sprint_status(int s1, int entry, int changed, int r_changed, char *str,
int frame);
extern int clip_set_render_entry(int s1, int entry);
extern int clip_get_render_entry(int s1);
extern int clip_set_description(int clip_id, char *description);
extern int clip_get_description(int clip_id, char *description);
extern int clip_entry_is_rendering(int clip_id, int entry);
extern int clip_entry_set_is_rendering(int clip_id, int entry, int value);
extern int clip_get_loop_dec(int s1);
extern int clip_set_loop_dec(int s1, int active, int periods);
extern int clip_apply_loop_dec(int s1, double fps);
extern int clip_set_manual_fader(int s1, int value );
extern int clip_apply_fader_inc(int s1);
extern int clip_set_fader_active(int s1, int nframes, int direction);
extern int clip_set_fader_val(int s1, float val);
extern int clip_get_fader_active(int s1);
extern float clip_get_fader_val(int s1);
extern float clip_get_fader_inc(int s1);
extern int clip_get_fader_direction(int s1);
extern int clip_reset_fader(int t1);
extern int clip_reset_offset(int s1);
extern int clip_get_effect_status(int s1);
extern int clip_get_selected_entry(int s1);
extern int clip_set_effect_status(int s1, int status);
extern int clip_set_selected_entry(int s1, int position);
#ifdef HAVE_XML2
extern void CreateClip(xmlNodePtr node, clip_info * clip);
extern void CreateEffects(xmlNodePtr node, clip_eff_chain ** effects);
extern void CreateEffect(xmlNodePtr node, clip_eff_chain * effect, int pos);
extern void CreateArguments(xmlNodePtr node, int *arg, int argcount);
extern void ParseClip(xmlDocPtr doc, xmlNodePtr cur, clip_info * skel);
extern void ParseEffects(xmlDocPtr doc, xmlNodePtr cur, clip_info * skel);
extern void ParseEffect(xmlDocPtr doc, xmlNodePtr cur, int dst_clip);
extern void ParseArguments(xmlDocPtr doc, xmlNodePtr cur, int *arg);
extern unsigned char *UTF8toLAT1(unsigned char *in);
#endif
#endif