]> git.sesse.net Git - mlt/blobdiff - src/modules/core/filter_data_feed.c
Big modification - switch to macros for parent class access
[mlt] / src / modules / core / filter_data_feed.c
index a49052517a251c9ac772730936ac01e7c28ab352..1f5c76c2d21080291d4260990dfe00bad3fa60c2 100644 (file)
@@ -18,6 +18,8 @@
  * 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>
 
@@ -53,14 +55,21 @@ static void destroy_data_queue( void *arg )
 static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 {
        // Get the filter properties
-       mlt_properties filter_properties = mlt_filter_properties( this );
+       mlt_properties filter_properties = MLT_FILTER_PROPERTIES( this );
 
        // Get the frame properties
-       mlt_properties frame_properties = mlt_frame_properties( frame );
+       mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
 
        // Get the data queue
        mlt_deque data_queue = mlt_properties_get_data( frame_properties, "data_queue", NULL );
 
+       // Get the type of the data feed
+       char *type = mlt_properties_get( filter_properties, "type" );
+
+       // Get the in and out points of this filter
+       int in = mlt_filter_get_in( this );
+       int out = mlt_filter_get_out( this );
+
        // Create the data queue if it doesn't exist
        if ( data_queue == NULL )
        {
@@ -72,18 +81,47 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
        }
 
        // Now create the data feed
-       if ( data_queue != NULL )
+       if ( data_queue != NULL && type != NULL && !strcmp( type, "attr_check" ) )
+       {
+               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 )
+                       {
+                               char *value = mlt_properties_get( frame_properties, name );
+                               sprintf( inactive, "%s.inactive", name );
+                               if ( value != NULL && 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 );
+                               }
+                       }
+               }
+       }
+       else if ( data_queue != NULL )
        {
-               // Get the in and out points of this filter
-               int in = mlt_filter_get_in( this );
-               int out = mlt_filter_get_out( this );
-
                // Create a new data feed
                mlt_properties feed = mlt_properties_new( );
 
-               // Get the type of the data feed
-               char *type = mlt_properties_get( filter_properties, "type" );
-
                // Assign it the base properties
                mlt_properties_set( feed, "id", mlt_properties_get( filter_properties, "_unique_id" ) );
                mlt_properties_set( feed, "type", type );
@@ -122,7 +160,7 @@ mlt_filter filter_data_feed_init( char *arg )
        if ( this != NULL )
        {
                // Get the properties
-               mlt_properties properties = mlt_filter_properties( this );
+               mlt_properties properties = MLT_FILTER_PROPERTIES( this );
 
                // Assign the argument (default to titles)
                mlt_properties_set( properties, "type", arg == NULL ? "titles" : arg );