From 4b367e32ac0eae77d69b2742d3a0aa7bac9a120b Mon Sep 17 00:00:00 2001 From: "N.N." Date: Thu, 12 Jun 2008 16:33:28 +0000 Subject: libswscale-dev use svn path=/trunk/externals/pdvjtools/; revision=9987 --- videogrid/videogrid.cc | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'videogrid') diff --git a/videogrid/videogrid.cc b/videogrid/videogrid.cc index 770b7e2..28f0260 100644 --- a/videogrid/videogrid.cc +++ b/videogrid/videogrid.cc @@ -35,10 +35,14 @@ along with this program. If not, see . /* 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 #include #include +#include /*libquicktime includes*/ //#include @@ -139,6 +143,8 @@ int convertir_img_ff(pathimage pathFitxer, tipus_format f, int W, int H, int pos int frameFinished; int numBytes; uint8_t *buffer; + static int sws_flags = SWS_BICUBIC; + struct SwsContext *img_convert_ctx; int nN = posi; @@ -215,9 +221,19 @@ int convertir_img_ff(pathimage pathFitxer, tipus_format f, int W, int H, int pos 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,9 +255,19 @@ int convertir_img_ff(pathimage pathFitxer, tipus_format f, int W, int H, int pos 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); -- cgit v1.2.1