2 * filter_region.c -- region filter
3 * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
4 * Author: Charles Yates <charles.yates@pandora.be>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #include "filter_region.h"
22 #include "transition_region.h"
24 #include <framework/mlt.h>
30 /** Filter processing.
33 static mlt_frame
filter_process( mlt_filter
this, mlt_frame frame
)
35 // Get the properties of the filter
36 mlt_properties properties
= MLT_FILTER_PROPERTIES( this );
38 // Get the region transition
39 mlt_transition transition
= mlt_properties_get_data( properties
, "_transition", NULL
);
41 // Create the transition if not available
42 if ( transition
== NULL
)
44 // Create the transition
45 transition
= mlt_factory_transition( "region", NULL
);
47 // Register with the filter
48 mlt_properties_set_data( properties
, "_transition", transition
, 0, ( mlt_destructor
)mlt_transition_close
, NULL
);
50 // Pass a reference to this filter down
51 mlt_properties_set_data( MLT_TRANSITION_PROPERTIES( transition
), "_region_filter", this, 0, NULL
, NULL
);
54 // Pass all properties down
55 mlt_properties_pass( MLT_TRANSITION_PROPERTIES( transition
), properties
, "" );
58 return mlt_transition_process( transition
, frame
, NULL
);
61 /** Constructor for the filter.
64 mlt_filter
filter_region_init( void *arg
)
66 // Create a new filter
67 mlt_filter
this = mlt_filter_new( );
69 // Further initialisation
72 // Get the properties from the filter
73 mlt_properties properties
= MLT_FILTER_PROPERTIES( this );
75 // Assign the filter process method
76 this->process
= filter_process
;
78 // Resource defines the shape of the region
79 mlt_properties_set( properties
, "resource", arg
== NULL ?
"rectangle" : arg
);
81 // Ensure that attached filters are handled privately
82 mlt_properties_set_int( properties
, "_filter_private", 1 );