aboutsummaryrefslogtreecommitdiff
path: root/videogrid
diff options
context:
space:
mode:
authorN.N. <sergi_ll@users.sourceforge.net>2008-06-12 16:33:28 +0000
committerN.N. <sergi_ll@users.sourceforge.net>2008-06-12 16:33:28 +0000
commit4b367e32ac0eae77d69b2742d3a0aa7bac9a120b (patch)
tree73555fe0aeb93c4b53f4cbbf0b252bb7e6c45fb2 /videogrid
parent48e488b6a8b58eca67aee89f8a9f9e888db6e5e7 (diff)
libswscale-dev use
svn path=/trunk/externals/pdvjtools/; revision=9987
Diffstat (limited to 'videogrid')
-rw-r--r--videogrid/videogrid.cc38
1 files changed, 32 insertions, 6 deletions
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 <http://www.gnu.org/licenses/>.
/* 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 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);