2 * transition_frei0r.c -- frei0r transition
3 * Copyright (c) 2008 Marco Gittler <g.marco@freenet.de>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library 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 GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <framework/mlt.h>
21 #include "frei0r_helper.h"
24 static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ){
26 mlt_frame b_frame = mlt_frame_pop_frame( a_frame );
27 mlt_transition transition = mlt_frame_pop_service( a_frame );
28 mlt_properties properties = MLT_TRANSITION_PROPERTIES( transition );
29 mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame );
30 mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame );
32 int invert = mlt_properties_get_int( properties, "invert" );
34 uint8_t *images[]={NULL,NULL,NULL};
36 *format = mlt_image_rgb24a;
37 mlt_frame_get_image( a_frame, &images[0], format, width, height, 0 );
38 mlt_frame_get_image( b_frame, &images[1], format, width, height, 0 );
40 double position = mlt_transition_get_position( transition, a_frame );
41 mlt_profile profile = mlt_service_profile( MLT_TRANSITION_SERVICE( transition ) );
42 double time = position / mlt_profile_fps( profile );
43 process_frei0r_item( MLT_TRANSITION_SERVICE(transition), position, time, properties, !invert ? a_frame : b_frame, images, width, height );
45 *width = mlt_properties_get_int( !invert ? a_props : b_props, "width" );
46 *height = mlt_properties_get_int( !invert ? a_props : b_props, "height" );
47 *image = mlt_properties_get_data( !invert ? a_props : b_props , "image", NULL );
51 mlt_frame transition_process( mlt_transition transition, mlt_frame a_frame, mlt_frame b_frame )
53 mlt_frame_push_service( a_frame, transition );
54 mlt_frame_push_frame( a_frame, b_frame );
55 mlt_frame_push_get_image( a_frame, transition_get_image );
59 void transition_close( mlt_transition this ){
60 destruct ( MLT_TRANSITION_PROPERTIES ( this ) );