]> git.sesse.net Git - mlt/blobdiff - src/modules/gtk2/producer_pango.c
Feed rework and fixes to westley and composite
[mlt] / src / modules / gtk2 / producer_pango.c
index e4969aba59b287ab9c35692c85faf2e0f93ae986..6863edb6473bb0eafbc15ae85b442bfb235b985b 100644 (file)
@@ -101,7 +101,7 @@ mlt_producer producer_pango_init( const char *filename )
                g_type_init();
 
                // Get the properties interface
-               mlt_properties properties = mlt_producer_properties( &this->parent );
+               mlt_properties properties = MLT_PRODUCER_PROPERTIES( &this->parent );
 
                // Set the default properties
                mlt_properties_set( properties, "fgcolour", "0xffffffff" );
@@ -269,7 +269,7 @@ static void refresh_image( mlt_frame frame, int width, int height )
        GdkPixbuf *pixbuf = NULL;
 
        // Obtain properties of frame
-       mlt_properties properties = mlt_frame_properties( frame );
+       mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
 
        // Obtain the producer pango for this frame
        producer_pango this = mlt_properties_get_data( properties, "producer_pango", NULL );
@@ -278,7 +278,7 @@ static void refresh_image( mlt_frame frame, int width, int height )
        mlt_producer producer = &this->parent;
 
        // Obtain the producer properties
-       mlt_properties producer_props = mlt_producer_properties( producer );
+       mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
 
        // Get producer properties
        char *fg = mlt_properties_get( producer_props, "fgcolour" );
@@ -409,7 +409,7 @@ static void refresh_image( mlt_frame frame, int width, int height )
 static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable )
 {
        // Obtain properties of frame
-       mlt_properties properties = mlt_frame_properties( frame );
+       mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
 
        *width = mlt_properties_get_int( properties, "rescale_width" );
        *height = mlt_properties_get_int( properties, "rescale_height" );
@@ -419,7 +419,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
 
        // Determine format
        //mlt_producer this = mlt_properties_get_data( properties, "producer_pango", NULL );
-       //*format = ( mlt_properties_get_int( mlt_producer_properties( this ), "bpp" ) == 4 ) ? mlt_image_rgb24a : mlt_image_rgb24;
+       //*format = ( mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( this ), "bpp" ) == 4 ) ? mlt_image_rgb24a : mlt_image_rgb24;
 
        // May need to know the size of the image to clone it
        int size = 0;
@@ -436,7 +436,8 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
        {
                // Clone our image
                uint8_t *copy = mlt_pool_alloc( size );
-               memcpy( copy, image, size );
+               if ( copy != NULL )
+                       memcpy( copy, image, size );
 
                // We're going to pass the copy on
                image = copy;
@@ -454,7 +455,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
 static uint8_t *producer_get_alpha_mask( mlt_frame this )
 {
        // Obtain properties of frame
-       mlt_properties properties = mlt_frame_properties( this );
+       mlt_properties properties = MLT_FRAME_PROPERTIES( this );
 
        // Return the alpha mask
        return mlt_properties_get_data( properties, "alpha", NULL );
@@ -468,7 +469,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
        *frame = mlt_frame_init( );
 
        // Obtain properties of frame and producer
-       mlt_properties properties = mlt_frame_properties( *frame );
+       mlt_properties properties = MLT_FRAME_PROPERTIES( *frame );
 
        // Set the producer on the frame properties
        mlt_properties_set_data( properties, "producer_pango", this, 0, NULL, NULL );
@@ -552,7 +553,7 @@ static GdkPixbuf *pango_get_pixbuf( const char *markup, const char *text, const
        else if ( text != NULL && strcmp( text, "" ) != 0 )
                pango_layout_set_text( layout, text, strlen( text ) );
        else
-               return NULL;
+               pango_layout_set_text( layout, "  ", 2 );
        pango_layout_get_pixel_size( layout, &w, &h );
 
        pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, TRUE /* has alpha */, 8, w + 2 * pad, h + 2 * pad );