Same and following clip identification
[melted] / mlt++ / src / MltProducer.cpp
index 4aaab48..ab0527c 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "MltProducer.h"
+#include "MltFilter.h"
 using namespace Mlt;
 
 Producer::Producer( ) :
@@ -35,6 +36,18 @@ Producer::Producer( char *id, char *service ) :
                instance = mlt_factory_producer( "fezzik", id != NULL ? id : service );
 }
 
+Producer::Producer( Service &producer ) :
+       instance( NULL )
+{
+       mlt_service_type type = producer.type( );
+       if ( type == producer_type || type == playlist_type || 
+                type == tractor_type || type == multitrack_type )
+       {
+               instance = ( mlt_producer )producer.get_service( );
+               inc_ref( );
+       }
+}
+
 Producer::Producer( mlt_producer producer ) :
        instance( producer )
 {
@@ -117,3 +130,20 @@ int Producer::get_playtime( )
        return mlt_producer_get_playtime( get_producer( ) );
 }
 
+Producer *Producer::cut( int in, int out )
+{
+       mlt_producer producer = mlt_producer_cut( get_producer( ), in, out );
+       Producer *result = new Producer( producer );
+       mlt_producer_close( producer );
+       return result;
+}
+
+bool Producer::same_clip( Producer &that )
+{
+       return mlt_producer_cut_parent( get_producer( ) ) == mlt_producer_cut_parent( that.get_producer( ) );
+}
+
+bool Producer::runs_into( Producer &that )
+{
+       return same_clip( that ) && get_out( ) == ( that.get_in( ) - 1 );
+}