Merge pull request #4 from mcfrisk/coverity

A few Coverity fixes
vdpau compilation fix for ffmpeg 0.11

In file included from producer_avformat.c:157:0:
vdpau.c: In function ‘vdpau_get_buffer’:
vdpau.c:162:10: error: ‘AVFrame’ has no member named ‘age’
vdpau.c:169:10: error: ‘AVFrame’ has no member named ‘age’
Fix vdpau library paths

They have changed in Debian.
vdpau: reduce runtime detection cost

Don't try to dlopen() every time, once is enough.
mlt_filter_new(): check return value from mlt_filter_init()

Fixes Coverity CID 709326: Unchecked return value (CHECKED_RETURN)
Calling function "mlt_filter_init" without checking return value (as is done elsewhere 7 out of 8 times).
No check of the return value of "mlt_filter_init(self, NULL)".
 78                mlt_filter_init( self, NULL );
 79        return self;
mlt_filter.c: fix possible buffer overflows

Fixes Coverity CID 709411: Copy into fixed size buffer (STRING_OVERFLOW)
You might overrun the 20 byte fixed-size string "name" by copying "unique_id" without checking the length.
257        strcat( name, unique_id );

and

CID 709412: Copy into fixed size buffer (STRING_OVERFLOW)
You might overrun the 20 byte fixed-size string "name" by copying "unique_id" without checking the length.
302        strcat( name, unique_id );
mlt_frame_get_waveform(): handle memory allocation failure

Fixes Coverity CID 709347.

At conditional (1): "bitmap != NULL" taking the false branch.
CID 709347: Dereference after null check (FORWARD_NULL)
Comparing "bitmap" to null implies that "bitmap" might be null.
 802        if ( bitmap != NULL )
 803                memset( bitmap, 0, size );
 804        mlt_properties_set_data( properties, "waveform", bitmap, size, ( mlt_destructor )mlt_pool_release, NULL );
...
 826                        // Position buffer pointer using y coordinate, stride, and x coordinate
Assigning null: "p" = "bitmap + i / skip + displacement * w".
 827                        unsigned char *p = bitmap + i / skip + displacement * w;
...
 831                                if ( *pcm < 0 )
Dereferencing null variable "p".
 832                                        p[ w * k ] = ( k == 0 ) ? 0xFF : p[ w * k ] + gray;
 833                                else
Dereferencing null variable "p".
 834                                        p[ w * k ] = ( k == height ) ? 0xFF : p[ w * k ] + gray;
mlt_playlist_init(): check return values from mlt_producer_init() and calloc()

Fixes Coverity CID 709327: Unchecked return value (CHECKED_RETURN)
Calling function "mlt_producer_init" without checking return value (as is done elsewhere 17 out of 20 times).
No check of the return value of "mlt_producer_init(producer, self)".
  73                mlt_producer_init( producer, self );
mlt_producer_new(): check return value from mlt_producer_init()
mlt_producer_seek(): check that eof is not NULL

Fixes Coverity CID 709348: Dereference after null check (FORWARD_NULL)
Comparing "eof" to null implies that "eof" might be null.
 310        else if ( use_points && ( eof == NULL || !strcmp( eof, "pause" ) ) && position >= mlt_producer_get_playtime( self ) )
 311        {
 312                mlt_producer_set_speed( self, 0 );
 313                position = mlt_producer_get_playtime( self ) - 1;
 314        }
At conditional (3): "use_points" taking the true branch.
Passing null variable "eof" to function "strcmp", which dereferences it. (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
 315        else if ( use_points && !strcmp( eof, "loop" ) && position >= mlt_producer_get_playtime( self ) )
mlt_property_get_time(): get mutex before accessing self->types

Fixes Coverity CID 709356: Data race condition (MISSING_LOCK)
Accessing variable "self->types" (mlt_property_s.types) requires the mlt_property_s.mutex lock.
871                self->types |= mlt_prop_string;
Fix calloc() parameter ordering

First parameter to calloc() is the count and second the amount of
bytes for each item. Likely this has no run time effect since the resulting
buffer size is the same.