]> git.sesse.net Git - mlt/commitdiff
Fix segfault in vdpau_init when x11_display not set.
authorDan Dennedy <dan@dennedy.org>
Sun, 13 Dec 2009 19:34:00 +0000 (11:34 -0800)
committerDan Dennedy <dan@dennedy.org>
Sun, 13 Dec 2009 19:34:00 +0000 (11:34 -0800)
src/modules/avformat/vdpau.c

index 16b806c154af87c38f6b4d3ff9ed6293f4e35a30..8e8fb1d937d07fa56d4afd860bbd77971688b645 100644 (file)
@@ -50,8 +50,8 @@ static int vdpau_init( producer_avformat this )
        mlt_log_debug( MLT_PRODUCER_SERVICE(this->parent), "vdpau_init\n" );
        int success = 0;
        mlt_properties properties = MLT_PRODUCER_PROPERTIES( this->parent );
-       Display *display = (Display*) strtol( mlt_environment( "x11_display" ), NULL, 16 );
-       if ( !display || mlt_properties_get_int( properties, "novdpau" ) )
+       
+       if ( !mlt_environment( "x11_display" ) || mlt_properties_get_int( properties, "novdpau" ) )
                return success;
 
        if ( !g_vdpau )
@@ -66,6 +66,7 @@ static int vdpau_init( producer_avformat this )
                        {
                                int screen = mlt_properties_get_int( properties, "x11_screen" );
                                VdpDevice device;
+                               Display *display = (Display*) strtol( mlt_environment( "x11_display" ), NULL, 16 );
                                
                                mlt_log_debug( MLT_PRODUCER_SERVICE(this->parent), "X11 Display = %p\n", display );
                                if ( VDP_STATUS_OK == create_device( display, screen, &device, &vdp_get_proc_address ) )