X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fcore%2Ftransition_region.c;h=b75a2904329e2cb2d06a66dc9c5a0d57f7a6af8b;hb=b6c72f309b9b2637109ffe020b4de4b278473c42;hp=688d51cddaa6ed4098427f80a6e95e73a266ad8b;hpb=0a763f7b10f28184bba59fd8cecbc29999c131ef;p=melted diff --git a/src/modules/core/transition_region.c b/src/modules/core/transition_region.c index 688d51c..b75a290 100644 --- a/src/modules/core/transition_region.c +++ b/src/modules/core/transition_region.c @@ -3,19 +3,19 @@ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited * Author: Charles Yates * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "transition_region.h" @@ -46,7 +46,8 @@ static int create_instance( mlt_transition this, char *name, char *value, int co *arg ++ = '\0'; // Create the filter - filter = mlt_factory_filter( type, arg ); + mlt_profile profile = mlt_service_profile( MLT_TRANSITION_SERVICE( this ) ); + filter = mlt_factory_filter( profile, type, arg ); // If we have a filter, then initialise and store it if ( filter != NULL ) @@ -67,8 +68,8 @@ static int create_instance( mlt_transition this, char *name, char *value, int co sprintf( key, "%s.", name ); // Just in case, let's assume that the filter here has a composite - mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "composite.start", "0%,0%:100%x100%" ); - mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "composite.fill", "true" ); + //mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "composite.geometry", "0%,0%:100%x100%" ); + //mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "composite.fill", 1 ); // Pass all the key properties on the filter down mlt_properties_pass( MLT_FILTER_PROPERTIES( filter ), properties, key ); @@ -106,7 +107,7 @@ static uint8_t *filter_get_alpha_mask( mlt_frame this ) mlt_image_format format = mlt_image_yuv422; // Get the shape image to trigger alpha creation - mlt_properties_set( MLT_FRAME_PROPERTIES( shape_frame ), "distort", "true" ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( shape_frame ), "distort", 1 ); mlt_frame_get_image( shape_frame, &image, &format, ®ion_width, ®ion_height, 0 ); alpha = mlt_frame_get_alpha_mask( shape_frame ); @@ -119,12 +120,17 @@ static uint8_t *filter_get_alpha_mask( mlt_frame this ) alpha = p; while ( size -- ) { - *p ++ = *image ++; + *p ++ = ( int )( ( ( *image ++ - 16 ) * 299 ) / 255 ); image ++; } - mlt_properties_set_data( MLT_FRAME_PROPERTIES( shape_frame ), "alpha", alpha, - region_width * region_height, mlt_pool_release, NULL ); + mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "alpha", alpha, region_width * region_height, mlt_pool_release, NULL ); } + else + { + mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "alpha", alpha, region_width * region_height, NULL, NULL ); + } + + this->get_alpha_mask = NULL; return alpha; } @@ -162,7 +168,8 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for if ( composite == NULL ) { // Create composite via the factory - composite = mlt_factory_transition( "composite", NULL ); + mlt_profile profile = mlt_service_profile( MLT_TRANSITION_SERVICE( this ) ); + composite = mlt_factory_transition( profile, "composite", NULL ); // If we have one if ( composite != NULL ) @@ -171,8 +178,8 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for mlt_properties composite_properties = MLT_TRANSITION_PROPERTIES( composite ); // We want to ensure that we don't get a wobble... - mlt_properties_set( composite_properties, "distort", "true" ); - mlt_properties_set( composite_properties, "progressive", "1" ); + //mlt_properties_set_int( composite_properties, "distort", 1 ); + mlt_properties_set_int( composite_properties, "progressive", 1 ); // Pass all the composite. properties on the transition down mlt_properties_pass( composite_properties, properties, "composite." ); @@ -331,16 +338,11 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for // Special case circle resource if ( strcmp( resource, "circle" ) == 0 ) - { - // Special case to ensure that fezzik produces a pixbuf with a NULL constructor - resource = "pixbuf"; - - // Specify the svg circle - mlt_properties_set( properties, "producer.resource", "" ); - } + resource = "pixbuf:"; - // Create the producer - producer = mlt_factory_producer( factory, resource ); + // Create the producer + mlt_profile profile = mlt_service_profile( MLT_TRANSITION_SERVICE( this ) ); + producer = mlt_factory_producer( profile, factory, resource ); // If we have one if ( producer != NULL ) @@ -417,7 +419,7 @@ static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt /** Constructor for the transition. */ -mlt_transition transition_region_init( void *arg ) +mlt_transition transition_region_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { // Create a new transition mlt_transition this = mlt_transition_new( ); @@ -436,6 +438,9 @@ mlt_transition transition_region_init( void *arg ) // Resource defines the shape of the region mlt_properties_set( properties, "resource", arg == NULL ? "rectangle" : arg ); + + // Inform apps and framework that this is a video only transition + mlt_properties_set_int( properties, "_transition_type", 1 ); } // Return the transition