]> git.sesse.net Git - mlt/blobdiff - src/framework/mlt_transition.c
src/framework/*: improve the doxygen documentation (work in progress). This also...
[mlt] / src / framework / mlt_transition.c
index 18e747dd0c2d7a7f8802aaff7df832d5fdeb6f89..7ab5f2fb9e302915c1ad0e3fdf63307035aacd10 100644 (file)
@@ -1,7 +1,9 @@
-/*
- * mlt_transition.c -- abstraction for all transition services
- * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
- * Author: Charles Yates <charles.yates@pandora.be>
+/**
+ * \file mlt_transition.c
+ * \brief abstraction for all transition services
+ *
+ * Copyright (C) 2003-2008 Ushodaya Enterprises Limited
+ * \author Charles Yates <charles.yates@pandora.be>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -18,8 +20,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "config.h"
-
 #include "mlt_transition.h"
 #include "mlt_frame.h"
 
@@ -158,7 +158,7 @@ mlt_frame mlt_transition_process( mlt_transition this, mlt_frame a_frame, mlt_fr
 
 /** Get a frame from this transition.
 
-       The logic is complex here. A transition is typically applied to frames on the a and 
+       The logic is complex here. A transition is typically applied to frames on the a and
        b tracks specified in the connect method above and only if both contain valid info
        for the transition type (this is either audio or image).
 
@@ -173,15 +173,15 @@ mlt_frame mlt_transition_process( mlt_transition this, mlt_frame a_frame, mlt_fr
                 +----------+-------------+
 
        During the overlap of c1 and c2, there is nothing for the A transition to do, so this
-       results in a no operation, but B is triggered. During the overlap of c2 and c3, again, 
-       the A transition is inactive and because the B transition is pointing at track 0, 
-       it too would be inactive. This isn't an ideal situation - it's better if the B 
+       results in a no operation, but B is triggered. During the overlap of c2 and c3, again,
+       the A transition is inactive and because the B transition is pointing at track 0,
+       it too would be inactive. This isn't an ideal situation - it's better if the B
        transition simply treats the frames from c3 as though they're the a track.
 
-       For this to work, we cache all frames coming from all tracks between the a and b 
-       tracks.  Before we process, we determine that the b frame contains someting of the 
+       For this to work, we cache all frames coming from all tracks between the a and b
+       tracks.  Before we process, we determine that the b frame contains someting of the
        right type and then we determine which frame to use as the a frame (selecting a
-       matching frame from a_track to b_track - 1). If both frames contain data of the 
+       matching frame from a_track to b_track - 1). If both frames contain data of the
        correct type, we process the transition.
 
        This method is invoked for each track and we return the cached frames as needed.
@@ -275,21 +275,23 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i
                        mlt_frame b_frame_ptr = this->frames[ !reverse_order ? b_frame : a_frame ];
                        int a_hide = mlt_properties_get_int( MLT_FRAME_PROPERTIES( a_frame_ptr ), "hide" );
                        int b_hide = mlt_properties_get_int( MLT_FRAME_PROPERTIES( b_frame_ptr ), "hide" );
-
-                       // Process the transition
-                       *frame = mlt_transition_process( this, a_frame_ptr, b_frame_ptr );
-
-                       // We need to ensure that the tractor doesn't consider this frame for output
-                       if ( *frame == a_frame_ptr )
-                               b_hide |= type;
-                       else
-                               a_hide |= type;
-
-                       mlt_properties_set_int( MLT_FRAME_PROPERTIES( a_frame_ptr ), "hide", a_hide );
-                       mlt_properties_set_int( MLT_FRAME_PROPERTIES( b_frame_ptr ), "hide", b_hide );
+                       if ( !( a_hide & type ) && !( b_hide & type ) )
+                       {
+                               // Process the transition
+                               *frame = mlt_transition_process( this, a_frame_ptr, b_frame_ptr );
+
+                               // We need to ensure that the tractor doesn't consider this frame for output
+                               if ( *frame == a_frame_ptr )
+                                       b_hide |= type;
+                               else
+                                       a_hide |= type;
+
+                               mlt_properties_set_int( MLT_FRAME_PROPERTIES( a_frame_ptr ), "hide", a_hide );
+                               mlt_properties_set_int( MLT_FRAME_PROPERTIES( b_frame_ptr ), "hide", b_hide );
+                       }
                }
        }
-       
+
        // Obtain the frame from the cache or the producer we're attached to
        if ( index >= a_track && index <= b_track )
                *frame = this->frames[ index ];