From: Steinar H. Gunderson Date: Fri, 17 Jan 2014 21:34:14 +0000 (+0100) Subject: Use the new ResourcePool Movit functionality. X-Git-Url: https://git.sesse.net/?p=mlt;a=commitdiff_plain;h=d3072ce359860d6255a419998352e547e8ffb125 Use the new ResourcePool Movit functionality. --- diff --git a/src/modules/opengl/filter_glsl_manager.cpp b/src/modules/opengl/filter_glsl_manager.cpp index e9924de0..19831177 100644 --- a/src/modules/opengl/filter_glsl_manager.cpp +++ b/src/modules/opengl/filter_glsl_manager.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "mlt_movit_input.h" #include "mlt_flip_effect.h" #include @@ -50,6 +51,7 @@ void dec_ref_and_delete(GlslManager *p) GlslManager::GlslManager() : Mlt::Filter( mlt_filter_new() ) + , resource_pool(new ResourcePool()) , pbo(0) , initEvent(0) , closeEvent(0) @@ -85,6 +87,7 @@ GlslManager::~GlslManager() GLsync sync = (GLsync) syncs_to_delete.pop_front(); glDeleteSync( sync ); } + delete resource_pool; } void GlslManager::add_ref(mlt_properties properties) diff --git a/src/modules/opengl/filter_glsl_manager.h b/src/modules/opengl/filter_glsl_manager.h index 496e1922..673c52c9 100644 --- a/src/modules/opengl/filter_glsl_manager.h +++ b/src/modules/opengl/filter_glsl_manager.h @@ -69,6 +69,7 @@ typedef struct glsl_pbo_s *glsl_pbo; class Effect; class EffectChain; class MltInput; +class ResourcePool; struct GlslChain { @@ -99,6 +100,8 @@ public: glsl_pbo get_pbo(int size); void cleanupContext(); + ResourcePool* get_resource_pool() { return resource_pool; } + static void set_chain(mlt_service, GlslChain*); static GlslChain* get_chain(mlt_service); @@ -127,6 +130,7 @@ private: static void onClose( mlt_properties owner, GlslManager* filter ); static void onServiceChanged( mlt_properties owner, mlt_service service ); static void onPropertyChanged( mlt_properties owner, mlt_service service, const char* property ); + ResourcePool* resource_pool; Mlt::Deque fbo_list; Mlt::Deque texture_list; Mlt::Deque syncs_to_delete; diff --git a/src/modules/opengl/filter_movit_convert.cpp b/src/modules/opengl/filter_movit_convert.cpp index dab3eae4..8595173e 100644 --- a/src/modules/opengl/filter_movit_convert.cpp +++ b/src/modules/opengl/filter_movit_convert.cpp @@ -213,7 +213,11 @@ static void finalize_movit_chain( mlt_service leaf_service, mlt_frame frame ) mlt_log_debug( leaf_service, "=== CREATING NEW CHAIN (old chain=%p, leaf=%p, fingerprint=%s) ===\n", chain, leaf_service, new_fingerprint.c_str() ); mlt_profile profile = mlt_service_profile( leaf_service ); chain = new GlslChain; - chain->effect_chain = new EffectChain( profile->display_aspect_num, profile->display_aspect_den ); + chain->effect_chain = new EffectChain( + profile->display_aspect_num, + profile->display_aspect_den, + GlslManager::get_instance()->get_resource_pool() + ); chain->fingerprint = new_fingerprint; build_movit_chain( leaf_service, frame, chain ); diff --git a/src/modules/opengl/mlt_movit_input.cpp b/src/modules/opengl/mlt_movit_input.cpp index 4339ac30..a75fe1ff 100644 --- a/src/modules/opengl/mlt_movit_input.cpp +++ b/src/modules/opengl/mlt_movit_input.cpp @@ -26,6 +26,7 @@ MltInput::MltInput(unsigned width, unsigned height) , needs_mipmaps(false) , input(0) , isRGB(true) + , m_chain(NULL) { register_int("output_linear_gamma", &output_linear_gamma); register_int("needs_mipmaps", &needs_mipmaps); @@ -62,6 +63,7 @@ void MltInput::finalize() bool ok = input->set_int("output_linear_gamma", output_linear_gamma); ok |= input->set_int("needs_mipmaps", needs_mipmaps); assert(ok); + input->inform_added(m_chain); input->finalize(); } diff --git a/src/modules/opengl/mlt_movit_input.h b/src/modules/opengl/mlt_movit_input.h index bbeac078..d7f64c55 100644 --- a/src/modules/opengl/mlt_movit_input.h +++ b/src/modules/opengl/mlt_movit_input.h @@ -35,6 +35,7 @@ public: Effect::AlphaHandling alpha_handling() const; std::string output_fragment_shader(); void set_gl_state(GLuint glsl_program_num, const std::string& prefix, unsigned *sampler_num); + void inform_added(EffectChain *chain) { m_chain = chain; } // Input ovverrides void finalize(); @@ -55,6 +56,7 @@ private: Input *input; bool isRGB; YCbCrFormat m_ycbcr_format; + EffectChain *m_chain; }; #endif // MLT_MOVIT_INPUT_H