Skip to content

Commit

Permalink
Adapt opengl module to movit as external lib.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Feb 5, 2013
1 parent 1f1501d commit d3bde04
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 69 deletions.
42 changes: 7 additions & 35 deletions src/modules/opengl/Makefile
@@ -1,4 +1,4 @@
CFLAGS += -I../.. -I../../eigen3
CFLAGS += -I../..

LDFLAGS += -L../../framework -lmlt -lm

Expand All @@ -9,39 +9,6 @@ TARGET = ../libmltopengl$(LIBSUF)
OBJS = factory.o

CPPOBJS = filter_glsl_manager.o

# Movit Core
CPPOBJS += movit/util.o movit/effect.o movit/effect_chain.o movit/init.o

# Movit Inputs
CPPOBJS += movit/flat_input.o
CPPOBJS += movit/ycbcr_input.o

# Movit Effects
CPPOBJS += movit/lift_gamma_gain_effect.o
CPPOBJS += movit/white_balance_effect.o
CPPOBJS += movit/gamma_expansion_effect.o
CPPOBJS += movit/gamma_compression_effect.o
CPPOBJS += movit/colorspace_conversion_effect.o
CPPOBJS += movit/saturation_effect.o
CPPOBJS += movit/vignette_effect.o
CPPOBJS += movit/mirror_effect.o
CPPOBJS += movit/blur_effect.o
CPPOBJS += movit/diffusion_effect.o
CPPOBJS += movit/glow_effect.o
CPPOBJS += movit/unsharp_mask_effect.o
CPPOBJS += movit/mix_effect.o
CPPOBJS += movit/resize_effect.o
CPPOBJS += movit/resample_effect.o
CPPOBJS += movit/dither_effect.o
CPPOBJS += movit/deconvolution_sharpen_effect.o
CPPOBJS += movit/sandbox_effect.o
CPPOBJS += movit/overlay_effect.o
CPPOBJS += movit/alpha_division_effect.o
CPPOBJS += movit/alpha_multiplication_effect.o
CPPOBJS += movit/padding_effect.o

# Movit MLT services
CPPOBJS += filter_movit_blur.o
CPPOBJS += filter_movit_convert.o
CPPOBJS += filter_deconvolution_sharpen.o
Expand Down Expand Up @@ -69,9 +36,14 @@ else
endif
endif

CXXFLAGS += $(CFLAGS) -Wno-deprecated
CXXFLAGS += -Wno-deprecated $(CFLAGS)
CXXFLAGS += `pkg-config --cflags movit 2> /dev/null`

SHADERDIR = `pkg-config --variable=shaderdir movit`
CXXFLAGS += -DSHADERDIR=\"$(SHADERDIR)\"

LDFLAGS += -L../../mlt++ -lmlt++
LDFLAGS += `pkg-config --libs movit 2> /dev/null`

SRCS := $(OBJS:.o=.c) $(CPPOBJS:.o=.cpp)

Expand Down
14 changes: 7 additions & 7 deletions src/modules/opengl/configure
Expand Up @@ -2,13 +2,12 @@

if [ "$help" != "1" ]
then
# TODO: test for OpenGL
# if [ ! $(pkg-config libdv) ]
# then
# echo "- libdv not found: disabling"
# touch ../disable-dv
# exit 0
# fi
if ! $(pkg-config movit)
then
echo "- movit not found: disabling"
touch ../disable-opengl
exit 0
fi

echo > config.mak
case $targetos in
Expand All @@ -19,4 +18,5 @@ then
*)
;;
esac
exit 0
fi
3 changes: 1 addition & 2 deletions src/modules/opengl/filter_deconvolution_sharpen.cpp
Expand Up @@ -22,8 +22,7 @@
#include <assert.h>

#include "glsl_manager.h"
#include "movit/init.h"
#include "movit/deconvolution_sharpen_effect.h"
#include <movit/deconvolution_sharpen_effect.h>

static mlt_frame process( mlt_filter filter, mlt_frame frame )
{
Expand Down
20 changes: 16 additions & 4 deletions src/modules/opengl/filter_glsl_manager.cpp
Expand Up @@ -18,10 +18,11 @@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include <stdlib.h>
#include <string>
#include "glsl_manager.h"
#include "movit/init.h"
#include "movit/effect_chain.h"
#include <movit/init.h>
#include <movit/effect_chain.h>
#include "mlt_movit_input.h"

extern "C" {
Expand All @@ -36,6 +37,7 @@ extern "C" {
#include <sys/syscall.h>
#endif


GlslManager::GlslManager()
: Mlt::Filter( mlt_filter_new() )
, pbo(0)
Expand Down Expand Up @@ -168,11 +170,21 @@ glsl_pbo GlslManager::get_pbo(int size)
return pbo;
}

std::string get_movit_path()
{
}

void GlslManager::onInit( mlt_properties owner, GlslManager* filter )
{
mlt_log_verbose( filter->get_service(), "%s: %d\n", __FUNCTION__, syscall(SYS_gettid) );
::init_movit( std::string(mlt_environment( "MLT_DATA" )).append("/opengl/movit"),
mlt_log_get_level() == MLT_LOG_DEBUG? MOVIT_DEBUG_ON : MOVIT_DEBUG_OFF );
#ifdef WIN32
std::string path = std::string(mlt_environment("MLT_APPDIR")).append("\\share\\movit");
#elif defined(__DARWIN__) && defined(RELOCATABLE)
std::string path = std::string(mlt_environment("MLT_APPDIR")).append("/share/movit");
#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 );
}

Expand Down
3 changes: 1 addition & 2 deletions src/modules/opengl/filter_lift_gamma_gain.cpp
Expand Up @@ -22,8 +22,7 @@
#include <assert.h>

#include "glsl_manager.h"
#include "movit/init.h"
#include "movit/lift_gamma_gain_effect.h"
#include <movit/lift_gamma_gain_effect.h>

static mlt_frame process( mlt_filter filter, mlt_frame frame )
{
Expand Down
3 changes: 1 addition & 2 deletions src/modules/opengl/filter_movit_blur.cpp
Expand Up @@ -22,8 +22,7 @@
#include <assert.h>

#include "glsl_manager.h"
#include "movit/init.h"
#include "movit/blur_effect.h"
#include <movit/blur_effect.h>

static mlt_frame process( mlt_filter filter, mlt_frame frame )
{
Expand Down
4 changes: 3 additions & 1 deletion src/modules/opengl/filter_movit_convert.cpp
Expand Up @@ -19,10 +19,12 @@

#include <framework/mlt.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#include "glsl_manager.h"
#include "movit/effect_chain.h"
#include <movit/effect_chain.h>
#include <movit/util.h>
#include "mlt_movit_input.h"


Expand Down
3 changes: 1 addition & 2 deletions src/modules/opengl/filter_movit_diffusion.cpp
Expand Up @@ -22,8 +22,7 @@
#include <assert.h>

#include "glsl_manager.h"
#include "movit/init.h"
#include "movit/diffusion_effect.h"
#include <movit/diffusion_effect.h>

static mlt_frame process( mlt_filter filter, mlt_frame frame )
{
Expand Down
3 changes: 1 addition & 2 deletions src/modules/opengl/filter_movit_glow.cpp
Expand Up @@ -22,8 +22,7 @@
#include <assert.h>

#include "glsl_manager.h"
#include "movit/init.h"
#include "movit/glow_effect.h"
#include <movit/glow_effect.h>

static mlt_frame process( mlt_filter filter, mlt_frame frame )
{
Expand Down
3 changes: 1 addition & 2 deletions src/modules/opengl/filter_movit_mirror.cpp
Expand Up @@ -22,8 +22,7 @@
#include <assert.h>

#include "glsl_manager.h"
#include "movit/init.h"
#include "movit/mirror_effect.h"
#include <movit/mirror_effect.h>

static mlt_frame process( mlt_filter filter, mlt_frame frame )
{
Expand Down
2 changes: 1 addition & 1 deletion src/modules/opengl/filter_movit_resample.cpp
Expand Up @@ -22,7 +22,7 @@
#include <assert.h>

#include "glsl_manager.h"
#include "movit/resample_effect.h"
#include <movit/resample_effect.h>

static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
{
Expand Down
1 change: 1 addition & 0 deletions src/modules/opengl/filter_movit_resize.cpp
Expand Up @@ -19,6 +19,7 @@

#include <framework/mlt.h>
#include <string.h>
#include <math.h>
#include <assert.h>

#include "glsl_manager.h"
Expand Down
3 changes: 1 addition & 2 deletions src/modules/opengl/filter_movit_saturation.cpp
Expand Up @@ -22,8 +22,7 @@
#include <assert.h>

#include "glsl_manager.h"
#include "movit/init.h"
#include "movit/saturation_effect.h"
#include <movit/saturation_effect.h>

static mlt_frame process( mlt_filter filter, mlt_frame frame )
{
Expand Down
3 changes: 1 addition & 2 deletions src/modules/opengl/filter_movit_vignette.cpp
Expand Up @@ -22,8 +22,7 @@
#include <assert.h>

#include "glsl_manager.h"
#include "movit/init.h"
#include "movit/vignette_effect.h"
#include <movit/vignette_effect.h>

static mlt_frame process( mlt_filter filter, mlt_frame frame )
{
Expand Down
3 changes: 1 addition & 2 deletions src/modules/opengl/filter_white_balance.cpp
Expand Up @@ -22,8 +22,7 @@
#include <assert.h>

#include "glsl_manager.h"
#include "movit/init.h"
#include "movit/white_balance_effect.h"
#include <movit/white_balance_effect.h>

static mlt_frame process( mlt_filter filter, mlt_frame frame )
{
Expand Down
6 changes: 3 additions & 3 deletions src/modules/opengl/mlt_movit_input.h
Expand Up @@ -20,9 +20,9 @@
#ifndef MLT_MOVIT_INPUT_H
#define MLT_MOVIT_INPUT_H

#include "movit/flat_input.h"
#include "movit/ycbcr_input.h"
#include "movit/effect_chain.h"
#include <movit/flat_input.h>
#include <movit/ycbcr_input.h>
#include <movit/effect_chain.h>

class MltInput : public Input
{
Expand Down

0 comments on commit d3bde04

Please sign in to comment.