From: lilo_booter Date: Sun, 8 Aug 2004 14:12:23 +0000 (+0000) Subject: Rudimentary rgb24 support X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=3833ec4ee7ffd18732242b30b602740d1ac7acad;p=melted Rudimentary rgb24 support git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@357 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index f72d9fa..7a176d8 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -392,6 +392,12 @@ static inline void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, pict.linesize[2] = width >> 1; img_convert( &pict, PIX_FMT_YUV420P, (AVPicture *)frame, pix_fmt, width, height ); } + else if ( format == mlt_image_rgb24 ) + { + AVPicture output; + avpicture_fill( &output, buffer, PIX_FMT_RGB24, width, height ); + img_convert( &output, PIX_FMT_RGB24, (AVPicture *)frame, pix_fmt, width, height ); + } else { AVPicture output; @@ -460,12 +466,22 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form int size = 0; // Set the result arguments that we know here (only *buffer is now required) - if ( *format != mlt_image_yuv422 && *format != mlt_image_yuv420p ) - *format = mlt_image_yuv422; *width = codec_context->width; *height = codec_context->height; - size = *width * ( *height + 1 ) * 2; + switch ( *format ) + { + case mlt_image_yuv420p: + size = *width * 3 * ( *height + 1 ) / 2; + break; + case mlt_image_rgb24: + size = *width * ( *height + 1 ) * 3; + break; + default: + *format = mlt_image_yuv422; + size = *width * ( *height + 1 ) * 2; + break; + } // Set this on the frame properties mlt_properties_set_int( frame_properties, "width", *width ); @@ -522,7 +538,6 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form { av_frame = calloc( 1, sizeof( AVFrame ) ); mlt_properties_set_data( properties, "av_frame", av_frame, 0, free, NULL ); - paused = 0; } while( ret >= 0 && !got_picture )