]> git.sesse.net Git - mlt/commitdiff
Fix get image for formats different from yuv422
authorj-b-m <j-b-m@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 1 Jul 2007 11:09:16 +0000 (11:09 +0000)
committerj-b-m <j-b-m@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 1 Jul 2007 11:09:16 +0000 (11:09 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1003 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/kdenlive/producer_framebuffer.c

index 3bf2232aebcf47344c780497d0906bc19bb6feed..4bdf92a04474199ed122e7665600009daef8bffb 100644 (file)
@@ -50,20 +50,23 @@ static int framebuffer_get_image( mlt_frame this, uint8_t **image, mlt_image_for
        *width = mlt_properties_get_int( frame_properties, "width" );
        *height = mlt_properties_get_int( frame_properties, "height" );
 
-       // image stride
-       int size, xstride, ystride;
-       switch( *format ){
-               case mlt_image_yuv422:
-                       size = *width * *height * 2;
-                       xstride = 2;
-                       ystride = 2 * *width;
+       int size;
+       switch ( *format )
+       {
+               case mlt_image_yuv420p:
+                       size = *width * 3 * ( *height + 1 ) / 2;
+                       break;
+               case mlt_image_rgb24:
+                       size = *width * ( *height + 1 ) * 3;
                        break;
                default:
-                       fprintf(stderr, "Unsupported image format\n");
-                       return -1;
+                       *format = mlt_image_yuv422;
+                       size = *width * ( *height + 1 ) * 2;
+                       break;
        }
 
-       uint8_t *output = mlt_properties_get_data( producer_properties, "output_buffer", 0 );
+       uint8_t *output = mlt_properties_get_data( producer_properties, "output_buffer", NULL );
+
        if( output == NULL )
        {
                output = mlt_pool_alloc( size );