From: lilo_booter Date: Wed, 1 Dec 2004 13:37:11 +0000 (+0000) Subject: Big modification - switch to macros for parent class access X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=f00476101550ec7d8e863f6516aa83bc1b524570;p=mlt Big modification - switch to macros for parent class access git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@544 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c index b904f137..e353f63d 100644 --- a/src/framework/mlt_consumer.c +++ b/src/framework/mlt_consumer.c @@ -42,7 +42,7 @@ int mlt_consumer_init( mlt_consumer this, void *child ) if ( error == 0 ) { // Get the properties from the service - mlt_properties properties = mlt_service_properties( &this->parent ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( &this->parent ); // Get the normalisation preference char *normalisation = mlt_environment( "MLT_NORMALISATION" ); @@ -132,7 +132,7 @@ mlt_service mlt_consumer_service( mlt_consumer this ) mlt_properties mlt_consumer_properties( mlt_consumer this ) { - return this != NULL ? mlt_service_properties( &this->parent ) : NULL; + return this != NULL ? MLT_SERVICE_PROPERTIES( &this->parent ) : NULL; } /** Connect the consumer to the producer. @@ -149,7 +149,7 @@ int mlt_consumer_connect( mlt_consumer this, mlt_service producer ) int mlt_consumer_start( mlt_consumer this ) { // Get the properies - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Determine if there's a test card producer char *test_card = mlt_properties_get( properties, "test_card" ); @@ -170,7 +170,7 @@ int mlt_consumer_start( mlt_consumer this ) if ( producer != NULL ) { // Test card should loop I guess... - mlt_properties_set( mlt_producer_properties( producer ), "eof", "pause" ); + mlt_properties_set( MLT_PRODUCER_PROPERTIES( producer ), "eof", "pause" ); mlt_producer_set_speed( producer, 0 ); mlt_producer_set_in_and_out( producer, 0, 0 ); @@ -208,7 +208,7 @@ int mlt_consumer_put_frame( mlt_consumer this, mlt_frame frame ) int error = 1; // Get the service assoicated to the consumer - mlt_service service = mlt_consumer_service( this ); + mlt_service service = MLT_CONSUMER_SERVICE( this ); if ( mlt_service_producer( service ) == NULL ) { @@ -246,10 +246,10 @@ mlt_frame mlt_consumer_get_frame( mlt_consumer this ) mlt_frame frame = NULL; // Get the service assoicated to the consumer - mlt_service service = mlt_consumer_service( this ); + mlt_service service = MLT_CONSUMER_SERVICE( this ); // Get the consumer properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Get the frame if ( mlt_service_producer( service ) == NULL && mlt_properties_get_int( properties, "put_mode" ) ) @@ -279,7 +279,7 @@ mlt_frame mlt_consumer_get_frame( mlt_consumer this ) if ( frame != NULL ) { // Get the frame properties - mlt_properties frame_properties = mlt_frame_properties( frame ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); // Get the test card producer mlt_producer test_card = mlt_properties_get_data( properties, "test_card_producer", NULL ); @@ -316,7 +316,7 @@ static void *consumer_read_ahead_thread( void *arg ) mlt_consumer this = arg; // Get the properties of the consumer - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Get the width and height int width = mlt_properties_get_int( properties, "width" ); @@ -369,7 +369,7 @@ static void *consumer_read_ahead_thread( void *arg ) frame->get_audio = NULL; } - mlt_properties_set_int( mlt_frame_properties( frame ), "rendered", 1 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 1 ); // Get the starting time (can ignore the times above) gettimeofday( &ante, NULL ); @@ -399,7 +399,7 @@ static void *consumer_read_ahead_thread( void *arg ) count ++; // All non normal playback frames should be shown - if ( mlt_properties_get_int( mlt_frame_properties( frame ), "_speed" ) != 1 ) + if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "_speed" ) != 1 ) { skipped = 0; time_frame = 0; @@ -415,7 +415,7 @@ static void *consumer_read_ahead_thread( void *arg ) // Get the image, mark as rendered and time it if ( !video_off ) mlt_frame_get_image( frame, &image, &this->format, &width, &height, 0 ); - mlt_properties_set_int( mlt_frame_properties( frame ), "rendered", 1 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 1 ); } else { @@ -534,7 +534,7 @@ mlt_frame mlt_consumer_rt_frame( mlt_consumer this ) mlt_frame frame = NULL; // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Check if the user has requested real time or not if ( this->real_time ) @@ -566,7 +566,7 @@ mlt_frame mlt_consumer_rt_frame( mlt_consumer this ) // This isn't true, but from the consumers perspective it is if ( frame != NULL ) - mlt_properties_set_int( mlt_frame_properties( frame ), "rendered", 1 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 1 ); } return frame; @@ -577,8 +577,8 @@ mlt_frame mlt_consumer_rt_frame( mlt_consumer this ) void mlt_consumer_stopped( mlt_consumer this ) { - mlt_properties_set_int( mlt_consumer_properties( this ), "running", 0 ); - mlt_events_fire( mlt_consumer_properties( this ), "consumer-stopped", NULL ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( this ), "running", 0 ); + mlt_events_fire( MLT_CONSUMER_PROPERTIES( this ), "consumer-stopped", NULL ); } /** Stop the consumer. @@ -587,7 +587,7 @@ void mlt_consumer_stopped( mlt_consumer this ) int mlt_consumer_stop( mlt_consumer this ) { // Get the properies - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Stop the consumer if ( this->stop != NULL ) @@ -635,7 +635,7 @@ int mlt_consumer_is_stopped( mlt_consumer this ) void mlt_consumer_close( mlt_consumer this ) { - if ( this != NULL && mlt_properties_dec_ref( mlt_consumer_properties( this ) ) <= 0 ) + if ( this != NULL && mlt_properties_dec_ref( MLT_CONSUMER_PROPERTIES( this ) ) <= 0 ) { // Get the childs close function void ( *consumer_close )( ) = this->close; diff --git a/src/framework/mlt_consumer.h b/src/framework/mlt_consumer.h index d05d307d..d68ff56d 100644 --- a/src/framework/mlt_consumer.h +++ b/src/framework/mlt_consumer.h @@ -57,6 +57,9 @@ struct mlt_consumer_s /** Public final methods */ +#define MLT_CONSUMER_SERVICE( consumer ) ( &( consumer )->parent ) +#define MLT_CONSUMER_PROPERTIES( consumer ) MLT_SERVICE_PROPERTIES( MLT_CONSUMER_SERVICE( consumer ) ) + extern int mlt_consumer_init( mlt_consumer self, void *child ); extern mlt_consumer mlt_consumer_new( ); extern mlt_service mlt_consumer_service( mlt_consumer self ); diff --git a/src/framework/mlt_factory.c b/src/framework/mlt_factory.c index 8766fd6d..e13662d6 100644 --- a/src/framework/mlt_factory.c +++ b/src/framework/mlt_factory.c @@ -156,7 +156,7 @@ mlt_producer mlt_factory_producer( char *service, void *input ) mlt_events_fire( event_object, "producer-create-done", service, input, obj, NULL ); if ( obj != NULL ) { - mlt_properties properties = mlt_producer_properties( obj ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( obj ); mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "producer" ); if ( mlt_properties_get_int( properties, "_mlt_service_hidden" ) == 0 ) @@ -184,7 +184,7 @@ mlt_filter mlt_factory_filter( char *service, void *input ) if ( obj != NULL ) { - mlt_properties properties = mlt_filter_properties( obj ); + mlt_properties properties = MLT_FILTER_PROPERTIES( obj ); mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "filter" ); mlt_properties_set( properties, "mlt_service", service ); @@ -210,7 +210,7 @@ mlt_transition mlt_factory_transition( char *service, void *input ) if ( obj != NULL ) { - mlt_properties properties = mlt_transition_properties( obj ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( obj ); mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "transition" ); mlt_properties_set( properties, "mlt_service", service ); @@ -240,11 +240,11 @@ mlt_consumer mlt_factory_consumer( char *service, void *input ) if ( obj != NULL ) { mlt_filter filter = mlt_factory_filter( "data_show", NULL ); - mlt_properties properties = mlt_consumer_properties( obj ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( obj ); mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "consumer" ); mlt_properties_set( properties, "mlt_service", service ); - mlt_service_attach( mlt_consumer_service( obj ), filter ); + mlt_service_attach( MLT_CONSUMER_SERVICE( obj ), filter ); mlt_filter_close( filter ); } return obj; diff --git a/src/framework/mlt_field.c b/src/framework/mlt_field.c index 2439fe97..1a93cd95 100644 --- a/src/framework/mlt_field.c +++ b/src/framework/mlt_field.c @@ -63,7 +63,7 @@ mlt_field mlt_field_init( ) this->tractor = mlt_tractor_init( ); // The first plant will be connected to the mulitrack - this->producer = mlt_multitrack_service( this->multitrack ); + this->producer = MLT_MULTITRACK_SERVICE( this->multitrack ); // Connect the tractor to the multitrack mlt_tractor_connect( this->tractor, this->producer ); @@ -88,7 +88,7 @@ mlt_field mlt_field_new( mlt_multitrack multitrack, mlt_tractor tractor ) this->tractor = tractor; // The first plant will be connected to the mulitrack - this->producer = mlt_multitrack_service( this->multitrack ); + this->producer = MLT_MULTITRACK_SERVICE( this->multitrack ); // Connect the tractor to the multitrack mlt_tractor_connect( this->tractor, this->producer ); @@ -103,7 +103,7 @@ mlt_field mlt_field_new( mlt_multitrack multitrack, mlt_tractor tractor ) mlt_service mlt_field_service( mlt_field this ) { - return this != NULL ? mlt_tractor_service( this->tractor ) : NULL; + return MLT_TRACTOR_SERVICE( this->tractor ); } /** Get the multi track. @@ -127,7 +127,7 @@ mlt_tractor mlt_field_tractor( mlt_field this ) mlt_properties mlt_field_properties( mlt_field this ) { - return mlt_service_properties( mlt_field_service( this ) ); + return MLT_SERVICE_PROPERTIES( mlt_field_service( this ) ); } /** Plant a filter. @@ -142,7 +142,7 @@ int mlt_field_plant_filter( mlt_field this, mlt_filter that, int track ) if ( result == 0 ) { // This is now the new producer - this->producer = mlt_filter_service( that ); + this->producer = MLT_FILTER_SERVICE( that ); // Reconnect tractor to new producer mlt_tractor_connect( this->tractor, this->producer ); @@ -166,7 +166,7 @@ int mlt_field_plant_transition( mlt_field this, mlt_transition that, int a_track if ( result == 0 ) { // This is now the new producer - this->producer = mlt_transition_service( that ); + this->producer = MLT_TRANSITION_SERVICE( that ); // Reconnect tractor to new producer mlt_tractor_connect( this->tractor, this->producer ); diff --git a/src/framework/mlt_filter.c b/src/framework/mlt_filter.c index 37f91db3..9472cc34 100644 --- a/src/framework/mlt_filter.c +++ b/src/framework/mlt_filter.c @@ -39,7 +39,7 @@ int mlt_filter_init( mlt_filter this, void *child ) this->child = child; if ( mlt_service_init( service, this ) == 0 ) { - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); // Override the get_frame method service->get_frame = filter_get_frame; @@ -82,7 +82,7 @@ mlt_service mlt_filter_service( mlt_filter this ) mlt_properties mlt_filter_properties( mlt_filter this ) { - return mlt_service_properties( mlt_filter_service( this ) ); + return MLT_SERVICE_PROPERTIES( MLT_FILTER_SERVICE( this ) ); } /** Connect this filter to a producers track. Note that a filter only operates @@ -96,7 +96,7 @@ int mlt_filter_connect( mlt_filter this, mlt_service producer, int index ) // If the connection was successful, grab the producer, track and reset in/out if ( ret == 0 ) { - mlt_properties properties = mlt_service_properties( &this->parent ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( &this->parent ); mlt_properties_set_position( properties, "in", 0 ); mlt_properties_set_position( properties, "out", 0 ); mlt_properties_set_int( properties, "track", index ); @@ -110,7 +110,7 @@ int mlt_filter_connect( mlt_filter this, mlt_service producer, int index ) void mlt_filter_set_in_and_out( mlt_filter this, mlt_position in, mlt_position out ) { - mlt_properties properties = mlt_service_properties( &this->parent ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( &this->parent ); mlt_properties_set_position( properties, "in", in ); mlt_properties_set_position( properties, "out", out ); } @@ -120,7 +120,7 @@ void mlt_filter_set_in_and_out( mlt_filter this, mlt_position in, mlt_position o int mlt_filter_get_track( mlt_filter this ) { - mlt_properties properties = mlt_service_properties( &this->parent ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( &this->parent ); return mlt_properties_get_int( properties, "track" ); } @@ -129,7 +129,7 @@ int mlt_filter_get_track( mlt_filter this ) mlt_position mlt_filter_get_in( mlt_filter this ) { - mlt_properties properties = mlt_service_properties( &this->parent ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( &this->parent ); return mlt_properties_get_position( properties, "in" ); } @@ -138,7 +138,7 @@ mlt_position mlt_filter_get_in( mlt_filter this ) mlt_position mlt_filter_get_out( mlt_filter this ) { - mlt_properties properties = mlt_service_properties( &this->parent ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( &this->parent ); return mlt_properties_get_position( properties, "out" ); } @@ -196,7 +196,7 @@ static int filter_get_frame( mlt_service service, mlt_frame_ptr frame, int index void mlt_filter_close( mlt_filter this ) { - if ( this != NULL && mlt_properties_dec_ref( mlt_filter_properties( this ) ) <= 0 ) + if ( this != NULL && mlt_properties_dec_ref( MLT_FILTER_PROPERTIES( this ) ) <= 0 ) { if ( this->close != NULL ) { diff --git a/src/framework/mlt_filter.h b/src/framework/mlt_filter.h index 20b119bd..d95a754c 100644 --- a/src/framework/mlt_filter.h +++ b/src/framework/mlt_filter.h @@ -44,6 +44,9 @@ struct mlt_filter_s /** Public final methods */ +#define MLT_FILTER_SERVICE( filter ) ( &( filter )->parent ) +#define MLT_FILTER_PROPERTIES( filter ) MLT_SERVICE_PROPERTIES( MLT_FILTER_SERVICE( filter ) ) + extern int mlt_filter_init( mlt_filter self, void *child ); extern mlt_filter mlt_filter_new( ); extern mlt_service mlt_filter_service( mlt_filter self ); diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index ff92fbff..a0a47326 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -70,6 +70,7 @@ mlt_frame mlt_frame_init( ) // Construct stacks for frames and methods this->stack_image = mlt_deque_init( ); this->stack_audio = mlt_deque_init( ); + this->stack_service = mlt_deque_init( ); } return this; @@ -88,7 +89,7 @@ mlt_properties mlt_frame_properties( mlt_frame this ) int mlt_frame_is_test_card( mlt_frame this ) { - return mlt_deque_count( this->stack_image ) == 0 || mlt_properties_get_int( mlt_frame_properties( this ), "test_image" ); + return mlt_deque_count( this->stack_image ) == 0 || mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "test_image" ); } /** Check if we have a way to derive something than test audio. @@ -96,7 +97,7 @@ int mlt_frame_is_test_card( mlt_frame this ) int mlt_frame_is_test_audio( mlt_frame this ) { - return this->get_audio == NULL || mlt_properties_get_int( mlt_frame_properties( this ), "test_audio" ); + return this->get_audio == NULL || mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "test_audio" ); } /** Get the aspect ratio of the frame. @@ -104,7 +105,7 @@ int mlt_frame_is_test_audio( mlt_frame this ) double mlt_frame_get_aspect_ratio( mlt_frame this ) { - return mlt_properties_get_double( mlt_frame_properties( this ), "aspect_ratio" ); + return mlt_properties_get_double( MLT_FRAME_PROPERTIES( this ), "aspect_ratio" ); } /** Set the aspect ratio of the frame. @@ -112,7 +113,7 @@ double mlt_frame_get_aspect_ratio( mlt_frame this ) int mlt_frame_set_aspect_ratio( mlt_frame this, double value ) { - return mlt_properties_set_double( mlt_frame_properties( this ), "aspect_ratio", value ); + return mlt_properties_set_double( MLT_FRAME_PROPERTIES( this ), "aspect_ratio", value ); } /** Get the position of this frame. @@ -120,7 +121,7 @@ int mlt_frame_set_aspect_ratio( mlt_frame this, double value ) mlt_position mlt_frame_get_position( mlt_frame this ) { - int pos = mlt_properties_get_position( mlt_frame_properties( this ), "_position" ); + int pos = mlt_properties_get_position( MLT_FRAME_PROPERTIES( this ), "_position" ); return pos < 0 ? 0 : pos; } @@ -129,7 +130,7 @@ mlt_position mlt_frame_get_position( mlt_frame this ) int mlt_frame_set_position( mlt_frame this, mlt_position value ) { - return mlt_properties_set_position( mlt_frame_properties( this ), "_position", value ); + return mlt_properties_set_position( MLT_FRAME_PROPERTIES( this ), "_position", value ); } /** Stack a get_image callback. @@ -196,9 +197,17 @@ void *mlt_frame_pop_audio( mlt_frame this ) return mlt_deque_pop_back( this->stack_audio ); } +/** Return the service stack +*/ + +mlt_deque mlt_frame_service_stack( mlt_frame this ) +{ + return this->stack_service; +} + int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) { - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); mlt_get_image get_image = mlt_frame_pop_get_image( this ); mlt_producer producer = mlt_properties_get_data( properties, "test_card_producer", NULL ); @@ -222,10 +231,10 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for else if ( producer != NULL ) { mlt_frame test_frame = NULL; - mlt_service_get_frame( mlt_producer_service( producer ), &test_frame, 0 ); + mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &test_frame, 0 ); if ( test_frame != NULL ) { - mlt_properties test_properties = mlt_frame_properties( test_frame ); + mlt_properties test_properties = MLT_FRAME_PROPERTIES( test_frame ); mlt_properties_set_double( test_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "consumer_aspect_ratio" ) ); mlt_properties_set( test_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) ); mlt_frame_get_image( test_frame, buffer, format, width, height, writable ); @@ -311,7 +320,7 @@ uint8_t *mlt_frame_get_alpha_mask( mlt_frame this ) int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); int hide = mlt_properties_get_int( properties, "test_audio" ); if ( hide == 0 && this->get_audio != NULL ) @@ -345,13 +354,34 @@ int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *for mlt_properties_set_int( properties, "audio_channels", *channels ); mlt_properties_set_int( properties, "audio_samples", *samples ); + if ( mlt_properties_get( properties, "meta.volume" ) ) + { + double value = mlt_properties_get_double( properties, "meta.volume" ); + if ( value == 0.0 ) + { + memset( *buffer, 0, *samples * *channels * 2 ); + mlt_properties_set_double( properties, "meta.volume", 1.0 ); + } + else if ( value != 1.0 ) + { + int total = *samples * *channels; + int16_t *p = *buffer; + while ( total -- ) + { + *p = *p * value; + p ++; + } + mlt_properties_set_double( properties, "meta.volume", 1.0 ); + } + } + return 0; } unsigned char *mlt_frame_get_waveform( mlt_frame this, int w, int h ) { int16_t *pcm = NULL; - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); mlt_audio_format format = mlt_audio_pcm; int frequency = 32000; // lower frequency available? int channels = 2; @@ -405,16 +435,19 @@ unsigned char *mlt_frame_get_waveform( mlt_frame this, int w, int h ) mlt_producer mlt_frame_get_original_producer( mlt_frame this ) { if ( this != NULL ) - return mlt_properties_get_data( mlt_frame_properties( this ), "_producer", NULL ); + return mlt_properties_get_data( MLT_FRAME_PROPERTIES( this ), "_producer", NULL ); return NULL; } void mlt_frame_close( mlt_frame this ) { - if ( this != NULL && mlt_properties_dec_ref( mlt_frame_properties( this ) ) <= 0 ) + if ( this != NULL && mlt_properties_dec_ref( MLT_FRAME_PROPERTIES( this ) ) <= 0 ) { mlt_deque_close( this->stack_image ); mlt_deque_close( this->stack_audio ); + while( mlt_deque_peek_back( this->stack_service ) ) + mlt_service_close( mlt_deque_pop_back( this->stack_service ) ); + mlt_deque_close( this->stack_service ); mlt_properties_close( &this->parent ); free( this ); } @@ -715,7 +748,7 @@ void mlt_resize_yuv422( uint8_t *output, int owidth, int oheight, uint8_t *input uint8_t *mlt_frame_resize_yuv422( mlt_frame this, int owidth, int oheight ) { // Get properties - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); // Get the input image, width and height uint8_t *input = mlt_properties_get_data( properties, "image", NULL ); @@ -760,7 +793,7 @@ uint8_t *mlt_frame_resize_yuv422( mlt_frame this, int owidth, int oheight ) uint8_t *mlt_frame_rescale_yuv422( mlt_frame this, int owidth, int oheight ) { // Get properties - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); // Get the input image, width and height uint8_t *input = mlt_properties_get_data( properties, "image", NULL ); @@ -857,17 +890,15 @@ int mlt_frame_mix_audio( mlt_frame this, mlt_frame that, float weight_start, flo double d = 0, s = 0; mlt_frame_get_audio( this, &dest, format, &frequency_dest, &channels_dest, &samples_dest ); - //fprintf( stderr, "mix: frame dest samples %d channels %d position %lld\n", samples_dest, channels_dest, mlt_properties_get_position( mlt_frame_properties( this ), "_position" ) ); mlt_frame_get_audio( that, &src, format, &frequency_src, &channels_src, &samples_src ); - //fprintf( stderr, "mix: frame src samples %d channels %d\n", samples_src, channels_src ); - int silent = mlt_properties_get_int( mlt_frame_properties( this ), "silent_audio" ); - mlt_properties_set_int( mlt_frame_properties( this ), "silent_audio", 0 ); + int silent = mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "silent_audio" ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( this ), "silent_audio", 0 ); if ( silent ) memset( dest, 0, samples_dest * channels_dest * sizeof( int16_t ) ); - silent = mlt_properties_get_int( mlt_frame_properties( that ), "silent_audio" ); - mlt_properties_set_int( mlt_frame_properties( that ), "silent_audio", 0 ); + silent = mlt_properties_get_int( MLT_FRAME_PROPERTIES( that ), "silent_audio" ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( that ), "silent_audio", 0 ); if ( silent ) memset( src, 0, samples_src * channels_src * sizeof( int16_t ) ); diff --git a/src/framework/mlt_frame.h b/src/framework/mlt_frame.h index 6da256b9..3a11daa3 100644 --- a/src/framework/mlt_frame.h +++ b/src/framework/mlt_frame.h @@ -38,8 +38,12 @@ struct mlt_frame_s // Private properties mlt_deque stack_image; mlt_deque stack_audio; + mlt_deque stack_service; }; +#define MLT_FRAME_PROPERTIES( frame ) ( &( frame )->parent ) +#define MLT_FRAME_SERVICE_STACK( frame ) ( ( frame )->stack_service ) + extern mlt_frame mlt_frame_init( ); extern mlt_properties mlt_frame_properties( mlt_frame self ); extern int mlt_frame_is_test_card( mlt_frame self ); @@ -60,6 +64,7 @@ extern int mlt_frame_push_service( mlt_frame self, void *that ); extern void *mlt_frame_pop_service( mlt_frame self ); extern int mlt_frame_push_audio( mlt_frame self, void *that ); extern void *mlt_frame_pop_audio( mlt_frame self ); +extern mlt_deque mlt_frame_service_stack( mlt_frame self ); extern mlt_producer mlt_frame_get_original_producer( mlt_frame self ); extern void mlt_frame_close( mlt_frame self ); diff --git a/src/framework/mlt_multitrack.c b/src/framework/mlt_multitrack.c index 7e16e04d..c05c132b 100644 --- a/src/framework/mlt_multitrack.c +++ b/src/framework/mlt_multitrack.c @@ -27,26 +27,6 @@ #include #include -struct mlt_track_s -{ - mlt_producer producer; - mlt_event event; -}; - -typedef struct mlt_track_s *mlt_track; - -/** Private definition. -*/ - -struct mlt_multitrack_s -{ - // We're extending producer here - struct mlt_producer_s parent; - mlt_track *list; - int size; - int count; -}; - /** Forward reference. */ @@ -65,7 +45,7 @@ mlt_multitrack mlt_multitrack_init( ) mlt_producer producer = &this->parent; if ( mlt_producer_init( producer, this ) == 0 ) { - mlt_properties properties = mlt_multitrack_properties( this ); + mlt_properties properties = MLT_MULTITRACK_PROPERTIES( this ); producer->get_frame = producer_get_frame; mlt_properties_set_data( properties, "multitrack", this, 0, NULL, NULL ); mlt_properties_set( properties, "log_id", "multitrack" ); @@ -98,7 +78,7 @@ mlt_producer mlt_multitrack_producer( mlt_multitrack this ) mlt_service mlt_multitrack_service( mlt_multitrack this ) { - return mlt_producer_service( mlt_multitrack_producer( this ) ); + return MLT_MULTITRACK_SERVICE( this ); } /** Get the properties associated this multitrack. @@ -106,7 +86,7 @@ mlt_service mlt_multitrack_service( mlt_multitrack this ) mlt_properties mlt_multitrack_properties( mlt_multitrack this ) { - return mlt_service_properties( mlt_multitrack_service( this ) ); + return MLT_MULTITRACK_PROPERTIES( this ); } /** Initialise position related information. @@ -117,7 +97,7 @@ void mlt_multitrack_refresh( mlt_multitrack this ) int i = 0; // Obtain the properties of this multitrack - mlt_properties properties = mlt_multitrack_properties( this ); + mlt_properties properties = MLT_MULTITRACK_PROPERTIES( this ); // We need to ensure that the multitrack reports the longest track as its length mlt_position length = 0; @@ -137,10 +117,10 @@ void mlt_multitrack_refresh( mlt_multitrack this ) { // If we have more than 1 track, we must be in continue mode if ( this->count > 1 ) - mlt_properties_set( mlt_producer_properties( producer ), "eof", "continue" ); + mlt_properties_set( MLT_PRODUCER_PROPERTIES( producer ), "eof", "continue" ); // Determine the longest length - //if ( !mlt_properties_get_int( mlt_producer_properties( producer ), "hide" ) ) + //if ( !mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( producer ), "hide" ) ) length = mlt_producer_get_playtime( producer ) > length ? mlt_producer_get_playtime( producer ) : length; // Handle fps @@ -155,7 +135,7 @@ void mlt_multitrack_refresh( mlt_multitrack this ) fprintf( stderr, "Warning: fps mismatch on track %d\n", i ); // It should be safe to impose fps on an image producer, but not necessarily safe for video - mlt_properties_set_double( mlt_producer_properties( producer ), "fps", fps ); + mlt_properties_set_double( MLT_PRODUCER_PROPERTIES( producer ), "fps", fps ); } } } @@ -185,7 +165,7 @@ static void mlt_multitrack_listener( mlt_producer producer, mlt_multitrack this int mlt_multitrack_connect( mlt_multitrack this, mlt_producer producer, int track ) { // Connect to the producer to ourselves at the specified track - int result = mlt_service_connect_producer( mlt_multitrack_service( this ), mlt_producer_service( producer ), track ); + int result = mlt_service_connect_producer( MLT_MULTITRACK_SERVICE( this ), MLT_PRODUCER_SERVICE( producer ), track ); if ( result == 0 ) { @@ -211,9 +191,9 @@ int mlt_multitrack_connect( mlt_multitrack this, mlt_producer producer, int trac // Assign the track in our list here this->list[ track ]->producer = producer; - this->list[ track ]->event = mlt_events_listen( mlt_producer_properties( producer ), this, + this->list[ track ]->event = mlt_events_listen( MLT_PRODUCER_PROPERTIES( producer ), this, "producer-changed", ( mlt_listener )mlt_multitrack_listener ); - mlt_properties_inc_ref( mlt_producer_properties( producer ) ); + mlt_properties_inc_ref( MLT_PRODUCER_PROPERTIES( producer ) ); mlt_event_inc_ref( this->list[ track ]->event ); // Increment the track count if need be @@ -301,7 +281,7 @@ mlt_position mlt_multitrack_clip( mlt_multitrack this, mlt_whence whence, int in if ( producer != NULL ) { // Get the properties of this producer - mlt_properties properties = mlt_producer_properties( producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); // Determine if it's a playlist mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL ); @@ -335,7 +315,7 @@ mlt_position mlt_multitrack_clip( mlt_multitrack this, mlt_whence whence, int in break; case mlt_whence_relative_current: - position = mlt_producer_position( mlt_multitrack_producer( this ) ); + position = mlt_producer_position( MLT_MULTITRACK_PRODUCER( this ) ); for ( i = 0; i < count - 2; i ++ ) if ( position >= map[ i ] && position < map[ i + 1 ] ) break; @@ -399,13 +379,13 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int ind mlt_producer producer = this->list[ index ]->producer; // Get the track hide property - int hide = mlt_properties_get_int( mlt_producer_properties( mlt_producer_cut_parent( producer ) ), "hide" ); + int hide = mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( mlt_producer_cut_parent( producer ) ), "hide" ); // Obtain the current position mlt_position position = mlt_producer_frame( parent ); // Get the parent properties - mlt_properties producer_properties = mlt_producer_properties( parent ); + mlt_properties producer_properties = MLT_PRODUCER_PROPERTIES( parent ); // Get the speed double speed = mlt_properties_get_double( producer_properties, "_speed" ); @@ -414,10 +394,10 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int ind mlt_producer_seek( producer, position ); // Get the frame from the producer - mlt_service_get_frame( mlt_producer_service( producer ), frame, 0 ); + mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), frame, 0 ); // Indicate speed of this producer - mlt_properties properties = mlt_frame_properties( *frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( *frame ); mlt_properties_set_double( properties, "_speed", speed ); mlt_properties_set_position( properties, "_position", position ); mlt_properties_set_int( properties, "hide", hide ); @@ -434,7 +414,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int ind if ( index >= this->count ) { // Let tractor know if we've reached the end - mlt_properties_set_int( mlt_frame_properties( *frame ), "last_track", 1 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( *frame ), "last_track", 1 ); // Move to the next frame mlt_producer_prepare_next( parent ); @@ -449,7 +429,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int ind void mlt_multitrack_close( mlt_multitrack this ) { - if ( this != NULL && mlt_properties_dec_ref( mlt_multitrack_properties( this ) ) <= 0 ) + if ( this != NULL && mlt_properties_dec_ref( MLT_MULTITRACK_PROPERTIES( this ) ) <= 0 ) { int i = 0; for ( i = 0; i < this->count; i ++ ) diff --git a/src/framework/mlt_multitrack.h b/src/framework/mlt_multitrack.h index 809678c9..f0eaa70e 100644 --- a/src/framework/mlt_multitrack.h +++ b/src/framework/mlt_multitrack.h @@ -23,9 +23,33 @@ #include "mlt_producer.h" +/** Private definition. +*/ + +struct mlt_track_s +{ + mlt_producer producer; + mlt_event event; +}; + +typedef struct mlt_track_s *mlt_track; + +struct mlt_multitrack_s +{ + // We're extending producer here + struct mlt_producer_s parent; + mlt_track *list; + int size; + int count; +}; + /** Public final methods */ +#define MLT_MULTITRACK_PRODUCER( multitrack ) ( &( multitrack )->parent ) +#define MLT_MULTITRACK_SERVICE( multitrack ) MLT_PRODUCER_SERVICE( MLT_MULTITRACK_PRODUCER( multitrack ) ) +#define MLT_MULTITRACK_PROPERTIES( multitrack ) MLT_SERVICE_PROPERTIES( MLT_MULTITRACK_SERVICE( multitrack ) ) + extern mlt_multitrack mlt_multitrack_init( ); extern mlt_producer mlt_multitrack_producer( mlt_multitrack self ); extern mlt_service mlt_multitrack_service( mlt_multitrack self ); diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index e59b05ca..d563d7dc 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -34,7 +34,7 @@ /** Virtual playlist entry. */ -typedef struct playlist_entry_s +struct playlist_entry_s { mlt_producer producer; mlt_position frame_in; @@ -44,20 +44,6 @@ typedef struct playlist_entry_s mlt_position producer_length; mlt_event event; int preservation_hack; -} -playlist_entry; - -/** Private definition. -*/ - -struct mlt_playlist_s -{ - struct mlt_producer_s parent; - struct mlt_producer_s blank; - - int size; - int count; - playlist_entry **list; }; /** Forward declarations @@ -89,19 +75,19 @@ mlt_playlist mlt_playlist_init( ) // Initialise blank mlt_producer_init( &this->blank, NULL ); - mlt_properties_set( mlt_producer_properties( &this->blank ), "mlt_service", "blank" ); - mlt_properties_set( mlt_producer_properties( &this->blank ), "resource", "blank" ); + mlt_properties_set( MLT_PRODUCER_PROPERTIES( &this->blank ), "mlt_service", "blank" ); + mlt_properties_set( MLT_PRODUCER_PROPERTIES( &this->blank ), "resource", "blank" ); // Indicate that this producer is a playlist - mlt_properties_set_data( mlt_playlist_properties( this ), "playlist", this, 0, NULL, NULL ); + mlt_properties_set_data( MLT_PLAYLIST_PROPERTIES( this ), "playlist", this, 0, NULL, NULL ); // Specify the eof condition - mlt_properties_set( mlt_playlist_properties( this ), "eof", "pause" ); - mlt_properties_set( mlt_playlist_properties( this ), "resource", "" ); - mlt_properties_set( mlt_playlist_properties( this ), "mlt_type", "mlt_producer" ); - mlt_properties_set_position( mlt_playlist_properties( this ), "in", 0 ); - mlt_properties_set_position( mlt_playlist_properties( this ), "out", -1 ); - mlt_properties_set_position( mlt_playlist_properties( this ), "length", 0 ); + mlt_properties_set( MLT_PLAYLIST_PROPERTIES( this ), "eof", "pause" ); + mlt_properties_set( MLT_PLAYLIST_PROPERTIES( this ), "resource", "" ); + mlt_properties_set( MLT_PLAYLIST_PROPERTIES( this ), "mlt_type", "mlt_producer" ); + mlt_properties_set_position( MLT_PLAYLIST_PROPERTIES( this ), "in", 0 ); + mlt_properties_set_position( MLT_PLAYLIST_PROPERTIES( this ), "out", -1 ); + mlt_properties_set_position( MLT_PLAYLIST_PROPERTIES( this ), "length", 0 ); this->size = 10; this->list = malloc( this->size * sizeof( playlist_entry * ) ); @@ -123,7 +109,7 @@ mlt_producer mlt_playlist_producer( mlt_playlist this ) mlt_service mlt_playlist_service( mlt_playlist this ) { - return mlt_producer_service( &this->parent ); + return MLT_PRODUCER_SERVICE( &this->parent ); } /** Get the propertues associated to this playlist. @@ -131,7 +117,7 @@ mlt_service mlt_playlist_service( mlt_playlist this ) mlt_properties mlt_playlist_properties( mlt_playlist this ) { - return mlt_producer_properties( &this->parent ); + return MLT_PRODUCER_PROPERTIES( &this->parent ); } /** Refresh the playlist after a clip has been changed. @@ -140,7 +126,7 @@ mlt_properties mlt_playlist_properties( mlt_playlist this ) static int mlt_playlist_virtual_refresh( mlt_playlist this ) { // Obtain the properties - mlt_properties properties = mlt_playlist_properties( this ); + mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this ); // Get the fps of the first producer double fps = mlt_properties_get_double( properties, "first_fps" ); @@ -159,13 +145,13 @@ static int mlt_playlist_virtual_refresh( mlt_playlist this ) // Inherit it from the producer fps = mlt_producer_get_fps( producer ); } - else if ( fps != mlt_properties_get_double( mlt_producer_properties( producer ), "fps" ) ) + else if ( fps != mlt_properties_get_double( MLT_PRODUCER_PROPERTIES( producer ), "fps" ) ) { // Generate a warning for now - the following attempt to fix may fail fprintf( stderr, "Warning: fps mismatch on playlist producer %d\n", this->count ); // It should be safe to impose fps on an image producer, but not necessarily safe for video - mlt_properties_set_double( mlt_producer_properties( producer ), "fps", fps ); + mlt_properties_set_double( MLT_PRODUCER_PROPERTIES( producer ), "fps", fps ); } // Check if the length of the producer has changed @@ -231,7 +217,7 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer source, // Make sure the blank is long enough to accomodate the length specified if ( out - in + 1 > mlt_producer_get_length( &this->blank ) ) { - mlt_properties blank_props = mlt_producer_properties( &this->blank ); + mlt_properties blank_props = MLT_PRODUCER_PROPERTIES( &this->blank ); mlt_events_block( blank_props, blank_props ); mlt_producer_set_in_and_out( &this->blank, in, out ); mlt_events_unblock( blank_props, blank_props ); @@ -249,10 +235,10 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer source, else { producer = source; - mlt_properties_inc_ref( mlt_producer_properties( producer ) ); + mlt_properties_inc_ref( MLT_PRODUCER_PROPERTIES( producer ) ); } - properties = mlt_producer_properties( producer ); + properties = MLT_PRODUCER_PROPERTIES( producer ); } else if ( mlt_producer_is_cut( source ) ) { @@ -261,7 +247,7 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer source, in = mlt_producer_get_in( producer ); if ( out == -1 || out > mlt_producer_get_out( producer ) ) out = mlt_producer_get_out( producer ); - properties = mlt_producer_properties( producer ); + properties = MLT_PRODUCER_PROPERTIES( producer ); mlt_properties_inc_ref( properties ); } else @@ -271,11 +257,11 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer source, in = mlt_producer_get_in( producer ); if ( out == -1 || out > mlt_producer_get_out( producer ) ) out = mlt_producer_get_out( producer ); - properties = mlt_producer_properties( producer ); + properties = MLT_PRODUCER_PROPERTIES( producer ); } // Fetch the cuts parent properties - parent = mlt_producer_properties( mlt_producer_cut_parent( producer ) ); + parent = MLT_PRODUCER_PROPERTIES( mlt_producer_cut_parent( producer ) ); // Check that we have room if ( this->count >= this->size ) @@ -354,7 +340,7 @@ static mlt_service mlt_playlist_virtual_seek( mlt_playlist this, int *progressiv mlt_producer producer = mlt_playlist_locate( this, &position, &i, &total ); // Get the properties - mlt_properties properties = mlt_playlist_properties( this ); + mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this ); // Get the eof handling char *eof = mlt_properties_get( properties, "eof" ); @@ -370,7 +356,7 @@ static mlt_service mlt_playlist_virtual_seek( mlt_playlist this, int *progressiv { playlist_entry *entry = this->list[ this->count - 1 ]; int count = entry->frame_count / entry->repeat; - mlt_producer this_producer = mlt_playlist_producer( this ); + mlt_producer this_producer = MLT_PLAYLIST_PRODUCER( this ); mlt_producer_seek( this_producer, original - 1 ); producer = entry->producer; mlt_producer_seek( producer, entry->frame_out % count ); @@ -381,7 +367,7 @@ static mlt_service mlt_playlist_virtual_seek( mlt_playlist this, int *progressiv else if ( !strcmp( eof, "loop" ) && total > 0 ) { playlist_entry *entry = this->list[ 0 ]; - mlt_producer this_producer = mlt_playlist_producer( this ); + mlt_producer this_producer = MLT_PLAYLIST_PRODUCER( this ); mlt_producer_seek( this_producer, 0 ); producer = entry->producer; mlt_producer_seek( producer, 0 ); @@ -391,7 +377,7 @@ static mlt_service mlt_playlist_virtual_seek( mlt_playlist this, int *progressiv producer = &this->blank; } - return mlt_producer_service( producer ); + return MLT_PRODUCER_SERVICE( producer ); } /** Invoked when a producer indicates that it has prematurely reached its end. @@ -525,7 +511,7 @@ int mlt_playlist_get_clip_info( mlt_playlist this, mlt_playlist_clip_info *info, if ( !error ) { mlt_producer producer = mlt_producer_cut_parent( this->list[ index ]->producer ); - mlt_properties properties = mlt_producer_properties( producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); info->clip = index; info->producer = producer; info->cut = this->list[ index ]->producer; @@ -562,7 +548,7 @@ int mlt_playlist_clear( mlt_playlist this ) mlt_producer_close( this->list[ i ]->producer ); } this->count = 0; - mlt_properties_set_double( mlt_playlist_properties( this ), "first_fps", 0 ); + mlt_properties_set_double( MLT_PLAYLIST_PROPERTIES( this ), "first_fps", 0 ); return mlt_playlist_virtual_refresh( this ); } @@ -602,12 +588,12 @@ int mlt_playlist_blank( mlt_playlist this, mlt_position length ) int mlt_playlist_insert( mlt_playlist this, mlt_producer producer, int where, mlt_position in, mlt_position out ) { // Append to end - mlt_events_block( mlt_playlist_properties( this ), this ); + mlt_events_block( MLT_PLAYLIST_PROPERTIES( this ), this ); mlt_playlist_append_io( this, producer, in, out ); // Move to the position specified mlt_playlist_move( this, this->count - 1, where ); - mlt_events_unblock( mlt_playlist_properties( this ), this ); + mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this ); return mlt_playlist_virtual_refresh( this ); } @@ -622,12 +608,12 @@ int mlt_playlist_remove( mlt_playlist this, int where ) { // We need to know the current clip and the position within the playlist int current = mlt_playlist_current_clip( this ); - mlt_position position = mlt_producer_position( mlt_playlist_producer( this ) ); + mlt_position position = mlt_producer_position( MLT_PLAYLIST_PRODUCER( this ) ); // We need all the details about the clip we're removing mlt_playlist_clip_info where_info; playlist_entry *entry = this->list[ where ]; - mlt_properties properties = mlt_producer_properties( entry->producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( entry->producer ); // Loop variable int i = 0; @@ -660,7 +646,8 @@ int mlt_playlist_remove( mlt_playlist this, int where ) mlt_properties_set_data( mix, "mix_in", NULL, 0, NULL, NULL ); } - mlt_producer_clear( entry->producer ); + if ( mlt_properties_ref_count( MLT_PRODUCER_PROPERTIES( entry->producer ) ) == 1 ) + mlt_producer_clear( entry->producer ); } // Close the producer associated to the clip info @@ -669,11 +656,11 @@ int mlt_playlist_remove( mlt_playlist this, int where ) // Correct position if ( where == current ) - mlt_producer_seek( mlt_playlist_producer( this ), where_info.start ); + mlt_producer_seek( MLT_PLAYLIST_PRODUCER( this ), where_info.start ); else if ( where < current && this->count > 0 ) - mlt_producer_seek( mlt_playlist_producer( this ), position - where_info.frame_count ); + mlt_producer_seek( MLT_PLAYLIST_PRODUCER( this ), position - where_info.frame_count ); else if ( this->count == 0 ) - mlt_producer_seek( mlt_playlist_producer( this ), 0 ); + mlt_producer_seek( MLT_PLAYLIST_PRODUCER( this ), 0 ); // Free the entry free( entry ); @@ -706,7 +693,7 @@ int mlt_playlist_move( mlt_playlist this, int src, int dest ) if ( src != dest && this->count > 1 ) { int current = mlt_playlist_current_clip( this ); - mlt_position position = mlt_producer_position( mlt_playlist_producer( this ) ); + mlt_position position = mlt_producer_position( MLT_PLAYLIST_PRODUCER( this ) ); playlist_entry *src_entry = NULL; // We need all the details about the current clip @@ -736,7 +723,7 @@ int mlt_playlist_move( mlt_playlist this, int src, int dest ) this->list[ dest ] = src_entry; mlt_playlist_get_clip_info( this, ¤t_info, current ); - mlt_producer_seek( mlt_playlist_producer( this ), current_info.start + position ); + mlt_producer_seek( MLT_PLAYLIST_PRODUCER( this ), current_info.start + position ); mlt_playlist_virtual_refresh( this ); } @@ -774,7 +761,7 @@ int mlt_playlist_resize_clip( mlt_playlist this, int clip, mlt_position in, mlt_ // Make sure the blank is long enough to accomodate the length specified if ( out - in + 1 > mlt_producer_get_length( &this->blank ) ) { - mlt_properties blank_props = mlt_producer_properties( &this->blank ); + mlt_properties blank_props = MLT_PRODUCER_PROPERTIES( &this->blank ); mlt_events_block( blank_props, blank_props ); mlt_producer_set_in_and_out( &this->blank, in, out ); mlt_events_unblock( blank_props, blank_props ); @@ -812,7 +799,7 @@ int mlt_playlist_split( mlt_playlist this, int clip, mlt_position position ) { int in = entry->frame_in; int out = entry->frame_out; - mlt_events_block( mlt_playlist_properties( this ), this ); + mlt_events_block( MLT_PLAYLIST_PROPERTIES( this ), this ); mlt_playlist_resize_clip( this, clip, in, in + position ); if ( !mlt_producer_is_blank( entry->producer ) ) { @@ -824,7 +811,7 @@ int mlt_playlist_split( mlt_playlist this, int clip, mlt_position position ) { mlt_playlist_insert( this, &this->blank, clip + 1, 0, out - position - 1 ); } - mlt_events_unblock( mlt_playlist_properties( this ), this ); + mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this ); mlt_playlist_virtual_refresh( this ); } else @@ -845,7 +832,7 @@ int mlt_playlist_join( mlt_playlist this, int clip, int count, int merge ) { int i = clip; mlt_playlist new_clip = mlt_playlist_init( ); - mlt_events_block( mlt_playlist_properties( this ), this ); + mlt_events_block( MLT_PLAYLIST_PROPERTIES( this ), this ); if ( clip + count >= this->count ) count = this->count - clip; for ( i = 0; i <= count; i ++ ) @@ -856,8 +843,8 @@ int mlt_playlist_join( mlt_playlist this, int clip, int count, int merge ) entry->preservation_hack = 1; mlt_playlist_remove( this, clip ); } - mlt_events_unblock( mlt_playlist_properties( this ), this ); - mlt_playlist_insert( this, mlt_playlist_producer( new_clip ), clip, 0, -1 ); + mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this ); + mlt_playlist_insert( this, MLT_PLAYLIST_PRODUCER( new_clip ), clip, 0, -1 ); mlt_playlist_close( new_clip ); } return error; @@ -876,7 +863,7 @@ int mlt_playlist_mix( mlt_playlist this, int clip, int length, mlt_transition tr mlt_producer track_a = NULL; mlt_producer track_b = NULL; mlt_tractor tractor = mlt_tractor_new( ); - mlt_events_block( mlt_playlist_properties( this ), this ); + mlt_events_block( MLT_PLAYLIST_PROPERTIES( this ), this ); // Check length is valid for both clips and resize if necessary. int max_size = clip_a->frame_count > clip_b->frame_count ? clip_a->frame_count : clip_b->frame_count; @@ -898,8 +885,8 @@ int mlt_playlist_mix( mlt_playlist this, int clip, int length, mlt_transition tr mlt_tractor_set_track( tractor, track_b, 1 ); // Insert the mix object into the playlist - mlt_playlist_insert( this, mlt_tractor_producer( tractor ), clip + 1, -1, -1 ); - mlt_properties_set_data( mlt_tractor_properties( tractor ), "mlt_mix", tractor, 0, NULL, NULL ); + mlt_playlist_insert( this, MLT_TRACTOR_PRODUCER( tractor ), clip + 1, -1, -1 ); + mlt_properties_set_data( MLT_TRACTOR_PROPERTIES( tractor ), "mlt_mix", tractor, 0, NULL, NULL ); // Attach the transition if ( transition != NULL ) @@ -924,8 +911,8 @@ int mlt_playlist_mix( mlt_playlist this, int clip, int length, mlt_transition tr else if ( clip_b->frame_out - clip_b->frame_in > length ) { mlt_playlist_resize_clip( this, clip + 2, clip_b->frame_in + length, clip_b->frame_out ); - mlt_properties_set_data( mlt_producer_properties( clip_b->producer ), "mix_in", tractor, 0, NULL, NULL ); - mlt_properties_set_data( mlt_tractor_properties( tractor ), "mix_out", clip_b->producer, 0, NULL, NULL ); + mlt_properties_set_data( MLT_PRODUCER_PROPERTIES( clip_b->producer ), "mix_in", tractor, 0, NULL, NULL ); + mlt_properties_set_data( MLT_TRACTOR_PROPERTIES( tractor ), "mix_out", clip_b->producer, 0, NULL, NULL ); } else { @@ -942,8 +929,8 @@ int mlt_playlist_mix( mlt_playlist this, int clip, int length, mlt_transition tr else if ( clip_a->frame_out - clip_a->frame_in > length ) { mlt_playlist_resize_clip( this, clip, clip_a->frame_in, clip_a->frame_out - length ); - mlt_properties_set_data( mlt_producer_properties( clip_a->producer ), "mix_out", tractor, 0, NULL, NULL ); - mlt_properties_set_data( mlt_tractor_properties( tractor ), "mix_in", clip_a->producer, 0, NULL, NULL ); + mlt_properties_set_data( MLT_PRODUCER_PROPERTIES( clip_a->producer ), "mix_out", tractor, 0, NULL, NULL ); + mlt_properties_set_data( MLT_TRACTOR_PROPERTIES( tractor ), "mix_in", clip_a->producer, 0, NULL, NULL ); } else { @@ -952,7 +939,7 @@ int mlt_playlist_mix( mlt_playlist this, int clip, int length, mlt_transition tr } // Unblock and force a fire off of change events to listeners - mlt_events_unblock( mlt_playlist_properties( this ), this ); + mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this ); mlt_playlist_virtual_refresh( this ); mlt_tractor_close( tractor ); } @@ -965,7 +952,7 @@ int mlt_playlist_mix( mlt_playlist this, int clip, int length, mlt_transition tr int mlt_playlist_mix_add( mlt_playlist this, int clip, mlt_transition transition ) { mlt_producer producer = mlt_producer_cut_parent( mlt_playlist_get_clip( this, clip ) ); - mlt_properties properties = producer != NULL ? mlt_producer_properties( producer ) : NULL; + mlt_properties properties = producer != NULL ? MLT_PRODUCER_PROPERTIES( producer ) : NULL; mlt_tractor tractor = properties != NULL ? mlt_properties_get_data( properties, "mlt_mix", NULL ) : NULL; int error = transition == NULL || tractor == NULL; if ( error == 0 ) @@ -1012,7 +999,7 @@ int mlt_playlist_get_clip_index_at( mlt_playlist this, int position ) int mlt_playlist_clip_is_mix( mlt_playlist this, int clip ) { mlt_producer producer = mlt_producer_cut_parent( mlt_playlist_get_clip( this, clip ) ); - mlt_properties properties = producer != NULL ? mlt_producer_properties( producer ) : NULL; + mlt_properties properties = producer != NULL ? MLT_PRODUCER_PROPERTIES( producer ) : NULL; mlt_tractor tractor = properties != NULL ? mlt_properties_get_data( properties, "mlt_mix", NULL ) : NULL; return tractor != NULL; } @@ -1029,7 +1016,7 @@ static int mlt_playlist_unmix( mlt_playlist this, int clip ) if ( error == 0 ) { mlt_producer producer = mlt_producer_cut_parent( this->list[ clip ]->producer ); - mlt_properties properties = mlt_producer_properties( producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); error = mlt_properties_get_data( properties, "mlt_mix", NULL ) == NULL || this->list[ clip ]->preservation_hack; } @@ -1038,11 +1025,11 @@ static int mlt_playlist_unmix( mlt_playlist this, int clip ) { playlist_entry *mix = this->list[ clip ]; mlt_tractor tractor = ( mlt_tractor )mlt_producer_cut_parent( mix->producer ); - mlt_properties properties = mlt_tractor_properties( tractor ); + mlt_properties properties = MLT_TRACTOR_PROPERTIES( tractor ); mlt_producer clip_a = mlt_properties_get_data( properties, "mix_in", NULL ); mlt_producer clip_b = mlt_properties_get_data( properties, "mix_out", NULL ); - int length = mlt_producer_get_playtime( mlt_tractor_producer( tractor ) ); - mlt_events_block( mlt_playlist_properties( this ), this ); + int length = mlt_producer_get_playtime( MLT_TRACTOR_PRODUCER( tractor ) ); + mlt_events_block( MLT_PLAYLIST_PROPERTIES( this ), this ); if ( clip_a != NULL ) { @@ -1067,7 +1054,7 @@ static int mlt_playlist_unmix( mlt_playlist this, int clip ) mlt_properties_set_data( properties, "mlt_mix", NULL, 0, NULL, NULL ); mlt_playlist_remove( this, clip ); - mlt_events_unblock( mlt_playlist_properties( this ), this ); + mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this ); mlt_playlist_virtual_refresh( this ); } return error; @@ -1081,7 +1068,7 @@ static int mlt_playlist_resize_mix( mlt_playlist this, int clip, int in, int out if ( error == 0 ) { mlt_producer producer = mlt_producer_cut_parent( this->list[ clip ]->producer ); - mlt_properties properties = mlt_producer_properties( producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); error = mlt_properties_get_data( properties, "mlt_mix", NULL ) == NULL; } @@ -1089,14 +1076,14 @@ static int mlt_playlist_resize_mix( mlt_playlist this, int clip, int in, int out { playlist_entry *mix = this->list[ clip ]; mlt_tractor tractor = ( mlt_tractor )mlt_producer_cut_parent( mix->producer ); - mlt_properties properties = mlt_tractor_properties( tractor ); + mlt_properties properties = MLT_TRACTOR_PROPERTIES( tractor ); mlt_producer clip_a = mlt_properties_get_data( properties, "mix_in", NULL ); mlt_producer clip_b = mlt_properties_get_data( properties, "mix_out", NULL ); mlt_producer track_a = mlt_tractor_get_track( tractor, 0 ); mlt_producer track_b = mlt_tractor_get_track( tractor, 1 ); int length = out - in + 1; - int length_diff = length - mlt_producer_get_playtime( mlt_tractor_producer( tractor ) ); - mlt_events_block( mlt_playlist_properties( this ), this ); + int length_diff = length - mlt_producer_get_playtime( MLT_TRACTOR_PRODUCER( tractor ) ); + mlt_events_block( MLT_PLAYLIST_PROPERTIES( this ), this ); if ( clip_a != NULL ) mlt_producer_set_in_and_out( clip_a, mlt_producer_get_in( clip_a ), mlt_producer_get_out( clip_a ) - length_diff ); @@ -1106,12 +1093,12 @@ static int mlt_playlist_resize_mix( mlt_playlist this, int clip, int in, int out mlt_producer_set_in_and_out( track_a, mlt_producer_get_in( track_a ) - length_diff, mlt_producer_get_out( track_a ) ); mlt_producer_set_in_and_out( track_b, mlt_producer_get_in( track_b ), mlt_producer_get_out( track_b ) + length_diff ); - mlt_producer_set_in_and_out( mlt_multitrack_producer( mlt_tractor_multitrack( tractor ) ), in, out ); - mlt_producer_set_in_and_out( mlt_tractor_producer( tractor ), in, out ); - mlt_properties_set_position( mlt_producer_properties( mix->producer ), "length", out - in + 1 ); + mlt_producer_set_in_and_out( MLT_MULTITRACK_PRODUCER( mlt_tractor_multitrack( tractor ) ), in, out ); + mlt_producer_set_in_and_out( MLT_TRACTOR_PRODUCER( tractor ), in, out ); + mlt_properties_set_position( MLT_PRODUCER_PROPERTIES( mix->producer ), "length", out - in + 1 ); mlt_producer_set_in_and_out( mix->producer, in, out ); - mlt_events_unblock( mlt_playlist_properties( this ), this ); + mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this ); mlt_playlist_virtual_refresh( this ); } return error; @@ -1125,7 +1112,7 @@ void mlt_playlist_consolidate_blanks( mlt_playlist this, int keep_length ) if ( this != NULL ) { int i = 0; - mlt_properties properties = mlt_playlist_properties( this ); + mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this ); mlt_events_block( properties, properties ); for ( i = 1; i < this->count; i ++ ) @@ -1172,9 +1159,9 @@ mlt_producer mlt_playlist_replace_with_blank( mlt_playlist this, int clip ) playlist_entry *entry = this->list[ clip ]; int in = entry->frame_in; int out = entry->frame_out; - mlt_properties properties = mlt_playlist_properties( this ); + mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this ); producer = entry->producer; - mlt_properties_inc_ref( mlt_producer_properties( producer ) ); + mlt_properties_inc_ref( MLT_PRODUCER_PROPERTIES( producer ) ); mlt_events_block( properties, properties ); mlt_playlist_remove( this, clip ); mlt_playlist_blank( this, out - in ); @@ -1190,7 +1177,7 @@ void mlt_playlist_insert_blank( mlt_playlist this, int clip, int length ) { if ( this != NULL && length > 0 ) { - mlt_properties properties = mlt_playlist_properties( this ); + mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this ); mlt_events_block( properties, properties ); mlt_playlist_blank( this, length ); mlt_playlist_move( this, this->count - 1, clip ); @@ -1204,7 +1191,7 @@ void mlt_playlist_pad_blanks( mlt_playlist this, int position, int length, int f if ( this != NULL && length != 0 ) { int clip = mlt_playlist_get_clip_index_at( this, position ); - mlt_properties properties = mlt_playlist_properties( this ); + mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this ); mlt_events_block( properties, properties ); if ( find && clip < this->count && !mlt_playlist_is_blank( this, clip ) ) clip ++; @@ -1231,7 +1218,7 @@ int mlt_playlist_insert_at( mlt_playlist this, int position, mlt_producer produc int ret = this == NULL || position < 0 || producer == NULL; if ( ret == 0 ) { - mlt_properties properties = mlt_playlist_properties( this ); + mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this ); int length = mlt_producer_get_playtime( producer ); int clip = mlt_playlist_get_clip_index_at( this, position ); mlt_playlist_clip_info info; @@ -1322,10 +1309,10 @@ int mlt_playlist_remove_region( mlt_playlist this, int position, int length ) int index = mlt_playlist_get_clip_index_at( this, position ); if ( index >= 0 && index < this->count ) { - mlt_properties properties = mlt_playlist_properties( this ); + mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this ); int clip_start = mlt_playlist_clip_start( this, index ); int clip_length = mlt_playlist_clip_length( this, index ); - int list_length = mlt_producer_get_playtime( mlt_playlist_producer( this ) ); + int list_length = mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( this ) ); mlt_events_block( properties, this ); if ( position + length > list_length ) @@ -1395,7 +1382,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i mlt_service_get_frame( real, frame, index ); // Check if we're at the end of the clip - mlt_properties properties = mlt_frame_properties( *frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( *frame ); if ( mlt_properties_get_int( properties, "end_of_clip" ) ) mlt_playlist_virtual_set_out( this ); @@ -1407,7 +1394,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i } // Check for notifier and call with appropriate argument - mlt_properties playlist_properties = mlt_producer_properties( producer ); + mlt_properties playlist_properties = MLT_PRODUCER_PROPERTIES( producer ); void ( *notifier )( void * ) = mlt_properties_get_data( playlist_properties, "notifier", NULL ); if ( notifier != NULL ) { @@ -1429,7 +1416,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i void mlt_playlist_close( mlt_playlist this ) { - if ( this != NULL && mlt_properties_dec_ref( mlt_playlist_properties( this ) ) <= 0 ) + if ( this != NULL && mlt_properties_dec_ref( MLT_PLAYLIST_PROPERTIES( this ) ) <= 0 ) { int i = 0; this->parent.close = NULL; diff --git a/src/framework/mlt_playlist.h b/src/framework/mlt_playlist.h index 419bdc5d..d9e974c3 100644 --- a/src/framework/mlt_playlist.h +++ b/src/framework/mlt_playlist.h @@ -42,9 +42,28 @@ typedef struct } mlt_playlist_clip_info; +/** Private definition. +*/ + +typedef struct playlist_entry_s playlist_entry; + +struct mlt_playlist_s +{ + struct mlt_producer_s parent; + struct mlt_producer_s blank; + + int size; + int count; + playlist_entry **list; +}; + /** Public final methods */ +#define MLT_PLAYLIST_PRODUCER( playlist ) ( &( playlist )->parent ) +#define MLT_PLAYLIST_SERVICE( playlist ) MLT_PRODUCER_SERVICE( MLT_PLAYLIST_PRODUCER( playlist ) ) +#define MLT_PLAYLIST_PROPERTIES( playlist ) MLT_SERVICE_PROPERTIES( MLT_PLAYLIST_SERVICE( playlist ) ) + extern mlt_playlist mlt_playlist_init( ); extern mlt_producer mlt_playlist_producer( mlt_playlist self ); extern mlt_service mlt_playlist_service( mlt_playlist self ); diff --git a/src/framework/mlt_producer.c b/src/framework/mlt_producer.c index 58594b8c..6dc08e1c 100644 --- a/src/framework/mlt_producer.c +++ b/src/framework/mlt_producer.c @@ -35,6 +35,13 @@ static int producer_get_frame( mlt_service this, mlt_frame_ptr frame, int index static void mlt_producer_property_changed( mlt_service owner, mlt_producer this, char *name ); static void mlt_producer_service_changed( mlt_service owner, mlt_producer this ); +//#define _MLT_PRODUCER_CHECKS_ 1 + +#ifdef _MLT_PRODUCER_CHECKS_ +static int producers_created = 0; +static int producers_destroyed = 0; +#endif + /** Constructor */ @@ -46,6 +53,10 @@ int mlt_producer_init( mlt_producer this, void *child ) // Continue if no error if ( error == 0 ) { +#ifdef _MLT_PRODUCER_CHECKS_ + producers_created ++; +#endif + // Initialise the producer memset( this, 0, sizeof( struct mlt_producer_s ) ); @@ -69,7 +80,7 @@ int mlt_producer_init( mlt_producer this, void *child ) this->close_object = this; // Get the properties of the parent - mlt_properties properties = mlt_service_properties( parent ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( parent ); // Set the default properties mlt_properties_set( properties, "mlt_type", "mlt_producer" ); @@ -110,7 +121,7 @@ int mlt_producer_init( mlt_producer this, void *child ) static void mlt_producer_property_changed( mlt_service owner, mlt_producer this, char *name ) { if ( !strcmp( name, "in" ) || !strcmp( name, "out" ) || !strcmp( name, "length" ) ) - mlt_events_fire( mlt_producer_properties( mlt_producer_cut_parent( this ) ), "producer-changed", NULL ); + mlt_events_fire( MLT_PRODUCER_PROPERTIES( mlt_producer_cut_parent( this ) ), "producer-changed", NULL ); } /** Listener for service changes. @@ -118,19 +129,7 @@ static void mlt_producer_property_changed( mlt_service owner, mlt_producer this, static void mlt_producer_service_changed( mlt_service owner, mlt_producer this ) { - mlt_events_fire( mlt_producer_properties( mlt_producer_cut_parent( this ) ), "producer-changed", NULL ); -} - -/** Special case destructor -*/ - -static void mlt_cut_destroy( void *obj ) -{ - mlt_producer this = obj; - this->close = NULL; - this->parent.close = NULL; - mlt_service_close( &this->parent ); - free( this ); + mlt_events_fire( MLT_PRODUCER_PROPERTIES( mlt_producer_cut_parent( this ) ), "producer-changed", NULL ); } /** Create a new producer. @@ -140,7 +139,6 @@ mlt_producer mlt_producer_new( ) { mlt_producer this = malloc( sizeof( struct mlt_producer_s ) ); mlt_producer_init( this, NULL ); - this->close = mlt_cut_destroy; return this; } @@ -149,7 +147,7 @@ mlt_producer mlt_producer_new( ) int mlt_producer_is_cut( mlt_producer this ) { - return mlt_properties_get_int( mlt_producer_properties( this ), "_cut" ); + return mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( this ), "_cut" ); } /** Determine if producer is a mix. @@ -157,7 +155,7 @@ int mlt_producer_is_cut( mlt_producer this ) int mlt_producer_is_mix( mlt_producer this ) { - mlt_properties properties = this != NULL ? mlt_producer_properties( this ) : NULL; + mlt_properties properties = this != NULL ? MLT_PRODUCER_PROPERTIES( this ) : NULL; mlt_tractor tractor = properties != NULL ? mlt_properties_get_data( properties, "mlt_mix", NULL ) : NULL; return tractor != NULL; } @@ -167,7 +165,7 @@ int mlt_producer_is_mix( mlt_producer this ) int mlt_producer_is_blank( mlt_producer this ) { - return this == NULL || !strcmp( mlt_properties_get( mlt_producer_properties( mlt_producer_cut_parent( this ) ), "resource" ), "blank" ); + return this == NULL || !strcmp( mlt_properties_get( MLT_PRODUCER_PROPERTIES( mlt_producer_cut_parent( this ) ), "resource" ), "blank" ); } /** Obtain the parent producer. @@ -175,7 +173,7 @@ int mlt_producer_is_blank( mlt_producer this ) mlt_producer mlt_producer_cut_parent( mlt_producer this ) { - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); if ( mlt_producer_is_cut( this ) ) return mlt_properties_get_data( properties, "_cut_parent", NULL ); else @@ -189,9 +187,10 @@ mlt_producer mlt_producer_cut( mlt_producer this, int in, int out ) { mlt_producer result = mlt_producer_new( ); mlt_producer parent = mlt_producer_cut_parent( this ); - mlt_properties properties = mlt_producer_properties( result ); - mlt_properties parent_props = mlt_producer_properties( parent ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( result ); + mlt_properties parent_props = MLT_PRODUCER_PROPERTIES( parent ); + mlt_events_block( MLT_PRODUCER_PROPERTIES( result ), MLT_PRODUCER_PROPERTIES( result ) ); // Special case - allow for a cut of the entire producer (this will squeeze all other cuts to 0) if ( in <= 0 ) in = 0; @@ -204,6 +203,13 @@ mlt_producer mlt_producer_cut( mlt_producer this, int in, int out ) mlt_properties_set_position( properties, "length", mlt_properties_get_position( parent_props, "length" ) ); mlt_producer_set_in_and_out( result, in, out ); + // Mini fezzik :-/ + mlt_filter filter = mlt_factory_filter( "data_feed", "attr_check" ); + mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "_fezzik", 1 ); + mlt_producer_attach( result, filter ); + mlt_filter_close( filter ); + mlt_events_unblock( MLT_PRODUCER_PROPERTIES( result ), MLT_PRODUCER_PROPERTIES( result ) ); + return result; } @@ -220,7 +226,7 @@ mlt_service mlt_producer_service( mlt_producer this ) mlt_properties mlt_producer_properties( mlt_producer this ) { - return mlt_service_properties( &this->parent ); + return MLT_SERVICE_PROPERTIES( &this->parent ); } /** Seek to a specified position. @@ -229,11 +235,12 @@ mlt_properties mlt_producer_properties( mlt_producer this ) int mlt_producer_seek( mlt_producer this, mlt_position position ) { // Determine eof handling - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); char *eof = mlt_properties_get( properties, "eof" ); int use_points = 1 - mlt_properties_get_int( properties, "ignore_points" ); - // Recursive behaviour for cuts... + // Recursive behaviour for cuts - repositions parent and then repositions cut + // hence no return on this condition if ( mlt_producer_is_cut( this ) ) mlt_producer_seek( mlt_producer_cut_parent( this ), position + mlt_producer_get_in( this ) ); @@ -253,10 +260,10 @@ int mlt_producer_seek( mlt_producer this, mlt_position position ) } // Set the position - mlt_properties_set_position( mlt_producer_properties( this ), "_position", position ); + mlt_properties_set_position( MLT_PRODUCER_PROPERTIES( this ), "_position", position ); // Calculate the absolute frame - mlt_properties_set_position( mlt_producer_properties( this ), "_frame", use_points * mlt_producer_get_in( this ) + position ); + mlt_properties_set_position( MLT_PRODUCER_PROPERTIES( this ), "_frame", use_points * mlt_producer_get_in( this ) + position ); return 0; } @@ -266,7 +273,7 @@ int mlt_producer_seek( mlt_producer this, mlt_position position ) mlt_position mlt_producer_position( mlt_producer this ) { - return mlt_properties_get_position( mlt_producer_properties( this ), "_position" ); + return mlt_properties_get_position( MLT_PRODUCER_PROPERTIES( this ), "_position" ); } /** Get the current position (relative to start of producer). @@ -274,7 +281,7 @@ mlt_position mlt_producer_position( mlt_producer this ) mlt_position mlt_producer_frame( mlt_producer this ) { - return mlt_properties_get_position( mlt_producer_properties( this ), "_frame" ); + return mlt_properties_get_position( MLT_PRODUCER_PROPERTIES( this ), "_frame" ); } /** Set the playing speed. @@ -282,7 +289,7 @@ mlt_position mlt_producer_frame( mlt_producer this ) int mlt_producer_set_speed( mlt_producer this, double speed ) { - return mlt_properties_set_double( mlt_producer_properties( this ), "_speed", speed ); + return mlt_properties_set_double( MLT_PRODUCER_PROPERTIES( this ), "_speed", speed ); } /** Get the playing speed. @@ -290,7 +297,7 @@ int mlt_producer_set_speed( mlt_producer this, double speed ) double mlt_producer_get_speed( mlt_producer this ) { - return mlt_properties_get_double( mlt_producer_properties( this ), "_speed" ); + return mlt_properties_get_double( MLT_PRODUCER_PROPERTIES( this ), "_speed" ); } /** Get the frames per second. @@ -298,7 +305,7 @@ double mlt_producer_get_speed( mlt_producer this ) double mlt_producer_get_fps( mlt_producer this ) { - return mlt_properties_get_double( mlt_producer_properties( this ), "fps" ); + return mlt_properties_get_double( MLT_PRODUCER_PROPERTIES( this ), "fps" ); } /** Set the in and out points. @@ -306,7 +313,7 @@ double mlt_producer_get_fps( mlt_producer this ) int mlt_producer_set_in_and_out( mlt_producer this, mlt_position in, mlt_position out ) { - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Correct ins and outs if necessary if ( in < 0 ) @@ -319,7 +326,7 @@ int mlt_producer_set_in_and_out( mlt_producer this, mlt_position in, mlt_positio else if ( out >= mlt_producer_get_length( this ) && !mlt_producer_is_blank( this ) ) out = mlt_producer_get_length( this ) - 1; else if ( out >= mlt_producer_get_length( this ) && mlt_producer_is_blank( this ) ) - mlt_properties_set_position( mlt_producer_properties( this ), "length", out + 1 ); + mlt_properties_set_position( MLT_PRODUCER_PROPERTIES( this ), "length", out + 1 ); // Swap ins and outs if wrong if ( out < in ) @@ -346,7 +353,7 @@ int mlt_producer_clear( mlt_producer this ) { if ( this != NULL ) { - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); mlt_events_block( properties, properties ); mlt_properties_set_position( properties, "in", 0 ); mlt_events_unblock( properties, properties ); @@ -360,7 +367,7 @@ int mlt_producer_clear( mlt_producer this ) mlt_position mlt_producer_get_in( mlt_producer this ) { - return mlt_properties_get_position( mlt_producer_properties( this ), "in" ); + return mlt_properties_get_position( MLT_PRODUCER_PROPERTIES( this ), "in" ); } /** Get the out point. @@ -368,7 +375,7 @@ mlt_position mlt_producer_get_in( mlt_producer this ) mlt_position mlt_producer_get_out( mlt_producer this ) { - return mlt_properties_get_position( mlt_producer_properties( this ), "out" ); + return mlt_properties_get_position( MLT_PRODUCER_PROPERTIES( this ), "out" ); } /** Get the total play time. @@ -384,7 +391,7 @@ mlt_position mlt_producer_get_playtime( mlt_producer this ) mlt_position mlt_producer_get_length( mlt_producer this ) { - return mlt_properties_get_position( mlt_producer_properties( this ), "length" ); + return mlt_properties_get_position( MLT_PRODUCER_PROPERTIES( this ), "length" ); } /** Prepare for next frame. @@ -406,10 +413,10 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind if ( this != NULL && !mlt_producer_is_cut( this ) ) { // Get the properties of this producer - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Determine eof handling - char *eof = mlt_properties_get( mlt_producer_properties( this ), "eof" ); + char *eof = mlt_properties_get( MLT_PRODUCER_PROPERTIES( this ), "eof" ); // Get the speed of the producer double speed = mlt_producer_get_speed( this ); @@ -430,8 +437,8 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind result = mlt_frame_set_position( *frame, mlt_producer_position( this ) ); // Mark as a test card - mlt_properties_set_int( mlt_frame_properties( *frame ), "test_image", 1 ); - mlt_properties_set_int( mlt_frame_properties( *frame ), "test_audio", 1 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( *frame ), "test_image", 1 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( *frame ), "test_audio", 1 ); // Calculate the next position mlt_producer_prepare_next( this ); @@ -443,7 +450,7 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind } // Copy the fps and speed of the producer onto the frame - properties = mlt_frame_properties( *frame ); + properties = MLT_FRAME_PROPERTIES( *frame ); mlt_properties_set_double( properties, "_speed", speed ); mlt_properties_set_double( properties, "fps", mlt_producer_get_fps( this ) ); mlt_properties_set_int( properties, "test_audio", mlt_frame_is_test_audio( *frame ) ); @@ -460,10 +467,10 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind mlt_producer parent = mlt_producer_cut_parent( this ); // Get the properties of the parent - mlt_properties parent_properties = mlt_producer_properties( parent ); + mlt_properties parent_properties = MLT_PRODUCER_PROPERTIES( parent ); // Get the properties of the cut - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Determine the clone index int clone_index = mlt_properties_get_int( properties, "_clone" ); @@ -475,7 +482,7 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind { char key[ 25 ]; sprintf( key, "_clone.%d", clone_index - 1 ); - clone = mlt_properties_get_data( mlt_producer_properties( mlt_producer_cut_parent( this ) ), key, NULL ); + clone = mlt_properties_get_data( MLT_PRODUCER_PROPERTIES( mlt_producer_cut_parent( this ) ), key, NULL ); if ( clone == NULL ) fprintf( stderr, "requested clone doesn't exist %d\n", clone_index ); clone = clone == NULL ? this : clone; } @@ -491,12 +498,12 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind mlt_properties_set_data( parent_properties, "use_clone", clone, 0, NULL, NULL ); // Now get the frame from the parents service - result = mlt_service_get_frame( mlt_producer_service( parent ), frame, index ); + result = mlt_service_get_frame( MLT_PRODUCER_SERVICE( parent ), frame, index ); // We're done with the clone now mlt_properties_set_data( parent_properties, "use_clone", NULL, 0, NULL, NULL ); - mlt_properties_set_double( mlt_frame_properties( *frame ), "_speed", speed ); + mlt_properties_set_double( MLT_FRAME_PROPERTIES( *frame ), "_speed", speed ); mlt_producer_prepare_next( this ); } else @@ -505,6 +512,21 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind result = 0; } + // Pass on all meta properties from the producer/cut on to the frame + if ( *frame != NULL && this != NULL ) + { + int i = 0; + mlt_properties p_props = MLT_PRODUCER_PROPERTIES( this ); + mlt_properties f_props = MLT_FRAME_PROPERTIES( *frame ); + int count = mlt_properties_count( p_props ); + for ( i = 0; i < count; i ++ ) + { + char *name = mlt_properties_get_name( p_props, i ); + if ( !strncmp( name, "meta.", 5 ) ) + mlt_properties_set( f_props, name, mlt_properties_get( p_props, name ) ); + } + } + return result; } @@ -513,7 +535,7 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind int mlt_producer_attach( mlt_producer this, mlt_filter filter ) { - return mlt_service_attach( mlt_producer_service( this ), filter ); + return mlt_service_attach( MLT_PRODUCER_SERVICE( this ), filter ); } /** Detach a filter. @@ -521,7 +543,7 @@ int mlt_producer_attach( mlt_producer this, mlt_filter filter ) int mlt_producer_detach( mlt_producer this, mlt_filter filter ) { - return mlt_service_detach( mlt_producer_service( this ), filter ); + return mlt_service_detach( MLT_PRODUCER_SERVICE( this ), filter ); } /** Retrieve a filter. @@ -529,7 +551,7 @@ int mlt_producer_detach( mlt_producer this, mlt_filter filter ) mlt_filter mlt_producer_filter( mlt_producer this, int index ) { - return mlt_service_filter( mlt_producer_service( this ), index ); + return mlt_service_filter( MLT_PRODUCER_SERVICE( this ), index ); } /** Clone this producer. @@ -538,7 +560,7 @@ mlt_filter mlt_producer_filter( mlt_producer this, int index ) static mlt_producer mlt_producer_clone( mlt_producer this ) { mlt_producer clone = NULL; - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); char *resource = mlt_properties_get( properties, "resource" ); char *service = mlt_properties_get( properties, "mlt_service" ); @@ -551,7 +573,7 @@ static mlt_producer mlt_producer_clone( mlt_producer this ) clone = mlt_factory_producer( "fezzik", resource ); if ( clone != NULL ) - mlt_properties_inherit( mlt_producer_properties( clone ), properties ); + mlt_properties_inherit( MLT_PRODUCER_PROPERTIES( clone ), properties ); mlt_events_unblock( mlt_factory_event_object( ), mlt_factory_event_object( ) ); @@ -564,7 +586,7 @@ static mlt_producer mlt_producer_clone( mlt_producer this ) static void mlt_producer_set_clones( mlt_producer this, int clones ) { mlt_producer parent = mlt_producer_cut_parent( this ); - mlt_properties properties = mlt_producer_properties( parent ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( parent ); int existing = mlt_properties_get_int( properties, "_clones" ); int i = 0; char key[ 25 ]; @@ -598,7 +620,7 @@ static void mlt_producer_set_clones( mlt_producer this, int clones ) sprintf( key, "_clone.%d", i ); clone = mlt_properties_get_data( properties, key, NULL ); if ( clone != NULL ) - mlt_properties_pass( mlt_producer_properties( clone ), properties, "" ); + mlt_properties_pass( MLT_PRODUCER_PROPERTIES( clone ), properties, "" ); } // Update the number of clones on the properties @@ -693,7 +715,7 @@ static int on_start_producer( mlt_parser this, mlt_producer object ) refs = malloc( ( ref_count + 1 ) * sizeof( clip_references ) ); if ( old_refs != NULL ) memcpy( refs, old_refs, ref_count * sizeof( clip_references ) ); - mlt_properties_set_int( mlt_producer_properties( object ), "_clone", -1 ); + mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( object ), "_clone", -1 ); refs[ ref_count ].cut = object; refs[ ref_count ].start = info->position; refs[ ref_count ].end = info->position + mlt_producer_get_playtime( object ) - 1; @@ -743,7 +765,7 @@ int mlt_producer_optimise( mlt_producer this ) parser->on_start_multitrack = on_start_multitrack; parser->on_end_multitrack = on_end_multitrack; push( parser, 0, 0, 0 ); - mlt_parser_start( parser, mlt_producer_service( this ) ); + mlt_parser_start( parser, MLT_PRODUCER_SERVICE( this ) ); free( pop( parser ) ); for ( k = 0; k < mlt_properties_count( producers ); k ++ ) { @@ -763,7 +785,7 @@ int mlt_producer_optimise( mlt_producer this ) if ( intersect( &refs[ i ], &refs[ j ] ) ) { clones ++; - mlt_properties_set_int( mlt_producer_properties( refs[ j ].cut ), "_clone", clones ); + mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( refs[ j ].cut ), "_clone", clones ); } } if ( clones > max_clones ) @@ -773,8 +795,8 @@ int mlt_producer_optimise( mlt_producer this ) for ( i = 0; i < count; i ++ ) { mlt_producer cut = refs[ i ].cut; - if ( mlt_properties_get_int( mlt_producer_properties( cut ), "_clone" ) == -1 ) - mlt_properties_set_int( mlt_producer_properties( cut ), "_clone", 0 ); + if ( mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( cut ), "_clone" ) == -1 ) + mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( cut ), "_clone", 0 ); } mlt_producer_set_clones( producer, max_clones ); @@ -785,7 +807,7 @@ int mlt_producer_optimise( mlt_producer this ) for ( i = 0; i < count; i ++ ) { mlt_producer cut = refs[ i ].cut; - mlt_properties_set_int( mlt_producer_properties( cut ), "_clone", 0 ); + mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( cut ), "_clone", 0 ); } mlt_producer_set_clones( producer, 0 ); } @@ -800,13 +822,30 @@ int mlt_producer_optimise( mlt_producer this ) void mlt_producer_close( mlt_producer this ) { - if ( this != NULL && mlt_properties_dec_ref( mlt_producer_properties( this ) ) <= 0 ) + if ( this != NULL && mlt_properties_dec_ref( MLT_PRODUCER_PROPERTIES( this ) ) <= 0 ) { this->parent.close = NULL; if ( this->close != NULL ) + { this->close( this->close_object ); + } else + { +#if _MLT_PRODUCER_CHECKS_ == 1 + // Show debug info + mlt_properties_debug( MLT_PRODUCER_PROPERTIES( this ), "Producer closing", stderr ); +#endif + +#ifdef _MLT_PRODUCER_CHECKS_ + // Increment destroyed count + producers_destroyed ++; + + // Show current stats - these should match when the app is closed + fprintf( stderr, "Producers created %d, destroyed %d\n", producers_created, producers_destroyed ); +#endif + mlt_service_close( &this->parent ); + } } } diff --git a/src/framework/mlt_producer.h b/src/framework/mlt_producer.h index a0c3356f..c2a47361 100644 --- a/src/framework/mlt_producer.h +++ b/src/framework/mlt_producer.h @@ -45,6 +45,9 @@ struct mlt_producer_s /** Public final methods */ +#define MLT_PRODUCER_SERVICE( producer ) ( &( producer )->parent ) +#define MLT_PRODUCER_PROPERTIES( producer ) MLT_SERVICE_PROPERTIES( MLT_PRODUCER_SERVICE( producer ) ) + extern int mlt_producer_init( mlt_producer self, void *child ); extern mlt_producer mlt_producer_new( ); extern mlt_service mlt_producer_service( mlt_producer self ); diff --git a/src/framework/mlt_properties.c b/src/framework/mlt_properties.c index 0bad06be..df2e7b4e 100644 --- a/src/framework/mlt_properties.c +++ b/src/framework/mlt_properties.c @@ -47,7 +47,7 @@ property_list; /** Memory leak checks. */ -//#define _MLT_PROPERTY_CHECKS_ +//#define _MLT_PROPERTY_CHECKS_ 2 #ifdef _MLT_PROPERTY_CHECKS_ static int properties_created = 0; @@ -698,10 +698,12 @@ void mlt_properties_close( mlt_properties this ) property_list *list = this->local; int index = 0; -#ifdef _MLT_PROPERTY_CHECKS_ +#if _MLT_PROPERTY_CHECKS_ == 1 // Show debug info mlt_properties_debug( this, "Closing", stderr ); +#endif +#ifdef _MLT_PROPERTY_CHECKS_ // Increment destroyed count properties_destroyed ++; diff --git a/src/framework/mlt_property.c b/src/framework/mlt_property.c index 1a458d86..a4bba69a 100644 --- a/src/framework/mlt_property.c +++ b/src/framework/mlt_property.c @@ -236,7 +236,7 @@ char *mlt_property_get_string( mlt_property this ) { this->types |= mlt_prop_string; this->prop_string = malloc( 32 ); - sprintf( this->prop_string, "%e", this->prop_double ); + sprintf( this->prop_string, "%f", this->prop_double ); } else if ( this->types & mlt_prop_position ) { diff --git a/src/framework/mlt_service.c b/src/framework/mlt_service.c index 93ee56b8..36f79e05 100644 --- a/src/framework/mlt_service.c +++ b/src/framework/mlt_service.c @@ -119,7 +119,7 @@ mlt_service_type mlt_service_identify( mlt_service this ) mlt_service_type type = invalid_type; if ( this != NULL ) { - mlt_properties properties = mlt_service_properties( this ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( this ); char *mlt_type = mlt_properties_get( properties, "mlt_type" ); char *resource = mlt_properties_get( properties, "resource" ); if ( mlt_type == NULL ) @@ -191,7 +191,7 @@ int mlt_service_connect_producer( mlt_service this, mlt_service producer, int in if ( producer != NULL ) { mlt_service_lock( producer ); - mlt_properties_inc_ref( mlt_service_properties( producer ) ); + mlt_properties_inc_ref( MLT_SERVICE_PROPERTIES( producer ) ); mlt_service_unlock( producer ); } @@ -320,8 +320,8 @@ mlt_properties mlt_service_properties( mlt_service self ) void mlt_service_apply_filters( mlt_service this, mlt_frame frame, int index ) { int i; - mlt_properties frame_properties = mlt_frame_properties( frame ); - mlt_properties service_properties = mlt_service_properties( this ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); + mlt_properties service_properties = MLT_SERVICE_PROPERTIES( this ); mlt_service_base *base = this->local; mlt_position position = mlt_frame_get_position( frame ); mlt_position this_in = mlt_properties_get_position( service_properties, "in" ); @@ -341,7 +341,7 @@ void mlt_service_apply_filters( mlt_service this, mlt_frame frame, int index ) mlt_properties_set_position( frame_properties, "in", in == 0 ? this_in : in ); mlt_properties_set_position( frame_properties, "out", out == 0 ? this_out : out ); mlt_filter_process( base->filters[ i ], frame ); - mlt_service_apply_filters( mlt_filter_service( base->filters[ i ] ), frame, index + 1 ); + mlt_service_apply_filters( MLT_FILTER_SERVICE( base->filters[ i ] ), frame, index + 1 ); } } } @@ -356,9 +356,8 @@ int mlt_service_get_frame( mlt_service this, mlt_frame_ptr frame, int index ) mlt_service_lock( this ); if ( this != NULL && this->get_frame != NULL ) { - char uniq[ 20 ]; int result = 0; - mlt_properties properties = mlt_service_properties( this ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( this ); mlt_position in = mlt_properties_get_position( properties, "in" ); mlt_position out = mlt_properties_get_position( properties, "out" ); mlt_properties_inc_ref( properties ); @@ -366,17 +365,14 @@ int mlt_service_get_frame( mlt_service this, mlt_frame_ptr frame, int index ) result = this->get_frame( this, frame, index ); if ( result == 0 ) { - properties = mlt_frame_properties( *frame ); + properties = MLT_FRAME_PROPERTIES( *frame ); if ( in >=0 && out > 0 ) { mlt_properties_set_position( properties, "in", in ); mlt_properties_set_position( properties, "out", out ); } mlt_service_apply_filters( this, *frame, 1 ); - sprintf( uniq, "gf_%p", this ); - if ( mlt_properties_get_data( properties, uniq, NULL ) != NULL ) - fprintf( stderr, "%s is not unique in this frame\n", uniq ); - mlt_properties_set_data( properties, uniq, this, 0, ( mlt_destructor )mlt_service_close, NULL ); + mlt_deque_push_back( MLT_FRAME_SERVICE_STACK( *frame ), this ); } else { @@ -391,7 +387,7 @@ int mlt_service_get_frame( mlt_service this, mlt_frame_ptr frame, int index ) static void mlt_service_filter_changed( mlt_service owner, mlt_service this ) { - mlt_events_fire( mlt_service_properties( this ), "service-changed", NULL ); + mlt_events_fire( MLT_SERVICE_PROPERTIES( this ), "service-changed", NULL ); } /** Attach a filter. @@ -403,7 +399,7 @@ int mlt_service_attach( mlt_service this, mlt_filter filter ) if ( error == 0 ) { int i = 0; - mlt_properties properties = mlt_service_properties( this ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( this ); mlt_service_base *base = this->local; for ( i = 0; error == 0 && i < base->filter_count; i ++ ) @@ -420,8 +416,8 @@ int mlt_service_attach( mlt_service this, mlt_filter filter ) if ( base->filters != NULL ) { - mlt_properties props = mlt_filter_properties( filter ); - mlt_properties_inc_ref( mlt_filter_properties( filter ) ); + mlt_properties props = MLT_FILTER_PROPERTIES( filter ); + mlt_properties_inc_ref( MLT_FILTER_PROPERTIES( filter ) ); base->filters[ base->filter_count ++ ] = filter; mlt_events_fire( properties, "service-changed", NULL ); mlt_events_listen( props, this, "service-changed", ( mlt_listener )mlt_service_filter_changed ); @@ -446,7 +442,7 @@ int mlt_service_detach( mlt_service this, mlt_filter filter ) { int i = 0; mlt_service_base *base = this->local; - mlt_properties properties = mlt_service_properties( this ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( this ); for ( i = 0; i < base->filter_count; i ++ ) if ( base->filters[ i ] == filter ) @@ -458,7 +454,7 @@ int mlt_service_detach( mlt_service this, mlt_filter filter ) for ( i ++ ; i < base->filter_count; i ++ ) base->filters[ i - 1 ] = base->filters[ i ]; base->filter_count --; - mlt_events_disconnect( mlt_filter_properties( filter ), this ); + mlt_events_disconnect( MLT_FILTER_PROPERTIES( filter ), this ); mlt_filter_close( filter ); mlt_events_fire( properties, "service-changed", NULL ); } @@ -487,7 +483,7 @@ mlt_filter mlt_service_filter( mlt_service this, int index ) void mlt_service_close( mlt_service this ) { mlt_service_lock( this ); - if ( this != NULL && mlt_properties_dec_ref( mlt_service_properties( this ) ) <= 0 ) + if ( this != NULL && mlt_properties_dec_ref( MLT_SERVICE_PROPERTIES( this ) ) <= 0 ) { mlt_service_unlock( this ); if ( this->close != NULL ) @@ -499,7 +495,7 @@ void mlt_service_close( mlt_service this ) mlt_service_base *base = this->local; int i = 0; int count = base->filter_count; - mlt_events_block( mlt_service_properties( this ), this ); + mlt_events_block( MLT_SERVICE_PROPERTIES( this ), this ); while( count -- ) mlt_service_detach( this, base->filters[ 0 ] ); free( base->filters ); diff --git a/src/framework/mlt_service.h b/src/framework/mlt_service.h index b200eead..0d4e5611 100644 --- a/src/framework/mlt_service.h +++ b/src/framework/mlt_service.h @@ -44,6 +44,8 @@ struct mlt_service_s /** The public API. */ +#define MLT_SERVICE_PROPERTIES( service ) ( &( service )->parent ) + extern int mlt_service_init( mlt_service self, void *child ); extern void mlt_service_lock( mlt_service self ); extern void mlt_service_unlock( mlt_service self ); diff --git a/src/framework/mlt_tractor.c b/src/framework/mlt_tractor.c index 92533deb..84940891 100644 --- a/src/framework/mlt_tractor.c +++ b/src/framework/mlt_tractor.c @@ -29,15 +29,6 @@ #include #include -/** Private structure. -*/ - -struct mlt_tractor_s -{ - struct mlt_producer_s parent; - mlt_service producer; -}; - /** Forward references to static methods. */ @@ -55,7 +46,7 @@ mlt_tractor mlt_tractor_init( ) mlt_producer producer = &this->parent; if ( mlt_producer_init( producer, this ) == 0 ) { - mlt_properties properties = mlt_producer_properties( producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); mlt_properties_set( properties, "resource", "" ); mlt_properties_set( properties, "mlt_type", "mlt_producer" ); @@ -87,7 +78,7 @@ mlt_tractor mlt_tractor_new( ) { mlt_multitrack multitrack = mlt_multitrack_init( ); mlt_field field = mlt_field_new( multitrack, this ); - mlt_properties props = mlt_producer_properties( producer ); + mlt_properties props = MLT_PRODUCER_PROPERTIES( producer ); mlt_properties_set( props, "resource", "" ); mlt_properties_set( props, "mlt_type", "mlt_producer" ); @@ -98,7 +89,7 @@ mlt_tractor mlt_tractor_new( ) mlt_properties_set_data( props, "multitrack", multitrack, 0, ( mlt_destructor )mlt_multitrack_close, NULL ); mlt_properties_set_data( props, "field", field, 0, ( mlt_destructor )mlt_field_close, NULL ); - mlt_events_listen( mlt_multitrack_properties( multitrack ), this, "producer-changed", ( mlt_listener )mlt_tractor_listener ); + mlt_events_listen( MLT_MULTITRACK_PROPERTIES( multitrack ), this, "producer-changed", ( mlt_listener )mlt_tractor_listener ); producer->get_frame = producer_get_frame; producer->close = ( mlt_destructor )mlt_tractor_close; @@ -118,7 +109,7 @@ mlt_tractor mlt_tractor_new( ) mlt_service mlt_tractor_service( mlt_tractor this ) { - return mlt_producer_service( &this->parent ); + return MLT_PRODUCER_SERVICE( &this->parent ); } /** Get the producer object associated to the tractor. @@ -134,7 +125,7 @@ mlt_producer mlt_tractor_producer( mlt_tractor this ) mlt_properties mlt_tractor_properties( mlt_tractor this ) { - return mlt_producer_properties( &this->parent ); + return MLT_PRODUCER_PROPERTIES( &this->parent ); } /** Get the field this tractor is harvesting. @@ -142,7 +133,7 @@ mlt_properties mlt_tractor_properties( mlt_tractor this ) mlt_field mlt_tractor_field( mlt_tractor this ) { - return mlt_properties_get_data( mlt_tractor_properties( this ), "field", NULL ); + return mlt_properties_get_data( MLT_TRACTOR_PROPERTIES( this ), "field", NULL ); } /** Get the multitrack this tractor is pulling. @@ -150,7 +141,7 @@ mlt_field mlt_tractor_field( mlt_tractor this ) mlt_multitrack mlt_tractor_multitrack( mlt_tractor this ) { - return mlt_properties_get_data( mlt_tractor_properties( this ), "multitrack", NULL ); + return mlt_properties_get_data( MLT_TRACTOR_PROPERTIES( this ), "multitrack", NULL ); } /** Ensure the tractors in/out points match the multitrack. @@ -159,8 +150,8 @@ mlt_multitrack mlt_tractor_multitrack( mlt_tractor this ) void mlt_tractor_refresh( mlt_tractor this ) { mlt_multitrack multitrack = mlt_tractor_multitrack( this ); - mlt_properties properties = mlt_multitrack_properties( multitrack ); - mlt_properties self = mlt_tractor_properties( this ); + mlt_properties properties = MLT_MULTITRACK_PROPERTIES( multitrack ); + mlt_properties self = MLT_TRACTOR_PROPERTIES( this ); mlt_events_block( properties, self ); mlt_events_block( self, self ); mlt_multitrack_refresh( multitrack ); @@ -181,7 +172,7 @@ static void mlt_tractor_listener( mlt_multitrack tracks, mlt_tractor this ) int mlt_tractor_connect( mlt_tractor this, mlt_service producer ) { - int ret = mlt_service_connect_producer( mlt_tractor_service( this ), producer, 0 ); + int ret = mlt_service_connect_producer( MLT_TRACTOR_SERVICE( this ), producer, 0 ); // This is the producer we're going to connect to if ( ret == 0 ) @@ -209,9 +200,9 @@ mlt_producer mlt_tractor_get_track( mlt_tractor this, int index ) static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) { uint8_t *data = NULL; - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); mlt_frame frame = mlt_frame_pop_service( this ); - mlt_properties frame_properties = mlt_frame_properties( frame ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); mlt_properties_set_int( frame_properties, "width", mlt_properties_get_int( properties, "width" ) ); mlt_properties_set_int( frame_properties, "height", mlt_properties_get_int( properties, "height" ) ); mlt_properties_set( frame_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) ); @@ -236,7 +227,7 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma static int producer_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); mlt_frame frame = mlt_frame_pop_audio( this ); mlt_frame_get_audio( frame, buffer, format, frequency, channels, samples ); mlt_properties_set_data( properties, "audio", *buffer, 0, NULL, NULL ); @@ -261,7 +252,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra int count = 0; // Get the properties of the parent producer - mlt_properties properties = mlt_producer_properties( parent ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( parent ); // Try to obtain the multitrack associated to the tractor mlt_multitrack multitrack = mlt_properties_get_data( properties, "multitrack", NULL ); @@ -292,7 +283,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra mlt_properties temp_properties = NULL; // Get the multitrack's producer - mlt_producer target = mlt_multitrack_producer( multitrack ); + mlt_producer target = MLT_MULTITRACK_PRODUCER( multitrack ); mlt_producer_seek( target, mlt_producer_frame( parent ) ); mlt_producer_set_speed( target, mlt_producer_get_speed( parent ) ); @@ -300,7 +291,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra *frame = mlt_frame_init( ); // Get the properties of the frame - frame_properties = mlt_frame_properties( *frame ); + frame_properties = MLT_FRAME_PROPERTIES( *frame ); // Loop through each of the tracks we're harvesting for ( i = 0; !done; i ++ ) @@ -309,7 +300,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra mlt_service_get_frame( this->producer, &temp, i ); // Get the temporary properties - temp_properties = mlt_frame_properties( temp ); + temp_properties = MLT_FRAME_PROPERTIES( temp ); // Check for last track done = mlt_properties_get_int( temp_properties, "last_track" ); @@ -319,8 +310,9 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra mlt_properties_set_data( frame_properties, label, temp, 0, ( mlt_destructor )mlt_frame_close, NULL ); // We want the last data_queue - if ( !done && mlt_properties_get_data( temp_properties, "data_queue", NULL ) != NULL ) - data_queue = mlt_properties_get_data( mlt_frame_properties( temp ), "data_queue", NULL ); + if ( !done && mlt_properties_get_data( temp_properties, "data_queue", NULL ) != NULL && + mlt_deque_count( mlt_properties_get_data( temp_properties, "data_queue", NULL ) ) != 0 ) + data_queue = mlt_properties_get_data( MLT_FRAME_PROPERTIES( temp ), "data_queue", NULL ); // Pick up first video and audio frames if ( !done && !mlt_frame_is_test_audio( temp ) && !( mlt_properties_get_int( temp_properties, "hide" ) & 2 ) ) @@ -338,7 +330,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra if ( video != NULL ) { - mlt_properties video_properties = mlt_frame_properties( video ); + mlt_properties video_properties = MLT_FRAME_PROPERTIES( video ); mlt_frame_push_service( *frame, video ); mlt_frame_push_service( *frame, producer_get_image ); mlt_properties_set_data( frame_properties, "data_queue", data_queue, 0, NULL, NULL ); @@ -351,8 +343,8 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra } mlt_frame_set_position( *frame, mlt_producer_frame( parent ) ); - mlt_properties_set_int( mlt_frame_properties( *frame ), "test_audio", audio == NULL ); - mlt_properties_set_int( mlt_frame_properties( *frame ), "test_image", video == NULL ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( *frame ), "test_audio", audio == NULL ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( *frame ), "test_image", video == NULL ); } else if ( producer != NULL ) { @@ -385,7 +377,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra void mlt_tractor_close( mlt_tractor this ) { - if ( this != NULL && mlt_properties_dec_ref( mlt_tractor_properties( this ) ) <= 0 ) + if ( this != NULL && mlt_properties_dec_ref( MLT_TRACTOR_PROPERTIES( this ) ) <= 0 ) { this->parent.close = NULL; mlt_producer_close( &this->parent ); diff --git a/src/framework/mlt_tractor.h b/src/framework/mlt_tractor.h index b9e606ff..da0030a6 100644 --- a/src/framework/mlt_tractor.h +++ b/src/framework/mlt_tractor.h @@ -23,6 +23,19 @@ #include "mlt_producer.h" +/** Private structure. +*/ + +struct mlt_tractor_s +{ + struct mlt_producer_s parent; + mlt_service producer; +}; + +#define MLT_TRACTOR_PRODUCER( tractor ) ( &( tractor )->parent ) +#define MLT_TRACTOR_SERVICE( tractor ) MLT_PRODUCER_SERVICE( MLT_TRACTOR_PRODUCER( tractor ) ) +#define MLT_TRACTOR_PROPERTIES( tractor ) MLT_SERVICE_PROPERTIES( MLT_TRACTOR_SERVICE( tractor ) ) + extern mlt_tractor mlt_tractor_init( ); extern mlt_tractor mlt_tractor_new( ); extern mlt_service mlt_tractor_service( mlt_tractor self ); diff --git a/src/framework/mlt_transition.c b/src/framework/mlt_transition.c index 7606ab18..6e1649ca 100644 --- a/src/framework/mlt_transition.c +++ b/src/framework/mlt_transition.c @@ -42,7 +42,7 @@ int mlt_transition_init( mlt_transition this, void *child ) this->child = child; if ( mlt_service_init( service, this ) == 0 ) { - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); service->get_frame = transition_get_frame; service->close = ( mlt_destructor )mlt_transition_close; @@ -82,7 +82,7 @@ mlt_service mlt_transition_service( mlt_transition this ) mlt_properties mlt_transition_properties( mlt_transition this ) { - return mlt_service_properties( mlt_transition_service( this ) ); + return MLT_TRANSITION_PROPERTIES( this ); } /** Connect this transition with a producers a and b tracks. @@ -93,7 +93,7 @@ int mlt_transition_connect( mlt_transition this, mlt_service producer, int a_tra int ret = mlt_service_connect_producer( &this->parent, producer, a_track ); if ( ret == 0 ) { - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); this->producer = producer; mlt_properties_set_int( properties, "a_track", a_track ); mlt_properties_set_int( properties, "b_track", b_track ); @@ -106,7 +106,7 @@ int mlt_transition_connect( mlt_transition this, mlt_service producer, int a_tra void mlt_transition_set_in_and_out( mlt_transition this, mlt_position in, mlt_position out ) { - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); mlt_properties_set_position( properties, "in", in ); mlt_properties_set_position( properties, "out", out ); } @@ -116,7 +116,7 @@ void mlt_transition_set_in_and_out( mlt_transition this, mlt_position in, mlt_po int mlt_transition_get_a_track( mlt_transition this ) { - return mlt_properties_get_int( mlt_transition_properties( this ), "a_track" ); + return mlt_properties_get_int( MLT_TRANSITION_PROPERTIES( this ), "a_track" ); } /** Get the index of the b track. @@ -124,7 +124,7 @@ int mlt_transition_get_a_track( mlt_transition this ) int mlt_transition_get_b_track( mlt_transition this ) { - return mlt_properties_get_int( mlt_transition_properties( this ), "b_track" ); + return mlt_properties_get_int( MLT_TRANSITION_PROPERTIES( this ), "b_track" ); } /** Get the in point. @@ -132,7 +132,7 @@ int mlt_transition_get_b_track( mlt_transition this ) mlt_position mlt_transition_get_in( mlt_transition this ) { - return mlt_properties_get_position( mlt_transition_properties( this ), "in" ); + return mlt_properties_get_position( MLT_TRANSITION_PROPERTIES( this ), "in" ); } /** Get the out point. @@ -140,7 +140,7 @@ mlt_position mlt_transition_get_in( mlt_transition this ) mlt_position mlt_transition_get_out( mlt_transition this ) { - return mlt_properties_get_position( mlt_transition_properties( this ), "out" ); + return mlt_properties_get_position( MLT_TRANSITION_PROPERTIES( this ), "out" ); } /** Process the frame. @@ -175,7 +175,7 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i { mlt_transition this = service->child; - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); int accepts_blanks = mlt_properties_get_int( properties, "_accepts_blanks" ); int a_track = mlt_properties_get_int( properties, "a_track" ); @@ -214,11 +214,11 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i { int hide = 0; *frame = mlt_transition_process( this, this->a_frame, this->b_frame ); - if ( !mlt_properties_get_int( mlt_frame_properties( this->a_frame ), "test_image" ) ) + if ( !mlt_properties_get_int( MLT_FRAME_PROPERTIES( this->a_frame ), "test_image" ) ) hide = 1; - if ( !mlt_properties_get_int( mlt_frame_properties( this->a_frame ), "test_audio" ) ) + if ( !mlt_properties_get_int( MLT_FRAME_PROPERTIES( this->a_frame ), "test_audio" ) ) hide |= 2; - mlt_properties_set_int( mlt_frame_properties( this->b_frame ), "hide", hide ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( this->b_frame ), "hide", hide ); } this->a_held = 0; } @@ -249,7 +249,7 @@ static int transition_get_frame( mlt_service service, mlt_frame_ptr frame, int i void mlt_transition_close( mlt_transition this ) { - if ( this != NULL && mlt_properties_dec_ref( mlt_transition_properties( this ) ) <= 0 ) + if ( this != NULL && mlt_properties_dec_ref( MLT_TRANSITION_PROPERTIES( this ) ) <= 0 ) { this->parent.close = NULL; if ( this->close != NULL ) diff --git a/src/framework/mlt_transition.h b/src/framework/mlt_transition.h index 05090032..c6912db8 100644 --- a/src/framework/mlt_transition.h +++ b/src/framework/mlt_transition.h @@ -53,6 +53,9 @@ struct mlt_transition_s /** Public final methods */ +#define MLT_TRANSITION_SERVICE( transition ) ( &( transition )->parent ) +#define MLT_TRANSITION_PROPERTIES( transition ) MLT_SERVICE_PROPERTIES( MLT_TRANSITION_SERVICE( transition ) ) + extern int mlt_transition_init( mlt_transition self, void *child ); extern mlt_transition mlt_transition_new( ); extern mlt_service mlt_transition_service( mlt_transition self ); diff --git a/src/framework/mlt_types.h b/src/framework/mlt_types.h index 7d233594..605e51a0 100644 --- a/src/framework/mlt_types.h +++ b/src/framework/mlt_types.h @@ -71,7 +71,6 @@ typedef struct mlt_properties_s *mlt_properties; typedef struct mlt_event_struct *mlt_event; typedef struct mlt_service_s *mlt_service; typedef struct mlt_producer_s *mlt_producer; -typedef struct mlt_manager_s *mlt_manager; typedef struct mlt_playlist_s *mlt_playlist; typedef struct mlt_multitrack_s *mlt_multitrack; typedef struct mlt_filter_s *mlt_filter; diff --git a/src/inigo/inigo.c b/src/inigo/inigo.c index bc2f1560..d37a4475 100644 --- a/src/inigo/inigo.c +++ b/src/inigo/inigo.c @@ -8,7 +8,7 @@ static void transport_action( mlt_producer producer, char *value ) { - mlt_properties properties = mlt_producer_properties( producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); mlt_multitrack multitrack = mlt_properties_get_data( properties, "multitrack", NULL ); mlt_properties_set_int( properties, "stats_off", 0 ); @@ -134,7 +134,7 @@ static mlt_consumer create_consumer( char *id, mlt_producer producer ) mlt_consumer consumer = mlt_factory_consumer( id, arg ); if ( consumer != NULL ) { - mlt_properties properties = mlt_consumer_properties( consumer ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer ); mlt_properties_set_data( properties, "transport_callback", transport_action, 0, NULL, NULL ); mlt_properties_set_data( properties, "transport_producer", producer, 0, NULL, NULL ); } @@ -143,8 +143,8 @@ static mlt_consumer create_consumer( char *id, mlt_producer producer ) static void transport( mlt_producer producer, mlt_consumer consumer ) { - mlt_properties properties = mlt_producer_properties( producer ); - int silent = mlt_properties_get_int( mlt_consumer_properties( consumer ), "silent" ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); + int silent = mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( consumer ), "silent" ); struct timespec tm = { 0, 40000 }; if ( mlt_properties_get_int( properties, "done" ) == 0 && !mlt_consumer_is_stopped( consumer ) ) @@ -213,7 +213,7 @@ int main( int argc, char **argv ) if ( argc > 1 && inigo != NULL && mlt_producer_get_length( inigo ) > 0 ) { // Get inigo's properties - mlt_properties inigo_props = mlt_producer_properties( inigo ); + mlt_properties inigo_props = MLT_PRODUCER_PROPERTIES( inigo ); // Get the last group mlt_properties group = mlt_properties_get_data( inigo_props, "group", 0 ); @@ -256,11 +256,11 @@ int main( int argc, char **argv ) if ( consumer != NULL && store == NULL ) { // Apply group settings - mlt_properties properties = mlt_consumer_properties( consumer ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer ); mlt_properties_inherit( properties, group ); // Connect consumer to inigo - mlt_consumer_connect( consumer, mlt_producer_service( inigo ) ); + mlt_consumer_connect( consumer, MLT_PRODUCER_SERVICE( inigo ) ); // Start the consumer mlt_consumer_start( consumer ); diff --git a/src/miracle/miracle_unit.c b/src/miracle/miracle_unit.c index 18f19aca..2eca0d25 100644 --- a/src/miracle/miracle_unit.c +++ b/src/miracle/miracle_unit.c @@ -78,7 +78,7 @@ miracle_unit miracle_unit_init( int index, char *constructor ) mlt_properties_set( this->properties, "arg", arg ); mlt_properties_set_data( this->properties, "consumer", consumer, 0, ( mlt_destructor )mlt_consumer_close, NULL ); mlt_properties_set_data( this->properties, "playlist", playlist, 0, ( mlt_destructor )mlt_playlist_close, NULL ); - mlt_consumer_connect( consumer, mlt_playlist_service( playlist ) ); + mlt_consumer_connect( consumer, MLT_PLAYLIST_SERVICE( playlist ) ); } return this; @@ -145,7 +145,7 @@ void miracle_unit_set_notifier( miracle_unit this, valerie_notifier notifier, ch { mlt_properties properties = this->properties; mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL ); - mlt_properties playlist_properties = mlt_playlist_properties( playlist ); + mlt_properties playlist_properties = MLT_PLAYLIST_PROPERTIES( playlist ); mlt_properties_set( properties, "root", root_dir ); mlt_properties_set_data( properties, "notifier", notifier, 0, NULL, NULL ); @@ -180,7 +180,7 @@ static void clear_unit( miracle_unit unit ) { mlt_properties properties = unit->properties; mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL ); - mlt_producer producer = mlt_playlist_producer( playlist ); + mlt_producer producer = MLT_PLAYLIST_PRODUCER( playlist ); mlt_playlist_clear( unit->old_playlist ); copy_playlist( unit->old_playlist, playlist ); @@ -199,14 +199,14 @@ static void clean_unit( miracle_unit unit ) mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL ); mlt_playlist_clip_info info; int current = mlt_playlist_current_clip( playlist ); - mlt_producer producer = mlt_playlist_producer( playlist ); + mlt_producer producer = MLT_PLAYLIST_PRODUCER( playlist ); mlt_position position = mlt_producer_frame( producer ); double speed = mlt_producer_get_speed( producer ); mlt_playlist_get_clip_info( playlist, &info, current ); if ( info.producer != NULL ) { - mlt_properties_inc_ref( mlt_producer_properties( info.producer ) ); + mlt_properties_inc_ref( MLT_PRODUCER_PROPERTIES( info.producer ) ); position -= info.start; clear_unit( unit ); mlt_playlist_append_io( playlist, info.producer, info.frame_in, info.frame_out ); @@ -235,7 +235,7 @@ void miracle_unit_report_list( miracle_unit unit, valerie_response response ) mlt_playlist_clip_info info; char *title; mlt_playlist_get_clip_info( playlist , &info, i ); - title = mlt_properties_get( mlt_producer_properties( info.producer ), "title" ); + title = mlt_properties_get( MLT_PRODUCER_PROPERTIES( info.producer ), "title" ); if ( title == NULL ) title = strip_root( unit, info.resource ); valerie_response_printf( response, 10240, "%d \"%s\" %d %d %d %d %.2f\n", @@ -398,7 +398,7 @@ void miracle_unit_play( miracle_unit_t *unit, int speed ) { mlt_properties properties = unit->properties; mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL ); - mlt_producer producer = mlt_playlist_producer( playlist ); + mlt_producer producer = MLT_PLAYLIST_PRODUCER( playlist ); mlt_consumer consumer = mlt_properties_get_data( unit->properties, "consumer", NULL ); mlt_producer_set_speed( producer, ( double )speed / 1000 ); mlt_consumer_start( consumer ); @@ -416,7 +416,7 @@ void miracle_unit_terminate( miracle_unit unit ) { mlt_consumer consumer = mlt_properties_get_data( unit->properties, "consumer", NULL ); mlt_playlist playlist = mlt_properties_get_data( unit->properties, "playlist", NULL ); - mlt_producer producer = mlt_playlist_producer( playlist ); + mlt_producer producer = MLT_PLAYLIST_PRODUCER( playlist ); mlt_producer_set_speed( producer, 0 ); mlt_consumer_stop( consumer ); miracle_unit_status_communicate( unit ); @@ -490,7 +490,7 @@ int miracle_unit_get_status( miracle_unit unit, valerie_status status ) { mlt_properties properties = unit->properties; mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL ); - mlt_producer producer = mlt_playlist_producer( playlist ); + mlt_producer producer = MLT_PLAYLIST_PRODUCER( playlist ); mlt_producer clip = mlt_playlist_current( playlist ); mlt_playlist_clip_info info; @@ -499,7 +499,7 @@ int miracle_unit_get_status( miracle_unit unit, valerie_status status ) if ( info.resource != NULL && strcmp( info.resource, "" ) ) { - char *title = mlt_properties_get( mlt_producer_properties( info.producer ), "title" ); + char *title = mlt_properties_get( MLT_PRODUCER_PROPERTIES( info.producer ), "title" ); if ( title == NULL ) title = strip_root( unit, info.resource ); strncpy( status->clip, title, sizeof( status->clip ) ); @@ -546,7 +546,7 @@ void miracle_unit_change_position( miracle_unit unit, int clip, int32_t position { mlt_properties properties = unit->properties; mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL ); - mlt_producer producer = mlt_playlist_producer( playlist ); + mlt_producer producer = MLT_PLAYLIST_PRODUCER( playlist ); mlt_playlist_clip_info info; if ( clip < 0 ) @@ -639,7 +639,7 @@ void miracle_unit_step( miracle_unit unit, int32_t offset ) { mlt_properties properties = unit->properties; mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL ); - mlt_producer producer = mlt_playlist_producer( playlist ); + mlt_producer producer = MLT_PLAYLIST_PRODUCER( playlist ); mlt_position position = mlt_producer_frame( producer ); mlt_producer_seek( producer, position + offset ); } @@ -690,12 +690,12 @@ int miracle_unit_set( miracle_unit unit, char *name_value ) if ( strncmp( name_value, "consumer.", 9 ) ) { mlt_playlist playlist = mlt_properties_get_data( unit->properties, "playlist", NULL ); - properties = mlt_playlist_properties( playlist ); + properties = MLT_PLAYLIST_PROPERTIES( playlist ); } else { mlt_consumer consumer = mlt_properties_get_data( unit->properties, "consumer", NULL ); - properties = mlt_consumer_properties( consumer ); + properties = MLT_CONSUMER_PROPERTIES( consumer ); name_value += 9; } @@ -705,7 +705,7 @@ int miracle_unit_set( miracle_unit unit, char *name_value ) char *miracle_unit_get( miracle_unit unit, char *name ) { mlt_playlist playlist = mlt_properties_get_data( unit->properties, "playlist", NULL ); - mlt_properties properties = mlt_playlist_properties( playlist ); + mlt_properties properties = MLT_PLAYLIST_PROPERTIES( playlist ); return mlt_properties_get( properties, name ); } diff --git a/src/miracle/miracle_unit_commands.c b/src/miracle/miracle_unit_commands.c index f0cbfd11..98a420d5 100644 --- a/src/miracle/miracle_unit_commands.c +++ b/src/miracle/miracle_unit_commands.c @@ -269,7 +269,7 @@ int miracle_receive( command_argument cmd_arg, char *doc ) miracle_unit unit = miracle_get_unit(cmd_arg->unit); if ( unit != NULL && producer != NULL ) { - if ( miracle_unit_append_service( unit, mlt_producer_service( producer ) ) == valerie_ok ) + if ( miracle_unit_append_service( unit, MLT_PRODUCER_SERVICE( producer ) ) == valerie_ok ) { mlt_producer_close( producer ); return RESPONSE_SUCCESS; diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index 9b431259..f5a7cc2b 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -141,7 +141,7 @@ mlt_consumer consumer_avformat_init( char *arg ) if ( this != NULL ) { // Get properties from the consumer - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Assign close callback this->close = consumer_close; @@ -228,7 +228,7 @@ mlt_consumer consumer_avformat_init( char *arg ) static int consumer_start( mlt_consumer this ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Check that we're not already running if ( !mlt_properties_get_int( properties, "running" ) ) @@ -285,7 +285,7 @@ static int consumer_start( mlt_consumer this ) static int consumer_stop( mlt_consumer this ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Check that we're running if ( mlt_properties_get_int( properties, "running" ) ) @@ -309,7 +309,7 @@ static int consumer_stop( mlt_consumer this ) static int consumer_is_stopped( mlt_consumer this ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); return !mlt_properties_get_int( properties, "running" ); } @@ -319,7 +319,7 @@ static int consumer_is_stopped( mlt_consumer this ) static AVStream *add_audio_stream( mlt_consumer this, AVFormatContext *oc, int codec_id ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Create a new stream AVStream *st = av_new_stream( oc, 1 ); @@ -405,7 +405,7 @@ static void close_audio( AVFormatContext *oc, AVStream *st ) static AVStream *add_video_stream( mlt_consumer this, AVFormatContext *oc, int codec_id ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Create a new stream AVStream *st = av_new_stream( oc, 0 ); @@ -564,7 +564,7 @@ static void *consumer_thread( void *arg ) mlt_consumer this = arg; // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Get the terminate on pause property int terminate_on_pause = mlt_properties_get_int( properties, "terminate_on_pause" ); @@ -760,7 +760,7 @@ static void *consumer_thread( void *arg ) frames ++; // Default audio args - frame_properties = mlt_frame_properties( frame ); + frame_properties = MLT_FRAME_PROPERTIES( frame ); // Check for the terminated condition terminated = terminate_on_pause && mlt_properties_get_double( frame_properties, "_speed" ) == 0.0; @@ -841,7 +841,7 @@ static void *consumer_thread( void *arg ) AVCodecContext *c; frame = mlt_deque_pop_front( queue ); - frame_properties = mlt_frame_properties( frame ); + frame_properties = MLT_FRAME_PROPERTIES( frame ); c = &video_st->codec; @@ -857,8 +857,8 @@ static void *consumer_thread( void *arg ) // This will cause some fx to go awry.... if ( mlt_properties_get_int( properties, "transcode" ) ) { - mlt_properties_set_int( mlt_frame_properties( frame ), "normalised_width", img_height * 4.0 / 3.0 ); - mlt_properties_set_int( mlt_frame_properties( frame ), "normalised_height", img_height ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "normalised_width", img_height * 4.0 / 3.0 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "normalised_height", img_height ); } mlt_frame_get_image( frame, &image, &img_fmt, &img_width, &img_height, 0 ); diff --git a/src/modules/avformat/filter_avcolour_space.c b/src/modules/avformat/filter_avcolour_space.c index 77fd029c..217f7031 100644 --- a/src/modules/avformat/filter_avcolour_space.c +++ b/src/modules/avformat/filter_avcolour_space.c @@ -115,9 +115,9 @@ static inline void convert_image( uint8_t *out, uint8_t *in, int out_fmt, int in static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ) { mlt_filter filter = mlt_frame_pop_service( this ); - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); int output_format = *format; - mlt_image_format forced = mlt_properties_get_int( mlt_filter_properties( filter ), "forced" ); + mlt_image_format forced = mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "forced" ); int error = 0; // Allow this filter to force processing in a colour space other than requested diff --git a/src/modules/avformat/filter_avdeinterlace.c b/src/modules/avformat/filter_avdeinterlace.c index 853be72f..35e65415 100644 --- a/src/modules/avformat/filter_avdeinterlace.c +++ b/src/modules/avformat/filter_avdeinterlace.c @@ -297,8 +297,8 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * // Check that we want progressive and we aren't already progressive if ( *format == mlt_image_yuv422 && - !mlt_properties_get_int( mlt_frame_properties( this ), "progressive" ) && - mlt_properties_get_int( mlt_frame_properties( this ), "consumer_deinterlace" ) ) + !mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "progressive" ) && + mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "consumer_deinterlace" ) ) { // Create a picture AVPicture *output = mlt_pool_alloc( sizeof( AVPicture ) ); @@ -317,7 +317,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * mlt_pool_release( output ); // Make sure that others know the frame is deinterlaced - mlt_properties_set_int( mlt_frame_properties( this ), "progressive", 1 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( this ), "progressive", 1 ); } else { diff --git a/src/modules/avformat/filter_avresample.c b/src/modules/avformat/filter_avresample.c index 4c37ae09..ae0c5dfb 100644 --- a/src/modules/avformat/filter_avresample.c +++ b/src/modules/avformat/filter_avresample.c @@ -35,13 +35,13 @@ static int resample_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { // Get the properties of the frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); // Get the filter service mlt_filter filter = mlt_frame_pop_audio( frame ); // Get the filter properties - mlt_properties filter_properties = mlt_filter_properties( filter ); + mlt_properties filter_properties = MLT_FILTER_PROPERTIES( filter ); // Get the resample information int output_rate = mlt_properties_get_int( filter_properties, "frequency" ); @@ -190,13 +190,13 @@ mlt_filter filter_avresample_init( char *arg ) // Deal with argument if ( arg != NULL ) - mlt_properties_set( mlt_filter_properties( this ), "frequency", arg ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "frequency", arg ); // Default to 2 channel output - mlt_properties_set_int( mlt_filter_properties( this ), "channels", 2 ); + mlt_properties_set_int( MLT_FILTER_PROPERTIES( this ), "channels", 2 ); // Store the buffer - mlt_properties_set_data( mlt_filter_properties( this ), "buffer", buffer, size, mlt_pool_release, NULL ); + mlt_properties_set_data( MLT_FILTER_PROPERTIES( this ), "buffer", buffer, size, mlt_pool_release, NULL ); } return this; diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 1cebb3f3..24a7828a 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -57,7 +57,7 @@ mlt_producer producer_avformat_init( char *file ) if ( mlt_producer_init( this, NULL ) == 0 ) { // Get the properties - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Set the resource property (required for all producers) mlt_properties_set( properties, "resource", file ); @@ -156,7 +156,7 @@ static int producer_open( mlt_producer this, char *file ) AVFormatContext *context = NULL; // Get the properties - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // We will treat everything with the producer fps double fps = mlt_properties_get_double( properties, "fps" ); @@ -334,7 +334,7 @@ static int producer_open( mlt_producer this, char *file ) static double producer_time_of_frame( mlt_producer this, mlt_position position ) { // Get the properties - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Obtain the fps double fps = mlt_properties_get_double( properties, "fps" ); @@ -420,7 +420,7 @@ static inline void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) { // Get the properties from the frame - mlt_properties frame_properties = mlt_frame_properties( frame ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); // Obtain the frame number of this frame mlt_position position = mlt_properties_get_position( frame_properties, "avformat_position" ); @@ -429,7 +429,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form mlt_producer this = mlt_properties_get_data( frame_properties, "avformat_producer", NULL ); // Get the producer properties - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Fetch the video_context AVFormatContext *context = mlt_properties_get_data( properties, "video_context", NULL ); @@ -634,7 +634,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form static void producer_set_up_video( mlt_producer this, mlt_frame frame ) { // Get the properties - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Fetch the video_context AVFormatContext *context = mlt_properties_get_data( properties, "video_context", NULL ); @@ -643,7 +643,7 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame ) int index = mlt_properties_get_int( properties, "video_index" ); // Get the frame properties - mlt_properties frame_properties = mlt_frame_properties( frame ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); if ( context != NULL && index != -1 ) { @@ -727,7 +727,7 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame ) static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { // Get the properties from the frame - mlt_properties frame_properties = mlt_frame_properties( frame ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); // Obtain the frame number of this frame mlt_position position = mlt_properties_get_position( frame_properties, "avformat_position" ); @@ -736,7 +736,7 @@ static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_form mlt_producer this = mlt_properties_get_data( frame_properties, "avformat_producer", NULL ); // Get the producer properties - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Fetch the audio_context AVFormatContext *context = mlt_properties_get_data( properties, "audio_context", NULL ); @@ -938,7 +938,7 @@ static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_form static void producer_set_up_audio( mlt_producer this, mlt_frame frame ) { // Get the properties - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Fetch the audio_context AVFormatContext *context = mlt_properties_get_data( properties, "audio_context", NULL ); @@ -950,7 +950,7 @@ static void producer_set_up_audio( mlt_producer this, mlt_frame frame ) if ( context != NULL && index != -1 ) { // Get the frame properties - mlt_properties frame_properties = mlt_frame_properties( frame ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); // Get the audio stream AVStream *stream = context->streams[ index ]; @@ -1002,7 +1002,7 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index mlt_frame_set_position( *frame, mlt_producer_position( this ) ); // Set the position of this producer - mlt_properties_set_position( mlt_frame_properties( *frame ), "avformat_position", mlt_producer_frame( this ) ); + mlt_properties_set_position( MLT_FRAME_PROPERTIES( *frame ), "avformat_position", mlt_producer_frame( this ) ); // Set up the video producer_set_up_video( this, *frame ); @@ -1011,7 +1011,7 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index producer_set_up_audio( this, *frame ); // Set the aspect_ratio - mlt_properties_set_double( mlt_frame_properties( *frame ), "aspect_ratio", mlt_properties_get_double( mlt_producer_properties( this ), "aspect_ratio" ) ); + mlt_properties_set_double( MLT_FRAME_PROPERTIES( *frame ), "aspect_ratio", mlt_properties_get_double( MLT_PRODUCER_PROPERTIES( this ), "aspect_ratio" ) ); // Calculate the next timecode mlt_producer_prepare_next( this ); diff --git a/src/modules/core/consumer_null.c b/src/modules/core/consumer_null.c index 57452e13..88a7947e 100644 --- a/src/modules/core/consumer_null.c +++ b/src/modules/core/consumer_null.c @@ -67,7 +67,7 @@ mlt_consumer consumer_null_init( char *arg ) static int consumer_start( mlt_consumer this ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Check that we're not already running if ( !mlt_properties_get_int( properties, "running" ) ) @@ -98,7 +98,7 @@ static int consumer_start( mlt_consumer this ) static int consumer_stop( mlt_consumer this ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Check that we're running if ( mlt_properties_get_int( properties, "running" ) ) @@ -122,7 +122,7 @@ static int consumer_stop( mlt_consumer this ) static int consumer_is_stopped( mlt_consumer this ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); return !mlt_properties_get_int( properties, "running" ); } @@ -135,7 +135,7 @@ static void *consumer_thread( void *arg ) mlt_consumer this = arg; // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Frame and size mlt_frame frame = NULL; diff --git a/src/modules/core/filter_brightness.c b/src/modules/core/filter_brightness.c index 6850d528..9b43163f 100644 --- a/src/modules/core/filter_brightness.c +++ b/src/modules/core/filter_brightness.c @@ -38,7 +38,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * if ( error == 0 && *format == mlt_image_yuv422 ) { // Get the brightness level - double level = mlt_properties_get_double( mlt_frame_properties( this ), "brightness" ); + double level = mlt_properties_get_double( MLT_FRAME_PROPERTIES( this ), "brightness" ); // Only process if level is something other than 1 if ( level != 1.0 ) @@ -66,22 +66,22 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) { // Get the starting brightness level - double level = fabs( mlt_properties_get_double( mlt_filter_properties( this ), "start" ) ); + double level = fabs( mlt_properties_get_double( MLT_FILTER_PROPERTIES( this ), "start" ) ); // If there is an end adjust gain to the range - if ( mlt_properties_get( mlt_filter_properties( this ), "end" ) != NULL ) + if ( mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "end" ) != NULL ) { // Determine the time position of this frame in the transition duration mlt_position in = mlt_filter_get_in( this ); mlt_position out = mlt_filter_get_out( this ); mlt_position time = mlt_frame_get_position( frame ); double position = ( double )( time - in ) / ( double )( out - in + 1 ); - double end = fabs( mlt_properties_get_double( mlt_filter_properties( this ), "end" ) ); + double end = fabs( mlt_properties_get_double( MLT_FILTER_PROPERTIES( this ), "end" ) ); level += ( end - level ) * position; } // Push the frame filter - mlt_properties_set_double( mlt_frame_properties( frame ), "brightness", level ); + mlt_properties_set_double( MLT_FRAME_PROPERTIES( frame ), "brightness", level ); mlt_frame_push_get_image( frame, filter_get_image ); return frame; @@ -96,7 +96,7 @@ mlt_filter filter_brightness_init( char *arg ) if ( this != NULL ) { this->process = filter_process; - mlt_properties_set( mlt_filter_properties( this ), "start", arg == NULL ? "1" : arg ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "start", arg == NULL ? "1" : arg ); } return this; } diff --git a/src/modules/core/filter_channelcopy.c b/src/modules/core/filter_channelcopy.c index fd49d12f..d0ee59ba 100644 --- a/src/modules/core/filter_channelcopy.c +++ b/src/modules/core/filter_channelcopy.c @@ -33,7 +33,7 @@ static int filter_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { // Get the properties of the a frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); int i, j; int from = mlt_properties_get_int( properties, "channelcopy.from" ); int to = mlt_properties_get_int( properties, "channelcopy.to" ); @@ -69,8 +69,8 @@ static int filter_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) { - mlt_properties properties = mlt_filter_properties( this ); - mlt_properties frame_props = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); + mlt_properties frame_props = MLT_FRAME_PROPERTIES( frame ); // Propogate the parameters mlt_properties_set_int( frame_props, "channelcopy.to", mlt_properties_get_int( properties, "to" ) ); @@ -95,9 +95,9 @@ mlt_filter filter_channelcopy_init( char *arg ) { this->process = filter_process; if ( arg != NULL ) - mlt_properties_set_int( mlt_filter_properties( this ), "to", atoi( arg ) ); + mlt_properties_set_int( MLT_FILTER_PROPERTIES( this ), "to", atoi( arg ) ); else - mlt_properties_set_int( mlt_filter_properties( this ), "to", 1 ); + mlt_properties_set_int( MLT_FILTER_PROPERTIES( this ), "to", 1 ); } return this; } diff --git a/src/modules/core/filter_data_feed.c b/src/modules/core/filter_data_feed.c index a4905251..1f5c76c2 100644 --- a/src/modules/core/filter_data_feed.c +++ b/src/modules/core/filter_data_feed.c @@ -18,6 +18,8 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include +#include #include "filter_data.h" #include @@ -53,14 +55,21 @@ static void destroy_data_queue( void *arg ) static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) { // Get the filter properties - mlt_properties filter_properties = mlt_filter_properties( this ); + mlt_properties filter_properties = MLT_FILTER_PROPERTIES( this ); // Get the frame properties - mlt_properties frame_properties = mlt_frame_properties( frame ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); // Get the data queue mlt_deque data_queue = mlt_properties_get_data( frame_properties, "data_queue", NULL ); + // Get the type of the data feed + char *type = mlt_properties_get( filter_properties, "type" ); + + // Get the in and out points of this filter + int in = mlt_filter_get_in( this ); + int out = mlt_filter_get_out( this ); + // Create the data queue if it doesn't exist if ( data_queue == NULL ) { @@ -72,18 +81,47 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) } // Now create the data feed - if ( data_queue != NULL ) + if ( data_queue != NULL && type != NULL && !strcmp( type, "attr_check" ) ) + { + int i = 0; + int count = mlt_properties_count( frame_properties ); + char inactive[ 512 ]; + + for ( i = 0; i < count; i ++ ) + { + char *name = mlt_properties_get_name( frame_properties, i ); + if ( !strncmp( name, "meta.attr.", 10 ) && strstr( name, ".inactive" ) == NULL ) + { + char *value = mlt_properties_get( frame_properties, name ); + sprintf( inactive, "%s.inactive", name ); + if ( value != NULL && mlt_properties_get_int( frame_properties, inactive ) == 0 ) + { + // Create a new data feed + mlt_properties feed = mlt_properties_new( ); + + // Assign it the base properties + mlt_properties_set( feed, "id", mlt_properties_get( filter_properties, "_unique_id" ) ); + mlt_properties_set( feed, "type", strrchr( name, '.' ) + 1 ); + mlt_properties_set_position( feed, "position", mlt_frame_get_position( frame ) ); + + // Assign in/out of service we're connected to + mlt_properties_set_position( feed, "in", mlt_properties_get_position( frame_properties, "in" ) ); + mlt_properties_set_position( feed, "out", mlt_properties_get_position( frame_properties, "out" ) ); + + // Assign the value to the feed + mlt_properties_set( feed, "markup", value ); + + // Push it on to the queue + mlt_deque_push_back( data_queue, feed ); + } + } + } + } + else if ( data_queue != NULL ) { - // Get the in and out points of this filter - int in = mlt_filter_get_in( this ); - int out = mlt_filter_get_out( this ); - // Create a new data feed mlt_properties feed = mlt_properties_new( ); - // Get the type of the data feed - char *type = mlt_properties_get( filter_properties, "type" ); - // Assign it the base properties mlt_properties_set( feed, "id", mlt_properties_get( filter_properties, "_unique_id" ) ); mlt_properties_set( feed, "type", type ); @@ -122,7 +160,7 @@ mlt_filter filter_data_feed_init( char *arg ) if ( this != NULL ) { // Get the properties - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); // Assign the argument (default to titles) mlt_properties_set( properties, "type", arg == NULL ? "titles" : arg ); diff --git a/src/modules/core/filter_data_show.c b/src/modules/core/filter_data_show.c index 6323236b..db2e6707 100644 --- a/src/modules/core/filter_data_show.c +++ b/src/modules/core/filter_data_show.c @@ -36,7 +36,7 @@ static mlt_filter obtain_filter( mlt_filter filter, char *type ) int type_len = strlen( type ); // Get the properties of the data show filter - mlt_properties filter_properties = mlt_filter_properties( filter ); + mlt_properties filter_properties = MLT_FILTER_PROPERTIES( filter ); // Get the profile properties mlt_properties profile_properties = mlt_properties_get_data( filter_properties, "profile_properties", NULL ); @@ -80,7 +80,7 @@ static mlt_filter obtain_filter( mlt_filter filter, char *type ) if ( result == NULL && !strcmp( name, type ) && result == NULL ) result = mlt_factory_filter( value, NULL ); else if ( result != NULL && !strncmp( name, type, type_len ) && name[ type_len ] == '.' ) - mlt_properties_set( mlt_filter_properties( result ), name + type_len + 1, value ); + mlt_properties_set( MLT_FILTER_PROPERTIES( result ), name + type_len + 1, value ); else if ( result != NULL ) break; } @@ -98,7 +98,7 @@ static int process_feed( mlt_properties feed, mlt_filter filter, mlt_frame frame int error = 1; // Get the properties of the data show filter - mlt_properties filter_properties = mlt_filter_properties( filter ); + mlt_properties filter_properties = MLT_FILTER_PROPERTIES( filter ); // Get the type requested by the feeding filter char *type = mlt_properties_get( feed, "type" ); @@ -123,7 +123,7 @@ static int process_feed( mlt_properties feed, mlt_filter filter, mlt_frame frame if ( requested != NULL ) { int i = 0; - mlt_properties properties = mlt_filter_properties( requested ); + mlt_properties properties = MLT_FILTER_PROPERTIES( requested ); static char *prefix = "properties."; int len = strlen( prefix ); @@ -171,7 +171,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format mlt_filter filter = mlt_frame_pop_service( frame ); // Get the frame properties - mlt_properties frame_properties = mlt_frame_properties( frame ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); // Fetch the data queue mlt_deque data_queue = mlt_properties_get_data( frame_properties, "data_queue", NULL ); @@ -221,7 +221,7 @@ mlt_filter filter_data_show_init( char *arg ) if ( this != NULL ) { // Get the properties - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); // Assign the argument (default to titles) mlt_properties_set( properties, "profile", arg == NULL ? NULL : arg ); diff --git a/src/modules/core/filter_gamma.c b/src/modules/core/filter_gamma.c index 5417afd3..e01cc08a 100644 --- a/src/modules/core/filter_gamma.c +++ b/src/modules/core/filter_gamma.c @@ -36,7 +36,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * if ( error == 0 && *format == mlt_image_yuv422 ) { // Get the gamma value - double gamma = mlt_properties_get_double( mlt_frame_properties( this ), "gamma" ); + double gamma = mlt_properties_get_double( MLT_FRAME_PROPERTIES( this ), "gamma" ); if ( gamma != 1.0 ) { @@ -67,9 +67,9 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) { - double gamma = mlt_properties_get_double( mlt_filter_properties( this ), "gamma" ); + double gamma = mlt_properties_get_double( MLT_FILTER_PROPERTIES( this ), "gamma" ); gamma = gamma <= 0 ? 1 : gamma; - mlt_properties_set_double( mlt_frame_properties( frame ), "gamma", gamma ); + mlt_properties_set_double( MLT_FRAME_PROPERTIES( frame ), "gamma", gamma ); mlt_frame_push_get_image( frame, filter_get_image ); return frame; } @@ -83,7 +83,7 @@ mlt_filter filter_gamma_init( char *arg ) if ( this != NULL ) { this->process = filter_process; - mlt_properties_set( mlt_filter_properties( this ), "gamma", arg == NULL ? "1" : arg ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "gamma", arg == NULL ? "1" : arg ); } return this; } diff --git a/src/modules/core/filter_luma.c b/src/modules/core/filter_luma.c index ef5043e3..22165af9 100644 --- a/src/modules/core/filter_luma.c +++ b/src/modules/core/filter_luma.c @@ -36,7 +36,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * { int error = 0; mlt_filter filter = mlt_frame_pop_service( this ); - mlt_properties properties = mlt_filter_properties( filter ); + mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); mlt_transition luma = mlt_properties_get_data( properties, "luma", NULL ); mlt_frame b_frame = mlt_properties_get_data( properties, "frame", NULL ); int out = mlt_properties_get_int( properties, "period" ); @@ -50,7 +50,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * luma = mlt_factory_transition( "luma", resource ); if ( luma != NULL ) { - mlt_properties luma_properties = mlt_transition_properties( luma ); + mlt_properties luma_properties = MLT_TRANSITION_PROPERTIES( luma ); mlt_properties_set_int( luma_properties, "in", 0 ); mlt_properties_set_int( luma_properties, "out", out ); mlt_properties_set_int( luma_properties, "reverse", 1 ); @@ -68,7 +68,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * ( mlt_properties_get( properties, "blur" ) != NULL || mlt_frame_get_position( this ) % ( out + 1 ) != out ) ) { - mlt_properties luma_properties = mlt_transition_properties( luma ); + mlt_properties luma_properties = MLT_TRANSITION_PROPERTIES( luma ); mlt_properties_pass( luma_properties, properties, "luma." ); mlt_transition_process( luma, this, b_frame ); } @@ -77,14 +77,14 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * if ( error == 0 ) { - mlt_properties a_props = mlt_frame_properties( this ); + mlt_properties a_props = MLT_FRAME_PROPERTIES( this ); int size = 0; uint8_t *src = mlt_properties_get_data( a_props, "image", &size ); uint8_t *dst = mlt_pool_alloc( size ); if ( dst != NULL ) { - mlt_properties b_props = mlt_frame_properties( b_frame ); + mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame ); memcpy( dst, src, size ); mlt_properties_set_data( b_props, "image", dst, size, mlt_pool_release, NULL ); mlt_properties_set_int( b_props, "width", *width ); @@ -117,7 +117,7 @@ mlt_filter filter_luma_init( void *arg ) mlt_filter this = mlt_filter_new( ); if ( this != NULL ) { - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); this->process = filter_process; if ( arg != NULL ) mlt_properties_set( properties, "resource", arg ); diff --git a/src/modules/core/filter_mirror.c b/src/modules/core/filter_mirror.c index 66b88720..a7cb697f 100644 --- a/src/modules/core/filter_mirror.c +++ b/src/modules/core/filter_mirror.c @@ -35,7 +35,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format mlt_filter this = mlt_frame_pop_service( frame ); // Get the mirror type - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); // Get the properties char *mirror = mlt_properties_get( properties, "mirror" ); @@ -261,7 +261,7 @@ mlt_filter filter_mirror_init( void *arg ) if ( this != NULL ) { // Get the properties - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); // Set the default mirror type mlt_properties_set_or_default( properties, "mirror", arg, "horizontal" ); diff --git a/src/modules/core/filter_obscure.c b/src/modules/core/filter_obscure.c index bf88a09c..f7dccd5e 100644 --- a/src/modules/core/filter_obscure.c +++ b/src/modules/core/filter_obscure.c @@ -220,7 +220,7 @@ static void obscure_render( uint8_t *image, int width, int height, struct geomet static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ) { // Get the frame properties - mlt_properties frame_properties = mlt_frame_properties( frame ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); // Pop the top of stack now mlt_filter this = mlt_frame_pop_service( frame ); @@ -234,7 +234,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format if ( this != NULL ) { // Get the filter properties - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); // Obtain the normalised width and height from the frame int normalised_width = mlt_properties_get_int( frame_properties, "normalised_width" ); @@ -285,7 +285,7 @@ mlt_filter filter_obscure_init( void *arg ) mlt_filter this = mlt_filter_new( ); if ( this != NULL ) { - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); this->process = filter_process; mlt_properties_set( properties, "start", arg != NULL ? arg : "0%,0%:100%x100%" ); mlt_properties_set( properties, "end", "" ); diff --git a/src/modules/core/filter_region.c b/src/modules/core/filter_region.c index db69b661..1e7ad17a 100644 --- a/src/modules/core/filter_region.c +++ b/src/modules/core/filter_region.c @@ -33,7 +33,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) { // Get the properties of the filter - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); // Get the region transition mlt_transition transition = mlt_properties_get_data( properties, "_transition", NULL ); @@ -48,11 +48,11 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) mlt_properties_set_data( properties, "_transition", transition, 0, ( mlt_destructor )mlt_transition_close, NULL ); // Pass a reference to this filter down - mlt_properties_set_data( mlt_transition_properties( transition ), "_region_filter", this, 0, NULL, NULL ); + mlt_properties_set_data( MLT_TRANSITION_PROPERTIES( transition ), "_region_filter", this, 0, NULL, NULL ); } // Pass all properties down - mlt_properties_pass( mlt_transition_properties( transition ), properties, "" ); + mlt_properties_pass( MLT_TRANSITION_PROPERTIES( transition ), properties, "" ); // Process the frame return mlt_transition_process( transition, frame, NULL ); @@ -70,7 +70,7 @@ mlt_filter filter_region_init( void *arg ) if ( this != NULL ) { // Get the properties from the filter - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); // Assign the filter process method this->process = filter_process; diff --git a/src/modules/core/filter_rescale.c b/src/modules/core/filter_rescale.c index e606a174..164d9cd6 100644 --- a/src/modules/core/filter_rescale.c +++ b/src/modules/core/filter_rescale.c @@ -31,7 +31,7 @@ typedef int ( *image_scaler )( mlt_frame this, uint8_t **image, mlt_image_format static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format iformat, mlt_image_format oformat, int iwidth, int iheight, int owidth, int oheight ) { // Get the properties - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); // Get the rescaling interpolsation char *interps = mlt_properties_get( properties, "rescale.interp" ); @@ -162,7 +162,7 @@ static void scale_alpha( mlt_frame this, int iwidth, int iheight, int owidth, in } this->get_alpha_mask = NULL; - mlt_properties_set_data( mlt_frame_properties( this ), "alpha", output, 0, mlt_pool_release, NULL ); + mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "alpha", output, 0, mlt_pool_release, NULL ); } } @@ -172,13 +172,13 @@ static void scale_alpha( mlt_frame this, int iwidth, int iheight, int owidth, in static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ) { // Get the frame properties - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); // Get the filter from the stack mlt_filter filter = mlt_frame_pop_service( this ); // Get the filter properties - mlt_properties filter_properties = mlt_filter_properties( filter ); + mlt_properties filter_properties = MLT_FILTER_PROPERTIES( filter ); // Get the image scaler method image_scaler scaler_method = mlt_properties_get_data( filter_properties, "method", NULL ); @@ -203,7 +203,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * // Default from the scaler if not specifed on the frame if ( interps == NULL ) { - interps = mlt_properties_get( mlt_filter_properties( filter ), "interpolation" ); + interps = mlt_properties_get( MLT_FILTER_PROPERTIES( filter ), "interpolation" ); mlt_properties_set( properties, "rescale.interp", interps ); } @@ -332,7 +332,7 @@ mlt_filter filter_rescale_init( char *arg ) if ( this != NULL ) { // Get the properties - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); // Set the process method this->process = filter_process; diff --git a/src/modules/core/filter_resize.c b/src/modules/core/filter_resize.c index 627d9e0b..2315f780 100644 --- a/src/modules/core/filter_resize.c +++ b/src/modules/core/filter_resize.c @@ -34,7 +34,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * int error = 0; // Get the properties from the frame - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); // Pop the top of stack now mlt_filter filter = mlt_frame_pop_service( this ); @@ -94,7 +94,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * if ( error == 0 && *format == mlt_image_yuv422 ) { // Get the requested scale operation - char *op = mlt_properties_get( mlt_filter_properties( filter ), "scale" ); + char *op = mlt_properties_get( MLT_FILTER_PROPERTIES( filter ), "scale" ); // Correct field order if needed if ( mlt_properties_get_int( properties, "top_field_first" ) == 1 ) @@ -161,7 +161,7 @@ mlt_filter filter_resize_init( char *arg ) if ( mlt_filter_init( this, this ) == 0 ) { this->process = filter_process; - mlt_properties_set( mlt_filter_properties( this ), "scale", arg == NULL ? "off" : arg ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "scale", arg == NULL ? "off" : arg ); } return this; } diff --git a/src/modules/core/filter_watermark.c b/src/modules/core/filter_watermark.c index aee35ed3..f834c121 100644 --- a/src/modules/core/filter_watermark.c +++ b/src/modules/core/filter_watermark.c @@ -41,7 +41,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format mlt_filter this = mlt_frame_pop_service( frame ); // Get the properties of the filter - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); // Get the producer from the filter mlt_producer producer = mlt_properties_get_data( properties, "producer", NULL ); @@ -70,7 +70,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format if ( composite != NULL ) { // Get the properties - mlt_properties composite_properties = mlt_transition_properties( composite ); + mlt_properties composite_properties = MLT_TRANSITION_PROPERTIES( composite ); // Pass all the composite. properties on the filter down mlt_properties_pass( composite_properties, properties, "composite." ); @@ -95,7 +95,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format mlt_properties_set_data( properties, "producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL ); // Ensure that we loop - mlt_properties_set( mlt_producer_properties( producer ), "eof", "loop" ); + mlt_properties_set( MLT_PRODUCER_PROPERTIES( producer ), "eof", "loop" ); // Set the old resource mlt_properties_set( properties, "_old_resource", resource ); @@ -105,7 +105,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format if ( producer != NULL ) { // Get the producer properties - mlt_properties producer_properties = mlt_producer_properties( producer ); + mlt_properties producer_properties = MLT_PRODUCER_PROPERTIES( producer ); // Now pass all producer. properties on the filter down mlt_properties_pass( producer_properties, properties, "producer." ); @@ -115,7 +115,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format if ( composite != NULL && producer != NULL ) { // Get the service of the producer - mlt_service service = mlt_producer_service( producer ); + mlt_service service = MLT_PRODUCER_SERVICE( producer ); // We will get the 'b frame' from the producer mlt_frame b_frame = NULL; @@ -124,7 +124,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format 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_properties_get_position( MLT_FRAME_PROPERTIES( frame ), name ); // Make sure the producer is in the correct position mlt_producer_seek( producer, position ); @@ -136,8 +136,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format if ( mlt_service_get_frame( service, &b_frame, 0 ) == 0 ) { // Get the a and b frame properties - mlt_properties a_props = mlt_frame_properties( frame ); - mlt_properties b_props = mlt_frame_properties( b_frame ); + mlt_properties a_props = MLT_FRAME_PROPERTIES( frame ); + mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame ); // Set the b frame to be in the same position and have same consumer requirements mlt_frame_set_position( b_frame, position ); @@ -149,7 +149,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format if ( mlt_properties_get_int( properties, "distort" ) ) { - mlt_properties_set( mlt_transition_properties( composite ), "distort", "true" ); + mlt_properties_set( MLT_TRANSITION_PROPERTIES( composite ), "distort", "true" ); mlt_properties_set( a_props, "distort", "true" ); mlt_properties_set( b_props, "distort", "true" ); } @@ -157,7 +157,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format if ( mlt_properties_get_int( properties, "reverse" ) == 0 ) { // Apply all filters that are attached to this filter to the b frame - mlt_service_apply_filters( mlt_filter_service( this ), b_frame, 0 ); + mlt_service_apply_filters( MLT_FILTER_SERVICE( this ), b_frame, 0 ); // Process the frame mlt_transition_process( composite, frame, b_frame ); @@ -176,7 +176,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format mlt_properties_set_int( b_props, "consumer_deinterlace", 1 ); mlt_properties_set( a_props, "rescale.interp", "nearest" ); mlt_properties_set( b_props, "rescale.interp", "nearest" ); - mlt_service_apply_filters( mlt_filter_service( this ), b_frame, 0 ); + 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 ); @@ -210,10 +210,10 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) { // Get the properties of the frame - mlt_properties properties = mlt_frame_properties( 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" ); + char *name = mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "_unique_id" ); // Assign the current position to the name mlt_properties_set_position( properties, name, mlt_frame_get_position( frame ) - mlt_filter_get_in( this ) ); @@ -235,7 +235,7 @@ mlt_filter filter_watermark_init( void *arg ) mlt_filter this = mlt_filter_new( ); if ( this != NULL ) { - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); this->process = filter_process; mlt_properties_set( properties, "factory", "fezzik" ); if ( arg != NULL ) diff --git a/src/modules/core/producer_colour.c b/src/modules/core/producer_colour.c index b4e8da83..0c40f99b 100644 --- a/src/modules/core/producer_colour.c +++ b/src/modules/core/producer_colour.c @@ -41,7 +41,7 @@ mlt_producer producer_colour_init( char *colour ) if ( producer != NULL && mlt_producer_init( producer, NULL ) == 0 ) { // Get the properties interface - mlt_properties properties = mlt_producer_properties( producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); // Callback registration producer->get_frame = producer_get_frame; @@ -109,13 +109,13 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form int size = 0; // Obtain properties of frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); // Obtain the producer for this frame mlt_producer producer = mlt_properties_get_data( properties, "producer_colour", NULL ); // Obtain properties of producer - mlt_properties producer_props = mlt_producer_properties( producer ); + mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer ); // Get the current image and dimensions cached in the producer uint8_t *image = mlt_properties_get_data( producer_props, "image", &size ); @@ -183,10 +183,10 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i if ( *frame != NULL ) { // Obtain properties of frame and producer - mlt_properties properties = mlt_frame_properties( *frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( *frame ); // Obtain properties of producer - mlt_properties producer_props = mlt_producer_properties( producer ); + mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer ); // Determine if we're producing PAL or NTSC int is_pal = mlt_properties_get_double( producer_props, "fps" ) == 25.0; diff --git a/src/modules/core/producer_noise.c b/src/modules/core/producer_noise.c index 435e7e68..7746c0d8 100644 --- a/src/modules/core/producer_noise.c +++ b/src/modules/core/producer_noise.c @@ -55,10 +55,10 @@ mlt_producer producer_noise_init( void *arg ) // Initialise the producer if ( this != NULL ) { - int is_pal = mlt_properties_get_int( mlt_producer_properties( this ), "normalised_height" ) == 576; + int is_pal = mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( this ), "normalised_height" ) == 576; // Synthetic - aspect ratio of 1 - mlt_properties_set_double( mlt_producer_properties( this ), "aspect_ratio", is_pal ? 59.0/54.0 : 10.0/11.0 ); + mlt_properties_set_double( MLT_PRODUCER_PROPERTIES( this ), "aspect_ratio", is_pal ? 59.0/54.0 : 10.0/11.0 ); // Callback registration this->get_frame = producer_get_frame; @@ -71,7 +71,7 @@ mlt_producer producer_noise_init( void *arg ) static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) { // Obtain properties of frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); // Calculate the size of the image int size = *width * *height * 2; @@ -111,7 +111,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { // Get the frame properties - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); int size = 0; @@ -149,10 +149,10 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index if ( *frame != NULL ) { // Obtain properties of frame - mlt_properties properties = mlt_frame_properties( *frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( *frame ); // Obtain properties of producer - mlt_properties producer_props = mlt_producer_properties( this ); + mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( this ); // Determine if we're producing PAL or NTSC int is_pal = mlt_properties_get_double( producer_props, "fps" ) == 25.0; diff --git a/src/modules/core/producer_ppm.c b/src/modules/core/producer_ppm.c index a0a9896f..bd726923 100644 --- a/src/modules/core/producer_ppm.c +++ b/src/modules/core/producer_ppm.c @@ -45,7 +45,7 @@ mlt_producer producer_ppm_init( void *command ) if ( this != NULL && mlt_producer_init( &this->parent, this ) == 0 ) { mlt_producer producer = &this->parent; - mlt_properties properties = mlt_producer_properties( producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); producer->get_frame = producer_get_frame; producer->close = ( mlt_destructor )producer_close; @@ -69,7 +69,7 @@ mlt_producer producer_ppm_init( void *command ) static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) { // Get the frames properties - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); if ( mlt_properties_get_int( properties, "has_image" ) ) { @@ -162,7 +162,7 @@ static void producer_ppm_position( producer_ppm this, uint64_t requested ) static int producer_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { // Get the frames properties - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); FILE *pipe = mlt_properties_get_data( properties, "audio.pipe", NULL ); @@ -214,7 +214,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i producer_ppm_position( this, mlt_producer_frame( producer ) ); // Get the frames properties - mlt_properties properties = mlt_frame_properties( *frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( *frame ); FILE *video = this->video; FILE *audio = this->audio; diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index e03e69b1..e39047d4 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -198,7 +198,7 @@ static struct geometry_s *transition_parse_keys( mlt_transition this, int norma int i = 0; // Get the properties of the transition - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); // Get the in and out position mlt_position in = mlt_transition_get_in( this ); @@ -322,8 +322,8 @@ static inline float delta_calculate( mlt_transition this, mlt_frame frame ) mlt_position out = mlt_transition_get_out( this ); // Get the position of the frame - char *name = mlt_properties_get( mlt_transition_properties( this ), "_unique_id" ); - mlt_position position = mlt_properties_get_position( mlt_frame_properties( frame ), name ); + char *name = mlt_properties_get( MLT_TRANSITION_PROPERTIES( this ), "_unique_id" ); + mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( frame ), name ); // Now do the calcs float x = ( float )( position - in ) / ( float )( out - in + 1 ); @@ -723,7 +723,7 @@ static uint16_t* get_luma( mlt_properties properties, int width, int height ) if ( producer != NULL ) { // Get the producer properties - mlt_properties producer_properties = mlt_producer_properties( producer ); + mlt_properties producer_properties = MLT_PRODUCER_PROPERTIES( producer ); // Ensure that we loop mlt_properties_set( producer_properties, "eof", "loop" ); @@ -735,13 +735,13 @@ static uint16_t* get_luma( mlt_properties properties, int width, int height ) mlt_frame luma_frame = NULL; // Get the luma frame - if ( mlt_service_get_frame( mlt_producer_service( producer ), &luma_frame, 0 ) == 0 ) + if ( mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &luma_frame, 0 ) == 0 ) { uint8_t *luma_image; mlt_image_format luma_format = mlt_image_yuv422; // Get image from the luma producer - mlt_properties_set( mlt_frame_properties( luma_frame ), "rescale.interp", "none" ); + mlt_properties_set( MLT_FRAME_PROPERTIES( luma_frame ), "rescale.interp", "none" ); mlt_frame_get_image( luma_frame, &luma_image, &luma_format, &luma_width, &luma_height, 0 ); // Generate the luma map @@ -783,8 +783,8 @@ static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t ** mlt_image_format format = mlt_image_yuv422; // Get the properties objects - mlt_properties b_props = mlt_frame_properties( b_frame ); - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); if ( mlt_properties_get( properties, "distort" ) == NULL && mlt_properties_get( b_props, "distort" ) == NULL && geometry->distort == 0 ) { @@ -858,10 +858,10 @@ static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t ** static struct geometry_s *composite_calculate( struct geometry_s *result, mlt_transition this, mlt_frame a_frame, float position ) { // Get the properties from the transition - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); // Get the properties from the frame - mlt_properties a_props = mlt_frame_properties( a_frame ); + mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame ); // Structures for geometry struct geometry_s *start = mlt_properties_get_data( properties, "geometries", NULL ); @@ -907,10 +907,10 @@ mlt_frame composite_copy_region( mlt_transition this, mlt_frame a_frame, mlt_pos mlt_frame b_frame = mlt_frame_init( ); // Get the properties of the a frame - mlt_properties a_props = mlt_frame_properties( a_frame ); + mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame ); // Get the properties of the b frame - mlt_properties b_props = mlt_frame_properties( b_frame ); + mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame ); // Get the position float position = position_calculate( this, frame_position ); @@ -1004,15 +1004,15 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f mlt_frame_get_image( a_frame, image, format, width, height, 1 ); // Get the properties from the transition - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); if ( b_frame != NULL ) { // Get the properties of the a frame - mlt_properties a_props = mlt_frame_properties( a_frame ); + mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame ); // Get the properties of the b frame - mlt_properties b_props = mlt_frame_properties( b_frame ); + mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame ); // Structures for geometry struct geometry_s result; @@ -1058,7 +1058,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f if ( mlt_properties_get_int( properties, "titles" ) ) { if ( mlt_properties_get( b_props, "rescale.interp" ) == NULL ) - mlt_properties_set( b_props, "rescale.interp", "nearest" ); + mlt_properties_set( b_props, "rescale.interp", "hyper" ); mlt_properties_set( properties, "fill", NULL ); width_b = mlt_properties_get_int( a_props, "dest_width" ); height_b = mlt_properties_get_int( a_props, "dest_height" ); @@ -1105,13 +1105,13 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f static mlt_frame composite_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame ) { // Get a unique name to store the frame position - char *name = mlt_properties_get( mlt_transition_properties( this ), "_unique_id" ); + char *name = mlt_properties_get( MLT_TRANSITION_PROPERTIES( this ), "_unique_id" ); // Assign the current position to the name - mlt_properties_set_position( mlt_frame_properties( a_frame ), name, mlt_frame_get_position( a_frame ) ); + mlt_properties_set_position( MLT_FRAME_PROPERTIES( a_frame ), name, mlt_frame_get_position( a_frame ) ); // Propogate the transition properties to the b frame - mlt_properties_set_double( mlt_frame_properties( b_frame ), "relative_position", position_calculate( this, mlt_frame_get_position( a_frame ) ) ); + mlt_properties_set_double( MLT_FRAME_PROPERTIES( b_frame ), "relative_position", position_calculate( this, mlt_frame_get_position( a_frame ) ) ); mlt_frame_push_service( a_frame, this ); mlt_frame_push_frame( a_frame, b_frame ); @@ -1127,7 +1127,7 @@ mlt_transition transition_composite_init( char *arg ) mlt_transition this = calloc( sizeof( struct mlt_transition_s ), 1 ); if ( this != NULL && mlt_transition_init( this, NULL ) == 0 ) { - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); this->process = composite_process; diff --git a/src/modules/core/transition_luma.c b/src/modules/core/transition_luma.c index c938f0ca..c241b3ec 100644 --- a/src/modules/core/transition_luma.c +++ b/src/modules/core/transition_luma.c @@ -37,8 +37,8 @@ static float position_calculate( mlt_transition this, mlt_frame frame ) mlt_position out = mlt_transition_get_out( this ); // Get the position of the frame - char *name = mlt_properties_get( mlt_transition_properties( this ), "_unique_id" ); - mlt_position position = mlt_properties_get_position( mlt_frame_properties( frame ), name ); + char *name = mlt_properties_get( MLT_TRANSITION_PROPERTIES( this ), "_unique_id" ); + mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( frame ), name ); // Now do the calcs return ( float )( position - in ) / ( float )( out - in + 1 ); @@ -354,13 +354,13 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f mlt_transition transition = mlt_frame_pop_service( a_frame ); // Get the properties of the transition - mlt_properties properties = mlt_transition_properties( transition ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( transition ); // Get the properties of the a frame - mlt_properties a_props = mlt_frame_properties( a_frame ); + mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame ); // Get the properties of the b frame - mlt_properties b_props = mlt_frame_properties( b_frame ); + mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame ); // The cached luma map information int luma_width = mlt_properties_get_int( properties, "width" ); @@ -403,7 +403,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f if ( producer != NULL ) { // Get the producer properties - mlt_properties producer_properties = mlt_producer_properties( producer ); + mlt_properties producer_properties = MLT_PRODUCER_PROPERTIES( producer ); // Ensure that we loop mlt_properties_set( producer_properties, "eof", "loop" ); @@ -415,13 +415,13 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f mlt_frame luma_frame = NULL; // Get the luma frame - if ( mlt_service_get_frame( mlt_producer_service( producer ), &luma_frame, 0 ) == 0 ) + if ( mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &luma_frame, 0 ) == 0 ) { uint8_t *luma_image; mlt_image_format luma_format = mlt_image_yuv422; // Get image from the luma producer - mlt_properties_set( mlt_frame_properties( luma_frame ), "rescale.interp", "none" ); + mlt_properties_set( MLT_FRAME_PROPERTIES( luma_frame ), "rescale.interp", "none" ); mlt_frame_get_image( luma_frame, &luma_image, &luma_format, &luma_width, &luma_height, 0 ); // Generate the luma map @@ -504,10 +504,10 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f static mlt_frame transition_process( mlt_transition transition, mlt_frame a_frame, mlt_frame b_frame ) { // Get a unique name to store the frame position - char *name = mlt_properties_get( mlt_transition_properties( transition ), "_unique_id" ); + char *name = mlt_properties_get( MLT_TRANSITION_PROPERTIES( transition ), "_unique_id" ); // Assign the current position to the name - mlt_properties_set_position( mlt_frame_properties( a_frame ), name, mlt_frame_get_position( a_frame ) ); + mlt_properties_set_position( MLT_FRAME_PROPERTIES( a_frame ), name, mlt_frame_get_position( a_frame ) ); // Push the transition on to the frame mlt_frame_push_service( a_frame, transition ); @@ -533,10 +533,10 @@ mlt_transition transition_luma_init( char *lumafile ) transition->process = transition_process; // Default factory - mlt_properties_set( mlt_transition_properties( transition ), "factory", "fezzik" ); + mlt_properties_set( MLT_TRANSITION_PROPERTIES( transition ), "factory", "fezzik" ); // Set the main property - mlt_properties_set( mlt_transition_properties( transition ), "resource", lumafile ); + mlt_properties_set( MLT_TRANSITION_PROPERTIES( transition ), "resource", lumafile ); return transition; } diff --git a/src/modules/core/transition_mix.c b/src/modules/core/transition_mix.c index 1f084719..fbe911bc 100644 --- a/src/modules/core/transition_mix.c +++ b/src/modules/core/transition_mix.c @@ -31,13 +31,13 @@ static int transition_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { // Get the properties of the a frame - mlt_properties a_props = mlt_frame_properties( frame ); + mlt_properties a_props = MLT_FRAME_PROPERTIES( frame ); // Get the b frame from the stack mlt_frame b_frame = mlt_frame_pop_audio( frame ); // Get the properties of the b frame - mlt_properties b_props = mlt_frame_properties( b_frame ); + mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame ); // Restore the original get_audio frame->get_audio = mlt_properties_get_data( a_props, "mix.get_audio", NULL ); @@ -52,7 +52,6 @@ static int transition_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_fo mix_start = 1 - mix_start; mix_end = 1 - mix_end; } - //fprintf( stderr, "transition_mix: previous %f current %f\n", mix_start, mix_end ); mlt_frame_mix_audio( frame, b_frame, mix_start, mix_end, buffer, format, frequency, channels, samples ); @@ -65,8 +64,8 @@ static int transition_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_fo static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame ) { - mlt_properties properties = mlt_transition_properties( this ); - mlt_properties b_props = mlt_frame_properties( b_frame ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); + mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame ); // Only if mix is specified, otherwise a producer may set the mix if ( mlt_properties_get( properties, "start" ) != NULL ) @@ -108,14 +107,14 @@ static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt } // Ensure that the tractor knows this isn't test audio... - if ( mlt_properties_get_int( mlt_frame_properties( a_frame ), "test_audio" ) ) + if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES( a_frame ), "test_audio" ) ) { - mlt_properties_set_int( mlt_frame_properties( a_frame ), "test_audio", 0 ); - mlt_properties_set_int( mlt_frame_properties( a_frame ), "silent_audio", 1 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( a_frame ), "test_audio", 0 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( a_frame ), "silent_audio", 1 ); } // Backup the original get_audio (it's still needed) - mlt_properties_set_data( mlt_frame_properties( a_frame ), "mix.get_audio", a_frame->get_audio, 0, NULL, NULL ); + mlt_properties_set_data( MLT_FRAME_PROPERTIES( a_frame ), "mix.get_audio", a_frame->get_audio, 0, NULL, NULL ); // Override the get_audio method a_frame->get_audio = transition_get_audio; @@ -135,8 +134,8 @@ mlt_transition transition_mix_init( char *arg ) { this->process = transition_process; if ( arg != NULL ) - mlt_properties_set_double( mlt_transition_properties( this ), "start", atof( arg ) ); - mlt_properties_set_int( mlt_transition_properties( this ), "_accepts_blanks", 1 ); + mlt_properties_set_double( MLT_TRANSITION_PROPERTIES( this ), "start", atof( arg ) ); + mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( this ), "_accepts_blanks", 1 ); } return this; } diff --git a/src/modules/core/transition_region.c b/src/modules/core/transition_region.c index c93eec89..120382e1 100644 --- a/src/modules/core/transition_region.c +++ b/src/modules/core/transition_region.c @@ -52,7 +52,7 @@ static int create_instance( mlt_transition this, char *name, char *value, int co if ( filter != NULL ) { // Properties of this - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); // String to hold the property name char id[ 256 ]; @@ -67,11 +67,11 @@ static int create_instance( mlt_transition this, char *name, char *value, int co sprintf( key, "%s.", name ); // Just in case, let's assume that the filter here has a composite - mlt_properties_set( mlt_filter_properties( filter ), "composite.start", "0%,0%:100%x100%" ); - mlt_properties_set( mlt_filter_properties( filter ), "composite.fill", "true" ); + mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "composite.start", "0%,0%:100%x100%" ); + mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "composite.fill", "true" ); // Pass all the key properties on the filter down - mlt_properties_pass( mlt_filter_properties( filter ), properties, key ); + mlt_properties_pass( MLT_FILTER_PROPERTIES( filter ), properties, key ); // Ensure that filter is assigned mlt_properties_set_data( properties, id, filter, 0, ( mlt_destructor )mlt_filter_close, NULL ); @@ -94,19 +94,19 @@ static uint8_t *filter_get_alpha_mask( mlt_frame this ) uint8_t *alpha = NULL; // Obtain properties of frame - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); // Get the shape frame mlt_frame shape_frame = mlt_properties_get_data( properties, "shape_frame", NULL ); // Get the width and height of the image - int region_width = mlt_properties_get_int( mlt_frame_properties( this ), "width" ); - int region_height = mlt_properties_get_int( mlt_frame_properties( this ), "height" ); + int region_width = mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "width" ); + int region_height = mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "height" ); uint8_t *image = NULL; mlt_image_format format = mlt_image_yuv422; // Get the shape image to trigger alpha creation - mlt_properties_set( mlt_frame_properties( shape_frame ), "distort", "true" ); + mlt_properties_set( MLT_FRAME_PROPERTIES( shape_frame ), "distort", "true" ); mlt_frame_get_image( shape_frame, &image, &format, ®ion_width, ®ion_height, 0 ); alpha = mlt_frame_get_alpha_mask( shape_frame ); @@ -122,7 +122,7 @@ static uint8_t *filter_get_alpha_mask( mlt_frame this ) *p ++ = *image ++; image ++; } - mlt_properties_set_data( mlt_frame_properties( shape_frame ), "alpha", alpha, + mlt_properties_set_data( MLT_FRAME_PROPERTIES( shape_frame ), "alpha", alpha, region_width * region_height, mlt_pool_release, NULL ); } @@ -144,7 +144,7 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for mlt_transition this = mlt_frame_pop_service( frame ); // Get the properties of the transition - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); // Get the composite from the transition mlt_transition composite = mlt_properties_get_data( properties, "composite", NULL ); @@ -156,7 +156,7 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for 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_properties_get_position( MLT_FRAME_PROPERTIES( frame ), name ); // Create a composite if we don't have one if ( composite == NULL ) @@ -168,7 +168,7 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for if ( composite != NULL ) { // Get the properties - mlt_properties composite_properties = mlt_transition_properties( composite ); + mlt_properties composite_properties = MLT_TRANSITION_PROPERTIES( composite ); // We want to ensure that we don't get a wobble... mlt_properties_set( composite_properties, "distort", "true" ); @@ -184,7 +184,7 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for else { // Pass all current properties down - mlt_properties composite_properties = mlt_transition_properties( composite ); + mlt_properties composite_properties = MLT_TRANSITION_PROPERTIES( composite ); mlt_properties_pass( composite_properties, properties, "composite." ); } @@ -248,7 +248,7 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for if ( temp != NULL ) { - mlt_properties_pass( mlt_filter_properties( temp ), properties, key ); + mlt_properties_pass( MLT_FILTER_PROPERTIES( temp ), properties, key ); count ++; } } @@ -280,7 +280,7 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for b_frame = composite_copy_region( composite, frame, position ); // Ensure a destructor - mlt_properties_set_data( mlt_frame_properties( frame ), name, b_frame, 0, ( mlt_destructor )mlt_frame_close, NULL ); + mlt_properties_set_data( MLT_FRAME_PROPERTIES( frame ), name, b_frame, 0, ( mlt_destructor )mlt_frame_close, NULL ); } // Set the position of the b_frame @@ -290,7 +290,7 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for while ( filter != NULL ) { // Stack this filter - if ( mlt_properties_get_int( mlt_filter_properties( filter ), "off" ) == 0 ) + if ( mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "off" ) == 0 ) mlt_filter_process( filter, b_frame ); // Generate the key for the next @@ -303,7 +303,7 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for // Allow filters to be attached to a region filter filter = mlt_properties_get_data( properties, "_region_filter", NULL ); if ( filter != NULL ) - mlt_service_apply_filters( mlt_filter_service( filter ), b_frame, 0 ); + mlt_service_apply_filters( MLT_FILTER_SERVICE( filter ), b_frame, 0 ); // Hmm - this is probably going to go wrong.... mlt_frame_set_position( frame, position ); @@ -343,7 +343,7 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for if ( producer != NULL ) { // Get the producer properties - mlt_properties producer_properties = mlt_producer_properties( producer ); + mlt_properties producer_properties = MLT_PRODUCER_PROPERTIES( producer ); // Ensure that we loop mlt_properties_set( producer_properties, "eof", "loop" ); @@ -366,10 +366,10 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for mlt_producer_seek( producer, position ); // Get the shape frame - if ( mlt_service_get_frame( mlt_producer_service( producer ), &shape_frame, 0 ) == 0 ) + if ( mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &shape_frame, 0 ) == 0 ) { // Ensure that the shape frame will be closed - mlt_properties_set_data( mlt_frame_properties( b_frame ), "shape_frame", shape_frame, 0, ( mlt_destructor )mlt_frame_close, NULL ); + mlt_properties_set_data( MLT_FRAME_PROPERTIES( b_frame ), "shape_frame", shape_frame, 0, ( mlt_destructor )mlt_frame_close, NULL ); // Specify the callback for evaluation b_frame->get_alpha_mask = filter_get_alpha_mask; @@ -390,10 +390,10 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame ) { // Get the properties of the frame - mlt_properties properties = mlt_frame_properties( a_frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( a_frame ); // Get a unique name to store the frame position - char *name = mlt_properties_get( mlt_transition_properties( this ), "_unique_id" ); + char *name = mlt_properties_get( MLT_TRANSITION_PROPERTIES( this ), "_unique_id" ); // Assign the current position to the name mlt_properties_set_position( properties, name, mlt_frame_get_position( a_frame ) ); @@ -423,7 +423,7 @@ mlt_transition transition_region_init( void *arg ) if ( this != NULL ) { // Get the properties from the transition - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); // Assign the transition process method this->process = transition_process; diff --git a/src/modules/data_fx.properties b/src/modules/data_fx.properties index b0167804..1c186a08 100644 --- a/src/modules/data_fx.properties +++ b/src/modules/data_fx.properties @@ -79,3 +79,169 @@ tickertape.filter[1].producer.markup=Shotcut tickertape.filter[1].composite.start=101%,1%:300%x99%:100 tickertape.filter[1].composite.end=-300%,1%:300%x99%:100 tickertape.filter[1].composite.titles=1 + +# +# ETV Location +# + +location=region +location.description=Titles +location.properties.markup=filter[1].producer.markup +location.type.markup=text +location.period=2 +location.properties.length[0]=filter[0].composite.out +location.properties.length[1]=filter[1].composite.out +location.composite.start=0,80:230x30 +location.filter[0]=watermark +location.filter[0].resource=colour:0x6c010100 +location.filter[0].composite.start=0%,0%:100%x100%:0 +location.filter[0].composite.key[5]=0%,0%:100%x100%:100 +location.filter[1]=watermark +location.filter[1].resource=pango: +location.filter[1].producer.markup=Shotcut +location.filter[1].producer.font=San 24 +location.filter[1].composite.start=0%,0%:100%x100%:0 +location.filter[1].composite.key[8]=0%,0%:100%x100%:100 +location.filter[1].composite.titles=1 +#location.filter[1].composite.halign=right + +courtesy=region +courtesy.description=Titles +courtesy.properties.markup=filter[1].producer.markup +courtesy.type.markup=text +courtesy.period=2 +courtesy.properties.length[0]=filter[0].composite.out +courtesy.properties.length[1]=filter[1].composite.out +courtesy.composite.start=0,115:230x30 +courtesy.filter[0]=watermark +courtesy.filter[0].resource=colour:0x6c010100 +courtesy.filter[0].composite.start=0%,0%:100%x100%:0 +courtesy.filter[0].composite.key[5]=0%,0%:100%x100%:100 +courtesy.filter[1]=watermark +courtesy.filter[1].resource=pango: +courtesy.filter[1].producer.markup=ETV Exclusive +courtesy.filter[1].producer.font=San 24 +courtesy.filter[1].composite.start=1%,1%:99%x99%:0 +courtesy.filter[1].composite.key[8]=1%,1%:99%x99%:100 +courtesy.filter[1].composite.titles=1 +#exclusive.filter[1].composite.halign=right + +exclusive=region +exclusive.description=Titles +exclusive.period=2 +exclusive.properties.length[0]=filter[0].composite.out +exclusive.properties.length[1]=filter[1].composite.out +exclusive.composite.start=0,115:230x30 +exclusive.filter[0]=watermark +exclusive.filter[0].resource=colour:0x6c010100 +exclusive.filter[0].composite.start=0%,0%:100%x100%:0 +exclusive.filter[0].composite.key[5]=0%,0%:100%x100%:100 +exclusive.filter[1]=watermark +exclusive.filter[1].resource=pango: +exclusive.filter[1].producer.markup=ETV Exclusive +exclusive.filter[1].producer.font=San 24 +exclusive.filter[1].composite.start=1%,1%:99%x99%:0 +exclusive.filter[1].composite.key[8]=1%,1%:99%x99%:100 +exclusive.filter[1].composite.titles=1 +#exclusive.filter[1].composite.halign=right + +shot=region +shot.description=Titles +shot.period=2 +shot.properties.length[0]=filter[0].composite.out +shot.properties.length[1]=filter[1].composite.out +shot.composite.start=590,160:80x25 +shot.filter[0]=watermark +shot.filter[0].resource=colour:0x6c010100 +shot.filter[0].composite.start=0%,0%:100%x100%:0 +shot.filter[0].composite.key[5]=0%,0%:100%x100%:100 +shot.filter[1]=watermark +shot.filter[1].resource=pango: +shot.filter[1].producer.markup=Live +shot.filter[1].producer.font=San 24 +shot.filter[1].composite.start=1%,1%:99%x99%:0 +shot.filter[1].composite.key[8]=1%,1%:99%x99%:100 +shot.filter[1].composite.titles=1 +#shot.filter[1].composite.halign=centre + +special=region +special.description=Titles +special.period=2 +special.properties.length[0]=filter[0].composite.out +special.properties.length[1]=filter[1].composite.out +special.composite.start=465,375:255x35 +special.filter[0]=watermark +special.filter[0].resource=colour:0x6c010100 +special.filter[0].composite.start=0%,0%:100%x100%:0 +special.filter[0].composite.key[5]=0%,0%:100%x100%:100 +special.filter[1]=watermark +special.filter[1].resource=pango: +special.filter[1].producer.markup=Special +special.filter[1].producer.font=San 24 +special.filter[1].composite.start=1%,1%:99%x99%:0 +special.filter[1].composite.key[8]=1%,1%:99%x99%:100 +special.filter[1].composite.titles=1 +#special.filter[1].composite.halign=centre + +name=region +name.description=Titles +name.properties.markup=filter[1].producer.markup +name.type.markup=text +name.period=2 +name.properties.length[0]=filter[0].composite.out +name.properties.length[1]=filter[1].composite.out +name.composite.start=0,410:720x45 +name.filter[0]=watermark +name.filter[0].resource=colour:0xbbbbbb00 +name.filter[0].composite.start=0%,0%:100%x100%:0 +name.filter[0].composite.key[5]=0%,0%:100%x100%:100 +name.filter[1]=watermark +name.filter[1].resource=pango: +name.filter[1].producer.markup=Shotcut +name.filter[1].producer.font=San 32 +name.filter[1].producer.fgcolour=0x6c010100 +name.filter[1].composite.start=1%,1%:99%x99%:0 +name.filter[1].composite.key[8]=1%,1%:99%x99%:100 +name.filter[1].composite.titles=1 +#name.filter[1].composite.halign=centre + +designation=region +designation.description=Titles +designation.properties.markup=filter[1].producer.markup +designation.type.markup=text +designation.period=2 +designation.properties.length[0]=filter[0].composite.out +designation.properties.length[1]=filter[1].composite.out +designation.composite.start=0,455:720x45 +designation.filter[0]=watermark +designation.filter[0].resource=colour:0xbbbbbb00 +designation.filter[0].composite.start=0%,0%:100%x100%:0 +designation.filter[0].composite.key[5]=0%,0%:100%x100%:100 +designation.filter[1]=watermark +designation.filter[1].resource=pango: +designation.filter[1].producer.markup=Shotcut +designation.filter[1].producer.font=San 32 +designation.filter[1].producer.fgcolour=0x6c010100 +designation.filter[1].composite.start=1%,1%:99%x99%:0 +designation.filter[1].composite.key[8]=1%,1%:99%x99%:100 +designation.filter[1].composite.titles=1 +#designation.filter[1].composite.halign=centre + +ticker=region +ticker.description=Tickertape +ticker.properties.markup=filter[1].producer.markup +ticker.type.markup=text +ticker.properties.length[0]=filter[1].composite.out +ticker.composite.start=0,500:722x75 +ticker.filter[0]=watermark +ticker.filter[0].resource=colour:0x6c010100 +ticker.filter[0].composite.start=0%,0%:100%x100%:100 +ticker.filter[1]=watermark +ticker.filter[1].resource=pango: +ticker.filter[1].producer.markup=Ticker - provided for reference +ticker.filter[1].composite.start=0%,0%:100%x100%:100 +ticker.filter[1].composite.titles=0 +ticker.filter[1].producer.font=San 24 +ticker.filter[1].composite.halign=centre +#ticker.filter[1].composite.valign=centre + diff --git a/src/modules/dv/consumer_libdv.c b/src/modules/dv/consumer_libdv.c index cc3542f3..448c2253 100644 --- a/src/modules/dv/consumer_libdv.c +++ b/src/modules/dv/consumer_libdv.c @@ -56,7 +56,7 @@ mlt_consumer consumer_libdv_init( char *arg ) if ( this != NULL && mlt_consumer_init( this, NULL ) == 0 ) { // Get properties from the consumer - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Assign close callback this->close = consumer_close; @@ -92,7 +92,7 @@ mlt_consumer consumer_libdv_init( char *arg ) static int consumer_start( mlt_consumer this ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Check that we're not already running if ( !mlt_properties_get_int( properties, "running" ) ) @@ -123,7 +123,7 @@ static int consumer_start( mlt_consumer this ) static int consumer_stop( mlt_consumer this ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Check that we're running if ( mlt_properties_get_int( properties, "running" ) ) @@ -151,7 +151,7 @@ static int consumer_stop( mlt_consumer this ) static int consumer_is_stopped( mlt_consumer this ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); return !mlt_properties_get_int( properties, "running" ); } @@ -161,7 +161,7 @@ static int consumer_is_stopped( mlt_consumer this ) static dv_encoder_t *libdv_get_encoder( mlt_consumer this, mlt_frame frame ) { // Get the properties of the consumer - mlt_properties this_properties = mlt_consumer_properties( this ); + mlt_properties this_properties = MLT_CONSUMER_PROPERTIES( this ); // Obtain the dv_encoder dv_encoder_t *encoder = mlt_properties_get_data( this_properties, "dv_encoder", NULL ); @@ -200,13 +200,13 @@ static int consumer_encode_video( mlt_consumer this, uint8_t *dv_frame, mlt_fram dv_encoder_t *encoder = libdv_get_encoder( this, frame ); // Get the properties of the consumer - mlt_properties this_properties = mlt_consumer_properties( this ); + mlt_properties this_properties = MLT_CONSUMER_PROPERTIES( this ); // This will hold the size of the dv frame int size = 0; // Is the image rendered - int rendered = mlt_properties_get_int( mlt_frame_properties( frame ), "rendered" ); + int rendered = mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "rendered" ); // Get width and height int width = mlt_properties_get_int( this_properties, "width" ); @@ -260,10 +260,10 @@ static int consumer_encode_video( mlt_consumer this, uint8_t *dv_frame, mlt_fram static void consumer_encode_audio( mlt_consumer this, uint8_t *dv_frame, mlt_frame frame ) { // Get the properties of the consumer - mlt_properties this_properties = mlt_consumer_properties( this ); + mlt_properties this_properties = MLT_CONSUMER_PROPERTIES( this ); // Get the properties of the frame - mlt_properties frame_properties = mlt_frame_properties( frame ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); // Obtain the dv_encoder dv_encoder_t *encoder = libdv_get_encoder( this, frame ); @@ -335,7 +335,7 @@ static void consumer_encode_audio( mlt_consumer this, uint8_t *dv_frame, mlt_fra static void consumer_output( mlt_consumer this, uint8_t *dv_frame, int size, mlt_frame frame ) { // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); FILE *output = stdout; char *target = mlt_properties_get( properties, "target" ); @@ -371,7 +371,7 @@ static void *consumer_thread( void *arg ) mlt_consumer this = arg; // Get the properties - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Get the terminate_on_pause property int top = mlt_properties_get_int( properties, "terminate_on_pause" ); @@ -398,7 +398,7 @@ static void *consumer_thread( void *arg ) if ( frame != NULL ) { // Terminate on pause - if ( top && mlt_properties_get_double( mlt_frame_properties( frame ), "_speed" ) == 0 ) + if ( top && mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame ), "_speed" ) == 0 ) { mlt_frame_close( frame ); break; diff --git a/src/modules/dv/producer_libdv.c b/src/modules/dv/producer_libdv.c index 6ab349c4..ae968468 100644 --- a/src/modules/dv/producer_libdv.c +++ b/src/modules/dv/producer_libdv.c @@ -136,7 +136,7 @@ mlt_producer producer_libdv_init( char *filename ) if ( filename != NULL && this != NULL && mlt_producer_init( &this->parent, this ) == 0 ) { mlt_producer producer = &this->parent; - mlt_properties properties = mlt_producer_properties( producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); // Register transport implementation with the producer producer->close = ( mlt_destructor )producer_close; @@ -199,7 +199,7 @@ static int producer_collect_info( producer_libdv this ) if ( valid ) { // Get the properties - mlt_properties properties = mlt_producer_properties( &this->parent ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( &this->parent ); // Get a dv_decoder dv_decoder_t *dv_decoder = dv_decoder_alloc( ); @@ -254,7 +254,7 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma uint8_t *pixels[3] = { NULL, NULL, NULL }; // Get the frames properties - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); // Get a dv_decoder dv_decoder_t *decoder = dv_decoder_alloc( ); @@ -329,7 +329,7 @@ static int producer_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_forma int16_t *audio_channels[ 4 ]; // Get the frames properties - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); // Get a dv_decoder dv_decoder_t *decoder = dv_decoder_alloc( ); @@ -404,7 +404,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i read_frame( this->fd, data, &this->is_pal ) ) { // Get the frames properties - mlt_properties properties = mlt_frame_properties( *frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( *frame ); // Get a dv_decoder dv_decoder_t *dv_decoder = dv_decoder_alloc( ); @@ -427,7 +427,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i ( *frame )->get_audio = producer_get_audio; // Push the quality string - mlt_frame_push_service( *frame, mlt_properties_get( mlt_producer_properties( producer ), "quality" ) ); + mlt_frame_push_service( *frame, mlt_properties_get( MLT_PRODUCER_PROPERTIES( producer ), "quality" ) ); // Push the get_image method on to the stack mlt_frame_push_get_image( *frame, producer_get_image ); diff --git a/src/modules/fezzik.ini b/src/modules/fezzik.ini index 51bf74ed..0e20babc 100644 --- a/src/modules/fezzik.ini +++ b/src/modules/fezzik.ini @@ -10,3 +10,4 @@ deinterlace=deinterlace,avdeinterlace rescaler=mcrescale,gtkrescale,rescale resizer=resize resampler=soxresample,avresample,resample +data=data_feed:attr_check diff --git a/src/modules/fezzik/producer_fezzik.c b/src/modules/fezzik/producer_fezzik.c index 9a0d9f3a..85de2726 100644 --- a/src/modules/fezzik/producer_fezzik.c +++ b/src/modules/fezzik/producer_fezzik.c @@ -114,7 +114,7 @@ static void create_filter( mlt_producer producer, char *effect, int *created ) mlt_filter filter = mlt_factory_filter( id, arg ); if ( filter != NULL ) { - mlt_properties_set_int( mlt_filter_properties( filter ), "_fezzik", 1 ); + mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "_fezzik", 1 ); mlt_producer_attach( producer, filter ); mlt_filter_close( filter ); *created = 1; @@ -164,7 +164,7 @@ mlt_producer producer_fezzik_init( char *arg ) producer = create_producer( arg ); if ( producer != NULL ) - properties = mlt_producer_properties( producer ); + properties = MLT_PRODUCER_PROPERTIES( producer ); // Attach filters if we have a producer and it isn't already westley'd :-) if ( producer != NULL && mlt_properties_get( properties, "westley" ) == NULL && mlt_properties_get( properties, "_westley" ) == NULL ) diff --git a/src/modules/fezzik/producer_hold.c b/src/modules/fezzik/producer_hold.c index 08c0247d..77afe3fa 100644 --- a/src/modules/fezzik/producer_hold.c +++ b/src/modules/fezzik/producer_hold.c @@ -48,7 +48,7 @@ mlt_producer producer_hold_init( char *arg ) if ( this != NULL && producer != NULL ) { // Get the properties of this producer - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Store the producer mlt_properties_set_data( properties, "producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL ); @@ -83,36 +83,36 @@ mlt_producer producer_hold_init( char *arg ) static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) { // Get the properties of the frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); // Obtain the real frame mlt_frame real_frame = mlt_frame_pop_service( frame ); // Get the image from the real frame int size = 0; - *buffer = mlt_properties_get_data( mlt_frame_properties( real_frame ), "image", &size ); - *width = mlt_properties_get_int( mlt_frame_properties( real_frame ), "width" ); - *height = mlt_properties_get_int( mlt_frame_properties( real_frame ), "height" ); + *buffer = mlt_properties_get_data( MLT_FRAME_PROPERTIES( real_frame ), "image", &size ); + *width = mlt_properties_get_int( MLT_FRAME_PROPERTIES( real_frame ), "width" ); + *height = mlt_properties_get_int( MLT_FRAME_PROPERTIES( real_frame ), "height" ); // If this is the first time, get it from the producer if ( *buffer == NULL ) { - mlt_properties_pass( mlt_frame_properties( real_frame ), properties, "" ); + mlt_properties_pass( MLT_FRAME_PROPERTIES( real_frame ), properties, "" ); // We'll deinterlace on the downstream deinterlacer - mlt_properties_set_int( mlt_frame_properties( real_frame ), "consumer_deinterlace", 1 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( real_frame ), "consumer_deinterlace", 1 ); // We want distorted to ensure we don't hit the resize filter twice - mlt_properties_set_int( mlt_frame_properties( real_frame ), "distort", 1 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( real_frame ), "distort", 1 ); // Get the image mlt_frame_get_image( real_frame, buffer, format, width, height, writable ); // Make sure we get the size - *buffer = mlt_properties_get_data( mlt_frame_properties( real_frame ), "image", &size ); + *buffer = mlt_properties_get_data( MLT_FRAME_PROPERTIES( real_frame ), "image", &size ); } - mlt_properties_pass( properties, mlt_frame_properties( real_frame ), "" ); + mlt_properties_pass( properties, MLT_FRAME_PROPERTIES( real_frame ), "" ); // Set the values obtained on the frame if ( *buffer != NULL ) @@ -139,7 +139,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index ) { // Get the properties of this producer - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Construct a new frame *frame = mlt_frame_init( ); @@ -163,7 +163,7 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index mlt_producer_seek( producer, position ); // Get the real frame - mlt_service_get_frame( mlt_producer_service( producer ), &real_frame, index ); + mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &real_frame, index ); // Ensure that the real frame gets wiped eventually mlt_properties_set_data( properties, "real_frame", real_frame, 0, ( mlt_destructor )mlt_frame_close, NULL ); @@ -171,9 +171,9 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index else { // Temporary fix - ensure that we aren't seen as a test frame - int8_t *image = mlt_properties_get_data( mlt_frame_properties( real_frame ), "image", NULL ); - mlt_properties_set_data( mlt_frame_properties( *frame ), "image", image, 0, NULL, NULL ); - mlt_properties_set_int( mlt_frame_properties( *frame ), "test_image", 0 ); + int8_t *image = mlt_properties_get_data( MLT_FRAME_PROPERTIES( real_frame ), "image", NULL ); + mlt_properties_set_data( MLT_FRAME_PROPERTIES( *frame ), "image", image, 0, NULL, NULL ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( *frame ), "test_image", 0 ); } // Stack the real frame and method @@ -181,7 +181,7 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index mlt_frame_push_service( *frame, producer_get_image ); // Ensure that the consumer sees what the real frame has - mlt_properties_pass( mlt_frame_properties( *frame ), mlt_frame_properties( real_frame ), "" ); + mlt_properties_pass( MLT_FRAME_PROPERTIES( *frame ), MLT_FRAME_PROPERTIES( real_frame ), "" ); } // Move to the next position diff --git a/src/modules/gtk2/consumer_gtk2.c b/src/modules/gtk2/consumer_gtk2.c index f563ecfb..b8689a39 100644 --- a/src/modules/gtk2/consumer_gtk2.c +++ b/src/modules/gtk2/consumer_gtk2.c @@ -46,7 +46,7 @@ mlt_consumer consumer_gtk2_preview_init( GtkWidget *widget ) // Now assign the lock/unlock callbacks if ( consumer != NULL ) { - mlt_properties properties = mlt_consumer_properties( consumer ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer ); mlt_properties_set_int( properties, "app_locked", 1 ); mlt_properties_set_data( properties, "app_lock", gdk_threads_enter, 0, NULL, NULL ); mlt_properties_set_data( properties, "app_unlock", gdk_threads_leave, 0, NULL, NULL ); diff --git a/src/modules/gtk2/filter_rescale.c b/src/modules/gtk2/filter_rescale.c index e1ebb7a4..14f3f28d 100644 --- a/src/modules/gtk2/filter_rescale.c +++ b/src/modules/gtk2/filter_rescale.c @@ -32,7 +32,7 @@ static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format iformat, mlt_image_format oformat, int iwidth, int iheight, int owidth, int oheight ) { // Get the properties - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); // Get the requested interpolation method char *interps = mlt_properties_get( properties, "rescale.interp" ); @@ -144,7 +144,7 @@ mlt_filter filter_rescale_init( char *arg ) if ( this != NULL ) { // Get the properties - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); // Set the inerpolation mlt_properties_set( properties, "interpolation", arg == NULL ? "bilinear" : arg ); diff --git a/src/modules/gtk2/producer_pango.c b/src/modules/gtk2/producer_pango.c index e4969aba..ffb20cbf 100644 --- a/src/modules/gtk2/producer_pango.c +++ b/src/modules/gtk2/producer_pango.c @@ -101,7 +101,7 @@ mlt_producer producer_pango_init( const char *filename ) g_type_init(); // Get the properties interface - mlt_properties properties = mlt_producer_properties( &this->parent ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( &this->parent ); // Set the default properties mlt_properties_set( properties, "fgcolour", "0xffffffff" ); @@ -269,7 +269,7 @@ static void refresh_image( mlt_frame frame, int width, int height ) GdkPixbuf *pixbuf = NULL; // Obtain properties of frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); // Obtain the producer pango for this frame producer_pango this = mlt_properties_get_data( properties, "producer_pango", NULL ); @@ -278,7 +278,7 @@ static void refresh_image( mlt_frame frame, int width, int height ) mlt_producer producer = &this->parent; // Obtain the producer properties - mlt_properties producer_props = mlt_producer_properties( producer ); + mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer ); // Get producer properties char *fg = mlt_properties_get( producer_props, "fgcolour" ); @@ -409,7 +409,7 @@ static void refresh_image( mlt_frame frame, int width, int height ) static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) { // Obtain properties of frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); *width = mlt_properties_get_int( properties, "rescale_width" ); *height = mlt_properties_get_int( properties, "rescale_height" ); @@ -419,7 +419,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form // Determine format //mlt_producer this = mlt_properties_get_data( properties, "producer_pango", NULL ); - //*format = ( mlt_properties_get_int( mlt_producer_properties( this ), "bpp" ) == 4 ) ? mlt_image_rgb24a : mlt_image_rgb24; + //*format = ( mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( this ), "bpp" ) == 4 ) ? mlt_image_rgb24a : mlt_image_rgb24; // May need to know the size of the image to clone it int size = 0; @@ -454,7 +454,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form static uint8_t *producer_get_alpha_mask( mlt_frame this ) { // Obtain properties of frame - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); // Return the alpha mask return mlt_properties_get_data( properties, "alpha", NULL ); @@ -468,7 +468,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i *frame = mlt_frame_init( ); // Obtain properties of frame and producer - mlt_properties properties = mlt_frame_properties( *frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( *frame ); // Set the producer on the frame properties mlt_properties_set_data( properties, "producer_pango", this, 0, NULL, NULL ); diff --git a/src/modules/gtk2/producer_pixbuf.c b/src/modules/gtk2/producer_pixbuf.c index be66990c..a37d6e95 100644 --- a/src/modules/gtk2/producer_pixbuf.c +++ b/src/modules/gtk2/producer_pixbuf.c @@ -70,7 +70,7 @@ mlt_producer producer_pixbuf_init( char *filename ) mlt_producer producer = &this->parent; // Get the properties interface - mlt_properties properties = mlt_producer_properties( &this->parent ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( &this->parent ); // Callback registration producer->get_frame = producer_get_frame; @@ -93,7 +93,7 @@ static void refresh_image( mlt_frame frame, int width, int height ) GError *error = NULL; // Obtain properties of frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); // Obtain the producer for this frame producer_pixbuf this = mlt_properties_get_data( properties, "producer_pixbuf", NULL ); @@ -102,7 +102,7 @@ static void refresh_image( mlt_frame frame, int width, int height ) mlt_producer producer = &this->parent; // Obtain properties of producer - mlt_properties producer_props = mlt_producer_properties( producer ); + mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer ); // Get the time to live for each frame double ttl = mlt_properties_get_int( producer_props, "ttl" ); @@ -215,7 +215,7 @@ static void refresh_image( mlt_frame frame, int width, int height ) static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) { // Obtain properties of frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); *width = mlt_properties_get_int( properties, "rescale_width" ); *height = mlt_properties_get_int( properties, "rescale_height" ); @@ -266,7 +266,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form static uint8_t *producer_get_alpha_mask( mlt_frame this ) { // Obtain properties of frame - mlt_properties properties = mlt_frame_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( this ); // Return the alpha mask return mlt_properties_get_data( properties, "alpha", NULL ); @@ -277,9 +277,9 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i // Get the real structure for this producer producer_pixbuf this = producer->child; - if ( this->count == 0 && mlt_properties_get( mlt_producer_properties( producer ), "resource" ) != NULL ) + if ( this->count == 0 && mlt_properties_get( MLT_PRODUCER_PROPERTIES( producer ), "resource" ) != NULL ) { - mlt_properties properties = mlt_producer_properties( producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); char *filename = mlt_properties_get( properties, "resource" ); // Read xml string @@ -376,7 +376,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i if ( *frame != NULL && this->count > 0 ) { // Obtain properties of frame and producer - mlt_properties properties = mlt_frame_properties( *frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( *frame ); // Determine if we're rendering for PAL or NTSC int is_pal = mlt_properties_get_int( properties, "normalised_height" ) == 576; diff --git a/src/modules/inigo/producer_inigo.c b/src/modules/inigo/producer_inigo.c index 5367d4ea..e5263c40 100644 --- a/src/modules/inigo/producer_inigo.c +++ b/src/modules/inigo/producer_inigo.c @@ -47,7 +47,7 @@ mlt_producer producer_inigo_file_init( char *file ) if ( result != NULL ) { - mlt_properties properties = mlt_producer_properties( result ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( result ); mlt_properties_set( properties, "resource", file ); } @@ -179,7 +179,7 @@ mlt_producer producer_inigo_init( char **argv ) else if ( type == 2 ) mlt_service_attach( ( mlt_service )mlt_producer_cut_parent( producer ), filter ); - properties = mlt_filter_properties( filter ); + properties = MLT_FILTER_PROPERTIES( filter ); mlt_properties_inherit( properties, group ); } } @@ -195,7 +195,7 @@ mlt_producer producer_inigo_init( char **argv ) mlt_playlist_repeat_clip( playlist, mlt_playlist_count( playlist ) - 1, repeat ); mlt_playlist_get_clip_info( playlist, &info, mlt_playlist_count( playlist ) - 1 ); producer = info.cut; - properties = mlt_producer_properties( producer ); + properties = MLT_PRODUCER_PROPERTIES( producer ); } } else if ( !strcmp( argv[ i ], "-split" ) ) @@ -212,7 +212,7 @@ mlt_producer producer_inigo_init( char **argv ) mlt_playlist_split( playlist, mlt_playlist_count( playlist ) - 1, split ); mlt_playlist_get_clip_info( playlist, &info, mlt_playlist_count( playlist ) - 1 ); producer = info.cut; - properties = mlt_producer_properties( producer ); + properties = MLT_PRODUCER_PROPERTIES( producer ); } } else if ( !strcmp( argv[ i ], "-swap" ) ) @@ -226,7 +226,7 @@ mlt_producer producer_inigo_init( char **argv ) mlt_playlist_move( playlist, mlt_playlist_count( playlist ) - 2, mlt_playlist_count( playlist ) - 1 ); mlt_playlist_get_clip_info( playlist, &info, mlt_playlist_count( playlist ) - 1 ); producer = info.cut; - properties = mlt_producer_properties( producer ); + properties = MLT_PRODUCER_PROPERTIES( producer ); } } else if ( !strcmp( argv[ i ], "-join" ) ) @@ -241,7 +241,7 @@ mlt_producer producer_inigo_init( char **argv ) mlt_playlist_join( playlist, mlt_playlist_count( playlist ) - clips - 1, clips, 0 ); mlt_playlist_get_clip_info( playlist, &info, mlt_playlist_count( playlist ) - 1 ); producer = info.cut; - properties = mlt_producer_properties( producer ); + properties = MLT_PRODUCER_PROPERTIES( producer ); } } else if ( !strcmp( argv[ i ], "-remove" ) ) @@ -255,7 +255,7 @@ mlt_producer producer_inigo_init( char **argv ) mlt_playlist_remove( playlist, mlt_playlist_count( playlist ) - 1 ); mlt_playlist_get_clip_info( playlist, &info, mlt_playlist_count( playlist ) - 1 ); producer = info.cut; - properties = mlt_producer_properties( producer ); + properties = MLT_PRODUCER_PROPERTIES( producer ); } } else if ( !strcmp( argv[ i ], "-mix" ) ) @@ -298,7 +298,7 @@ mlt_producer producer_inigo_init( char **argv ) transition = mlt_factory_transition( id, arg ); if ( transition != NULL ) { - properties = mlt_transition_properties( transition ); + properties = MLT_TRANSITION_PROPERTIES( transition ); mlt_properties_inherit( properties, group ); mlt_field_plant_transition( field, transition, 0, 1 ); mlt_properties_set_position( properties, "in", 0 ); @@ -317,7 +317,7 @@ mlt_producer producer_inigo_init( char **argv ) mlt_filter filter = create_filter( field, argv[ ++ i ], track ); if ( filter != NULL ) { - properties = mlt_filter_properties( filter ); + properties = MLT_FILTER_PROPERTIES( filter ); mlt_properties_inherit( properties, group ); } } @@ -326,7 +326,7 @@ mlt_producer producer_inigo_init( char **argv ) mlt_transition transition = create_transition( field, argv[ ++ i ], track - 1 ); if ( transition != NULL ) { - properties = mlt_transition_properties( transition ); + properties = MLT_TRANSITION_PROPERTIES( transition ); mlt_properties_inherit( properties, group ); } } @@ -345,12 +345,12 @@ mlt_producer producer_inigo_init( char **argv ) if ( producer != NULL && !mlt_producer_is_cut( producer ) ) mlt_playlist_append( playlist, producer ); producer = NULL; - mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), track ++ ); + mlt_multitrack_connect( multitrack, MLT_PLAYLIST_PRODUCER( playlist ), track ++ ); track_service( field, playlist, ( mlt_destructor )mlt_playlist_close ); playlist = mlt_playlist_init( ); if ( playlist != NULL ) { - properties = mlt_playlist_properties( playlist ); + properties = MLT_PLAYLIST_PROPERTIES( playlist ); if ( !strcmp( argv[ i ], "-hide-track" ) ) mlt_properties_set_int( properties, "hide", 3 ); else if ( !strcmp( argv[ i ], "-hide-video" ) ) @@ -372,7 +372,7 @@ mlt_producer producer_inigo_init( char **argv ) producer = create_producer( field, argv[ i ] ); if ( producer != NULL ) { - properties = mlt_producer_properties( producer ); + properties = MLT_PRODUCER_PROPERTIES( producer ); mlt_properties_inherit( properties, group ); } } @@ -399,15 +399,15 @@ mlt_producer producer_inigo_init( char **argv ) // We must have a playlist to connect if ( mlt_playlist_count( playlist ) > 0 ) - mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), track ); + mlt_multitrack_connect( multitrack, MLT_PLAYLIST_PRODUCER( playlist ), track ); - mlt_producer prod = mlt_tractor_producer( tractor ); + mlt_producer prod = MLT_TRACTOR_PRODUCER( tractor ); mlt_producer_optimise( prod ); - mlt_properties props = mlt_tractor_properties( tractor ); + mlt_properties props = MLT_TRACTOR_PROPERTIES( tractor ); mlt_properties_set_data( props, "group", group, 0, ( mlt_destructor )mlt_properties_close, NULL ); - mlt_properties_set_position( props, "length", mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) + 1 ); - mlt_producer_set_in_and_out( prod, 0, mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) ); - mlt_properties_set_double( props, "fps", mlt_producer_get_fps( mlt_multitrack_producer( multitrack ) ) ); + mlt_properties_set_position( props, "length", mlt_producer_get_out( MLT_MULTITRACK_PRODUCER( multitrack ) ) + 1 ); + mlt_producer_set_in_and_out( prod, 0, mlt_producer_get_out( MLT_MULTITRACK_PRODUCER( multitrack ) ) ); + mlt_properties_set_double( props, "fps", mlt_producer_get_fps( MLT_MULTITRACK_PRODUCER( multitrack ) ) ); if ( title != NULL ) mlt_properties_set( props, "title", strchr( title, '/' ) ? strrchr( title, '/' ) + 1 : title ); diff --git a/src/modules/normalize/filter_volume.c b/src/modules/normalize/filter_volume.c index 04fb9364..c4822d1d 100644 --- a/src/modules/normalize/filter_volume.c +++ b/src/modules/normalize/filter_volume.c @@ -167,7 +167,7 @@ double signal_max_power( int16_t *buffer, int channels, int samples, int16_t *pe static int filter_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { // Get the properties of the a frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); double gain = mlt_properties_get_double( properties, "volume.gain" ); double max_gain = mlt_properties_get_double( properties, "volume.max_gain" ); double limiter_level = 0.5; /* -6 dBFS */ @@ -181,7 +181,7 @@ static int filter_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format mlt_filter this = mlt_properties_get_data( properties, "filter_volume", NULL ); // Get the properties from the filter - mlt_properties filter_props = mlt_filter_properties( this ); + mlt_properties filter_props = MLT_FILTER_PROPERTIES( this ); if ( mlt_properties_get( properties, "volume.limiter" ) != NULL ) limiter_level = mlt_properties_get_double( properties, "volume.limiter" ); @@ -283,8 +283,8 @@ static int filter_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) { - mlt_properties properties = mlt_frame_properties( frame ); - mlt_properties filter_props = mlt_filter_properties( this ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); + mlt_properties filter_props = MLT_FILTER_PROPERTIES( this ); // Parse the gain property if ( mlt_properties_get( properties, "gain" ) == NULL ) @@ -452,7 +452,7 @@ mlt_filter filter_volume_init( char *arg ) mlt_filter this = calloc( sizeof( struct mlt_filter_s ), 1 ); if ( this != NULL && mlt_filter_init( this, NULL ) == 0 ) { - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); this->process = filter_process; if ( arg != NULL ) mlt_properties_set( properties, "gain", arg ); diff --git a/src/modules/plus/filter_affine.c b/src/modules/plus/filter_affine.c index f3d0b6bb..81fde678 100644 --- a/src/modules/plus/filter_affine.c +++ b/src/modules/plus/filter_affine.c @@ -35,7 +35,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * mlt_filter filter = mlt_frame_pop_service( this ); // Get the properties - mlt_properties properties = mlt_filter_properties( filter ); + mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); // Get the image int error = mlt_frame_get_image( this, image, format, width, height, 0 ); @@ -63,16 +63,16 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * if ( producer != NULL && transition != NULL ) { char *name = mlt_properties_get( properties, "_unique_id" ); - mlt_position position = mlt_properties_get_position( mlt_frame_properties( this ), name ); - mlt_properties frame_properties = mlt_frame_properties( this ); + mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( this ), name ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( this ); mlt_producer_seek( producer, position ); mlt_frame_set_position( this, position ); - mlt_properties_pass( mlt_producer_properties( producer ), properties, "producer." ); - mlt_properties_pass( mlt_transition_properties( transition ), properties, "transition." ); - mlt_service_get_frame( mlt_producer_service( producer ), &a_frame, 0 ); - mlt_properties_set( mlt_frame_properties( a_frame ), "rescale.interp", "nearest" ); - mlt_properties_set( mlt_frame_properties( a_frame ), "distort", "true" ); - mlt_properties_set_double( mlt_frame_properties( a_frame ), "consumer_aspect_ratio", + mlt_properties_pass( MLT_PRODUCER_PROPERTIES( producer ), properties, "producer." ); + mlt_properties_pass( MLT_TRANSITION_PROPERTIES( transition ), properties, "transition." ); + mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &a_frame, 0 ); + mlt_properties_set( MLT_FRAME_PROPERTIES( a_frame ), "rescale.interp", "nearest" ); + mlt_properties_set( MLT_FRAME_PROPERTIES( a_frame ), "distort", "true" ); + mlt_properties_set_double( MLT_FRAME_PROPERTIES( a_frame ), "consumer_aspect_ratio", mlt_properties_get_double( frame_properties, "consumer_aspect_ratio" ) ); mlt_transition_process( transition, a_frame, this ); mlt_frame_get_image( a_frame, image, format, width, height, writable ); @@ -90,10 +90,10 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) { // Get the properties of the frame - mlt_properties properties = mlt_frame_properties( 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" ); + char *name = mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "_unique_id" ); // Assign the current position to the name mlt_properties_set_position( properties, name, mlt_frame_get_position( frame ) - mlt_filter_get_in( this ) ); @@ -114,8 +114,8 @@ mlt_filter filter_affine_init( char *arg ) if ( this != NULL ) { this->process = filter_process; - mlt_properties_set( mlt_filter_properties( this ), "background", "colour:black" ); - mlt_properties_set( mlt_filter_properties( this ), "transition.rotate_x", "10" ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "background", "colour:black" ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "transition.rotate_x", "10" ); } return this; } diff --git a/src/modules/plus/filter_charcoal.c b/src/modules/plus/filter_charcoal.c index 58f403b5..cb0b13e2 100644 --- a/src/modules/plus/filter_charcoal.c +++ b/src/modules/plus/filter_charcoal.c @@ -79,11 +79,11 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * if ( error == 0 && *format == mlt_image_yuv422 ) { // Get the charcoal scatter value - int x_scatter = mlt_properties_get_double( mlt_filter_properties( filter ), "x_scatter" ); - int y_scatter = mlt_properties_get_double( mlt_filter_properties( filter ), "y_scatter" ); - float scale = mlt_properties_get_double( mlt_filter_properties( filter ), "scale" ); - float mix = mlt_properties_get_double( mlt_filter_properties( filter ), "mix" ); - int invert = mlt_properties_get_int( mlt_filter_properties( filter ), "invert" ); + int x_scatter = mlt_properties_get_double( MLT_FILTER_PROPERTIES( filter ), "x_scatter" ); + int y_scatter = mlt_properties_get_double( MLT_FILTER_PROPERTIES( filter ), "y_scatter" ); + float scale = mlt_properties_get_double( MLT_FILTER_PROPERTIES( filter ), "scale" ); + float mix = mlt_properties_get_double( MLT_FILTER_PROPERTIES( filter ), "mix" ); + int invert = mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "invert" ); // We'll process pixel by pixel int x = 0; @@ -135,7 +135,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * *image = temp; // Store new and destroy old - mlt_properties_set_data( mlt_frame_properties( this ), "image", *image, *width * *height * 2, mlt_pool_release, NULL ); + mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "image", *image, *width * *height * 2, mlt_pool_release, NULL ); } return error; @@ -162,10 +162,10 @@ mlt_filter filter_charcoal_init( char *arg ) if ( this != NULL ) { this->process = filter_process; - mlt_properties_set( mlt_filter_properties( this ), "x_scatter", "1" ); - mlt_properties_set( mlt_filter_properties( this ), "y_scatter", "1" ); - mlt_properties_set( mlt_filter_properties( this ), "scale", "1.5" ); - mlt_properties_set( mlt_filter_properties( this ), "mix", "0" ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "x_scatter", "1" ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "y_scatter", "1" ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "scale", "1.5" ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "mix", "0" ); } return this; } diff --git a/src/modules/plus/filter_sepia.c b/src/modules/plus/filter_sepia.c index 0e3b6e9f..07ab2682 100644 --- a/src/modules/plus/filter_sepia.c +++ b/src/modules/plus/filter_sepia.c @@ -45,8 +45,8 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * uint8_t *q = *image + *height * *width * 2; // Get u and v values - int u = mlt_properties_get_int( mlt_filter_properties( filter ), "u" ); - int v = mlt_properties_get_int( mlt_filter_properties( filter ), "v" ); + int u = mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "u" ); + int v = mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "v" ); // Loop through image while ( p != q ) @@ -81,8 +81,8 @@ mlt_filter filter_sepia_init( char *arg ) if ( this != NULL ) { this->process = filter_process; - mlt_properties_set( mlt_filter_properties( this ), "u", "75" ); - mlt_properties_set( mlt_filter_properties( this ), "v", "150" ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "u", "75" ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "v", "150" ); } return this; } diff --git a/src/modules/plus/transition_affine.c b/src/modules/plus/transition_affine.c index a8c92d03..1cfb64b4 100644 --- a/src/modules/plus/transition_affine.c +++ b/src/modules/plus/transition_affine.c @@ -177,7 +177,7 @@ static struct geometry_s *transition_parse_keys( mlt_transition this, int norma int i = 0; // Get the properties of the transition - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); // Get the in and out position mlt_position in = mlt_transition_get_in( this ); @@ -257,10 +257,10 @@ static struct geometry_s *transition_parse_keys( mlt_transition this, int norma struct geometry_s *composite_calculate( struct geometry_s *result, mlt_transition this, mlt_frame a_frame, float position ) { // Get the properties from the transition - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); // Get the properties from the frame - mlt_properties a_props = mlt_frame_properties( a_frame ); + mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame ); // Structures for geometry struct geometry_s *start = mlt_properties_get_data( properties, "geometries", NULL ); @@ -476,13 +476,13 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f mlt_transition this = mlt_frame_pop_service( a_frame ); // Get the properties of the transition - mlt_properties properties = mlt_transition_properties( this ); + mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); // Get the properties of the a frame - mlt_properties a_props = mlt_frame_properties( a_frame ); + mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame ); // Get the properties of the b frame - mlt_properties b_props = mlt_frame_properties( b_frame ); + mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame ); // Image, format, width, height and image for the b frame uint8_t *b_image = NULL; @@ -670,10 +670,10 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f static mlt_frame transition_process( mlt_transition transition, mlt_frame a_frame, mlt_frame b_frame ) { // Get a unique name to store the frame position - char *name = mlt_properties_get( mlt_transition_properties( transition ), "_unique_id" ); + char *name = mlt_properties_get( MLT_TRANSITION_PROPERTIES( transition ), "_unique_id" ); // Assign the current position to the name - mlt_properties a_props = mlt_frame_properties( a_frame ); + mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame ); mlt_properties_set_position( a_props, name, mlt_frame_get_position( a_frame ) ); // Push the transition on to the frame @@ -696,10 +696,10 @@ mlt_transition transition_affine_init( char *arg ) mlt_transition transition = mlt_transition_new( ); if ( transition != NULL ) { - mlt_properties_set_int( mlt_transition_properties( transition ), "sx", 1 ); - mlt_properties_set_int( mlt_transition_properties( transition ), "sy", 1 ); - mlt_properties_set( mlt_transition_properties( transition ), "distort", NULL ); - mlt_properties_set( mlt_transition_properties( transition ), "start", "0,0:100%x100%" ); + mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "sx", 1 ); + mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "sy", 1 ); + mlt_properties_set( MLT_TRANSITION_PROPERTIES( transition ), "distort", NULL ); + mlt_properties_set( MLT_TRANSITION_PROPERTIES( transition ), "start", "0,0:100%x100%" ); transition->process = transition_process; } return transition; diff --git a/src/modules/resample/filter_resample.c b/src/modules/resample/filter_resample.c index c2f81445..dbcc1188 100644 --- a/src/modules/resample/filter_resample.c +++ b/src/modules/resample/filter_resample.c @@ -37,13 +37,13 @@ static int resample_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { // Get the properties of the frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); // Get the filter service mlt_filter filter = mlt_frame_pop_audio( frame ); // Get the filter properties - mlt_properties filter_properties = mlt_filter_properties( filter ); + mlt_properties filter_properties = MLT_FILTER_PROPERTIES( filter ); // Get the resample information int output_rate = mlt_properties_get_int( filter_properties, "frequency" ); @@ -190,11 +190,11 @@ mlt_filter filter_resample_init( char *arg ) void *output_buffer = mlt_pool_alloc( BUFFER_LEN ); this->process = filter_process; if ( arg != NULL ) - mlt_properties_set_int( mlt_filter_properties( this ), "frequency", atoi( arg ) ); - mlt_properties_set_int( mlt_filter_properties( this ), "channels", 2 ); - mlt_properties_set_data( mlt_filter_properties( this ), "state", state, 0, (mlt_destructor)src_delete, NULL ); - mlt_properties_set_data( mlt_filter_properties( this ), "input_buffer", input_buffer, BUFFER_LEN, mlt_pool_release, NULL ); - mlt_properties_set_data( mlt_filter_properties( this ), "output_buffer", output_buffer, BUFFER_LEN, mlt_pool_release, NULL ); + mlt_properties_set_int( MLT_FILTER_PROPERTIES( this ), "frequency", atoi( arg ) ); + mlt_properties_set_int( MLT_FILTER_PROPERTIES( this ), "channels", 2 ); + mlt_properties_set_data( MLT_FILTER_PROPERTIES( this ), "state", state, 0, (mlt_destructor)src_delete, NULL ); + mlt_properties_set_data( MLT_FILTER_PROPERTIES( this ), "input_buffer", input_buffer, BUFFER_LEN, mlt_pool_release, NULL ); + mlt_properties_set_data( MLT_FILTER_PROPERTIES( this ), "output_buffer", output_buffer, BUFFER_LEN, mlt_pool_release, NULL ); } else { diff --git a/src/modules/sdl/consumer_sdl.c b/src/modules/sdl/consumer_sdl.c index b5c8fd19..71dbade1 100644 --- a/src/modules/sdl/consumer_sdl.c +++ b/src/modules/sdl/consumer_sdl.c @@ -97,8 +97,8 @@ mlt_consumer consumer_sdl_init( char *arg ) parent->close = consumer_close; // get a handle on properties - mlt_service service = mlt_consumer_service( parent ); - this->properties = mlt_service_properties( service ); + mlt_service service = MLT_CONSUMER_SERVICE( parent ); + this->properties = MLT_SERVICE_PROPERTIES( service ); // Set the default volume mlt_properties_set_double( this->properties, "volume", 1.0 ); @@ -341,7 +341,7 @@ static int consumer_play_audio( consumer_sdl this, mlt_frame frame, int init_aud if ( init_audio == 0 ) { - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); bytes = ( samples * channels * 2 ); pthread_mutex_lock( &this->audio_mutex ); while ( this->running && bytes > ( sizeof( this->audio_buffer) - this->audio_avail ) ) @@ -573,7 +573,7 @@ static void *video_thread( void *arg ) pthread_mutex_unlock( &this->video_mutex ); // Get the properties - properties = mlt_frame_properties( next ); + properties = MLT_FRAME_PROPERTIES( next ); // Get the speed of the frame speed = mlt_properties_get_double( properties, "_speed" ); @@ -647,7 +647,7 @@ static void *consumer_thread( void *arg ) this->bpp = mlt_properties_get_int( this->properties, "bpp" ); - if ( mlt_properties_get_int( mlt_consumer_properties( consumer ), "sdl_started" ) == 0 ) + if ( mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( consumer ), "sdl_started" ) == 0 ) { if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE ) < 0 ) { @@ -668,7 +668,7 @@ static void *consumer_thread( void *arg ) } } - if ( !mlt_properties_get_int( mlt_consumer_properties( consumer ), "audio_off" ) ) + if ( !mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( consumer ), "audio_off" ) ) SDL_InitSubSystem( SDL_INIT_AUDIO ); // Loop until told not to @@ -681,7 +681,7 @@ static void *consumer_thread( void *arg ) if ( frame != NULL ) { // Get the frame properties - properties = mlt_frame_properties( frame ); + properties = MLT_FRAME_PROPERTIES( frame ); // Play audio init_audio = consumer_play_audio( this, frame, init_audio, &duration ); @@ -726,10 +726,10 @@ static void *consumer_thread( void *arg ) if ( this->sdl_overlay != NULL ) SDL_FreeYUVOverlay( this->sdl_overlay ); - if ( !mlt_properties_get_int( mlt_consumer_properties( consumer ), "audio_off" ) ) + if ( !mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( consumer ), "audio_off" ) ) SDL_QuitSubSystem( SDL_INIT_AUDIO ); - if ( mlt_properties_get_int( mlt_consumer_properties( consumer ), "sdl_started" ) == 0 ) + if ( mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( consumer ), "sdl_started" ) == 0 ) SDL_Quit( ); while( mlt_deque_count( this->queue ) ) diff --git a/src/modules/sdl/consumer_sdl_preview.c b/src/modules/sdl/consumer_sdl_preview.c index 84a2c307..cfb6c0eb 100644 --- a/src/modules/sdl/consumer_sdl_preview.c +++ b/src/modules/sdl/consumer_sdl_preview.c @@ -63,7 +63,7 @@ mlt_consumer consumer_sdl_preview_init( char *arg ) mlt_consumer parent = &this->parent; // Get the properties - mlt_properties properties = mlt_consumer_properties( parent ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( parent ); // Get the width and height int width = mlt_properties_get_int( properties, "width" ); @@ -79,17 +79,17 @@ mlt_consumer consumer_sdl_preview_init( char *arg ) // Create child consumers this->play = mlt_factory_consumer( "sdl", arg ); this->still = mlt_factory_consumer( "sdl_still", arg ); - mlt_properties_set( mlt_consumer_properties( parent ), "real_time", "0" ); - mlt_properties_set( mlt_consumer_properties( parent ), "rescale", "nearest" ); + mlt_properties_set( MLT_CONSUMER_PROPERTIES( parent ), "real_time", "0" ); + mlt_properties_set( MLT_CONSUMER_PROPERTIES( parent ), "rescale", "nearest" ); parent->close = consumer_close; parent->start = consumer_start; parent->stop = consumer_stop; parent->is_stopped = consumer_is_stopped; this->joined = 1; - mlt_events_listen( mlt_consumer_properties( this->play ), this, "consumer-frame-show", ( mlt_listener )consumer_frame_show_cb ); - mlt_events_listen( mlt_consumer_properties( this->still ), this, "consumer-frame-show", ( mlt_listener )consumer_frame_show_cb ); - mlt_events_listen( mlt_consumer_properties( this->play ), this, "consumer-sdl-event", ( mlt_listener )consumer_sdl_event_cb ); - mlt_events_listen( mlt_consumer_properties( this->still ), this, "consumer-sdl-event", ( mlt_listener )consumer_sdl_event_cb ); + mlt_events_listen( MLT_CONSUMER_PROPERTIES( this->play ), this, "consumer-frame-show", ( mlt_listener )consumer_frame_show_cb ); + mlt_events_listen( MLT_CONSUMER_PROPERTIES( this->still ), this, "consumer-frame-show", ( mlt_listener )consumer_frame_show_cb ); + mlt_events_listen( MLT_CONSUMER_PROPERTIES( this->play ), this, "consumer-sdl-event", ( mlt_listener )consumer_sdl_event_cb ); + mlt_events_listen( MLT_CONSUMER_PROPERTIES( this->still ), this, "consumer-sdl-event", ( mlt_listener )consumer_sdl_event_cb ); return parent; } free( this ); @@ -99,13 +99,13 @@ mlt_consumer consumer_sdl_preview_init( char *arg ) void consumer_frame_show_cb( mlt_consumer sdl, mlt_consumer parent, mlt_frame frame ) { consumer_sdl this = parent->child; - this->last_speed = mlt_properties_get_double( mlt_frame_properties( frame ), "_speed" ); - mlt_events_fire( mlt_consumer_properties( parent ), "consumer-frame-show", frame, NULL ); + this->last_speed = mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame ), "_speed" ); + mlt_events_fire( MLT_CONSUMER_PROPERTIES( parent ), "consumer-frame-show", frame, NULL ); } static void consumer_sdl_event_cb( mlt_consumer sdl, mlt_consumer parent, SDL_Event *event ) { - mlt_events_fire( mlt_consumer_properties( parent ), "consumer-sdl-event", event, NULL ); + mlt_events_fire( MLT_CONSUMER_PROPERTIES( parent ), "consumer-sdl-event", event, NULL ); } static int consumer_start( mlt_consumer parent ) @@ -139,7 +139,7 @@ static int consumer_stop( mlt_consumer parent ) if ( this->joined == 0 ) { - mlt_properties properties = mlt_consumer_properties( parent ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( parent ); int app_locked = mlt_properties_get_int( properties, "app_locked" ); void ( *lock )( void ) = mlt_properties_get_data( properties, "app_lock", NULL ); void ( *unlock )( void ) = mlt_properties_get_data( properties, "app_unlock", NULL ); @@ -149,6 +149,9 @@ static int consumer_stop( mlt_consumer parent ) // Kill the thread and clean up this->running = 0; + if ( this->play ) mlt_consumer_stop( this->play ); + if ( this->still ) mlt_consumer_stop( this->still ); + pthread_join( this->thread, NULL ); this->joined = 1; @@ -177,9 +180,9 @@ static void *consumer_thread( void *arg ) mlt_frame frame = NULL; // properties - mlt_properties properties = mlt_consumer_properties( consumer ); - mlt_properties play = mlt_consumer_properties( this->play ); - mlt_properties still = mlt_consumer_properties( this->still ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer ); + mlt_properties play = MLT_CONSUMER_PROPERTIES( this->play ); + mlt_properties still = MLT_CONSUMER_PROPERTIES( this->still ); if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE ) < 0 ) { @@ -211,8 +214,8 @@ static void *consumer_thread( void *arg ) mlt_properties_set_int( play, "progressive", 1 ); mlt_properties_set_int( still, "progressive", 1 ); - mlt_properties_pass( play, mlt_consumer_properties( consumer ), "play." ); - mlt_properties_pass( still, mlt_consumer_properties( consumer ), "still." ); + mlt_properties_pass( play, MLT_CONSUMER_PROPERTIES( consumer ), "play." ); + mlt_properties_pass( still, MLT_CONSUMER_PROPERTIES( consumer ), "still." ); mlt_properties_set_data( play, "app_lock", mlt_properties_get_data( properties, "app_lock", NULL ), 0, NULL, NULL ); mlt_properties_set_data( still, "app_lock", mlt_properties_get_data( properties, "app_lock", NULL ), 0, NULL, NULL ); @@ -232,7 +235,7 @@ static void *consumer_thread( void *arg ) if ( frame != NULL ) { // Get the speed of the frame - double speed = mlt_properties_get_double( mlt_frame_properties( frame ), "_speed" ); + double speed = mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame ), "_speed" ); // Determine which speed to use double use_speed = first ? speed : this->last_speed; @@ -248,10 +251,10 @@ static void *consumer_thread( void *arg ) mlt_properties_set_int( properties, "changed", 0 ); // Set the changed property on this frame for the benefit of still - mlt_properties_set_int( mlt_frame_properties( frame ), "refresh", refresh ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "refresh", refresh ); // Make sure the recipient knows that this frame isn't really rendered - mlt_properties_set_int( mlt_frame_properties( frame ), "rendered", 0 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 0 ); // If we're not the first frame and both consumers are stopped, then stop ourselves if ( !first && mlt_consumer_is_stopped( this->play ) && mlt_consumer_is_stopped( this->still ) ) @@ -298,7 +301,7 @@ static void *consumer_thread( void *arg ) // Copy the rectangle info from the active consumer if ( this->running ) { - mlt_properties active = mlt_consumer_properties( this->active ); + mlt_properties active = MLT_CONSUMER_PROPERTIES( this->active ); mlt_properties_set_int( properties, "rect_x", mlt_properties_get_int( active, "rect_x" ) ); mlt_properties_set_int( properties, "rect_y", mlt_properties_get_int( active, "rect_y" ) ); mlt_properties_set_int( properties, "rect_w", mlt_properties_get_int( active, "rect_w" ) ); diff --git a/src/modules/sdl/consumer_sdl_still.c b/src/modules/sdl/consumer_sdl_still.c index 3ac12c0f..f4413525 100644 --- a/src/modules/sdl/consumer_sdl_still.c +++ b/src/modules/sdl/consumer_sdl_still.c @@ -90,8 +90,8 @@ mlt_consumer consumer_sdl_still_init( char *arg ) parent->close = consumer_close; // get a handle on properties - mlt_service service = mlt_consumer_service( parent ); - this->properties = mlt_service_properties( service ); + mlt_service service = MLT_CONSUMER_SERVICE( parent ); + this->properties = MLT_SERVICE_PROPERTIES( service ); // Default scaler (for now we'll use nearest) mlt_properties_set( this->properties, "rescale", "nearest" ); @@ -162,8 +162,8 @@ static int consumer_start( mlt_consumer parent ) if ( !this->filtered ) { mlt_filter filter = mlt_factory_filter( "avcolour_space", NULL ); - mlt_properties_set_int( mlt_filter_properties( filter ), "forced", mlt_image_yuv422 ); - mlt_service_attach( mlt_consumer_service( &this->parent ), filter ); + mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "forced", mlt_image_yuv422 ); + mlt_service_attach( MLT_CONSUMER_SERVICE( parent ), filter ); mlt_filter_close( filter ); this->filtered = 1; } @@ -416,14 +416,14 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) } else { - changed = mlt_properties_get_int( properties, "changed" ) | mlt_properties_get_int( mlt_frame_properties( frame ), "refresh" ); + changed = mlt_properties_get_int( properties, "changed" ) | mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "refresh" ); mlt_properties_set_int( properties, "changed", 0 ); } if ( changed == 0 && this->last_position == mlt_frame_get_position( frame ) && - this->last_producer == mlt_properties_get_data( mlt_frame_properties( frame ), "_producer", NULL ) ) + this->last_producer == mlt_properties_get_data( MLT_FRAME_PROPERTIES( frame ), "_producer", NULL ) ) { sdl_unlock_display( ); if ( unlock != NULL ) @@ -433,7 +433,7 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) // Update last frame shown info this->last_position = mlt_frame_get_position( frame ); - this->last_producer = mlt_properties_get_data( mlt_frame_properties( frame ), "_producer", NULL ); + this->last_producer = mlt_properties_get_data( MLT_FRAME_PROPERTIES( frame ), "_producer", NULL ); // Get the image, width and height if ( image == NULL ) @@ -444,9 +444,9 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) // Something? (or everything?) is too sensitive to aspect ratio //width = this->rect.w; //height = this->rect.h; - //mlt_properties_set( mlt_frame_properties( frame ), "distort", "true" ); - //mlt_properties_set_int( mlt_frame_properties( frame ), "normalised_width", width ); - //mlt_properties_set_int( mlt_frame_properties( frame ), "normalised_height", height ); + //mlt_properties_set( MLT_FRAME_PROPERTIES( frame ), "distort", "true" ); + //mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "normalised_width", width ); + //mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "normalised_height", height ); mlt_frame_get_image( frame, &image, &vfmt, &width, &height, 0 ); } @@ -486,7 +486,7 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) mlt_properties_set_int( this->properties, "rect_h", this->rect.h ); } - if ( this->sdl_screen != NULL ) + if ( !mlt_consumer_is_stopped( &this->parent ) && this->sdl_screen != NULL && this->sdl_screen->pixels != NULL ) { memset( this->sdl_screen->pixels, 0, this->window_width * this->window_height * this->sdl_screen->format->BytesPerPixel ); @@ -533,9 +533,9 @@ static void *consumer_thread( void *arg ) // internal intialization mlt_frame frame = NULL; - struct timespec tm = { 0, 10000000 }; + struct timespec tm = { 0, 99999999 }; - if ( mlt_properties_get_int( mlt_consumer_properties( consumer ), "sdl_started" ) == 0 ) + if ( mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( consumer ), "sdl_started" ) == 0 ) { if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE ) < 0 ) { @@ -548,12 +548,12 @@ static void *consumer_thread( void *arg ) } else { - mlt_properties_set_int( mlt_consumer_properties( consumer ), "changed", 2 ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( consumer ), "changed", 2 ); if ( SDL_GetVideoSurface( ) != NULL ) { this->sdl_screen = SDL_GetVideoSurface( ); consumer_get_dimensions( &this->window_width, &this->window_height ); - mlt_properties_set_int( mlt_consumer_properties( consumer ), "changed", 0 ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( consumer ), "changed", 0 ); } } @@ -572,7 +572,7 @@ static void *consumer_thread( void *arg ) } } - if ( mlt_properties_get_int( mlt_consumer_properties( consumer ), "sdl_started" ) == 0 ) + if ( mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( consumer ), "sdl_started" ) == 0 ) SDL_Quit( ); this->sdl_screen = NULL; diff --git a/src/modules/sox/filter_sox.c b/src/modules/sox/filter_sox.c index b707f5b3..355a8aba 100644 --- a/src/modules/sox/filter_sox.c +++ b/src/modules/sox/filter_sox.c @@ -90,7 +90,7 @@ static int create_effect( mlt_filter this, char *value, int count, int channel, sprintf( id, "_effect_%d_%d", count, channel ); // Save the effect state - mlt_properties_set_data( mlt_filter_properties( this ), id, eff, 0, mlt_pool_release, NULL ); + mlt_properties_set_data( MLT_FILTER_PROPERTIES( this ), id, eff, 0, mlt_pool_release, NULL ); error = 0; } } @@ -110,13 +110,13 @@ static int create_effect( mlt_filter this, char *value, int count, int channel, static int filter_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { // Get the properties of the frame - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); // Get the filter service mlt_filter filter = mlt_frame_pop_audio( frame ); // Get the filter properties - mlt_properties filter_properties = mlt_filter_properties( filter ); + mlt_properties filter_properties = MLT_FILTER_PROPERTIES( filter ); // Get the properties st_sample_t *input_buffer = mlt_properties_get_data( filter_properties, "input_buffer", NULL ); @@ -345,7 +345,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) frame->get_audio = filter_get_audio; // Parse the window property and allocate smoothing buffer if needed - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); int window = mlt_properties_get_int( properties, "window" ); if ( mlt_properties_get( properties, "smooth_buffer" ) == NULL && window > 1 ) { @@ -371,7 +371,7 @@ mlt_filter filter_sox_init( char *arg ) { void *input_buffer = mlt_pool_alloc( BUFFER_LEN ); void *output_buffer = mlt_pool_alloc( BUFFER_LEN ); - mlt_properties properties = mlt_filter_properties( this ); + mlt_properties properties = MLT_FILTER_PROPERTIES( this ); this->process = filter_process; diff --git a/src/modules/valerie/consumer_valerie.c b/src/modules/valerie/consumer_valerie.c index 4c36a9ec..984c743a 100644 --- a/src/modules/valerie/consumer_valerie.c +++ b/src/modules/valerie/consumer_valerie.c @@ -46,19 +46,19 @@ mlt_consumer consumer_valerie_init( char *arg ) { char *temp = NULL; int port = atoi( strchr( arg, ':' ) + 1 ); - mlt_properties_set( mlt_consumer_properties( this ), "server", arg ); - temp = mlt_properties_get( mlt_consumer_properties( this ), "server" ); + mlt_properties_set( MLT_CONSUMER_PROPERTIES( this ), "server", arg ); + temp = mlt_properties_get( MLT_CONSUMER_PROPERTIES( this ), "server" ); *( strchr( temp, ':' ) ) = '\0'; - mlt_properties_set_int( mlt_consumer_properties( this ), "port", port ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( this ), "port", port ); } else { - mlt_properties_set( mlt_consumer_properties( this ), "server", arg == NULL ? "localhost" : arg ); - mlt_properties_set_int( mlt_consumer_properties( this ), "port", 5250 ); + mlt_properties_set( MLT_CONSUMER_PROPERTIES( this ), "server", arg == NULL ? "localhost" : arg ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( this ), "port", 5250 ); } - mlt_properties_set_int( mlt_consumer_properties( this ), "unit", 0 ); - mlt_properties_set( mlt_consumer_properties( this ), "command", "append" ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( this ), "unit", 0 ); + mlt_properties_set( MLT_CONSUMER_PROPERTIES( this ), "command", "append" ); // Allow thread to be started/stopped this->start = consumer_start; @@ -78,10 +78,10 @@ mlt_consumer consumer_valerie_init( char *arg ) static int consumer_start( mlt_consumer this ) { // Get the producer service - mlt_service service = mlt_service_producer( mlt_consumer_service( this ) ); + mlt_service service = mlt_service_producer( MLT_CONSUMER_SERVICE( this ) ); // Get the properties object - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Get all the properties now char *server = mlt_properties_get( properties, "server" ); @@ -101,10 +101,10 @@ static int consumer_start( mlt_consumer this ) if ( service != NULL ) { if ( title != NULL ) - mlt_properties_set( mlt_service_properties( service ), "title", title ); - else if ( mlt_properties_get( mlt_service_properties( service ), "title" ) == NULL ) - mlt_properties_set( mlt_service_properties( service ), "title", "Anonymous Submission" ); - title = mlt_properties_get( mlt_service_properties( service ), "title" ); + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), "title", title ); + else if ( mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "title" ) == NULL ) + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), "title", "Anonymous Submission" ); + title = mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "title" ); } strcpy( command, cmd == NULL ? "" : cmd ); diff --git a/src/modules/vorbis/producer_vorbis.c b/src/modules/vorbis/producer_vorbis.c index 46cae760..76671a27 100644 --- a/src/modules/vorbis/producer_vorbis.c +++ b/src/modules/vorbis/producer_vorbis.c @@ -53,7 +53,7 @@ mlt_producer producer_vorbis_init( char *file ) if ( mlt_producer_init( this, NULL ) == 0 ) { // Get the properties - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Set the resource property (required for all producers) mlt_properties_set( properties, "resource", file ); @@ -113,7 +113,7 @@ static int producer_open( mlt_producer this, char *file ) if ( error == 0 ) { // Get the properties - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Assign the ov structure mlt_properties_set_data( properties, "ogg_vorbis_file", ov, 0, producer_file_close, NULL ); @@ -150,7 +150,7 @@ static int producer_open( mlt_producer this, char *file ) static double producer_time_of_frame( mlt_producer this, mlt_position position ) { // Get the properties - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Obtain the fps double fps = mlt_properties_get_double( properties, "fps" ); @@ -165,7 +165,7 @@ static double producer_time_of_frame( mlt_producer this, mlt_position position ) static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { // Get the properties from the frame - mlt_properties frame_properties = mlt_frame_properties( frame ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); // Obtain the frame number of this frame mlt_position position = mlt_properties_get_position( frame_properties, "vorbis_position" ); @@ -174,7 +174,7 @@ static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_form mlt_producer this = mlt_properties_get_data( frame_properties, "vorbis_producer", NULL ); // Get the producer properties - mlt_properties properties = mlt_producer_properties( this ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( this ); // Get the ogg vorbis file OggVorbis_File *ov = mlt_properties_get_data( properties, "ogg_vorbis_file", NULL ); @@ -306,7 +306,7 @@ static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_form static void producer_set_up_audio( mlt_producer this, mlt_frame frame ) { // Get the properties - mlt_properties properties = mlt_frame_properties( frame ); + mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); // Set the audio method frame->get_audio = producer_get_audio; @@ -327,7 +327,7 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index mlt_frame_set_position( *frame, mlt_producer_position( this ) ); // Set the position of this producer - mlt_properties_set_position( mlt_frame_properties( *frame ), "vorbis_position", mlt_producer_position( this ) ); + mlt_properties_set_position( MLT_FRAME_PROPERTIES( *frame ), "vorbis_position", mlt_producer_position( this ) ); // Set up the audio producer_set_up_audio( this, *frame ); diff --git a/src/modules/westley/consumer_westley.c b/src/modules/westley/consumer_westley.c index a5aaaf86..87ab12df 100644 --- a/src/modules/westley/consumer_westley.c +++ b/src/modules/westley/consumer_westley.c @@ -83,7 +83,7 @@ static char *westley_get_id( serialise_context context, mlt_service service, wes if ( i >= mlt_properties_count( map ) && type != westley_existing ) { // Attempt to reuse existing id - id = mlt_properties_get( mlt_service_properties( service ), "id" ); + id = mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "id" ); // If no id, or the id is used in the map (for another service), then // create a new one. @@ -155,7 +155,7 @@ mlt_consumer consumer_westley_init( char *arg ) this->start = consumer_start; this->is_stopped = consumer_is_stopped; - mlt_properties_set( mlt_consumer_properties( this ), "resource", arg ); + mlt_properties_set( MLT_CONSUMER_PROPERTIES( this ), "resource", arg ); // Return the consumer produced return this; @@ -168,7 +168,7 @@ mlt_consumer consumer_westley_init( char *arg ) return NULL; } -static inline void serialise_properties( serialise_context context, mlt_properties properties, xmlNode *node ) +static void serialise_properties( serialise_context context, mlt_properties properties, xmlNode *node ) { int i; xmlNode *p; @@ -199,16 +199,16 @@ static inline void serialise_properties( serialise_context context, mlt_properti } } -static inline void serialise_store_properties( serialise_context context, mlt_properties properties, xmlNode *node ) +static void serialise_store_properties( serialise_context context, mlt_properties properties, xmlNode *node, char *store ) { int i; xmlNode *p; // Enumerate the properties - for ( i = 0; context->store != NULL && i < mlt_properties_count( properties ); i++ ) + for ( i = 0; store != NULL && i < mlt_properties_count( properties ); i++ ) { char *name = mlt_properties_get_name( properties, i ); - if ( !strncmp( name, context->store, strlen( context->store ) ) ) + if ( !strncmp( name, store, strlen( store ) ) ) { char *value = mlt_properties_get_value( properties, i ); if ( value != NULL ) @@ -233,11 +233,11 @@ static inline void serialise_service_filters( serialise_context context, mlt_ser // Enumerate the filters for ( i = 0; ( filter = mlt_producer_filter( MLT_PRODUCER( service ), i ) ) != NULL; i ++ ) { - mlt_properties properties = mlt_filter_properties( filter ); + mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); if ( mlt_properties_get_int( properties, "_fezzik" ) == 0 ) { // Get a new id - if already allocated, do nothing - char *id = westley_get_id( context, mlt_filter_service( filter ), westley_filter ); + char *id = westley_get_id( context, MLT_FILTER_SERVICE( filter ), westley_filter ); if ( id != NULL ) { int in = mlt_properties_get_position( properties, "in" ); @@ -253,7 +253,7 @@ static inline void serialise_service_filters( serialise_context context, mlt_ser xmlNewProp( p, "out", temp ); } serialise_properties( context, properties, p ); - serialise_service_filters( context, mlt_filter_service( filter ), p ); + serialise_service_filters( context, MLT_FILTER_SERVICE( filter ), p ); } } } @@ -266,7 +266,7 @@ static void serialise_producer( serialise_context context, mlt_service service, if ( context->pass == 0 ) { - mlt_properties properties = mlt_service_properties( parent ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( parent ); // Get a new id - if already allocated, do nothing char *id = westley_get_id( context, parent, westley_producer ); if ( id == NULL ) @@ -287,7 +287,7 @@ static void serialise_producer( serialise_context context, mlt_service service, else { char *id = westley_get_id( context, parent, westley_existing ); - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); xmlNewProp( node, "parent", id ); xmlNewProp( node, "in", mlt_properties_get( properties, "in" ) ); xmlNewProp( node, "out", mlt_properties_get( properties, "out" ) ); @@ -322,16 +322,19 @@ static void serialise_multitrack( serialise_context context, mlt_service service xmlNode *track = xmlNewChild( node, NULL, "track", NULL ); int hide = 0; mlt_producer producer = mlt_multitrack_track( MLT_MULTITRACK( service ), i ); - mlt_properties properties = mlt_producer_properties( producer ); + mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); mlt_service parent = MLT_SERVICE( mlt_producer_cut_parent( producer ) ); char *id = westley_get_id( context, MLT_SERVICE( parent ), westley_existing ); xmlNewProp( track, "producer", id ); - if ( mlt_properties_get_int( properties, "_cut" ) == 1 ) + if ( mlt_producer_is_cut( producer ) ) { xmlNewProp( track, "in", mlt_properties_get( properties, "in" ) ); xmlNewProp( track, "out", mlt_properties_get( properties, "out" ) ); + serialise_store_properties( context, MLT_PRODUCER_PROPERTIES( producer ), track, context->store ); + serialise_store_properties( context, MLT_PRODUCER_PROPERTIES( producer ), track, "meta." ); + serialise_service_filters( context, MLT_PRODUCER_SERVICE( producer ), track ); } hide = mlt_properties_get_int( context->hide_map, id ); @@ -347,7 +350,7 @@ static void serialise_playlist( serialise_context context, mlt_service service, int i; xmlNode *child = node; mlt_playlist_clip_info info; - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); if ( context->pass == 0 ) { @@ -364,8 +367,8 @@ static void serialise_playlist( serialise_context context, mlt_service service, if ( info.producer != NULL ) { mlt_producer producer = mlt_producer_cut_parent( info.producer ); - char *service_s = mlt_properties_get( mlt_producer_properties( producer ), "mlt_service" ); - char *resource_s = mlt_properties_get( mlt_producer_properties( producer ), "resource" ); + char *service_s = mlt_properties_get( MLT_PRODUCER_PROPERTIES( producer ), "mlt_service" ); + char *resource_s = mlt_properties_get( MLT_PRODUCER_PROPERTIES( producer ), "resource" ); if ( resource_s != NULL && !strcmp( resource_s, "" ) ) serialise_playlist( context, MLT_SERVICE( producer ), node ); else if ( service_s != NULL && strcmp( service_s, "blank" ) != 0 ) @@ -380,7 +383,8 @@ static void serialise_playlist( serialise_context context, mlt_service service, xmlNewProp( child, "id", id ); // Store application specific properties - serialise_store_properties( context, properties, child ); + serialise_store_properties( context, properties, child, context->store ); + serialise_store_properties( context, properties, child, "meta." ); // Add producer to the map mlt_properties_set_int( context->hide_map, id, mlt_properties_get_int( properties, "hide" ) ); @@ -391,7 +395,7 @@ static void serialise_playlist( serialise_context context, mlt_service service, if ( ! mlt_playlist_get_clip_info( MLT_PLAYLIST( service ), &info, i ) ) { mlt_producer producer = mlt_producer_cut_parent( info.producer ); - char *service_s = mlt_properties_get( mlt_producer_properties( producer ), "mlt_service" ); + char *service_s = mlt_properties_get( MLT_PRODUCER_PROPERTIES( producer ), "mlt_service" ); if ( service_s != NULL && strcmp( service_s, "blank" ) == 0 ) { char length[ 20 ]; @@ -416,7 +420,11 @@ static void serialise_playlist( serialise_context context, mlt_service service, xmlNewProp( entry, "repeat", temp ); } if ( mlt_producer_is_cut( info.cut ) ) - serialise_service_filters( context, mlt_producer_service( info.cut ), entry ); + { + serialise_store_properties( context, MLT_PRODUCER_PROPERTIES( info.cut ), entry, context->store ); + serialise_store_properties( context, MLT_PRODUCER_PROPERTIES( info.cut ), entry, "meta." ); + serialise_service_filters( context, MLT_PRODUCER_SERVICE( info.cut ), entry ); + } } } } @@ -433,7 +441,7 @@ static void serialise_playlist( serialise_context context, mlt_service service, static void serialise_tractor( serialise_context context, mlt_service service, xmlNode *node ) { xmlNode *child = node; - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); if ( context->pass == 0 ) { @@ -455,7 +463,8 @@ static void serialise_tractor( serialise_context context, mlt_service service, x xmlNewProp( child, "out", mlt_properties_get( properties, "out" ) ); // Store application specific properties - serialise_store_properties( context, mlt_service_properties( service ), child ); + serialise_store_properties( context, MLT_SERVICE_PROPERTIES( service ), child, context->store ); + serialise_store_properties( context, MLT_SERVICE_PROPERTIES( service ), child, "meta." ); // Recurse on connected producer serialise_service( context, mlt_service_producer( service ), child ); @@ -466,7 +475,7 @@ static void serialise_tractor( serialise_context context, mlt_service service, x static void serialise_filter( serialise_context context, mlt_service service, xmlNode *node ) { xmlNode *child = node; - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); // Recurse on connected producer serialise_service( context, mlt_service_producer( service ), node ); @@ -493,7 +502,7 @@ static void serialise_filter( serialise_context context, mlt_service service, xm static void serialise_transition( serialise_context context, mlt_service service, xmlNode *node ) { xmlNode *child = node; - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); // Recurse on connected producer serialise_service( context, MLT_SERVICE( MLT_TRANSITION( service )->producer ), node ); @@ -522,7 +531,7 @@ static void serialise_service( serialise_context context, mlt_service service, x // Iterate over consumer/producer connections while ( service != NULL ) { - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); char *mlt_type = mlt_properties_get( properties, "mlt_type" ); // Tell about the producer @@ -603,7 +612,7 @@ static void serialise_service( serialise_context context, mlt_service service, x xmlDocPtr westley_make_doc( mlt_consumer consumer, mlt_service service ) { - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); xmlDocPtr doc = xmlNewDoc( "1.0" ); xmlNodePtr root = xmlNewNode( NULL, "westley" ); struct serialise_context_s *context = calloc( 1, sizeof( struct serialise_context_s ) ); @@ -622,7 +631,7 @@ xmlDocPtr westley_make_doc( mlt_consumer consumer, mlt_service service ) } // Assign the additional 'storage' pattern for properties - context->store = mlt_properties_get( mlt_consumer_properties( consumer ), "store" ); + context->store = mlt_properties_get( MLT_CONSUMER_PROPERTIES( consumer ), "store" ); // Assign a title property if ( mlt_properties_get( properties, "title" ) != NULL ) @@ -633,7 +642,7 @@ xmlDocPtr westley_make_doc( mlt_consumer consumer, mlt_service service ) context->hide_map = mlt_properties_new(); // Ensure producer is a framework producer - mlt_properties_set( mlt_service_properties( service ), "mlt_type", "mlt_producer" ); + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), "mlt_type", "mlt_producer" ); // In pass one, we serialise the end producers and playlists, // adding them to a map keyed by address. @@ -658,28 +667,28 @@ static int consumer_start( mlt_consumer this ) xmlDocPtr doc = NULL; // Get the producer service - mlt_service service = mlt_service_producer( mlt_consumer_service( this ) ); + mlt_service service = mlt_service_producer( MLT_CONSUMER_SERVICE( this ) ); if ( service != NULL ) { - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); char *resource = mlt_properties_get( properties, "resource" ); // Set the title if provided if ( mlt_properties_get( properties, "title" ) ) - mlt_properties_set( mlt_service_properties( service ), "title", mlt_properties_get( properties, "title" ) ); - else if ( mlt_properties_get( mlt_service_properties( service ), "title" ) == NULL ) - mlt_properties_set( mlt_service_properties( service ), "title", "Anonymous Submission" ); + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), "title", mlt_properties_get( properties, "title" ) ); + else if ( mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "title" ) == NULL ) + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), "title", "Anonymous Submission" ); // Check for a root on the consumer properties and pass to service if ( mlt_properties_get( properties, "root" ) ) - mlt_properties_set( mlt_service_properties( service ), "root", mlt_properties_get( properties, "root" ) ); + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), "root", mlt_properties_get( properties, "root" ) ); // Specify roots in other cases... if ( resource != NULL && mlt_properties_get( properties, "root" ) == NULL ) { // Get the current working directory char *cwd = getcwd( NULL, 0 ); - mlt_properties_set( mlt_service_properties( service ), "root", cwd ); + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), "root", cwd ); free( cwd ); } diff --git a/src/modules/westley/producer_westley.c b/src/modules/westley/producer_westley.c index 2f3a4581..276eecf6 100644 --- a/src/modules/westley/producer_westley.c +++ b/src/modules/westley/producer_westley.c @@ -109,10 +109,10 @@ static int context_push_service( deserialise_context this, mlt_service that, enu this->stack_types[ this->stack_service_size++ ] = type; // Record the tree branch on which this service lives - if ( that != NULL && mlt_properties_get( mlt_service_properties( that ), "_westley_branch" ) == NULL ) + if ( that != NULL && mlt_properties_get( MLT_SERVICE_PROPERTIES( that ), "_westley_branch" ) == NULL ) { char s[ BRANCH_SIG_LEN ]; - mlt_properties_set( mlt_service_properties( that ), "_westley_branch", serialise_branch( this, s ) ); + mlt_properties_set( MLT_SERVICE_PROPERTIES( that ), "_westley_branch", serialise_branch( this, s ) ); } } return ret; @@ -210,14 +210,14 @@ static int add_producer( deserialise_context context, mlt_service service, mlt_p if ( service != NULL && container != NULL ) { - char *container_branch = mlt_properties_get( mlt_service_properties( container ), "_westley_branch" ); - char *service_branch = mlt_properties_get( mlt_service_properties( service ), "_westley_branch" ); + char *container_branch = mlt_properties_get( MLT_SERVICE_PROPERTIES( container ), "_westley_branch" ); + char *service_branch = mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "_westley_branch" ); contained = !strncmp( container_branch, service_branch, strlen( container_branch ) ); } if ( contained ) { - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); char *hide_s = mlt_properties_get( properties, "hide" ); // Indicate that this service is no longer top of stack @@ -280,20 +280,21 @@ static void attach_filters( mlt_service this, mlt_service that ) for ( i = 0; ( filter = mlt_service_filter( that, i ) ) != NULL; i ++ ) { mlt_service_attach( this, filter ); - attach_filters( mlt_filter_service( filter ), mlt_filter_service( filter ) ); + attach_filters( MLT_FILTER_SERVICE( filter ), MLT_FILTER_SERVICE( filter ) ); } } } static void on_start_tractor( deserialise_context context, const xmlChar *name, const xmlChar **atts) { - mlt_service service = mlt_tractor_service( mlt_tractor_new( ) ); - mlt_properties properties = mlt_service_properties( service ); + mlt_tractor tractor = mlt_tractor_new( ); + mlt_service service = MLT_TRACTOR_SERVICE( tractor ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); track_service( context->destructors, service, (mlt_destructor) mlt_tractor_close ); for ( ; atts != NULL && *atts != NULL; atts += 2 ) - mlt_properties_set( mlt_service_properties( service ), (char*) atts[0], (char*) atts[1] ); + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), (char*) atts[0], (char*) atts[1] ); if ( mlt_properties_get( properties, "id" ) != NULL ) mlt_properties_set_data( context->producer_map, mlt_properties_get( properties, "id" ), service, 0, NULL, NULL ); @@ -313,6 +314,10 @@ static void on_end_tractor( deserialise_context context, const xmlChar *name ) if ( add_producer( context, tractor, 0, mlt_producer_get_out( MLT_PRODUCER( tractor ) ) ) == 0 ) context_push_service( context, tractor, type ); } + else + { + fprintf( stderr, "Invalid state for tractor\n" ); + } } static void on_start_multitrack( deserialise_context context, const xmlChar *name, const xmlChar **atts) @@ -323,23 +328,25 @@ static void on_start_multitrack( deserialise_context context, const xmlChar *nam // If we don't have a parent, then create one now, providing we're in a state where we can if ( parent == NULL || ( type == mlt_playlist_type || type == mlt_multitrack_type ) ) { + mlt_tractor tractor = NULL; // Push the parent back if ( parent != NULL ) context_push_service( context, parent, type ); // Create a tractor to contain the multitrack - parent = mlt_tractor_service( mlt_tractor_new( ) ); + tractor = mlt_tractor_new( ); + parent = MLT_TRACTOR_SERVICE( tractor ); track_service( context->destructors, parent, (mlt_destructor) mlt_tractor_close ); type = mlt_tractor_type; // Flag it as a synthesised tractor for clean up later - mlt_properties_set_int( mlt_service_properties( parent ), "fezzik_synth", 1 ); + mlt_properties_set_int( MLT_SERVICE_PROPERTIES( parent ), "fezzik_synth", 1 ); } if ( type == mlt_tractor_type ) { mlt_service service = MLT_SERVICE( mlt_tractor_multitrack( MLT_TRACTOR( parent ) ) ); - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); for ( ; atts != NULL && *atts != NULL; atts += 2 ) mlt_properties_set( properties, (char*) atts[0], (char*) atts[1] ); @@ -367,8 +374,9 @@ static void on_end_multitrack( deserialise_context context, const xmlChar *name static void on_start_playlist( deserialise_context context, const xmlChar *name, const xmlChar **atts) { - mlt_service service = mlt_playlist_service( mlt_playlist_init() ); - mlt_properties properties = mlt_service_properties( service ); + mlt_playlist playlist = mlt_playlist_init( ); + mlt_service service = MLT_PLAYLIST_SERVICE( playlist ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); track_service( context->destructors, service, (mlt_destructor) mlt_playlist_close ); @@ -395,7 +403,7 @@ static void on_end_playlist( deserialise_context context, const xmlChar *name ) if ( service != NULL && type == mlt_playlist_type ) { - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); mlt_position in = mlt_properties_get_position( properties, "in" ); mlt_position out = mlt_properties_get_position( properties, "out" ); @@ -415,7 +423,7 @@ static void on_start_producer( deserialise_context context, const xmlChar *name, mlt_service service = calloc( 1, sizeof( struct mlt_service_s ) ); mlt_service_init( service, NULL ); - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); context_push_service( context, service, mlt_dummy_producer_type ); @@ -427,7 +435,7 @@ static void on_end_producer( deserialise_context context, const xmlChar *name ) { enum service_type type; mlt_service service = context_pop_service( context, &type ); - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); if ( service != NULL && type == mlt_dummy_producer_type ) { @@ -460,6 +468,9 @@ static void on_end_producer( deserialise_context context, const xmlChar *name ) if ( producer == NULL && resource != NULL ) producer = MLT_SERVICE( mlt_factory_producer( "fezzik", resource ) ); + if ( producer == NULL ) + producer = MLT_SERVICE( mlt_factory_producer( "fezzik", "+INVALID.txt" ) ); + // Track this producer track_service( context->destructors, producer, (mlt_destructor) mlt_producer_close ); @@ -492,7 +503,7 @@ static void on_end_producer( deserialise_context context, const xmlChar *name ) mlt_properties_set( properties, "out", NULL ); // Inherit the properties - mlt_properties_inherit( mlt_service_properties( producer ), properties ); + mlt_properties_inherit( MLT_SERVICE_PROPERTIES( producer ), properties ); // Attach all filters from service onto producer attach_filters( producer, service ); @@ -513,7 +524,7 @@ static void on_end_producer( deserialise_context context, const xmlChar *name ) if ( parent != NULL ) { // Get the parent properties - properties = mlt_service_properties( parent ); + properties = MLT_SERVICE_PROPERTIES( parent ); char *resource = mlt_properties_get( properties, "resource" ); @@ -638,7 +649,7 @@ static void on_start_entry( deserialise_context context, const xmlChar *name, co } // Push the cut onto the stack - context_push_service( context, mlt_producer_service( entry ), mlt_entry_type ); + context_push_service( context, MLT_PRODUCER_SERVICE( entry ), mlt_entry_type ); mlt_properties_close( temp ); } @@ -664,18 +675,18 @@ static void on_start_track( deserialise_context context, const xmlChar *name, co // Push the dummy service onto the stack context_push_service( context, service, mlt_entry_type ); - mlt_properties_set( mlt_service_properties( service ), "resource", "" ); + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), "resource", "" ); for ( ; atts != NULL && *atts != NULL; atts += 2 ) { - mlt_properties_set( mlt_service_properties( service ), (char*) atts[0], (char*) atts[1] ); + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), (char*) atts[0], (char*) atts[1] ); // Look for the producer attribute if ( strcmp( atts[ 0 ], "producer" ) == 0 ) { mlt_producer producer = mlt_properties_get_data( context->producer_map, (char*) atts[1], NULL ); if ( producer != NULL ) - mlt_properties_set_data( mlt_service_properties( service ), "producer", producer, 0, NULL, NULL ); + mlt_properties_set_data( MLT_SERVICE_PROPERTIES( service ), "producer", producer, 0, NULL, NULL ); } } } @@ -688,13 +699,13 @@ static void on_end_track( deserialise_context context, const xmlChar *name ) if ( track != NULL && track_type == mlt_entry_type ) { - mlt_properties track_props = mlt_service_properties( track ); + mlt_properties track_props = MLT_SERVICE_PROPERTIES( track ); enum service_type parent_type; mlt_service parent = context_pop_service( context, &parent_type ); mlt_multitrack multitrack = NULL; mlt_producer producer = mlt_properties_get_data( track_props, "producer", NULL ); - mlt_properties producer_props = mlt_producer_properties( producer ); + mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer ); if ( parent_type == mlt_tractor_type ) multitrack = mlt_tractor_multitrack( MLT_TRACTOR( parent ) ); @@ -712,8 +723,9 @@ static void on_end_track( deserialise_context context, const xmlChar *name ) mlt_producer cut = mlt_producer_cut( MLT_PRODUCER( producer ), mlt_properties_get_position( track_props, "in" ), mlt_properties_get_position( track_props, "out" ) ); - mlt_properties_set_int( mlt_producer_properties( cut ), "cut", 1 ); mlt_multitrack_connect( multitrack, cut, mlt_multitrack_count( multitrack ) ); + mlt_properties_inherit( MLT_PRODUCER_PROPERTIES( cut ), track_props ); + track_props = MLT_PRODUCER_PROPERTIES( cut ); mlt_producer_close( cut ); } else @@ -751,7 +763,7 @@ static void on_start_filter( deserialise_context context, const xmlChar *name, c mlt_service service = calloc( 1, sizeof( struct mlt_service_s ) ); mlt_service_init( service, NULL ); - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); context_push_service( context, service, mlt_dummy_filter_type ); @@ -764,7 +776,7 @@ static void on_end_filter( deserialise_context context, const xmlChar *name ) { enum service_type type; mlt_service service = context_pop_service( context, &type ); - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); enum service_type parent_type; mlt_service parent = context_pop_service( context, &parent_type ); @@ -772,7 +784,7 @@ static void on_end_filter( deserialise_context context, const xmlChar *name ) if ( service != NULL && type == mlt_dummy_filter_type ) { mlt_service filter = MLT_SERVICE( mlt_factory_filter( mlt_properties_get( properties, "mlt_service" ), NULL ) ); - mlt_properties filter_props = mlt_service_properties( filter ); + mlt_properties filter_props = MLT_SERVICE_PROPERTIES( filter ); track_service( context->destructors, filter, (mlt_destructor) mlt_filter_close ); @@ -826,7 +838,7 @@ static void on_start_transition( deserialise_context context, const xmlChar *nam mlt_service service = calloc( 1, sizeof( struct mlt_service_s ) ); mlt_service_init( service, NULL ); - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); context_push_service( context, service, mlt_dummy_transition_type ); @@ -839,7 +851,7 @@ static void on_end_transition( deserialise_context context, const xmlChar *name { enum service_type type; mlt_service service = context_pop_service( context, &type ); - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); enum service_type parent_type; mlt_service parent = context_pop_service( context, &parent_type ); @@ -847,7 +859,7 @@ static void on_end_transition( deserialise_context context, const xmlChar *name if ( service != NULL && type == mlt_dummy_transition_type ) { mlt_service effect = MLT_SERVICE( mlt_factory_transition(mlt_properties_get(properties,"mlt_service"), NULL ) ); - mlt_properties effect_props = mlt_service_properties( effect ); + mlt_properties effect_props = MLT_SERVICE_PROPERTIES( effect ); track_service( context->destructors, effect, (mlt_destructor) mlt_transition_close ); @@ -903,7 +915,7 @@ static void on_start_property( deserialise_context context, const xmlChar *name, { enum service_type type; mlt_service service = context_pop_service( context, &type ); - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); char *value = NULL; if ( service != NULL ) @@ -935,7 +947,7 @@ static void on_end_property( deserialise_context context, const xmlChar *name ) { enum service_type type; mlt_service service = context_pop_service( context, &type ); - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); if ( service != NULL ) { @@ -1062,7 +1074,7 @@ static void on_characters( void *ctx, const xmlChar *ch, int len ) char *value = calloc( len + 1, 1 ); enum service_type type; mlt_service service = context_pop_service( context, &type ); - mlt_properties properties = mlt_service_properties( service ); + mlt_properties properties = MLT_SERVICE_PROPERTIES( service ); if ( service != NULL ) context_push_service( context, service, type ); @@ -1335,7 +1347,7 @@ mlt_producer producer_westley_init( int info, char *data ) { // Verify it is a producer service (mlt_type="mlt_producer") // (producer, playlist, multitrack) - char *type = mlt_properties_get( mlt_service_properties( service ), "mlt_type" ); + char *type = mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "mlt_type" ); if ( type == NULL || ( strcmp( type, "mlt_producer" ) != 0 && strcmp( type, "producer" ) != 0 ) ) service = NULL; } @@ -1367,7 +1379,7 @@ mlt_producer producer_westley_init( int info, char *data ) // We are done referencing destructor property list // Set this var to service properties for convenience - properties = mlt_service_properties( service ); + properties = MLT_SERVICE_PROPERTIES( service ); // Assign the title mlt_properties_set( properties, "title", title ); diff --git a/src/modules/xine/filter_deinterlace.c b/src/modules/xine/filter_deinterlace.c index e4b851ce..fa48a4da 100644 --- a/src/modules/xine/filter_deinterlace.c +++ b/src/modules/xine/filter_deinterlace.c @@ -85,14 +85,14 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * // Check that we want progressive and we aren't already progressive if ( *format == mlt_image_yuv422 && - !mlt_properties_get_int( mlt_frame_properties( this ), "progressive" ) && - mlt_properties_get_int( mlt_frame_properties( this ), "consumer_deinterlace" ) ) + !mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "progressive" ) && + mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "consumer_deinterlace" ) ) { // Get the input image error = mlt_frame_get_image( this, image, format, width, height, 1 ); // Determine deinterlace method - char *method_str = mlt_properties_get( mlt_filter_properties( filter ), "method" ); + char *method_str = mlt_properties_get( MLT_FILTER_PROPERTIES( filter ), "method" ); int method = DEINTERLACE_LINEARBLEND; if ( strcmp( method_str, "bob" ) == 0 ) @@ -108,7 +108,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * deinterlace_yuv( *image, image, *width * 2, *height, method ); // Make sure that others know the frame is deinterlaced - mlt_properties_set_int( mlt_frame_properties( this ), "progressive", 1 ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( this ), "progressive", 1 ); } else { @@ -142,7 +142,7 @@ mlt_filter filter_deinterlace_init( void *arg ) if ( this != NULL ) { this->process = deinterlace_process; - mlt_properties_set( mlt_filter_properties( this ), "method", arg == NULL ? "linearblend" : arg ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "method", arg == NULL ? "linearblend" : arg ); } return this; } diff --git a/src/valerie/valerie_remote.c b/src/valerie/valerie_remote.c index bdda706e..89a184f5 100644 --- a/src/valerie/valerie_remote.c +++ b/src/valerie/valerie_remote.c @@ -229,7 +229,7 @@ static valerie_response valerie_remote_push( valerie_remote remote, char *comman if ( service != NULL ) { mlt_consumer consumer = mlt_factory_consumer( "westley", "buffer" ); - mlt_properties properties = mlt_consumer_properties( consumer ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer ); char *buffer = NULL; mlt_consumer_connect( consumer, service ); mlt_consumer_start( consumer );