#include <glew.h>
#include <mlt++/MltFilter.h>
#include <mlt++/MltDeque.h>
+#include <map>
+#include <string>
#define MAXLISTCOUNT 1024
typedef struct glsl_list_s *glsl_list;
class EffectChain;
class MltInput;
+struct GlslChain
+{
+ EffectChain *effect_chain;
+
+ // All services owned by the effect chain and their associated Movit effect.
+ std::map<mlt_service, Effect*> effects;
+
+ // For each effect in the Movit graph, a unique identifier for the service
+ // and whether it's disabled or not, using post-order traversal.
+ // We need to generate the chain if and only if this has changed.
+ std::string fingerprint;
+};
+
class GlslManager : public Mlt::Filter
{
public:
glsl_pbo get_pbo(int size);
void cleanupContext();
- Properties effect_list( Mlt::Service &service );
- static bool init_chain(mlt_service);
- static EffectChain* get_chain(mlt_service);
- static MltInput* get_input(mlt_service);
- static void reset_finalized(mlt_service);
+ static void set_chain(mlt_service, GlslChain*);
+ static GlslChain* get_chain(mlt_service);
+
static Effect* get_effect(mlt_service, mlt_frame);
- static Effect* add_effect(mlt_service, mlt_frame, Effect*);
- static Effect* add_effect(mlt_service, mlt_frame, Effect*, Effect* input_b);
- static void render_fbo(mlt_service, void *chain, GLuint fbo, int width, int height);
- int render_frame_texture(mlt_service, mlt_frame, int width, int height, uint8_t **image);
- int render_frame_rgba(mlt_service, mlt_frame, int width, int height, uint8_t **image);
+ static Effect* set_effect(mlt_service, mlt_frame, Effect*);
+ static MltInput* get_input(mlt_producer, mlt_frame);
+ static MltInput* set_input(mlt_producer, mlt_frame, MltInput*);
+ static uint8_t* get_input_pixel_pointer(mlt_producer, mlt_frame);
+ static uint8_t* set_input_pixel_pointer(mlt_producer, mlt_frame, uint8_t*);
+
+ static mlt_service get_effect_input(mlt_service, mlt_frame);
+ static void set_effect_input(mlt_service, mlt_frame, mlt_service);
+ static void get_effect_secondary_input(mlt_service, mlt_frame, mlt_service*, mlt_frame*);
+ static void set_effect_secondary_input(mlt_service, mlt_frame, mlt_service, mlt_frame);
+
+ int render_frame_texture(EffectChain*, mlt_frame, int width, int height, uint8_t **image);
+ int render_frame_rgba(EffectChain*, mlt_frame, int width, int height, uint8_t **image);
static void lock_service(mlt_frame frame);
static void unlock_service(mlt_frame frame);
private:
+ static void* get_frame_specific_data( mlt_service service, mlt_frame frame, const char *key, int *length );
+ static int set_frame_specific_data( mlt_service service, mlt_frame frame, const char *key, void *value, int length, mlt_destructor destroy, mlt_serialiser serialise );
+
static void onInit( mlt_properties owner, GlslManager* filter );
static void onClose( mlt_properties owner, GlslManager* filter );
static void onServiceChanged( mlt_properties owner, mlt_service service );