]> git.sesse.net Git - mlt/commitdiff
Mutable watermark producer and small optimisation
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 31 Jul 2004 14:15:21 +0000 (14:15 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 31 Jul 2004 14:15:21 +0000 (14:15 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@347 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/core/filter_watermark.c
src/modules/core/transition_composite.c

index 4f1c5be35646ae376a792a9a8b1ef0b4f303d78f..f23ac60bebddc46867cc97e09096d6746e0c4aef 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 /** Do it :-).
 */
@@ -48,6 +49,12 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
        // Get the composite from the filter
        mlt_transition composite = mlt_properties_get_data( properties, "composite", NULL );
 
+       // Get the resource to use
+       char *resource = mlt_properties_get( properties, "resource" );
+
+       // Get the old resource
+       char *old_resource = mlt_properties_get( properties, "old_resource" );
+
        // Create a composite if we don't have one
        if ( composite == NULL )
        {
@@ -70,11 +77,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
        }
 
        // Create a producer if don't have one
-       if ( producer == NULL )
+       if ( producer == NULL || ( old_resource != NULL && strcmp( resource, old_resource ) ) )
        {
-               // Get the resource to use
-               char *resource = mlt_properties_get( properties, "resource" );
-
                // Get the factory producer service
                char *factory = mlt_properties_get( properties, "factory" );
 
@@ -89,6 +93,9 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
 
                        // Ensure that we loop
                        mlt_properties_set( mlt_producer_properties( producer ), "eof", "loop" );
+
+                       // Set the old resource
+                       mlt_properties_set( properties, "old_resource", resource );
                }
        }
 
index 466c7742a390605c1c5a3cdc27dd70b6811d9b90..622ae8fe85546443763735e77f38a015be600b07 100644 (file)
@@ -896,6 +896,16 @@ static struct geometry_s *composite_calculate( struct geometry_s *result, mlt_tr
        return start;
 }
 
+static inline void inline_memcpy( uint8_t *dest, uint8_t *src, int length )
+{
+       uint8_t *end = src + length;
+       while ( src < end )
+       {
+               *dest ++ = *src ++;
+               *dest ++ = *src ++;
+       }
+}
+
 mlt_frame composite_copy_region( mlt_transition this, mlt_frame a_frame, mlt_position frame_position )
 {
        // Create a frame to return
@@ -963,7 +973,7 @@ mlt_frame composite_copy_region( mlt_transition this, mlt_frame a_frame, mlt_pos
 
        while ( q < r )
        {
-               memcpy( q, p, w * 2 );
+               inline_memcpy( q, p, w * 2 );
                q += w * 2;
                p += width * 2;
        }