X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Favformat%2Ffilter_swscale.c;h=d1266aeaeed5c97d5285d915ef685ce75855a3a0;hb=f4963a6aa07644399b273b5d2b1f9299c9047414;hp=1a31a8792bc4de476f2c0e4eeb561c6d5919511d;hpb=bf13b4d4753f0a2c8d73664e970e0d7b1b4a5a31;p=melted diff --git a/src/modules/avformat/filter_swscale.c b/src/modules/avformat/filter_swscale.c index 1a31a87..d1266ae 100644 --- a/src/modules/avformat/filter_swscale.c +++ b/src/modules/avformat/filter_swscale.c @@ -31,6 +31,12 @@ #include #include #include +#include + +#if LIBAVUTIL_VERSION_INT < (50<<16) +#define PIX_FMT_RGB32 PIX_FMT_RGBA32 +#define PIX_FMT_YUYV422 PIX_FMT_YUV422 +#endif static inline int is_big_endian( ) { @@ -50,10 +56,10 @@ static inline int convert_mlt_to_av_cs( mlt_image_format format ) value = PIX_FMT_RGB24; break; case mlt_image_rgb24a: - value = PIX_FMT_RGBA32; + value = PIX_FMT_RGB32; break; case mlt_image_yuv422: - value = PIX_FMT_YUV422; + value = PIX_FMT_YUYV422; break; case mlt_image_yuv420p: value = PIX_FMT_YUV420P; @@ -108,7 +114,7 @@ static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format iform avpicture_fill( &output, outbuf, oformat, owidth, oheight ); // Extract the alpha channel - if ( iformat == PIX_FMT_RGBA32 && oformat == PIX_FMT_YUV422 ) + if ( iformat == PIX_FMT_RGB32 && oformat == PIX_FMT_YUYV422 ) { // Allocate the alpha mask uint8_t *alpha = mlt_pool_alloc( iwidth * ( iheight + 1 ) ); @@ -117,7 +123,7 @@ static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format iform // Convert the image and extract alpha mlt_convert_rgb24a_to_yuv422( *image, iwidth, iheight, iwidth * 4, outbuf, alpha ); mlt_properties_set_data( properties, "alpha", alpha, iwidth * ( iheight + 1 ), ( mlt_destructor )mlt_pool_release, NULL ); - iformat = PIX_FMT_YUV422; + iformat = PIX_FMT_YUYV422; avpicture_fill( &input, outbuf, iformat, iwidth, iheight ); avpicture_fill( &output, *image, oformat, owidth, oheight ); } @@ -125,6 +131,7 @@ static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format iform // Create the context and output image struct SwsContext *context = sws_getContext( iwidth, iheight, iformat, owidth, oheight, oformat, interp, NULL, NULL, NULL); + assert(context); // Perform the scaling sws_scale( context, input.data, input.linesize, 0, iheight, output.data, output.linesize);