X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmelt%2Fmelt.c;h=b8e974d704c4c618c58d30253e73f3dcefa03710;hb=52d8310e82be1fcbcd0b0da3c7ad7036159cbd7a;hp=7541ae4910ba07e48cdfcc656a740b9c697c6dc9;hpb=66efd2568e1002f11f19d2c672aaf090f7073192;p=mlt diff --git a/src/melt/melt.c b/src/melt/melt.c index 7541ae49..b8e974d7 100644 --- a/src/melt/melt.c +++ b/src/melt/melt.c @@ -281,7 +281,7 @@ static void transport( mlt_producer producer, mlt_consumer consumer ) } else { - fprintf( stderr, "Current Position: %10d\r", (int)mlt_producer_position( producer ) ); + fprintf( stderr, "Current Position: %10d\r", (int)mlt_consumer_position( consumer ) ); } } @@ -361,8 +361,14 @@ static void guess_profile( mlt_producer melt, mlt_profile profile ) profile->progressive = mlt_properties_get_int( p, "meta.media.progressive" ); profile->frame_rate_num = mlt_properties_get_int( p, "meta.media.frame_rate_num" ); profile->frame_rate_den = mlt_properties_get_int( p, "meta.media.frame_rate_den" ); + // AVCHD is mis-reported as double frame rate. + if ( profile->progressive == 0 && ( + profile->frame_rate_num / profile->frame_rate_den == 50 || + profile->frame_rate_num / profile->frame_rate_den == 59 ) ) + profile->frame_rate_num /= 2; profile->sample_aspect_num = mlt_properties_get_int( p, "meta.media.sample_aspect_num" ); profile->sample_aspect_den = mlt_properties_get_int( p, "meta.media.sample_aspect_den" ); + profile->colorspace = mlt_properties_get_int( p, "meta.media.colorspace" ); profile->display_aspect_num = (int) ( (double) profile->sample_aspect_num * profile->width / profile->sample_aspect_den + 0.5 ); profile->display_aspect_den = profile->height; free( profile->description ); @@ -435,6 +441,7 @@ int main( int argc, char **argv ) mlt_profile profile = NULL; int is_progress = 0; int is_silent = 0; + mlt_profile backup_profile; // Construct the factory mlt_repository repo = mlt_factory_init( NULL ); @@ -535,8 +542,21 @@ query_all: profile->is_explicit = 1; // Look for the consumer option to load profile settings from consumer properties + backup_profile = mlt_profile_clone( profile ); load_consumer( &consumer, profile, argc, argv ); + // If the consumer changed the profile, then it is explicit. + if ( backup_profile && !profile->is_explicit && ( + profile->width != backup_profile->width || + profile->height != backup_profile->height || + profile->sample_aspect_num != backup_profile->sample_aspect_num || + profile->sample_aspect_den != backup_profile->sample_aspect_den || + profile->frame_rate_den != backup_profile->frame_rate_den || + profile->frame_rate_num != backup_profile->frame_rate_num || + profile->colorspace != backup_profile->colorspace ) ) + profile->is_explicit = 1; + mlt_profile_close( backup_profile ); + // Get melt producer if ( argc > 1 ) melt = mlt_factory_producer( profile, "melt", &argv[ 1 ] ); @@ -545,9 +565,14 @@ query_all: { // Generate an automatic profile if needed. if ( ! profile->is_explicit ) + { guess_profile( melt, profile ); - - // Reload the consumer with the fully qualified profile + mlt_producer_close( melt ); + melt = mlt_factory_producer( profile, "melt", &argv[ 1 ] ); + } + + // Reload the consumer with the fully qualified profile. + // The producer or guess_profile could have changed the profile. load_consumer( &consumer, profile, argc, argv ); // If we have no consumer, default to sdl