3 * Copyright (C) 2013 Dan Dennedy <dan@dennedy.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef GLSL_MANAGER_H
21 #define GLSL_MANAGER_H
24 #include <mlt++/MltFilter.h>
25 #include <mlt++/MltDeque.h>
27 #define MAXLISTCOUNT 1024
28 typedef struct glsl_list_s *glsl_list;
31 void *items[MAXLISTCOUNT];
34 int ( *add )( glsl_list, void* );
35 void* ( *at )( glsl_list, int );
36 void* ( *take_at )( glsl_list, int );
37 void* ( *take )( glsl_list, void* );
46 GLint internal_format;
48 typedef struct glsl_texture_s *glsl_texture;
57 typedef struct glsl_fbo_s *glsl_fbo;
64 typedef struct glsl_pbo_s *glsl_pbo;
70 class GlslManager : public Mlt::Filter
75 static GlslManager* get_instance();
77 glsl_fbo get_fbo(int width, int height);
78 static void release_fbo(glsl_fbo);
79 glsl_texture get_texture(int width, int height, GLint internal_format);
80 static void release_texture(glsl_texture);
81 glsl_pbo get_pbo(int size);
82 void cleanupContext();
84 Properties effect_list( Mlt::Service &service );
85 static bool init_chain(mlt_service);
86 static EffectChain* get_chain(mlt_service);
87 static MltInput* get_input(mlt_service);
88 static void reset_finalized(mlt_service);
89 static Effect* get_effect(mlt_filter, mlt_frame);
90 static Effect* add_effect(mlt_filter, mlt_frame, Effect*);
91 static Effect* add_effect(mlt_filter, mlt_frame, Effect*, Effect* input_b);
92 static void render(mlt_service, void *chain, GLuint fbo, int width, int height);
93 static void lock_service(mlt_frame frame);
94 static void unlock_service(mlt_frame frame);
97 static void onInit( mlt_properties owner, GlslManager* filter );
98 static void onClose( mlt_properties owner, GlslManager* filter );
99 static void onServiceChanged( mlt_properties owner, mlt_service service );
100 static void onPropertyChanged( mlt_properties owner, mlt_service service, const char* property );
102 Mlt::Deque texture_list;
104 Mlt::Event* initEvent;
105 Mlt::Event* closeEvent;
108 #endif // GLSL_MANAGER_H