/* * frei0r_helper.c -- frei0r helper * Copyright (c) 2008 Marco Gittler * * 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 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 * Lesser General Public License for more details. * * 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 "frei0r_helper.h" #include #include #include static void parse_color( char *color, f0r_param_color_t *fcolor ) { unsigned int temp = strtoul( color, &color, 0 ); if ( strlen( color ) > 6 ) temp >>= 8; fcolor->r = ( temp >> 16 ) & 0xff; fcolor->r /= 255; fcolor->g = ( temp >> 8 ) & 0xff; fcolor->g /= 255; fcolor->b = ( temp >> 0 ) & 0xff; fcolor->b /= 255; } int process_frei0r_item( mlt_service_type type, double position , mlt_properties prop , mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ){ int i=0; f0r_instance_t ( *f0r_construct ) ( unsigned int , unsigned int ) = mlt_properties_get_data( prop , "f0r_construct" ,NULL); void (*f0r_update)(f0r_instance_t instance, double time, const uint32_t* inframe, uint32_t* outframe)=mlt_properties_get_data( prop , "f0r_update" ,NULL); void (*f0r_destruct)(f0r_instance_t instance)=mlt_properties_get_data( prop , "f0r_destruct" ,NULL); void (*f0r_get_plugin_info)(f0r_plugin_info_t*)=mlt_properties_get_data( prop, "f0r_get_plugin_info" ,NULL); void (*f0r_get_param_info)(f0r_param_info_t* info, int param_index)=mlt_properties_get_data( prop , "f0r_get_param_info" ,NULL); void (*f0r_set_param_value)(f0r_instance_t instance, f0r_param_t param, int param_index)=mlt_properties_get_data( prop , "f0r_set_param_value" ,NULL); void (*f0r_get_param_value)(f0r_instance_t instance, f0r_param_t param, int param_index)=mlt_properties_get_data( prop , "f0r_get_param_value" ,NULL); void (*f0r_update2) (f0r_instance_t instance, double time, const uint32_t* inframe1,const uint32_t* inframe2,const uint32_t* inframe3, uint32_t* outframe)=mlt_properties_get_data( prop , "f0r_update2" ,NULL); //use as name the width and height f0r_instance_t inst; char ctorname[1024]=""; sprintf(ctorname,"ctor-%dx%d",*width,*height); void* neu=mlt_properties_get_data( prop , ctorname ,NULL ); if (!f0r_construct){ //printf("no ctor\n"); return -1; } if ( neu == 0 ){ inst= f0r_construct(*width,*height); mlt_properties_set_data( prop , ctorname , inst, sizeof(void*) , f0r_destruct , NULL );; }else{ inst=mlt_properties_get_data( prop , ctorname , NULL ); } if (f0r_get_plugin_info){ f0r_plugin_info_t info; f0r_get_plugin_info(&info); for (i=0;i