]> git.sesse.net Git - mlt/commitdiff
apply patch from Jean-Baptiste <jb@ader.ch> to add rgb24a support to producer_qimage
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 24 May 2006 06:01:53 +0000 (06:01 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 24 May 2006 06:01:53 +0000 (06:01 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@914 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/qimage/producer_qimage.c

index 34fae626926439047e7d1bc60b9c2396097cec4b..550df36b2265f238acf5700a49f3be43593c1322 100644 (file)
@@ -92,24 +92,44 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
        // The fault is not in the design of mlt, but in the implementation of the qimage producer...
        if ( *buffer != NULL )
        {
-               // Clone the image and the alpha
-               uint8_t *image_copy = mlt_pool_alloc( image_size );
-               uint8_t *alpha_copy = mlt_pool_alloc( alpha_size );
+               if ( *format == mlt_image_yuv422 || *format == mlt_image_yuv420p )
+               {
+                       // Clone the image and the alpha
+                       uint8_t *image_copy = mlt_pool_alloc( image_size );
+                       uint8_t *alpha_copy = mlt_pool_alloc( alpha_size );
 
-               memcpy( image_copy, *buffer, image_size );
+                       memcpy( image_copy, *buffer, image_size );
 
-               // Copy or default the alpha
-               if ( alpha != NULL )
-                       memcpy( alpha_copy, alpha, alpha_size );
-               else
-                       memset( alpha_copy, 255, alpha_size );
+                       // Copy or default the alpha
+                       if ( alpha != NULL )
+                               memcpy( alpha_copy, alpha, alpha_size );
+                       else
+                               memset( alpha_copy, 255, alpha_size );
+
+                       // Now update properties so we free the copy after
+                       mlt_properties_set_data( properties, "image", image_copy, image_size, mlt_pool_release, NULL );
+                       mlt_properties_set_data( properties, "alpha", alpha_copy, alpha_size, mlt_pool_release, NULL );
+
+                       // We're going to pass the copy on
+                       *buffer = image_copy;
+               }
+               else if ( *format == mlt_image_rgb24a )
+               {
+                       // Clone the image and the alpha
+                       image_size = *width * ( *height + 1 ) * 4;
+                       alpha_size = *width * ( *height + 1 );
+                       uint8_t *image_copy = mlt_pool_alloc( image_size );
+                       uint8_t *alpha_copy = mlt_pool_alloc( alpha_size );
 
-               // Now update properties so we free the copy after
-               mlt_properties_set_data( properties, "image", image_copy, image_size, mlt_pool_release, NULL );
-               mlt_properties_set_data( properties, "alpha", alpha_copy, alpha_size, mlt_pool_release, NULL );
+                       mlt_convert_yuv422_to_rgb24a(*buffer, image_copy, (*width)*(*height));
 
-               // We're going to pass the copy on
-               *buffer = image_copy;
+                       // Now update properties so we free the copy after
+                       mlt_properties_set_data( properties, "image", image_copy, image_size, mlt_pool_release, NULL );
+                       mlt_properties_set_data( properties, "alpha", alpha_copy, alpha_size, mlt_pool_release, NULL );
+
+                       // We're going to pass the copy on
+                       *buffer = image_copy;
+               }
        }
        else
        {