#include <GL/glx.h>
#endif
+using namespace movit;
+
void dec_ref_and_delete(GlslManager *p)
{
if (p->dec_ref() == 0) {
return tex;
}
}
-
- // Recycle a glsl_texture with deleted glTexture.
- glsl_texture gtex = 0;
- for (int i = 0; i < texture_list.count(); ++i) {
- glsl_texture tex = (glsl_texture) texture_list.peek(i);
- if (!tex->used && !tex->width && !tex->height) {
- gtex = tex;
- break;
- }
- }
unlock();
GLuint tex = 0;
glGenTextures(1, &tex);
if (!tex) {
- glDeleteTextures(1, &tex);
return NULL;
}
+ glsl_texture gtex = new glsl_texture_s;
if (!gtex) {
- gtex = new glsl_texture_s;
- if (!gtex)
- return NULL;
+ glDeleteTextures(1, &tex);
+ return NULL;
}
+ printf("created a new texture for %dx%d: %d\n", width, height, tex);
glBindTexture( GL_TEXTURE_2D, tex );
glTexImage2D( GL_TEXTURE_2D, 0, internal_format, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
void GlslManager::cleanupContext()
{
lock();
- for (int i = 0; i < texture_list.count(); ++i) {
- glsl_texture texture = (glsl_texture) texture_list.peek(i);
+ while (texture_list.peek_back()) {
+ glsl_texture texture = (glsl_texture) texture_list.peek_back();
glDeleteTextures(1, &texture->texture);
- texture->used = 0;
- texture->width = 0;
- texture->height = 0;
+ delete texture;
+ texture_list.pop_back();
}
if (pbo) {
glDeleteBuffers(1, &pbo->pbo);
#else
std::string path = std::string(getenv("MLT_MOVIT_PATH") ? getenv("MLT_MOVIT_PATH") : SHADERDIR);
#endif
- ::init_movit( path, mlt_log_get_level() == MLT_LOG_DEBUG? MOVIT_DEBUG_ON : MOVIT_DEBUG_OFF );
- filter->set( "glsl_supported", movit_initialized );
+ bool success = init_movit( path, MOVIT_DEBUG_ON );
+ filter->set( "glsl_supported", success );
}
void GlslManager::onClose( mlt_properties owner, GlslManager *filter )
set_frame_specific_data( service, frame, "_movit effect secondary input frame", input_frame, 0, NULL, NULL );
}
+void GlslManager::get_effect_third_input( mlt_service service, mlt_frame frame, mlt_service *input_service, mlt_frame *input_frame)
+{
+ *input_service = (mlt_service) get_frame_specific_data( service, frame, "_movit effect third input", NULL );
+ *input_frame = (mlt_frame) get_frame_specific_data( service, frame, "_movit effect third input frame", NULL );
+}
+
+void GlslManager::set_effect_third_input( mlt_service service, mlt_frame frame, mlt_service input_service, mlt_frame input_frame )
+{
+ set_frame_specific_data( service, frame, "_movit effect third input", input_service, 0, NULL, NULL );
+ set_frame_specific_data( service, frame, "_movit effect third input frame", input_frame, 0, NULL, NULL );
+}
+
int GlslManager::render_frame_texture(EffectChain *chain, mlt_frame frame, int width, int height, uint8_t **image)
{
glsl_texture texture = get_texture( width, height, GL_RGBA8 );