]> git.sesse.net Git - mlt/blobdiff - src/modules/avformat/vdpau.c
fix samples number calculation for 24 and 32 bit output
[mlt] / src / modules / avformat / vdpau.c
index b5710b382227c7c97e55c6561e0893133f319a47..594e571d8cbd2fc9bbb430513ed90e735d8f4f6c 100644 (file)
@@ -37,7 +37,9 @@ static VdpDecoderCreate        *vdp_decoder_create;
 static VdpDecoderDestroy       *vdp_decoder_destroy;
 static VdpDecoderRender        *vdp_decoder_render;
 
+// TODO: Shouldn't these be protected by a mutex?
 static int vdpau_init_done = 0;
+static int vdpau_supported = 1;
 
 /** VDPAUD functions
 */
@@ -57,6 +59,8 @@ static void vdpau_fini( producer_avformat self )
 
 static int vdpau_init( producer_avformat self )
 {
+       if ( !vdpau_supported )
+               return 0;
        mlt_log_debug( MLT_PRODUCER_SERVICE(self->parent), "vdpau_init\n" );
        int success = 0;
        mlt_properties properties = MLT_PRODUCER_PROPERTIES( self->parent );
@@ -70,9 +74,16 @@ static int vdpau_init( producer_avformat self )
        if ( !vdpau_init_done )
        {
                int flags = RTLD_NOW;
-               object = dlopen( "/usr/lib64/libvdpau.so", flags );
+               object = dlopen( "/usr/lib/libvdpau.so", flags );
+#ifdef ARCH_X86_64
                if ( !object )
-                       object = dlopen( "/usr/lib/libvdpau.so", flags );
+                       object = dlopen( "/usr/lib64/libvdpau.so", flags );
+               if ( !object )
+                       object = dlopen( "/usr/lib/x86_64-linux-gnu/libvdpau.so.1", flags );
+#elif ARCH_X86
+               if ( !object )
+                       object = dlopen( "/usr/lib/i386-linux-gnu/libvdpau.so.1", flags );
+#endif
                if ( !object )
                        object = dlopen( "/usr/local/lib/libvdpau.so", flags );
                if ( object )
@@ -80,6 +91,8 @@ static int vdpau_init( producer_avformat self )
                else
                {
                        mlt_log( MLT_PRODUCER_SERVICE(self->parent), MLT_LOG_WARNING, "%s: failed to dlopen libvdpau.so\n  (%s)\n", __FUNCTION__, dlerror() );
+                       // Don't try again.
+                       vdpau_supported = 0;
                        return success;
                }
        }
@@ -118,7 +131,8 @@ static int vdpau_init( producer_avformat self )
                if ( object )
                        dlclose( object );
                if ( self->vdpau )
-                       vdpau_fini( self );
+                       free( self->vdpau );
+               self->vdpau = NULL;
        }
 
        return success;
@@ -152,14 +166,12 @@ static int vdpau_get_buffer( AVCodecContext *codec_context, AVFrame *frame )
                        frame->reordered_opaque = codec_context->reordered_opaque;
                        if ( frame->reference )
                        {
-                               frame->age = self->vdpau->ip_age[0];
                                self->vdpau->ip_age[0] = self->vdpau->ip_age[1] + 1;
                                self->vdpau->ip_age[1] = 1;
                                self->vdpau->b_age++;
                        }
                        else
                        {
-                               frame->age = self->vdpau->b_age;
                                self->vdpau->ip_age[0] ++;
                                self->vdpau->ip_age[1] ++;
                                self->vdpau->b_age = 1;