Skip to content

Commit

Permalink
Use the new ResourcePool Movit functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
sesse authored and ddennedy committed Jan 26, 2014
1 parent 3a08309 commit d3072ce
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/modules/opengl/filter_glsl_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <movit/init.h>
#include <movit/util.h>
#include <movit/effect_chain.h>
#include <movit/resource_pool.h>
#include "mlt_movit_input.h"
#include "mlt_flip_effect.h"
#include <mlt++/MltEvent.h>
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions src/modules/opengl/filter_glsl_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ typedef struct glsl_pbo_s *glsl_pbo;
class Effect;
class EffectChain;
class MltInput;
class ResourcePool;

struct GlslChain
{
Expand Down Expand Up @@ -99,6 +100,8 @@ class GlslManager : public Mlt::Filter
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);

Expand Down Expand Up @@ -127,6 +130,7 @@ class GlslManager : public Mlt::Filter
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;
Expand Down
6 changes: 5 additions & 1 deletion src/modules/opengl/filter_movit_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 2 additions & 0 deletions src/modules/opengl/mlt_movit_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions src/modules/opengl/mlt_movit_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class MltInput : public Input
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();
Expand All @@ -55,6 +56,7 @@ class MltInput : public Input
Input *input;
bool isRGB;
YCbCrFormat m_ycbcr_format;
EffectChain *m_chain;
};

#endif // MLT_MOVIT_INPUT_H

0 comments on commit d3072ce

Please sign in to comment.