minore extensions and cleanings to the internal 'filter' api

This commit is contained in:
xant
2010-06-14 21:59:06 +02:00
parent 5aaa74ae32
commit 2faf041d29
15 changed files with 68 additions and 30 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ bool Filter::apply(Layer *lay, FilterInstance *instance)
act("initialized filter %s on layer %s", name, lay->name);
// here maybe keep a list of layers that possess instantiantions of this filter?
instance->set_layer(lay);
return true;
}
+19 -5
View File
@@ -37,8 +37,8 @@ FilterInstance::FilterInstance()
core = NULL;
intcore = 0;
outframe = NULL;
inuse = false;
active = false;
layer = NULL;
}
FilterInstance::FilterInstance(Filter *fr)
@@ -124,10 +124,24 @@ bool FilterInstance::get_parameter(int idx) {
bool FilterInstance::apply(Layer *lay)
{
bool ret = false;
if (!inuse && proto)
if (!layer && proto)
ret = proto->apply(lay, this);
if (ret)
inuse = true;
return ret;
}
void FilterInstance::set_layer(Layer *lay)
{
layer = lay;
}
Layer *FilterInstance::get_layer()
{
return layer;
}
bool FilterInstance::inuse()
{
if (layer)
return true;
return false;
}
+2 -1
View File
@@ -1,6 +1,7 @@
/* FreeJ - New Freior based Filter class
*
* (c) Copyright 2007-2010 Denis Roio <jaromil@dyne.org>
* Copyright (C) 2007-2010 Denis Roio <jaromil@dyne.org>
* Copyright (C) 2010 Andrea Guzzo <xant@xant.net>
*
* This source code is free software; you can redistribute it and/or
* modify it under the terms of the GNU Public License as published
+2 -1
View File
@@ -1,6 +1,7 @@
/* FreeJ - FreeFrame videoFX wrapper
*
* (c) Copyright 2008 Denis Roio <jaromil@dyne.org>
* Copyright (C) 2008-2010 Denis Roio <jaromil@dyne.org>
* Copyright (C) 2010 Andrea Guzzo <xant@dyne.org>
*
* studied on a Pure Data Packet module
* by Tom Schouten <pdp@zzz.kotnet.org>
+3 -1
View File
@@ -1,5 +1,7 @@
/* FreeJ - Frei0r wrapper
* (c) Copyright 2007 Denis Rojo <jaromil@dyne.org>
*
* Copyright (C) 2007-2010 Denis Roio <jaromil@dyne.org>
* Copyright (C) 2010 Andrea Guzzo <xant@xant.net>
*
* This source code is free software; you can redistribute it and/or
* modify it under the terms of the GNU Public License as published
+1
View File
@@ -25,6 +25,7 @@
#include <color.h>
#include <cairo.h>
#include <jsapi.h>
class CairoColor: public Color {
+2 -1
View File
@@ -1,5 +1,6 @@
/* FreeJ
* (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
* Copyright (C) 2001-2010 Denis Roio <jaromil@dyne.org>
* Copyright (C) 2010 Andrea Guzzo <xant@xant.net>
*
* This source code is free software; you can redistribute it and/or
* modify it under the terms of the GNU Public License as published
+11 -1
View File
@@ -45,15 +45,25 @@ class FilterInstance : public Entry {
virtual bool get_parameter(int idx); ///< get the parameter value
virtual bool apply(Layer *lay);
virtual bool inuse();
Layer *get_layer();
uint32_t *outframe;
Filter *proto;
bool active;
bool inuse;
unsigned intcore;
void *core;
protected:
void set_layer(Layer *lay);
private:
Layer *layer;
FACTORY_ALLOWED
};
+8 -7
View File
@@ -46,6 +46,7 @@ class JSObject;
class Entry;
class BaseLinklist {
friend class Entry;
public:
BaseLinklist() {
#ifdef THREADSAFE
@@ -61,11 +62,6 @@ class BaseLinklist {
#endif
};
/* don't touch these from outside
use begin() and end() and len() methods */
Entry *first;
Entry *last;
int length;
Entry *selection;
virtual Entry *_pick(int pos) =0;
@@ -77,7 +73,12 @@ class BaseLinklist {
pthread_mutex_t mutex;
pthread_mutexattr_t mattr;
#endif
protected:
/* don't touch these from outside
use begin() and end() and len() methods */
Entry *first;
Entry *last;
int length;
};
template <class T>
@@ -103,7 +104,7 @@ class Linklist : public BaseLinklist {
Entry *_pick(int pos);
T *pick(int pos);
T *search(const char *name, int *idx);
T *search(const char *name, int *idx=NULL);
T **completion(char *needle);
T *selected();
+2 -1
View File
@@ -41,7 +41,6 @@
#define __LOGGING_H__
#include <exceptions.h>
#include <console_ctrl.h>
#define MAX_LOG_MSG 1024
@@ -54,6 +53,8 @@ enum LogLevel { // ordered by increasing verbosity
DEBUG
};
class ConsoleController;
// Base class to implement for providing a logging service
class Logger {
public:
+2 -2
View File
@@ -1,8 +1,8 @@
/* FreeJ
*
* Copyright (C) 2004-2010 Denis Roio <jaromil@dyne.org>
* Copyright (C) 2004-2010 Denis Roio <jaromil@dyne.org>
* Copyright (C) 2004-2006 Silvano Galliani <kysucix@dyne.org>
* Copyright (C) 2010 Andrea Guzzo <xant@xant.net>
* Copyright (C) 2010 Andrea Guzzo <xant@dyne.org>
*
* This source code is free software; you can redistribute it and/or
* modify it under the terms of the GNU Public License as published
+2 -4
View File
@@ -250,10 +250,8 @@ void *Layer::do_filters(void *tmp_buf) {
filters.lock();
filt = (FilterInstance *)filters.begin();
while(filt) {
if(filt->active) {
/// QUAAA fps should be passed XXX TODO
tmp_buf = (void*) filt->process(25.0, (uint32_t*)tmp_buf);
}
if(filt->active)
tmp_buf = (void*) filt->process(fps.fps, (uint32_t*)tmp_buf);
filt = (FilterInstance *)filt->next;
}
filters.unlock();
+1 -1
View File
@@ -335,7 +335,7 @@ JS(layer_add_filter) {
GET_LAYER(Layer);
JS_EndRequest(cx);
if(filter_instance->inuse) {
if(filter_instance->inuse()) {
error("filter %s is already in use", filter_instance->proto->name);
return JS_TRUE;
}
+2
View File
@@ -20,6 +20,8 @@
#include <stdlib.h>
#include <logging.h>
#include <console_ctrl.h>
int Logger::printlog(LogLevel level, const char *format, ...) {
va_list arg;
+10 -4
View File
@@ -20,7 +20,6 @@
*/
#include <config.h>
#include <dlfcn.h>
#include <stdlib.h>
#include <string.h>
@@ -38,10 +37,13 @@
#include <freeframe_freej.h>
#ifdef HAVE_DARWIN
#define _UINT64
#include <Carbon/Carbon.h>
#endif
//#ifdef WITH_COCOA
#include <CVFilter.h>
//#endif
Plugger::Plugger() {
char temp[256];
@@ -193,13 +195,17 @@ int Plugger::refresh(Context *env) {
}
}
#endif
if(found<0) break;
if(found<0)
break;
}
free(filelist);
} while((dir = strtok(NULL,":")));
#ifdef WITH_COCOA
CVFilter::listFilters(env->filters);
#endif
act("filters found: %u", env->filters.len());
act("generators found: %u", env->generators.len());