]> git.sesse.net Git - mlt/blobdiff - src/modules/core/filter_data_feed.c
refactor dissolve_yuv() to use composite_line_yuv()
[mlt] / src / modules / core / filter_data_feed.c
index 9c8067af11532a6c71b5e25b67614c474d6940bb..e3cf81d34b2e744dd27c149fba43144085ad8c12 100644 (file)
@@ -3,24 +3,23 @@
  * Copyright (C) 2004-2005 Ushodaya Enterprises Limited
  * Author: Charles Yates <charles.yates@pandora.be>
  *
- * 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 <stdlib.h>
 #include <string.h>
-#include "filter_data.h"
 #include <framework/mlt.h>
 
 /** This filter should be used in conjuction with the data_show filter.
@@ -85,35 +84,39 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
        {
                int i = 0;
                int count = mlt_properties_count( frame_properties );
-               char inactive[ 512 ];
 
                for ( i = 0; i < count; i ++ )
                {
                        char *name = mlt_properties_get_name( frame_properties, i );
-                       if ( !strncmp( name, "meta.attr.", 10 ) && strstr( name, ".inactive" ) == NULL )
+
+                       // Only deal with meta.attr.name values here - these should have a value of 1 to be considered
+                       // Additional properties of the form are meta.attr.name.property are passed down on the feed
+                       if ( !strncmp( name, "meta.attr.", 10 ) && strchr( name + 10, '.' ) == NULL && mlt_properties_get_int( frame_properties, name ) == 1 )
                        {
-                               char *value = mlt_properties_get( frame_properties, name );
-                               sprintf( inactive, "%s.inactive", name );
-                               if ( value != NULL && strcmp( value, "" ) && mlt_properties_get_int( frame_properties, inactive ) == 0 )
-                               {
-                                       // Create a new data feed
-                                       mlt_properties feed = mlt_properties_new( );
-
-                                       // Assign it the base properties
-                                       mlt_properties_set( feed, "id", mlt_properties_get( filter_properties, "_unique_id" ) );
-                                       mlt_properties_set( feed, "type", strrchr( name, '.' ) + 1 );
-                                       mlt_properties_set_position( feed, "position", mlt_frame_get_position( frame ) );
-
-                                       // Assign in/out of service we're connected to
-                                       mlt_properties_set_position( feed, "in", mlt_properties_get_position( frame_properties, "in" ) );
-                                       mlt_properties_set_position( feed, "out", mlt_properties_get_position( frame_properties, "out" ) );
-
-                                       // Assign the value to the feed
-                                       mlt_properties_set( feed, "markup", value );
-
-                                       // Push it on to the queue
-                                       mlt_deque_push_back( data_queue, feed );
-                               }
+                               // Temp var to hold name + '.' for pass method
+                               char temp[ 132 ];
+
+                               // Create a new data feed
+                               mlt_properties feed = mlt_properties_new( );
+
+                               // Assign it the base properties
+                               mlt_properties_set( feed, "id", mlt_properties_get( filter_properties, "_unique_id" ) );
+                               mlt_properties_set( feed, "type", strrchr( name, '.' ) + 1 );
+                               mlt_properties_set_position( feed, "position", mlt_frame_get_position( frame ) );
+
+                               // Assign in/out of service we're connected to
+                               mlt_properties_set_position( feed, "in", mlt_properties_get_position( frame_properties, "in" ) );
+                               mlt_properties_set_position( feed, "out", mlt_properties_get_position( frame_properties, "out" ) );
+
+                               // Pass all meta properties 
+                               sprintf( temp, "%s.", name );
+                               mlt_properties_pass( feed, frame_properties, temp );
+
+                               // Push it on to the queue
+                               mlt_deque_push_back( data_queue, feed );
+
+                               // Make sure this attribute only gets processed once
+                               mlt_properties_set_int( frame_properties, name, 0 );
                        }
                }
        }
@@ -151,7 +154,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 /** Constructor for the filter.
 */
 
-mlt_filter filter_data_feed_init( char *arg )
+mlt_filter filter_data_feed_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
        // Create the filter
        mlt_filter this = mlt_filter_new( );