X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fsdl%2Fconsumer_sdl.c;h=6b9ad0ce20549a61b7ad58bed1a28388d1b9819a;hb=757e8d55530954c3002b71f78d5027a222e810f7;hp=41eea141ed2208dc5e9f56c5f469740213605637;hpb=788b48cb6c5163a522e0f51c80ad640cf7caed31;p=melted diff --git a/src/modules/sdl/consumer_sdl.c b/src/modules/sdl/consumer_sdl.c index 41eea14..6b9ad0c 100644 --- a/src/modules/sdl/consumer_sdl.c +++ b/src/modules/sdl/consumer_sdl.c @@ -169,7 +169,14 @@ int consumer_start( mlt_consumer parent ) pthread_attr_t thread_attributes; this->running = 1; - + + // Allow the user to force resizing to window size + if ( mlt_properties_get_int( this->properties, "resize" ) ) + { + mlt_properties_set_int( this->properties, "width", this->width ); + mlt_properties_set_int( this->properties, "height", this->height ); + } + // Inherit the scheduling priority pthread_attr_init( &thread_attributes ); pthread_attr_setinheritsched( &thread_attributes, PTHREAD_INHERIT_SCHED ); @@ -463,9 +470,8 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) if ( this->sdl_screen != NULL ) { SDL_SetClipRect( this->sdl_screen, &rect ); - sdl_lock_display(); - this->sdl_overlay = SDL_CreateYUVOverlay( this->width - (this->width % 4), this->height - (this->height % 2 ), SDL_YUY2_OVERLAY, this->sdl_screen ); + this->sdl_overlay = SDL_CreateYUVOverlay( this->width, this->height, SDL_YUY2_OVERLAY, this->sdl_screen ); sdl_unlock_display(); } } @@ -475,7 +481,8 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) this->buffer = this->sdl_overlay->pixels[ 0 ]; if ( SDL_LockYUVOverlay( this->sdl_overlay ) >= 0 ) { - memcpy( this->buffer, image, width * height * 2 ); + if ( image != NULL ) + memcpy( this->buffer, image, width * height * 2 ); SDL_UnlockYUVOverlay( this->sdl_overlay ); SDL_DisplayYUVOverlay( this->sdl_overlay, &this->sdl_screen->clip_rect ); } @@ -658,6 +665,9 @@ static void consumer_close( mlt_consumer parent ) // Stop the consumer mlt_consumer_stop( parent ); + // Close the queue + mlt_deque_close( this->queue ); + // Destroy mutexes pthread_mutex_destroy( &this->audio_mutex ); pthread_cond_destroy( &this->audio_cond );