X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=mlt%2Fsrc%2Fmodules%2Fsdl%2Fconsumer_sdl.c;h=803e96ee6acd449f0e013b8fdadbf4376fff856f;hb=cc8b6005abe30b5f0816b5aa6b87aa6867275228;hp=714fc66f5a6351512192b8b14b781d74601415ac;hpb=1a50e779cfd5e1bc6a80054f6f56e64280c2dc41;p=melted diff --git a/mlt/src/modules/sdl/consumer_sdl.c b/mlt/src/modules/sdl/consumer_sdl.c index 714fc66..803e96e 100644 --- a/mlt/src/modules/sdl/consumer_sdl.c +++ b/mlt/src/modules/sdl/consumer_sdl.c @@ -96,6 +96,9 @@ mlt_consumer consumer_sdl_init( char *arg ) pthread_mutex_init( &this->audio_mutex, NULL ); pthread_cond_init( &this->audio_cond, NULL); + // Default fps + mlt_properties_set_double( this->properties, "fps", 25 ); + // process actual param if ( arg == NULL || !strcmp( arg, "PAL" ) ) { @@ -106,6 +109,7 @@ mlt_consumer consumer_sdl_init( char *arg ) { this->width = 720; this->height = 480; + mlt_properties_set_double( this->properties, "fps", 29.97 ); } else if ( sscanf( arg, "%dx%d", &this->width, &this->height ) != 2 ) { @@ -199,9 +203,13 @@ static int consumer_play_audio( consumer_sdl this, mlt_frame frame, int init_aud // Get the properties of this consumer mlt_properties properties = this->properties; mlt_audio_format afmt = mlt_audio_pcm; - int channels; - int samples; - int frequency; + + // Set the preferred params of the test card signal + int channels = 2; + int frequency = 48000; + static int counter = 0; + int samples = mlt_sample_calculator( mlt_properties_get_double( this->properties, "fps" ), frequency, counter++ ); + int16_t *pcm; int bytes; @@ -218,6 +226,8 @@ static int consumer_play_audio( consumer_sdl this, mlt_frame frame, int init_aud SDL_AudioSpec request; SDL_AudioSpec got; + SDL_EnableKeyRepeat( SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL ); + // specify audio format memset( &request, 0, sizeof( SDL_AudioSpec ) ); this->playing = 0; @@ -232,13 +242,10 @@ static int consumer_play_audio( consumer_sdl this, mlt_frame frame, int init_aud fprintf( stderr, "SDL failed to open audio: %s\n", SDL_GetError() ); init_audio = 2; } - else + else if ( got.size != 0 ) { - if ( got.size != 0 ) - { - SDL_PauseAudio( 0 ); - init_audio = 0; - } + SDL_PauseAudio( 0 ); + init_audio = 0; } } @@ -321,8 +328,10 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) { mlt_producer producer = mlt_properties_get_data( properties, "transport_producer", NULL ); void (*callback)( mlt_producer, char * ) = mlt_properties_get_data( properties, "transport_callback", NULL ); - if ( callback != NULL && producer != NULL ) + if ( callback != NULL && producer != NULL && strcmp( SDL_GetKeyName(event.key.keysym.sym), "space" ) ) callback( producer, SDL_GetKeyName(event.key.keysym.sym) ); + else if ( callback != NULL && producer != NULL && !strcmp( SDL_GetKeyName(event.key.keysym.sym), "space" ) ) + callback( producer, " " ); } break; }