+ return ( out > 0 ) ? ( out - in + 1 ) : 0;
+}
+
+/** Get the position within the filter.
+ *
+ * The position is relative to the in point.
+ * This will only be valid once mlt_filter_process is called.
+ *
+ * \public \memberof mlt_filter_s
+ * \param self a filter
+ * \param frame a frame
+ * \return the position
+ */
+
+mlt_position mlt_filter_get_position( mlt_filter self, mlt_frame frame )
+{
+ mlt_properties properties = MLT_FILTER_PROPERTIES( self );
+ mlt_position in = mlt_properties_get_position( properties, "in" );
+ const char *unique_id = mlt_properties_get( properties, "_unique_id" );
+ char name[20];
+
+ // Make the properties key from unique id
+ snprintf( name, 20, "pos.%s", unique_id );
+ name[20 - 1] = '\0';
+
+ return mlt_properties_get_position( MLT_FRAME_PROPERTIES( frame ), name ) - in;
+}
+
+/** Get the percent complete.
+ *
+ * This will only be valid once mlt_filter_process is called.
+ *
+ * \public \memberof mlt_filter_s
+ * \param self a filter
+ * \param frame a frame
+ * \return the progress in the range 0.0 to 1.0
+ */
+
+double mlt_filter_get_progress( mlt_filter self, mlt_frame frame )
+{
+ double position = mlt_filter_get_position( self, frame );
+ double length = mlt_filter_get_length2( self, frame );
+ return position / length;