From df1a6457d0270cc8156b38c59b7479d415847551 Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Fri, 3 Dec 2004 12:25:01 +0000 Subject: [PATCH] Possible fixes to xlib errors git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@550 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/framework/mlt_consumer.c | 2 +- src/modules/data_fx.properties | 8 ++++---- src/modules/sdl/consumer_sdl_preview.c | 13 +++++++++++++ src/modules/sdl/consumer_sdl_still.c | 8 +++++--- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c index e353f63..2020096 100644 --- a/src/framework/mlt_consumer.c +++ b/src/framework/mlt_consumer.c @@ -222,7 +222,7 @@ int mlt_consumer_put_frame( mlt_consumer this, mlt_frame frame ) tm.tv_nsec = now.tv_usec * 1000; pthread_cond_timedwait( &this->put_cond, &this->put_mutex, &tm ); } - if ( this->put == NULL ) + if ( !mlt_consumer_is_stopped( this ) && this->put == NULL ) this->put = frame; else mlt_frame_close( frame ); diff --git a/src/modules/data_fx.properties b/src/modules/data_fx.properties index 5aa77c0..bcfac20 100644 --- a/src/modules/data_fx.properties +++ b/src/modules/data_fx.properties @@ -157,11 +157,11 @@ shot.filter[0].composite.start=0%,0%:100%x100%:10 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%:10 +shot.filter[1].producer.markup=File Shot +shot.filter[1].producer.font=San 20 +shot.filter[1].composite.start=1%,1%:99%x99%:15 shot.filter[1].composite.key[8]=1%,1%:99%x99%:100 -shot.filter[1].composite.titles=1 +shot.filter[1].composite.titles=0 #shot.filter[1].composite.halign=centre special=region diff --git a/src/modules/sdl/consumer_sdl_preview.c b/src/modules/sdl/consumer_sdl_preview.c index cfb6c0e..cb2e33c 100644 --- a/src/modules/sdl/consumer_sdl_preview.c +++ b/src/modules/sdl/consumer_sdl_preview.c @@ -178,6 +178,7 @@ static void *consumer_thread( void *arg ) // internal intialization int first = 1; mlt_frame frame = NULL; + int last_position = -1; // properties mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer ); @@ -256,6 +257,18 @@ static void *consumer_thread( void *arg ) // Make sure the recipient knows that this frame isn't really rendered mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 0 ); + // Optimisation to reduce latency + if ( speed == 1.0 ) + { + if ( last_position != -1 && last_position + 1 != mlt_frame_get_position( frame ) ) + mlt_consumer_purge( this->play ); + last_position = mlt_frame_get_position( frame ); + } + else + { + last_position = -1; + } + // 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 ) ) { diff --git a/src/modules/sdl/consumer_sdl_still.c b/src/modules/sdl/consumer_sdl_still.c index f441352..6420dfc 100644 --- a/src/modules/sdl/consumer_sdl_still.c +++ b/src/modules/sdl/consumer_sdl_still.c @@ -123,7 +123,9 @@ mlt_consumer consumer_sdl_still_init( char *arg ) this->window_height = this->height; // Set the sdl flags - this->sdl_flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_RESIZABLE | SDL_DOUBLEBUF; + //this->sdl_flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_RESIZABLE | SDL_DOUBLEBUF; + // Experimental settings + this->sdl_flags = SDL_RESIZABLE | SDL_DOUBLEBUF; // Allow thread to be started/stopped parent->start = consumer_start; @@ -486,7 +488,7 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) mlt_properties_set_int( this->properties, "rect_h", this->rect.h ); } - if ( !mlt_consumer_is_stopped( &this->parent ) && this->sdl_screen != NULL && this->sdl_screen->pixels != NULL ) + if ( !mlt_consumer_is_stopped( &this->parent ) && SDL_GetVideoSurface( ) != NULL && 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,7 +535,7 @@ static void *consumer_thread( void *arg ) // internal intialization mlt_frame frame = NULL; - struct timespec tm = { 0, 99999999 }; + struct timespec tm = { 0, 10000000 }; if ( mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( consumer ), "sdl_started" ) == 0 ) { -- 1.7.4.4