* \param self the service to lock
*/
+#include <execinfo.h>
+
void mlt_service_lock( mlt_service self )
{
if ( self != NULL )
int mlt_service_attach( mlt_service self, mlt_filter filter )
{
+#if 0
+ void *buffer[1024];
+ int num, i;
+ char **sym;
+ printf("ATTACHING %p -> %p\n", self, filter);
+ for (i = 0; i < 1024; ++i) buffer[i] = 0;
+ num = backtrace(buffer, 1024);
+ sym = backtrace_symbols(buffer, num);
+ for (i = 0; i < num; ++i) {
+ //printf("%3d: %s\n", sym[i]);
+ }
+ free(sym);
+#endif
int error = self == NULL || filter == NULL;
if ( error == 0 )
{
mlt_properties_set_data( props, "service", self, 0, NULL, NULL );
mlt_events_fire( properties, "service-changed", NULL );
mlt_events_fire( props, "service-changed", NULL );
+ mlt_service cp = mlt_properties_get_data( properties, "_cut_parent", NULL );
+ if ( cp )
+ mlt_events_fire( MLT_SERVICE_PROPERTIES(cp), "service-changed", NULL );
mlt_events_listen( props, self, "service-changed", ( mlt_listener )mlt_service_filter_changed );
mlt_events_listen( props, self, "property-changed", ( mlt_listener )mlt_service_filter_property_changed );
}
return error;
}
-/** Retrieve a filter.
+/** Get the number of filters attached.
+ *
+ * \public \memberof mlt_service_s
+ * \param self a service
+ * \return the number of attached filters or -1 if there was an error
+ */
+
+int mlt_service_filter_count( mlt_service self )
+{
+ int result = -1;
+ if ( self )
+ {
+ mlt_service_base *base = self->local;
+ result = base->filter_count;
+ }
+ return result;
+}
+
+/** Reorder the attached filters.
+ *
+ * \public \memberof mlt_service_s
+ * \param self a service
+ * \param from the current index value of the filter to move
+ * \param to the new index value for the filter specified in \p from
+ * \return true if there was an error
+ */
+
+int mlt_service_move_filter( mlt_service self, int from, int to )
+{
+ int error = -1;
+ if ( self )
+ {
+ mlt_service_base *base = self->local;
+ if ( from < 0 ) from = 0;
+ if ( from >= base->filter_count ) from = base->filter_count - 1;
+ if ( to < 0 ) to = 0;
+ if ( to >= base->filter_count ) to = base->filter_count - 1;
+ if ( from != to && base->filter_count > 1 )
+ {
+ mlt_filter filter = base->filters[from];
+ int i;
+ if ( from > to )
+ {
+ for ( i = from; i > to; i-- )
+ base->filters[i] = base->filters[i - 1];
+ }
+ else
+ {
+ for ( i = from; i < to; i++ )
+ base->filters[i] = base->filters[i + 1];
+ }
+ base->filters[to] = filter;
+ mlt_events_fire( MLT_SERVICE_PROPERTIES(self), "service-changed", NULL );
+ error = 0;
+ }
+ }
+ return error;
+}
+
+/** Retrieve an attached filter.
*
* \public \memberof mlt_service_s
* \param self a service
return self? mlt_properties_get_data( MLT_SERVICE_PROPERTIES( self ), "_profile", NULL ) : NULL;
}
+/** Set the profile for a service.
+ *
+ * \public \memberof mlt_service_s
+ * \param self a service
+ * \param profile the profile to set onto the service
+ */
+
+void mlt_service_set_profile( mlt_service self, mlt_profile profile )
+{
+ mlt_properties_set_data( MLT_SERVICE_PROPERTIES( self ), "_profile", profile, 0, NULL, NULL );
+}
+
/** Destroy a service.
*
* \public \memberof mlt_service_s