From ea995b01d3637183947898385e329b70e213c84a Mon Sep 17 00:00:00 2001 From: j-b-m Date: Sun, 1 Jul 2007 11:09:16 +0000 Subject: [PATCH] Fix get image for formats different from yuv422 git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1003 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/modules/kdenlive/producer_framebuffer.c | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/modules/kdenlive/producer_framebuffer.c b/src/modules/kdenlive/producer_framebuffer.c index 3bf2232a..4bdf92a0 100644 --- a/src/modules/kdenlive/producer_framebuffer.c +++ b/src/modules/kdenlive/producer_framebuffer.c @@ -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 ); -- 2.39.2