]> git.sesse.net Git - mlt/commitdiff
added frei0r producers (patch from jb)
authorblendamedt <blendamedt@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 20 Feb 2009 11:56:17 +0000 (11:56 +0000)
committerblendamedt <blendamedt@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 20 Feb 2009 11:56:17 +0000 (11:56 +0000)
thx to jb

git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1360 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/frei0r/Makefile
src/modules/frei0r/factory.c
src/modules/frei0r/frei0r_helper.c

index 61b927a75fcf4cebb5cfdc0549c3d2783e9a26da..c708057584fe8516af1db0a2d87c54a9a5699705 100644 (file)
@@ -3,6 +3,7 @@ include ../../../config.mak
 TARGET = ../libmltfrei0r$(LIBSUF)
 
 OBJS = factory.o \
+          producer_frei0r.o \
           filter_frei0r.o \
           transition_frei0r.o \
           frei0r_helper.o
index 132123f4a9e3fe16716071877db74faa571ade0b..fbdd796294465ecdde0a52a8b67586eb2155e706 100644 (file)
@@ -35,6 +35,8 @@
 extern mlt_filter filter_frei0r_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
 extern mlt_frame filter_process( mlt_filter this, mlt_frame frame );
 extern void filter_close( mlt_filter this );
+extern int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int index );
+extern void producer_close( mlt_producer this );
 extern void transition_close( mlt_transition this );
 extern mlt_frame transition_process( mlt_transition transition, mlt_frame a_frame, mlt_frame b_frame );
 
@@ -45,6 +47,9 @@ static mlt_properties fill_param_info ( mlt_service_type type, const char *servi
        struct stat stat_buff;
 
        switch ( type ) {
+               case producer_type:
+                       strcpy ( servicetype , "producer" );
+                       break;
                case filter_type:
                        strcpy ( servicetype , "filter" );
                        break;
@@ -84,6 +89,9 @@ static mlt_properties fill_param_info ( mlt_service_type type, const char *servi
        mlt_properties_set ( metadata, "description" , info.explanation );
        mlt_properties_set ( metadata, "creator" , info.author );
        switch (type){
+               case producer_type:
+                       mlt_properties_set ( metadata, "type" , "producer" );
+                       break;
                case filter_type:
                        mlt_properties_set ( metadata, "type" , "filter" );
                        break;
@@ -168,7 +176,24 @@ static void * load_lib(  mlt_profile profile, mlt_service_type type , void* hand
                void* ret=NULL;
                mlt_properties properties=NULL;
 
-               if (type == filter_type && info.plugin_type == F0R_PLUGIN_TYPE_FILTER ){
+               if (type == producer_type && info.plugin_type == F0R_PLUGIN_TYPE_SOURCE ){
+                       mlt_producer this = mlt_producer_new( );
+                       if ( this != NULL )
+                       {
+                               this->get_frame = producer_get_frame;
+                               this->close = producer_close;
+                               f0r_init();
+                               properties=MLT_PRODUCER_PROPERTIES ( this );
+
+                               for (i=0;i<info.num_params;i++){
+                                       f0r_param_info_t pinfo;
+                                       f0r_get_param_info(&pinfo,i);
+
+                               }
+
+                               ret=this;
+                       }
+               } else if (type == filter_type && info.plugin_type == F0R_PLUGIN_TYPE_FILTER ){
                        mlt_filter this = mlt_filter_new( );
                        if ( this != NULL )
                        {
@@ -288,8 +313,11 @@ MLT_REPOSITORY
                                if (plginfo){
                                        f0r_plugin_info_t info;
                                        plginfo(&info);
-
-                                       if (firstname && info.plugin_type==F0R_PLUGIN_TYPE_FILTER){
+                                       if (firstname && info.plugin_type==F0R_PLUGIN_TYPE_SOURCE){
+                                               MLT_REGISTER( producer_type, pluginname, create_frei0r_item );
+                                               MLT_REGISTER_METADATA( producer_type, pluginname, fill_param_info, strdup(name) );
+                                       }
+                                       else if (firstname && info.plugin_type==F0R_PLUGIN_TYPE_FILTER){
                                                MLT_REGISTER( filter_type, pluginname, create_frei0r_item );
                                                MLT_REGISTER_METADATA( filter_type, pluginname, fill_param_info, strdup(name) );
                                        }
index dd7db7513469f794a924ab180fb4d981b2082c58..d246edc2b867b240fc9552fd5b7360a16842c9bb 100644 (file)
@@ -107,15 +107,21 @@ static void parse_color( char *color, f0r_param_color_t *fcolor )
        }
 
        int video_area = *width * *height;
-       uint32_t *img_a = mlt_pool_alloc( video_area * sizeof(uint32_t) );
+       uint32_t *img_a;
+
+       if ( type != producer_type )
+           img_a = mlt_pool_alloc( video_area * sizeof(uint32_t) );
        uint32_t *img_b = mlt_pool_alloc( video_area * sizeof(uint32_t) );
 
-       if (type==filter_type){
+       if (type==producer_type) {
+               f0r_update ( inst , position , NULL , img_b );
+               mlt_convert_rgb24a_to_yuv422((uint8_t *)img_b , *width, *height, *width * sizeof(uint32_t),*image, NULL);
+       } else if (type==filter_type) {
                mlt_convert_yuv422_to_rgb24a(*image, (uint8_t *)img_a, video_area);
                f0r_update ( inst , position , img_a , img_b );
                mlt_convert_rgb24a_to_yuv422((uint8_t *)img_b , *width, *height, *width * sizeof(uint32_t),
                                                                                                *image, NULL );
-       }else if (type==transition_type && f0r_update2 ){
+       } else if (type==transition_type && f0r_update2 ){
                uint32_t *result = mlt_pool_alloc( video_area * sizeof(uint32_t) );
 
                mlt_convert_yuv422_to_rgb24a ( image[0] , (uint8_t *)img_a , video_area );
@@ -128,7 +134,7 @@ static void parse_color( char *color, f0r_param_color_t *fcolor )
 
                mlt_pool_release(result);
        }
-       mlt_pool_release(img_a);
+       if ( type != producer_type ) mlt_pool_release(img_a);
        mlt_pool_release(img_b);
 
        return 0;