From ff9da69f0b59e132d8dd28b796e7dc4e9ec8b1bd Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Sat, 31 Jul 2004 14:15:21 +0000 Subject: [PATCH] Mutable watermark producer and small optimisation git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@347 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/modules/core/filter_watermark.c | 15 +++++++++++---- src/modules/core/transition_composite.c | 12 +++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/modules/core/filter_watermark.c b/src/modules/core/filter_watermark.c index 4f1c5be3..f23ac60b 100644 --- a/src/modules/core/filter_watermark.c +++ b/src/modules/core/filter_watermark.c @@ -27,6 +27,7 @@ #include #include +#include /** 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 ); } } diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index 466c7742..622ae8fe 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -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; } -- 2.39.2