From: lilo_booter Date: Fri, 26 Dec 2003 18:14:36 +0000 (+0000) Subject: playlist fps fix X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=4a9e61603ebd6244be57f1a7eea16c14eb2a9e1d;p=melted playlist fps fix git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@23 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/mlt/src/framework/mlt_playlist.c b/mlt/src/framework/mlt_playlist.c index eb89f04..b2f9bc8 100644 --- a/mlt/src/framework/mlt_playlist.c +++ b/mlt/src/framework/mlt_playlist.c @@ -23,6 +23,7 @@ #include "mlt_playlist.h" #include "mlt_frame.h" +#include #include /** Virtual playlist entry. @@ -93,11 +94,37 @@ mlt_service mlt_playlist_service( mlt_playlist this ) return mlt_producer_service( &this->parent ); } +/** Get the propertues associated to this playlist. +*/ + +mlt_properties mlt_playlist_properties( mlt_playlist this ) +{ + return mlt_producer_properties( &this->parent ); +} + /** Append to the virtual playlist. */ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer producer, mlt_timecode in, mlt_timecode out ) { + // Get the fps of the first producer + double fps = mlt_properties_get_double( mlt_playlist_properties( this ), "first_fps" ); + + // If fps is 0 + if ( fps == 0 ) + { + // Inherit it from the producer + fps = mlt_producer_get_fps( producer ); + } + else + { + // 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 ); + } + // Check that we have room if ( this->count >= this->size ) { @@ -115,6 +142,9 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer producer this->count ++; + mlt_properties_set_double( mlt_playlist_properties( this ), "first_fps", fps ); + mlt_properties_set_double( mlt_playlist_properties( this ), "fps", fps ); + return 0; } diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index eb89f04..b2f9bc8 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -23,6 +23,7 @@ #include "mlt_playlist.h" #include "mlt_frame.h" +#include #include /** Virtual playlist entry. @@ -93,11 +94,37 @@ mlt_service mlt_playlist_service( mlt_playlist this ) return mlt_producer_service( &this->parent ); } +/** Get the propertues associated to this playlist. +*/ + +mlt_properties mlt_playlist_properties( mlt_playlist this ) +{ + return mlt_producer_properties( &this->parent ); +} + /** Append to the virtual playlist. */ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer producer, mlt_timecode in, mlt_timecode out ) { + // Get the fps of the first producer + double fps = mlt_properties_get_double( mlt_playlist_properties( this ), "first_fps" ); + + // If fps is 0 + if ( fps == 0 ) + { + // Inherit it from the producer + fps = mlt_producer_get_fps( producer ); + } + else + { + // 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 ); + } + // Check that we have room if ( this->count >= this->size ) { @@ -115,6 +142,9 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer producer this->count ++; + mlt_properties_set_double( mlt_playlist_properties( this ), "first_fps", fps ); + mlt_properties_set_double( mlt_playlist_properties( this ), "fps", fps ); + return 0; }