consumer_sdl.c: bugfix segfault on unchecked pointer
[melted] / src / modules / sdl / consumer_sdl.c
index 0736b9d..30ec118 100644 (file)
@@ -190,9 +190,12 @@ int consumer_start( mlt_consumer parent )
                {
                        mlt_profile profile = mlt_service_profile( MLT_CONSUMER_SERVICE( parent ) );
                        mlt_filter filter = mlt_factory_filter( profile, "avcolour_space", NULL );
-                       mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "forced", mlt_image_yuv422 );
-                       mlt_service_attach( MLT_CONSUMER_SERVICE( parent ), filter );
-                       mlt_filter_close( filter );
+                       if ( filter )
+                       {
+                               mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "forced", mlt_image_yuv422 );
+                               mlt_service_attach( MLT_CONSUMER_SERVICE( parent ), filter );
+                               mlt_filter_close( filter );
+                       }
                        this->filtered = 1;
                }
        
@@ -221,7 +224,17 @@ int consumer_start( mlt_consumer parent )
                this->window_height = this->height;
 
                if ( this->sdl_screen == NULL && display_off == 0 )
+               {
+                       if ( mlt_properties_get_int( this->properties, "fullscreen" ) )
+                       {
+                               const SDL_VideoInfo *vi = SDL_GetVideoInfo();
+                               this->window_width = vi->current_w;
+                               this->window_height = vi->current_h;
+                               this->sdl_flags |= SDL_FULLSCREEN;
+                               SDL_ShowCursor( SDL_DISABLE );
+                       }
                        this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );
+               }
 
                pthread_create( &this->thread, NULL, consumer_thread, this );
        }
@@ -239,7 +252,8 @@ int consumer_stop( mlt_consumer parent )
                // Kill the thread and clean up
                this->joined = 1;
                this->running = 0;
-               pthread_join( this->thread, NULL );
+               if ( this->thread )
+                       pthread_join( this->thread, NULL );
 
                // internal cleanup
                if ( this->sdl_overlay != NULL )