diff --git a/src/filter.cpp b/src/filter.cpp index 0ed64af4..e6eaec8d 100644 --- a/src/filter.cpp +++ b/src/filter.cpp @@ -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; } diff --git a/src/filter_instance.cpp b/src/filter_instance.cpp index db0d04a0..5b10d603 100644 --- a/src/filter_instance.cpp +++ b/src/filter_instance.cpp @@ -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; +} diff --git a/src/filter_js.cpp b/src/filter_js.cpp index ba2f9c1e..3123e8a0 100644 --- a/src/filter_js.cpp +++ b/src/filter_js.cpp @@ -1,6 +1,7 @@ /* FreeJ - New Freior based Filter class * - * (c) Copyright 2007-2010 Denis Roio + * Copyright (C) 2007-2010 Denis Roio + * Copyright (C) 2010 Andrea Guzzo * * This source code is free software; you can redistribute it and/or * modify it under the terms of the GNU Public License as published diff --git a/src/freeframe.cpp b/src/freeframe.cpp index 4e56af75..7af3d0c1 100644 --- a/src/freeframe.cpp +++ b/src/freeframe.cpp @@ -1,6 +1,7 @@ /* FreeJ - FreeFrame videoFX wrapper * - * (c) Copyright 2008 Denis Roio + * Copyright (C) 2008-2010 Denis Roio + * Copyright (C) 2010 Andrea Guzzo * * studied on a Pure Data Packet module * by Tom Schouten diff --git a/src/frei0r.cpp b/src/frei0r.cpp index 41107e59..c0cb7f66 100644 --- a/src/frei0r.cpp +++ b/src/frei0r.cpp @@ -1,5 +1,7 @@ /* FreeJ - Frei0r wrapper - * (c) Copyright 2007 Denis Rojo + * + * Copyright (C) 2007-2010 Denis Roio + * Copyright (C) 2010 Andrea Guzzo * * This source code is free software; you can redistribute it and/or * modify it under the terms of the GNU Public License as published diff --git a/src/include/cairo_layer.h b/src/include/cairo_layer.h index b02aa916..afd716ab 100644 --- a/src/include/cairo_layer.h +++ b/src/include/cairo_layer.h @@ -25,6 +25,7 @@ #include #include +#include class CairoColor: public Color { diff --git a/src/include/filter.h b/src/include/filter.h index 03b38419..ea0e5cd9 100644 --- a/src/include/filter.h +++ b/src/include/filter.h @@ -1,5 +1,6 @@ /* FreeJ - * (c) Copyright 2001 Denis Roio aka jaromil + * Copyright (C) 2001-2010 Denis Roio + * Copyright (C) 2010 Andrea Guzzo * * This source code is free software; you can redistribute it and/or * modify it under the terms of the GNU Public License as published diff --git a/src/include/filter_instance.h b/src/include/filter_instance.h index 25191ae7..e02fc378 100644 --- a/src/include/filter_instance.h +++ b/src/include/filter_instance.h @@ -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 }; diff --git a/src/include/linklist.h b/src/include/linklist.h index f82479ed..c2aedbe4 100644 --- a/src/include/linklist.h +++ b/src/include/linklist.h @@ -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 @@ -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(); diff --git a/src/include/logging.h b/src/include/logging.h index 94e639a0..5a913f02 100644 --- a/src/include/logging.h +++ b/src/include/logging.h @@ -41,7 +41,6 @@ #define __LOGGING_H__ #include -#include #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: diff --git a/src/jsparser.cpp b/src/jsparser.cpp index d2c71235..da26f0da 100644 --- a/src/jsparser.cpp +++ b/src/jsparser.cpp @@ -1,8 +1,8 @@ /* FreeJ * - * Copyright (C) 2004-2010 Denis Roio + * Copyright (C) 2004-2010 Denis Roio * Copyright (C) 2004-2006 Silvano Galliani - * Copyright (C) 2010 Andrea Guzzo + * Copyright (C) 2010 Andrea Guzzo * * This source code is free software; you can redistribute it and/or * modify it under the terms of the GNU Public License as published diff --git a/src/layer.cpp b/src/layer.cpp index 113343ca..15f3c279 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -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(); diff --git a/src/layer_js.cpp b/src/layer_js.cpp index 25ba7119..332873e8 100644 --- a/src/layer_js.cpp +++ b/src/layer_js.cpp @@ -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; } diff --git a/src/logging.cpp b/src/logging.cpp index 604fd23d..57ceb7f5 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -20,6 +20,8 @@ #include #include +#include + int Logger::printlog(LogLevel level, const char *format, ...) { va_list arg; diff --git a/src/plugger.cpp b/src/plugger.cpp index 44d0b058..20c2b25f 100644 --- a/src/plugger.cpp +++ b/src/plugger.cpp @@ -20,7 +20,6 @@ */ #include - #include #include #include @@ -38,10 +37,13 @@ #include #ifdef HAVE_DARWIN -#define _UINT64 #include #endif +//#ifdef WITH_COCOA +#include +//#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());