From 03934f3d3b3c8aa162ef066020bdbfaaf7b30247 Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Fri, 26 Dec 2003 10:29:05 +0000 Subject: [PATCH] More SDL updates git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@18 d19143bc-622f-0410-bfdd-b5b2a6649095 --- mlt/src/framework/mlt_frame.c | 4 ++-- mlt/src/modules/sdl/consumer_sdl.c | 26 ++++++++++++++++++++++---- mlt/src/modules/sdl/consumer_sdl.h | 2 +- mlt/src/tests/charlie.c | 4 ++++ src/framework/mlt_frame.c | 4 ++-- src/modules/sdl/consumer_sdl.c | 26 ++++++++++++++++++++++---- src/modules/sdl/consumer_sdl.h | 2 +- src/tests/charlie.c | 4 ++++ 8 files changed, 58 insertions(+), 14 deletions(-) diff --git a/mlt/src/framework/mlt_frame.c b/mlt/src/framework/mlt_frame.c index 5eacb94..d1f6913 100644 --- a/mlt/src/framework/mlt_frame.c +++ b/mlt/src/framework/mlt_frame.c @@ -184,8 +184,8 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for uint8_t *q; test_card.vfmt = *format; - test_card.width = 720; - test_card.height = 576; + test_card.width = *width == 0 ? 720 : *width; + test_card.height = *height == 0 ? 576 : *height; switch( *format ) { diff --git a/mlt/src/modules/sdl/consumer_sdl.c b/mlt/src/modules/sdl/consumer_sdl.c index 2d70b90..c685296 100644 --- a/mlt/src/modules/sdl/consumer_sdl.c +++ b/mlt/src/modules/sdl/consumer_sdl.c @@ -46,6 +46,8 @@ struct consumer_sdl_s pthread_cond_t audio_cond; int window_width; int window_height; + int width; + int height; }; /** Forward references to static functions. @@ -59,7 +61,7 @@ static int consumer_get_dimensions( int *width, int *height ); via the argument, but keep it simple. */ -mlt_consumer consumer_sdl_init( void *dummy ) +mlt_consumer consumer_sdl_init( char *arg ) { // Create the consumer object consumer_sdl this = calloc( sizeof( struct consumer_sdl_s ), 1 ); @@ -85,8 +87,24 @@ mlt_consumer consumer_sdl_init( void *dummy ) pthread_mutex_init( &this->audio_mutex, NULL ); pthread_cond_init( &this->audio_cond, NULL); - // TODO: process actual param - + // process actual param + if ( arg == NULL || !strcmp( arg, "PAL" ) ) + { + this->width = 720; + this->height = 576; + } + else if ( !strcmp( arg, "NTSC" ) ) + { + this->width = 720; + this->height = 480; + } + else if ( sscanf( arg, "%dx%d", &this->width, &this->height ) != 2 ) + { + this->width = 720; + this->height = 576; + } + + // Create the the thread pthread_create( &this->thread, NULL, consumer_thread, this ); @@ -194,7 +212,7 @@ static void *consumer_thread( void *arg ) if ( mlt_service_get_frame( service, &frame, 0 ) == 0 ) { mlt_image_format vfmt = mlt_image_yuv422; - int width, height; + int width = this->width, height = this->height; uint8_t *image; mlt_audio_format afmt = mlt_audio_pcm; diff --git a/mlt/src/modules/sdl/consumer_sdl.h b/mlt/src/modules/sdl/consumer_sdl.h index 6c8114e..bf2fefd 100644 --- a/mlt/src/modules/sdl/consumer_sdl.h +++ b/mlt/src/modules/sdl/consumer_sdl.h @@ -23,6 +23,6 @@ #include -extern mlt_consumer consumer_sdl_init( void * ); +extern mlt_consumer consumer_sdl_init( char * ); #endif diff --git a/mlt/src/tests/charlie.c b/mlt/src/tests/charlie.c index f807b5d..b8c7d4f 100644 --- a/mlt/src/tests/charlie.c +++ b/mlt/src/tests/charlie.c @@ -19,6 +19,10 @@ mlt_producer create_producer( char *file ) result = mlt_factory_producer( "mcdv", file ); else if ( strstr( file, ".jpg" ) ) result = mlt_factory_producer( "pixbuf", file ); + else if ( strstr( file, ".JPG" ) ) + result = mlt_factory_producer( "pixbuf", file ); + else if ( strstr( file, ".jpeg" ) ) + result = mlt_factory_producer( "pixbuf", file ); else if ( strstr( file, ".png" ) ) result = mlt_factory_producer( "pixbuf", file ); diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 5eacb94..d1f6913 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -184,8 +184,8 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for uint8_t *q; test_card.vfmt = *format; - test_card.width = 720; - test_card.height = 576; + test_card.width = *width == 0 ? 720 : *width; + test_card.height = *height == 0 ? 576 : *height; switch( *format ) { diff --git a/src/modules/sdl/consumer_sdl.c b/src/modules/sdl/consumer_sdl.c index 2d70b90..c685296 100644 --- a/src/modules/sdl/consumer_sdl.c +++ b/src/modules/sdl/consumer_sdl.c @@ -46,6 +46,8 @@ struct consumer_sdl_s pthread_cond_t audio_cond; int window_width; int window_height; + int width; + int height; }; /** Forward references to static functions. @@ -59,7 +61,7 @@ static int consumer_get_dimensions( int *width, int *height ); via the argument, but keep it simple. */ -mlt_consumer consumer_sdl_init( void *dummy ) +mlt_consumer consumer_sdl_init( char *arg ) { // Create the consumer object consumer_sdl this = calloc( sizeof( struct consumer_sdl_s ), 1 ); @@ -85,8 +87,24 @@ mlt_consumer consumer_sdl_init( void *dummy ) pthread_mutex_init( &this->audio_mutex, NULL ); pthread_cond_init( &this->audio_cond, NULL); - // TODO: process actual param - + // process actual param + if ( arg == NULL || !strcmp( arg, "PAL" ) ) + { + this->width = 720; + this->height = 576; + } + else if ( !strcmp( arg, "NTSC" ) ) + { + this->width = 720; + this->height = 480; + } + else if ( sscanf( arg, "%dx%d", &this->width, &this->height ) != 2 ) + { + this->width = 720; + this->height = 576; + } + + // Create the the thread pthread_create( &this->thread, NULL, consumer_thread, this ); @@ -194,7 +212,7 @@ static void *consumer_thread( void *arg ) if ( mlt_service_get_frame( service, &frame, 0 ) == 0 ) { mlt_image_format vfmt = mlt_image_yuv422; - int width, height; + int width = this->width, height = this->height; uint8_t *image; mlt_audio_format afmt = mlt_audio_pcm; diff --git a/src/modules/sdl/consumer_sdl.h b/src/modules/sdl/consumer_sdl.h index 6c8114e..bf2fefd 100644 --- a/src/modules/sdl/consumer_sdl.h +++ b/src/modules/sdl/consumer_sdl.h @@ -23,6 +23,6 @@ #include -extern mlt_consumer consumer_sdl_init( void * ); +extern mlt_consumer consumer_sdl_init( char * ); #endif diff --git a/src/tests/charlie.c b/src/tests/charlie.c index f807b5d..b8c7d4f 100644 --- a/src/tests/charlie.c +++ b/src/tests/charlie.c @@ -19,6 +19,10 @@ mlt_producer create_producer( char *file ) result = mlt_factory_producer( "mcdv", file ); else if ( strstr( file, ".jpg" ) ) result = mlt_factory_producer( "pixbuf", file ); + else if ( strstr( file, ".JPG" ) ) + result = mlt_factory_producer( "pixbuf", file ); + else if ( strstr( file, ".jpeg" ) ) + result = mlt_factory_producer( "pixbuf", file ); else if ( strstr( file, ".png" ) ) result = mlt_factory_producer( "pixbuf", file ); -- 1.7.4.4