On Tue, Jun 21, 2011 at 11:18 AM, j-b-m <[email protected]> wrote:
> On Tuesday 21 June 2011 19:32:02 Dan Dennedy wrote:
>
>> >
>> > melt -profile dv_pal test.mlt colour:blue
>> >
>> > Expected behaviour: we should first see a letterboxed 16:9 red clip, then
>> > a blue clip with normal 4:3 PAL ratio.
>> >
>> > But in fact, the blue clip appears with 16:9 aspect ratio, the profile
>> > from the .mlt file seems to have corrupted our PAL DV profile.
>>
>> The loader producer is supposed to detect this situation (xml producer
>> changes explicit profile), insert a consumer producer, and restore the
>> explicit profile.
>
> Ok, I see. Patch below fixes the issue, but probably leaks a profile...
> but maybe it helps for a better solution
>
> regards
> jb
>
>
> diff --git a/src/modules/core/producer_loader.c
> b/src/modules/core/producer_loader.c
> index 2600b62..35abc04 100644
> --- a/src/modules/core/producer_loader.c
> +++ b/src/modules/core/producer_loader.c
> @@ -95,12 +95,12 @@ static mlt_producer create_producer( mlt_profile profile,
> char *file )
>                {
>                        char *name = mlt_properties_get_name( dictionary, i );
>                        if ( fnmatch( name, lookup, 0 ) == 0 )
> -                               result = create_from( profile, file, 
> mlt_properties_get_value(
> dictionary, i ) );
> +                               result = create_from( backup_profile, file,
> mlt_properties_get_value( dictionary, i ) );
>                }
>
>                // Check if the producer changed the profile - xml does this.
>                // The consumer producer does not handle frame rate 
> differences.
> -               if ( result && backup_profile->is_explicit && (
> +               if ( result && profile->is_explicit && (
>                     profile->width != backup_profile->width ||
>                     profile->height != backup_profile->height ||
>                     profile->sample_aspect_num != 
> backup_profile->sample_aspect_num ||
> @@ -108,22 +108,22 @@ static mlt_producer create_producer( mlt_profile 
> profile,
> char *file )
>                     profile->colorspace != backup_profile->colorspace ) )
>                {
>                        // Restore the original profile attributes.
> -                       profile->display_aspect_den = 
> backup_profile->display_aspect_den;
> -                       profile->display_aspect_num = 
> backup_profile->display_aspect_num;
> -                       profile->frame_rate_den = 
> backup_profile->frame_rate_den;
> -                       profile->frame_rate_num = 
> backup_profile->frame_rate_num;
> -                       profile->height = backup_profile->height;
> -                       profile->progressive = backup_profile->progressive;
> -                       profile->sample_aspect_den = 
> backup_profile->sample_aspect_den;
> -                       profile->sample_aspect_num = 
> backup_profile->sample_aspect_num;
> -                       profile->width = backup_profile->width;
> +                       backup_profile->display_aspect_den = 
> profile->display_aspect_den;
> +                       backup_profile->display_aspect_num = 
> profile->display_aspect_num;
> +                       backup_profile->frame_rate_den = 
> profile->frame_rate_den;
> +                       backup_profile->frame_rate_num = 
> profile->frame_rate_num;
> +                       backup_profile->height = profile->height;
> +                       backup_profile->progressive = profile->progressive;
> +                       backup_profile->sample_aspect_den = 
> profile->sample_aspect_den;
> +                       backup_profile->sample_aspect_num = 
> profile->sample_aspect_num;
> +                       backup_profile->width = profile->width;
>
>                        // Use the 'consumer' producer.
>                        mlt_producer_close( result );
> -                       result = mlt_factory_producer( profile, "consumer", 
> file );
> +                       result = mlt_factory_producer( backup_profile, 
> "consumer", file );
>                }
>
> -               mlt_profile_close( backup_profile );
> +               //mlt_profile_close( backup_profile );
>                free( lookup );
>        }
>
>

It was the consumer producer not isolating the profile it is using:

diff --git a/src/modules/core/producer_consumer.c
b/src/modules/core/producer_consumer.c
index 261810e..91ba97e 100644
--- a/src/modules/core/producer_consumer.c
+++ b/src/modules/core/producer_consumer.c
@@ -30,7 +30,6 @@ struct context_s {
        mlt_producer producer;
        mlt_consumer consumer;
        mlt_profile profile;
-       int is_close_profile;
 };
 typedef struct context_s *context;

@@ -100,13 +99,11 @@ static int get_frame( mlt_producer this,
mlt_frame_ptr frame, int index )
                if ( profile_name )
                {
                        cx->profile = mlt_profile_init( profile_name );
-                       cx->is_close_profile = 1;
                        cx->profile->is_explicit = 1;
                }
                else
                {
-                       cx->profile = profile;
-                       cx->is_close_profile = 0;
+                       cx->profile = mlt_profile_clone( profile );
                        cx->profile->is_explicit = 0;
                }

@@ -195,8 +192,7 @@ static void producer_close( mlt_producer this )
                mlt_consumer_stop( cx->consumer );
                mlt_consumer_close( cx->consumer );
                mlt_producer_close( cx->producer );
-               if ( cx->is_close_profile )
-                       mlt_profile_close( cx->profile );
+               mlt_profile_close( cx->profile );
        }
        
        this->close = NULL;

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Mlt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to