// Get the filter properties
mlt_properties filter_properties = MLT_FILTER_PROPERTIES( filter );
+ mlt_service_lock( MLT_FILTER_SERVICE( filter ) );
+
// Get the resample information
int output_rate = mlt_properties_get_int( filter_properties, "frequency" );
int16_t *sample_buffer = mlt_properties_get_data( filter_properties, "buffer", NULL );
mlt_properties_set_int( filter_properties, "last_frequency", *frequency );
}
+ mlt_service_unlock( MLT_FILTER_SERVICE( filter ) );
+
// Resample the audio
used = audio_resample( resample, sample_buffer, *buffer, *samples );
int size = used * *channels * sizeof( int16_t );
*samples = used;
*frequency = output_rate;
}
+ else
+ {
+ mlt_service_unlock( MLT_FILTER_SERVICE( filter ) );
+ }
return 0;
}
break;
case mlt_image_rgb24a:
case mlt_image_opengl:
- value = PIX_FMT_RGB32;
+ value = PIX_FMT_RGBA;
break;
case mlt_image_yuv422:
value = PIX_FMT_YUYV422;
{
// Get the producer
producer_avformat this = mlt_frame_pop_service( frame );
+ mlt_service_lock( MLT_PRODUCER_SERVICE(this->parent) );
mlt_producer producer = this->parent;
// Get the properties from the frame
}
}
- // Duplicate the last image if necessary (see comment on rawvideo below)
+ // Duplicate the last image if necessary
if ( this->av_frame && this->av_frame->linesize[0] && this->got_picture && this->seekable
&& ( paused
|| this->current_position == req_position
mlt_properties_set_int( properties, "meta.media.top_field_first", this->top_field_first );
mlt_properties_set_int( properties, "meta.media.progressive", mlt_properties_get_int( frame_properties, "progressive" ) );
+ mlt_service_unlock( MLT_PRODUCER_SERVICE(this->parent) );
+
return !this->got_picture;
}
timestamp = 0;
// Set to the real timecode
+ avformat_lock();
if ( av_seek_frame( context, -1, timestamp, AVSEEK_FLAG_BACKWARD ) != 0 )
paused = 1;
+ avformat_unlock();
// Clear the usage in the audio buffer
int i = MAX_AUDIO_STREAMS + 1;
// Copy to audio buffer while resampling
int16_t *source = decode_buffer;
int16_t *dest = &audio_buffer[ audio_used * channels ];
+ avformat_lock();
audio_used += audio_resample( resample, dest, source, convert_samples );
+ avformat_unlock();
}
else
{
// Get the producer
producer_avformat this = mlt_frame_pop_audio( frame );
+ mlt_service_lock( MLT_PRODUCER_SERVICE(this->parent) );
+
// Obtain the frame number of this frame
mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( frame ), "avformat_position" );
}
// Read a packet
+ avformat_lock();
ret = av_read_frame( context, &pkt );
+ avformat_unlock();
// We only deal with audio from the selected audio index
if ( ret >= 0 && pkt.data && pkt.size > 0 && ( pkt.stream_index == this->audio_index ||
if ( !paused )
this->audio_expected = position + 1;
+ mlt_service_unlock( MLT_PRODUCER_SERVICE(this->parent) );
+
return 0;
}
// Get the frame properties
mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
+ mlt_service_lock( MLT_FILTER_SERVICE( filter ) );
+
// Track specific
process_queue( mlt_properties_get_data( frame_properties, "data_queue", NULL ), frame, filter );
// Global
process_queue( mlt_properties_get_data( frame_properties, "global_queue", NULL ), frame, filter );
+ mlt_service_unlock( MLT_FILTER_SERVICE( filter ) );
+
// Need to get the image
return mlt_frame_get_image( frame, image, format, width, height, 1 );
}
int error = 0;
mlt_filter filter = mlt_frame_pop_service( this );
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+
+ mlt_service_lock( MLT_FILTER_SERVICE( filter ) );
+
mlt_transition luma = mlt_properties_get_data( properties, "luma", NULL );
mlt_frame b_frame = mlt_properties_get_data( properties, "frame", NULL );
mlt_properties b_frame_props = b_frame ? MLT_FRAME_PROPERTIES( b_frame ) : NULL;
}
}
+ mlt_service_unlock( MLT_FILTER_SERVICE( filter ) );
+
return error;
}
// 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 );
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 )
{
// Obtain the producer for this frame
mlt_producer producer = mlt_properties_get_data( properties, "producer_colour", NULL );
+ mlt_service_lock( MLT_PRODUCER_SERVICE( producer ) );
+
// Obtain properties of producer
mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
mlt_properties_set_int( producer_props, "_format", *format );
mlt_properties_set( producer_props, "_resource", now );
+ mlt_service_unlock( MLT_PRODUCER_SERVICE( producer ) );
+
switch ( *format )
{
case mlt_image_yuv422:
break;
}
}
+ else
+ {
+ mlt_service_unlock( MLT_PRODUCER_SERVICE( producer ) );
+ }
// Create the alpha channel
int alpha_size = *width * *height;
int field;
double luma_softness = mlt_properties_get_double( properties, "softness" );
+ mlt_service_lock( MLT_TRANSITION_SERVICE( this ) );
uint16_t *luma_bitmap = get_luma( this, properties, width_b, height_b );
+ mlt_service_unlock( MLT_TRANSITION_SERVICE( this ) );
char *operator = mlt_properties_get( properties, "operator" );
alpha_b = alpha_b == NULL ? mlt_frame_get_alpha_mask( b_frame ) : alpha_b;
// This compositer is yuv422 only
*format = mlt_image_yuv422;
+ mlt_service_lock( MLT_TRANSITION_SERVICE( transition ) );
+
// The cached luma map information
int luma_width = mlt_properties_get_int( properties, "width" );
int luma_height = mlt_properties_get_int( properties, "height" );
}
}
+ mlt_service_unlock( MLT_TRANSITION_SERVICE( transition ) );
+
// Arbitrary composite defaults
float mix = position_calculate( transition, a_frame );
float frame_delta = delta_calculate( transition, a_frame );
// Get the properties of the transition
mlt_properties properties = MLT_TRANSITION_PROPERTIES( this );
+ mlt_service_lock( MLT_TRANSITION_SERVICE( this ) );
+
// Get the composite from the transition
mlt_transition composite = mlt_properties_get_data( properties, "composite", NULL );
error = mlt_frame_get_image( frame, image, format, width, height, 0 );
}
+ mlt_service_unlock( MLT_TRANSITION_SERVICE( this ) );
+
return error;
}
unsigned char v, w;
RGB32 a, b;
- diff = mlt_properties_get_data( MLT_FILTER_PROPERTIES( filter ),
- "_diff", NULL );
+ mlt_service_lock( MLT_FILTER_SERVICE( filter ) );
+
+ diff = mlt_properties_get_data( MLT_FILTER_PROPERTIES( filter ), "_diff", NULL );
if (diff == NULL)
{
diff = mlt_pool_alloc(video_area*sizeof(unsigned char));
diff, video_area*sizeof(unsigned char), mlt_pool_release, NULL );
}
- buffer = mlt_properties_get_data( MLT_FILTER_PROPERTIES( filter ),
- "_buffer", NULL );
+ buffer = mlt_properties_get_data( MLT_FILTER_PROPERTIES( filter ), "_buffer", NULL );
if (buffer == NULL)
{
buffer = mlt_pool_alloc(video_area*sizeof(unsigned char));
buffer, video_area*sizeof(unsigned char), mlt_pool_release, NULL );
}
-
if (burn_foreground == 1) {
/* to burn the foreground, we need a background */
background = mlt_properties_get_data( MLT_FILTER_PROPERTIES( filter ),
}
}
+ mlt_service_unlock( MLT_FILTER_SERVICE( filter ) );
+
if (burn_foreground == 1) {
image_bgsubtract_y(diff, background, src, video_area, y_threshold);
} else {
#include "frei0r_helper.h"
#include <string.h>
+
static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
{
mlt_position time = mlt_properties_get_position( properties, "_filter_position" );
double position = ( double )( time ) / ( double )( length );
+ mlt_service_lock( MLT_FILTER_SERVICE( filter ) );
process_frei0r_item( filter_type, position, properties, this, image, width, height );
-
+ mlt_service_unlock( MLT_FILTER_SERVICE( filter ) );
}
return error;
mlt_position out = mlt_producer_get_out( producer );
mlt_position time = mlt_frame_get_position( frame );
double position = ( double )( time - in ) / ( double )( out - in + 1 );
+ mlt_service_lock( MLT_PRODUCER_SERVICE( producer ) );
process_frei0r_item( producer_type, position, producer_props, frame, buffer, width, height );
+ mlt_service_unlock( MLT_PRODUCER_SERVICE( producer ) );
}
return 0;
float pos=( float )( position - in ) / ( float )( out - in + 1 );
+ mlt_service_lock( MLT_TRANSITION_SERVICE( transition ) );
process_frei0r_item( transition_type, pos, properties, !invert ? a_frame : b_frame, images, width, height );
+ mlt_service_unlock( MLT_TRANSITION_SERVICE( transition ) );
*width = mlt_properties_get_int( !invert ? a_props : b_props, "width" );
*height = mlt_properties_get_int( !invert ? a_props : b_props, "height" );
*width = mlt_properties_get_int( properties, "rescale_width" );
*height = mlt_properties_get_int( properties, "rescale_height" );
+ mlt_service_lock( MLT_PRODUCER_SERVICE( &this->parent ) );
+
// Refresh the image
pthread_mutex_lock( &pango_mutex );
refresh_image( frame, *width, *height );
}
pthread_mutex_unlock( &pango_mutex );
+ mlt_service_unlock( MLT_PRODUCER_SERVICE( &this->parent ) );
return error;
}
*width = mlt_properties_get_int( properties, "rescale_width" );
*height = mlt_properties_get_int( properties, "rescale_height" );
+ mlt_service_lock( MLT_PRODUCER_SERVICE( &this->parent ) );
+
// Refresh the image
refresh_image( this, frame, *width, *height );
// Release references and locks
pthread_mutex_unlock( &this->mutex );
mlt_cache_item_close( this->image_cache );
+ mlt_service_unlock( MLT_PRODUCER_SERVICE( &this->parent ) );
return error;
}
}
if (do_freeze == 1) {
+ mlt_service_lock( MLT_FILTER_SERVICE( filter ) );
freeze_frame = mlt_properties_get_data( properties, "freeze_frame", NULL );
if ( freeze_frame == NULL || mlt_properties_get_position( properties, "_frame" ) != pos )
{
memcpy( image_copy, buffer, size );
*image = image_copy;
mlt_properties_set_data( props, "image", *image, size, ( mlt_destructor ) mlt_pool_release, NULL );
+ mlt_service_unlock( MLT_FILTER_SERVICE( filter ) );
+
return error;
}
int index = ( int )mlt_frame_pop_service( this );
mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer );
+ mlt_service_lock( MLT_PRODUCER_SERVICE( producer ) );
+
// Frame properties objects
mlt_properties frame_properties = MLT_FRAME_PROPERTIES( this );
mlt_frame first_frame = mlt_properties_get_data( properties, "first_frame", NULL );
mlt_properties_set_int( properties, "_output_format", *format );
}
+ mlt_service_unlock( MLT_PRODUCER_SERVICE( producer ) );
// Create a copy
uint8_t *image_copy = mlt_pool_alloc( size );
*format = mlt_audio_float;
mlt_frame_get_audio( frame, buffer, format, frequency, channels, samples );
}
+
+ mlt_service_lock( MLT_FILTER_SERVICE(filter) );
+
float *input_buffer = mlt_properties_get_data( filter_properties, "input_buffer", NULL );
float *output_buffer = mlt_properties_get_data( filter_properties, "output_buffer", NULL );
SRC_DATA data;
// Update output variables
*samples = data.output_frames_gen;
*frequency = output_rate;
+
}
else
+ {
mlt_log_error( MLT_FILTER_SERVICE( filter ), "%s %d,%d,%d\n", src_strerror( error ), *frequency, *samples, output_rate );
+ }
+ mlt_service_unlock( MLT_FILTER_SERVICE(filter) );
}
return error;