mlt_filter mlt_filter_new( )
{
mlt_filter self = calloc( 1, sizeof( struct mlt_filter_s ) );
- if ( self != NULL )
- mlt_filter_init( self, NULL );
- return self;
+ if ( self != NULL && mlt_filter_init( self, NULL ) == 0 )
+ {
+ return self;
+ }
+ else
+ {
+ free(self);
+ return NULL;
+ }
}
/** Get the service class interface.
char name[20];
// Make the properties key from unique id
- strcpy( name, "pos." );
- strcat( name, unique_id );
+ snprintf( name, 20, "pos.%s", unique_id );
+ name[20 - 1] = '\0';
return mlt_properties_get_position( MLT_FRAME_PROPERTIES( frame ), name ) - in;
}
int disable = mlt_properties_get_int( properties, "disable" );
const char *unique_id = mlt_properties_get( properties, "_unique_id" );
mlt_position position = mlt_frame_get_position( frame );
- char name[20];
+ char name[30];
// Make the properties key from unique id
- strcpy( name, "pos." );
- strcat( name, unique_id );
+ snprintf( name, sizeof(name), "pos.%s", unique_id );
+ name[sizeof(name) -1] = '\0';
// Save the position on the frame
mlt_properties_set_position( MLT_FRAME_PROPERTIES( frame ), name, position );
if ( disable || self->process == NULL )
+ {
return frame;
+ }
else
+ {
+ // Add a reference to this filter on the frame
+ mlt_properties_inc_ref( MLT_FILTER_PROPERTIES(self) );
+ snprintf( name, sizeof(name), "filter.%s", unique_id );
+ name[sizeof(name) -1] = '\0';
+ mlt_properties_set_data( MLT_FRAME_PROPERTIES(frame), name, self, 0,
+ (mlt_destructor) mlt_filter_close, NULL );
+
return self->process( self, frame );
+ }
}
/** Get a frame from this filter.