// Set the test card on the consumer
mlt_properties_set_data( properties, "test_card_producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL );
}
-
}
}
else
if ( mlt_prefix == NULL )
{
// Allow user over rides
- if ( prefix == NULL )
+ if ( prefix == NULL || !strcmp( prefix, "" ) )
prefix = getenv( "MLT_REPOSITORY" );
// If no directory is specified, default to install directory
if ( ret == 0 )
{
mlt_properties properties = mlt_service_properties( &this->parent );
- this->producer = producer;
mlt_properties_set_position( properties, "in", 0 );
mlt_properties_set_position( properties, "out", 0 );
mlt_properties_set_int( properties, "track", index );
int in = mlt_filter_get_in( this );
int out = mlt_filter_get_out( this );
+ // Get the producer this is connected to
+ mlt_service producer = mlt_service_producer( &this->parent );
+
// If the frame request is for this filters track, we need to process it
if ( index == track )
{
- int ret = mlt_service_get_frame( this->producer, frame, index );
+ int ret = mlt_service_get_frame( producer, frame, index );
if ( ret == 0 )
{
mlt_position position = mlt_frame_get_position( *frame );
}
else
{
- return mlt_service_get_frame( this->producer, frame, index );
+ return mlt_service_get_frame( producer, frame, index );
}
}
// protected filter method
mlt_frame ( *process )( mlt_filter, mlt_frame );
- // track and in/out points
- mlt_service producer;
-
// Protected
void *child;
};
base->out = NULL;
}
-/** Associate this service to the its consumer.
+/** Obtain the consumer this service is connected to.
+*/
+
+mlt_service mlt_service_consumer( mlt_service this )
+{
+ // Get the service base
+ mlt_service_base *base = this->local;
+
+ // Return the connected consumer
+ return base->out;
+}
+
+/** Obtain the producer this service is connected to.
+*/
+
+mlt_service mlt_service_producer( mlt_service this )
+{
+ // Get the service base
+ mlt_service_base *base = this->local;
+
+ // Return the connected producer
+ return base->count > 0 ? base->in[ base->count - 1 ] : NULL;
+}
+
+/** Associate this service to the consumer.
*/
static void mlt_service_connect( mlt_service this, mlt_service that )
int mlt_service_get_frame( mlt_service this, mlt_frame_ptr frame, int index )
{
- return this->get_frame( this, frame, index );
+ if ( this != NULL )
+ return this->get_frame( this, frame, index );
+ *frame = mlt_frame_init( );
+ return 0;
}
/** Close the service.
extern int mlt_service_connect_producer( mlt_service self, mlt_service producer, int index );
extern int mlt_service_get_frame( mlt_service self, mlt_frame_ptr frame, int index );
extern mlt_properties mlt_service_properties( mlt_service self );
+extern mlt_service mlt_service_consumer( mlt_service self );
+extern mlt_service mlt_service_producer( mlt_service self );
extern void mlt_service_close( mlt_service self );
// I'm not sure about self one - leaving it out of docs for now (only used in consumer_westley)
id[ ID_SIZE ] = '\0';
// Recurse on connected producer
- serialise_service( context, MLT_SERVICE( MLT_FILTER( service )->producer ), node );
+ serialise_service( context, mlt_service_producer( service ), node );
if ( context->pass == 1 )
{