#include <GL/glx.h>
#endif
-void deleteManager(GlslManager *p)
+void dec_ref_and_delete(GlslManager *p)
{
- delete p;
+ if (p->dec_ref() == 0) {
+ delete p;
+ }
}
GlslManager::GlslManager()
if ( filter ) {
// Set the mlt_filter child in case we choose to override virtual functions.
filter->child = this;
- mlt_properties_set_data(mlt_global_properties(), "glslManager", this, 0,
- (mlt_destructor) deleteManager, NULL);
+ add_ref(mlt_global_properties());
mlt_events_register( get_properties(), "init glsl", NULL );
mlt_events_register( get_properties(), "close glsl", NULL );
}
}
+void GlslManager::add_ref(mlt_properties properties)
+{
+ inc_ref();
+ mlt_properties_set_data(properties, "glslManager", this, 0,
+ (mlt_destructor) dec_ref_and_delete, NULL);
+}
+
GlslManager* GlslManager::get_instance()
{
return (GlslManager*) mlt_properties_get_data(mlt_global_properties(), "glslManager", 0);
public:
GlslManager();
~GlslManager();
+ void add_ref(mlt_properties properties);
static GlslManager* get_instance();
glsl_fbo get_fbo(int width, int height);
if ( glsl && ( filter = mlt_filter_new() ) ) {
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
mlt_properties_set_double( properties, "radius", 3 );
filter->process = process;
}
if ( glsl && ( filter = mlt_filter_new() ) )
{
+ mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
#ifdef WIN32
// XXX avcolor_space is crashing on Windows in this context!
mlt_filter cpu_csc = NULL;
GlslManager* glsl = GlslManager::get_instance();
if ( glsl && ( filter = mlt_filter_new() ) ) {
+ mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
filter->process = process;
}
return filter;
if ( glsl && ( filter = mlt_filter_new() ) ) {
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
mlt_properties_set_int( properties, "matrix_size", 5 );
mlt_properties_set_double( properties, "circle_radius", 2.0 );
mlt_properties_set_double( properties, "gaussian_radius", 0.0 );
if ( glsl && ( filter = mlt_filter_new() ) ) {
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
mlt_properties_set_double( properties, "radius", 3.0 );
mlt_properties_set_double( properties, "mix", 0.3 );
filter->process = process;
if ( glsl && ( filter = mlt_filter_new() ) ) {
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
mlt_properties_set_double( properties, "radius", 20.0 );
mlt_properties_set_double( properties, "blur_mix", 1.0 );
mlt_properties_set_double( properties, "highlight_cutoff", 0.2 );
if ( glsl && ( filter = mlt_filter_new() ) ) {
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
mlt_properties_set_double( properties, "lift_r", 0.0 );
mlt_properties_set_double( properties, "lift_g", 0.0 );
mlt_properties_set_double( properties, "lift_b", 0.0 );
GlslManager* glsl = GlslManager::get_instance();
if ( glsl && ( filter = mlt_filter_new() ) ) {
+ mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
filter->process = process;
}
return filter;
if ( glsl && ( filter = mlt_filter_new() ) ) {
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
mlt_properties_set( properties, "opacity", arg? arg : "1" );
filter->process = process;
}
GlslManager* glsl = GlslManager::get_instance();
if ( glsl && ( filter = mlt_filter_new() ) ) {
+ mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
mlt_properties_set( MLT_FILTER_PROPERTIES(filter), "rect", arg );
mlt_properties_set_int( MLT_FILTER_PROPERTIES(filter), "fill", 1 );
filter->process = process;
GlslManager* glsl = GlslManager::get_instance();
if ( glsl && ( filter = mlt_filter_new() ) ) {
+ mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
filter->process = process;
}
return filter;
if ( glsl && ( filter = mlt_filter_new() ) )
{
+ mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
filter->process = process;
}
return filter;
if ( glsl && ( filter = mlt_filter_new() ) ) {
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
mlt_properties_set( properties, "saturation", arg? arg : "1.0" );
filter->process = process;
}
GlslManager* glsl = GlslManager::get_instance();
if ( glsl && ( filter = mlt_filter_new() ) ) {
+ mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
filter->process = process;
mlt_properties_set_double( MLT_FILTER_PROPERTIES(filter), "radius", 0.3 );
mlt_properties_set_double( MLT_FILTER_PROPERTIES(filter), "inner_radius", 0.3 );
if ( glsl && ( filter = mlt_filter_new() ) ) {
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ glsl->add_ref( properties );
mlt_properties_set( properties, "neutral_color", arg? arg : "#7f7f7f" );
mlt_properties_set_double( properties, "color_temperature", 6500.0 );
filter->process = process;