2 * filter_movit_rect.cpp
3 * Copyright (C) 2013 Dan Dennedy <dan@dennedy.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include <framework/mlt.h>
21 #include "filter_glsl_manager.h"
23 using namespace movit;
25 static mlt_frame process( mlt_filter filter, mlt_frame frame )
27 // Drive the resize and resample filters on the b_frame for these composite parameters
28 mlt_properties properties = MLT_FILTER_PROPERTIES(filter);
29 mlt_properties frame_props = MLT_FRAME_PROPERTIES(frame);
30 mlt_properties_set( frame_props, "resize.rect", mlt_properties_get( properties, "rect" ) );
31 mlt_properties_set( frame_props, "resize.fill", mlt_properties_get( properties, "fill" ) );
32 mlt_properties_set( frame_props, "resize.halign", mlt_properties_get( properties, "halign" ) );
33 mlt_properties_set( frame_props, "resize.valign", mlt_properties_get( properties, "valign" ) );
38 mlt_filter filter_movit_rect_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
40 mlt_filter filter = NULL;
41 GlslManager* glsl = GlslManager::get_instance();
43 if ( glsl && ( filter = mlt_filter_new() ) ) {
44 mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
45 glsl->add_ref( properties );
46 mlt_properties_set( MLT_FILTER_PROPERTIES(filter), "rect", arg );
47 mlt_properties_set_int( MLT_FILTER_PROPERTIES(filter), "fill", 1 );
48 filter->process = process;