Revision: 9987 http://pure-data.svn.sourceforge.net/pure-data/?rev=9987&view=rev Author: sergi_ll Date: 2008-06-12 09:33:28 -0700 (Thu, 12 Jun 2008)
Log Message: ----------- libswscale-dev use
Modified Paths: -------------- trunk/externals/pdvjtools/videogrid/videogrid.cc
Modified: trunk/externals/pdvjtools/videogrid/videogrid.cc =================================================================== --- trunk/externals/pdvjtools/videogrid/videogrid.cc 2008-06-12 13:12:39 UTC (rev 9986) +++ trunk/externals/pdvjtools/videogrid/videogrid.cc 2008-06-12 16:33:28 UTC (rev 9987) @@ -35,10 +35,14 @@ /* incloure estructures de dades i capceleres de funcions per traballar amb threads */ #include "pthread.h"
+/*some linux distros need this to compile ffmpeg correctly as cpp*/ +#define __STDC_CONSTANT_MACROS 1 + /*ffmpeg includes*/ #include <ffmpeg/avcodec.h> #include <ffmpeg/avformat.h> #include <ffmpeg/avutil.h> +#include <ffmpeg/swscale.h>
/*libquicktime includes*/ //#include <quicktime/lqt.h> @@ -139,6 +143,8 @@ int frameFinished; int numBytes; uint8_t *buffer; + static int sws_flags = SWS_BICUBIC; + struct SwsContext *img_convert_ctx;
int nN = posi;
@@ -215,10 +221,20 @@ if(frameFinished) { // Convert the image from its native format to RGB - img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24, - (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, - pCodecCtx->height); + //img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24, + // (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, + // pCodecCtx->height); + img_convert_ctx = sws_getContext( pCodecCtx->width, pCodecCtx->height, + pCodecCtx->pix_fmt, + pCodecCtx->width, pCodecCtx->height, + PIX_FMT_RGB24, + sws_flags, NULL, NULL, NULL);
+ sws_scale (img_convert_ctx, pFrame->data, pFrame->linesize, + 0, pCodecCtx->height, + pFrameRGB->data, pFrameRGB->linesize); + sws_freeContext(img_convert_ctx); + // Save the frame to disk SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, W, H, posi); } @@ -239,10 +255,20 @@ if(frameFinished) { // Convert the image from its native format to RGB - img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24, - (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, - pCodecCtx->height); + //img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24, + // (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, + // pCodecCtx->height); + img_convert_ctx = sws_getContext( pCodecCtx->width, pCodecCtx->height, + pCodecCtx->pix_fmt, + pCodecCtx->width, pCodecCtx->height, + PIX_FMT_RGB24, + sws_flags, NULL, NULL, NULL);
+ sws_scale (img_convert_ctx, pFrame->data, pFrame->linesize, + 0, pCodecCtx->height, + pFrameRGB->data, pFrameRGB->linesize); + sws_freeContext(img_convert_ctx); + // Save the frame to disk SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, W, H, posi); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.