X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fcore%2Ffilter_watermark.c;h=217a3bec3b9dba45e99f9ef54c9d6ce4b7761a3a;hb=347a40b8498698136bcfa3a5fc33c2367dff1e33;hp=2e88e082adc7ff6a82ce11cfbc8568acf234ed72;hpb=42eea21bf0c71036397cac39f19d537c9344081c;p=mlt diff --git a/src/modules/core/filter_watermark.c b/src/modules/core/filter_watermark.c index 2e88e082..217a3bec 100644 --- a/src/modules/core/filter_watermark.c +++ b/src/modules/core/filter_watermark.c @@ -42,6 +42,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format // Get the properties of the filter mlt_properties properties = MLT_FILTER_PROPERTIES( this ); + mlt_service_lock( MLT_FILTER_SERVICE( this ) ); + // Get the producer from the filter mlt_producer producer = mlt_properties_get_data( properties, "producer", NULL ); @@ -115,6 +117,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format mlt_properties_pass( producer_properties, properties, "producer." ); } + mlt_service_unlock( MLT_FILTER_SERVICE( this ) ); + // Only continue if we have both producer and composite if ( composite != NULL && producer != NULL ) { @@ -124,11 +128,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format // We will get the 'b frame' from the producer mlt_frame b_frame = NULL; - // Get the unique id of the filter (used to reacquire the producer position) - char *name = mlt_properties_get( properties, "_unique_id" ); - // Get the original producer position - mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( frame ), name ); + mlt_position position = mlt_filter_get_position( this, frame ); // Make sure the producer is in the correct position mlt_producer_seek( producer, position ); @@ -155,9 +156,6 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format if ( mlt_frame_get_aspect_ratio( frame ) == 0 ) mlt_properties_set_double( a_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); - mlt_properties_set_int( b_props, "normalised_width", mlt_properties_get_int( a_props, "normalised_width" ) ); - mlt_properties_set_int( b_props, "normalised_height", mlt_properties_get_int( a_props, "normalised_height" ) ); - if ( mlt_properties_get_int( properties, "distort" ) ) { mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( composite ), "distort", 1 ); @@ -165,6 +163,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format mlt_properties_set_int( b_props, "distort", 1 ); } + *format = mlt_image_yuv422; if ( mlt_properties_get_int( properties, "reverse" ) == 0 ) { // Apply all filters that are attached to this filter to the b frame @@ -192,8 +191,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format mlt_service_apply_filters( MLT_FILTER_SERVICE( this ), b_frame, 0 ); error = mlt_frame_get_image( b_frame, image, format, width, height, 1 ); alpha = mlt_frame_get_alpha_mask( b_frame ); - mlt_properties_set_data( a_props, "image", *image, *width * *height * 2, NULL, NULL ); - mlt_properties_set_data( a_props, "alpha", alpha, *width * *height, NULL, NULL ); + mlt_frame_set_image( frame, *image, *width * *height * 2, NULL ); + mlt_frame_set_alpha( frame, alpha, *width * *height, NULL ); mlt_properties_set_int( a_props, "width", *width ); mlt_properties_set_int( a_props, "height", *height ); mlt_properties_set_int( a_props, "progressive", 1 ); @@ -225,15 +224,9 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) // Get the properties of the frame mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); - // Get a unique name to store the frame position - char *name = mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "_unique_id" ); - // Assign the frame out point to the filter (just in case we need it later) mlt_properties_set_int( MLT_FILTER_PROPERTIES( this ), "_out", mlt_properties_get_int( properties, "out" ) ); - // Assign the current position to the name - mlt_properties_set_position( properties, name, mlt_frame_get_position( frame ) - mlt_filter_get_in( this ) ); - // Push the filter on to the stack mlt_frame_push_service( frame, this ); @@ -253,7 +246,7 @@ mlt_filter filter_watermark_init( mlt_profile profile, mlt_service_type type, co { mlt_properties properties = MLT_FILTER_PROPERTIES( this ); this->process = filter_process; - mlt_properties_set( properties, "factory", "fezzik" ); + mlt_properties_set( properties, "factory", mlt_environment( "MLT_PRODUCER" ) ); if ( arg != NULL ) mlt_properties_set( properties, "resource", arg ); // Ensure that attached filters are handled privately