diff -U 3 -H -d -r -N -- SConstruct SConstruct
--- SConstruct	2008-06-16 03:37:13.000000000 +0600
+++ SConstruct	2011-08-20 23:40:52.749000002 +0600
@@ -43,12 +43,8 @@
 	if not conf.CheckHeader('libavformat/avformat.h','""'):
 		print 'FFMpeg headers could not be found'
 		Exit(1)
-	if not conf.CheckHeader('libavformat/avi.h','""'):
-		print 'libavformat/avi.h was not found. Copy it from your ffmpeg sources package'
-		Exit(1)
-	if not conf.CheckHeader('libavformat/riff.h','""'):
-		print 'libavformat/riff.h was not found. Copy it from your ffmpeg sources package'
-		Exit(1)
+
+
 	if not conf.CheckHeader('libswscale/swscale.h','""'):
 		print 'libswscale/swscale.h was not found. Copy it from your ffmpeg sources package.'
 		Exit(1)
diff -U 3 -H -d -r -N -- core/Decoder.cpp core/Decoder.cpp
--- core/Decoder.cpp	2008-06-16 03:37:13.000000000 +0600
+++ core/Decoder.cpp	2011-08-21 01:04:41.955000001 +0600
@@ -1,7 +1,7 @@
 /******************************************************************************
 * FOBS C++ wrapper code 
 * Copyright (c) 2004 Omnividea Multimedia S.L
-* Coded by Jos� San Pedro Wandelmer
+* Coded by Jos� San Pedro Wandelmer
 *
 *    This file is part of FOBS.
 *
@@ -585,9 +585,33 @@
          avpicture_fill(yuvPicture, yuvBuf, pix_fmt, dec->width, dec->height);
       }
      
-      ret = img_convert(yuvPicture, pix_fmt, 
-                       decodedPicture, dec->pix_fmt, 
-                       dec->width, dec->height);
+     SwsContext* img_convert_ctx = sws_getContext(
+                                   dec->width/*src*/, 
+                                   dec->height/*src*/, 
+                                   dec->pix_fmt/*src*/, 
+                                   dec->width/*dst*/, 
+                                   dec->height/*dst*/, 
+                                   pix_fmt/*dst*/, 
+                                   SWS_BICUBIC, 
+                                   NULL,
+                                   NULL,
+                                   NULL);
+     
+//       ret = img_convert(yuvPicture/*dst*/, pix_fmt/*dst*/, 
+//                         decodedPicture/*src*/, dec->pix_fmt/*src*/, 
+//                         dec->width/*src*/, dec->height/*src*/);
+      
+      ret = sws_scale(img_convert_ctx, 
+                      decodedPicture->data/*src*/, 
+                      decodedPicture->linesize/*src*/, 
+                      0/*src*/, 
+                      dec->height/*src*/,  
+                      yuvPicture->data/*dst*/, 
+                      yuvPicture->linesize/*dst*/);
+      
+      
+      sws_freeContext(img_convert_ctx);
+
       if(ret < 0) 
       {
          return NULL;
@@ -705,17 +729,41 @@
    enum PixelFormat pix_fmt;
    ReturnCode error = getRawFrame(&pict, (int *)&pix_fmt);
    if(isError(error)) return NULL;
-
+   
+   AVCodecContext *dec = inputFile->streams[videoStreamIndex]->codec;
    enum PixelFormat dst_pix_fmt=PIX_FMT_RGB24;
 
    if(reallocTransitionPicture(width, height) == 0)
    {
       //img_resample(img_resample_ctx, transitionPicture, decodedPicture);
       sws_scale(img_resample_ctx, decodedPicture->data, decodedPicture->linesize, 0, transitionPictureHeight/*?*/, transitionPicture->data, transitionPicture->linesize);
-      if(img_convert(transitionPictureRgb, dst_pix_fmt,transitionPicture, pix_fmt, width, height) < 0)
+      
+      SwsContext* img_convert_ctx = sws_getContext(
+                                   dec->width/*src*/, 
+                                   dec->height/*src*/, 
+                                   pix_fmt/*src*/, 
+                                   width/*dst*/, 
+                                   height/*dst*/, 
+                                   dst_pix_fmt/*dst*/, 
+                                   SWS_BICUBIC, 
+                                   NULL,
+                                   NULL,
+                                   NULL);
+      
+      if(sws_scale(img_convert_ctx, 
+                      transitionPicture->data/*src*/, 
+                      transitionPicture->linesize/*src*/, 
+                      0/*src*/, 
+                      transitionPictureHeight/*src*/,  
+                      transitionPictureRgb->data/*dst*/, 
+                      transitionPictureRgb->linesize/*dst*/) < 0)
+      
+//       if(img_convert(transitionPictureRgb, dst_pix_fmt,transitionPicture, pix_fmt, width, height) < 0)
       {
+         sws_freeContext(img_convert_ctx);
          return NULL;
       }
+      sws_freeContext(img_convert_ctx);
    }
    else
    {
@@ -764,9 +812,32 @@
          avpicture_fill(rgbPicture, rgbBuf, pix_fmt, dec->width, dec->height);
       }
      
-      ret = img_convert(rgbPicture, pix_fmt, 
-                       decodedPicture, dec->pix_fmt, 
-                       dec->width, dec->height);
+     SwsContext* img_convert_ctx = sws_getContext(
+                                   dec->width/*src*/, 
+                                   dec->height/*src*/, 
+                                   dec->pix_fmt/*src*/, 
+                                   dec->width/*dst*/, 
+                                   dec->height/*dst*/, 
+                                   pix_fmt/*dst*/, 
+                                   SWS_BICUBIC, 
+                                   NULL,
+                                   NULL,
+                                   NULL);
+     
+//       ret = img_convert(rgbPicture, pix_fmt, 
+//                        decodedPicture, dec->pix_fmt, 
+//                        dec->width, dec->height);
+             
+      ret = sws_scale(img_convert_ctx, 
+                    decodedPicture->data/*src*/, 
+                    decodedPicture->linesize/*src*/, 
+                    0/*src*/, 
+                    dec->height/*src*/,  
+                    rgbPicture->data/*dst*/, 
+                    rgbPicture->linesize/*dst*/);
+        
+      sws_freeContext(img_convert_ctx);
+        
       if(ret < 0) 
       {
          return NULL;
@@ -783,7 +854,7 @@
    if(testOpen() != 0) return NULL;
    int ret;
    AVPicture *tmpPicture;
-   enum PixelFormat pix_fmt=PIX_FMT_RGBA32;
+   enum PixelFormat pix_fmt=PIX_FMT_RGB32;
    AVCodecContext *dec = inputFile->streams[videoStreamIndex]->codec;
    
    if(currentRgbaFlag && compareTimeStamps(position, currentRgba))
@@ -818,9 +889,32 @@
          avpicture_fill(rgbaPicture, rgbaBuf, pix_fmt, dec->width, dec->height);
       }
      
-      ret = img_convert(rgbaPicture, pix_fmt, 
-                       decodedPicture, dec->pix_fmt, 
-                       dec->width, dec->height);
+     SwsContext* img_convert_ctx = sws_getContext(
+                                   dec->width/*src*/, 
+                                   dec->height/*src*/, 
+                                   dec->pix_fmt/*src*/, 
+                                   dec->width/*dst*/, 
+                                   dec->height/*dst*/, 
+                                   pix_fmt/*dst*/, 
+                                   SWS_BICUBIC, 
+                                   NULL,
+                                   NULL,
+                                   NULL);
+     
+//       ret = img_convert(rgbaPicture, pix_fmt, 
+//                        decodedPicture, dec->pix_fmt, 
+//                        dec->width, dec->height);
+      
+      ret = sws_scale(img_convert_ctx, 
+                      decodedPicture->data/*src*/, 
+                      decodedPicture->linesize/*src*/, 
+                      0/*src*/, 
+                      dec->height/*src*/,  
+                      rgbaPicture->data/*dst*/, 
+                      rgbaPicture->linesize/*dst*/);
+          
+      sws_freeContext(img_convert_ctx);
+      
       if(ret < 0) 
       {
          return NULL;
@@ -836,15 +930,39 @@
 {
    if(testOpen() != 0) return NULL;
    int ret;
-   enum PixelFormat pix_fmt=PIX_FMT_RGBA32;
+   enum PixelFormat pix_fmt=PIX_FMT_RGB32;
    AVCodecContext *dec = inputFile->streams[videoStreamIndex]->codec;
    
    {
       AVPicture tmpPicture;
-      avpicture_fill(&tmpPicture, (uint8_t *)buf, pix_fmt, dec->width, dec->height);    
-      ret = img_convert(&tmpPicture, pix_fmt, 
-                       decodedPicture, dec->pix_fmt, 
-                       dec->width, dec->height);
+      avpicture_fill(&tmpPicture, (uint8_t *)buf, pix_fmt, dec->width, dec->height);
+      
+      SwsContext* img_convert_ctx = sws_getContext(
+                                   dec->width/*src*/, 
+                                   dec->height/*src*/, 
+                                   dec->pix_fmt/*src*/, 
+                                   dec->width/*dst*/, 
+                                   dec->height/*dst*/, 
+                                   pix_fmt/*dst*/, 
+                                   SWS_BICUBIC, 
+                                   NULL,
+                                   NULL,
+                                   NULL);
+      
+//       ret = img_convert(&tmpPicture, pix_fmt, 
+//                        decodedPicture, dec->pix_fmt, 
+//                        dec->width, dec->height);
+      
+      ret = sws_scale(img_convert_ctx, 
+                      decodedPicture->data/*src*/, 
+                      decodedPicture->linesize/*src*/, 
+                      0/*src*/, 
+                      dec->height/*src*/,  
+                      tmpPicture.data/*dst*/, 
+                      tmpPicture.linesize/*dst*/);
+      
+      sws_freeContext(img_convert_ctx);
+      
       if(ret < 0) 
       {
          return NULL;
@@ -1142,7 +1260,9 @@
     ptr = pkt->data;
     len = pkt->size;
 
-    ret = avcodec_decode_audio(inputFile->streams[audioStreamIndex]->codec, (short*) samples, &data_size, ptr, len);
+//     ret = avcodec_decode_audio(inputFile->streams[audioStreamIndex]->codec, (short*) samples, &data_size, ptr, len);
+    
+    ret = avcodec_decode_audio3(inputFile->streams[audioStreamIndex]->codec, (short*) samples, &data_size, pkt);
     
     if(ret < 0)
     {
Files core/Decoder.o and core/Decoder.o differ
diff -U 3 -H -d -r -N -- core/Encoder.cpp core/Encoder.cpp
--- core/Encoder.cpp	2008-06-16 03:37:13.000000000 +0600
+++ core/Encoder.cpp	2011-08-21 02:13:27.024000002 +0600
@@ -944,10 +944,32 @@
          transitionPict = transitionPicture;
          /* create temporary picture if requiered*/
          //reallocTransitionPicture(width, height);
-         if (img_convert(transitionPicture, enc->pix_fmt, pict, pix_fmt, width, height) < 0) 
+         
+	 SwsContext* img_convert_ctx = sws_getContext(
+                                   width/*src*/, 
+                                   height/*src*/, 
+                                   PixelFormat(pix_fmt)/*src*/, 
+                                   width/*dst*/, 
+                                   height/*dst*/, 
+                                   enc->pix_fmt/*dst*/, 
+                                   SWS_BICUBIC, 
+                                   NULL,
+                                   NULL,
+                                   NULL);
+         
+         if(sws_scale(img_convert_ctx, 
+                      pict->data/*src*/, 
+                      pict->linesize/*src*/, 
+                      0/*src*/, 
+                      height/*src*/,  
+                      transitionPicture->data/*dst*/, 
+                      transitionPicture->linesize/*dst*/) < 0)
+         
+// 	 if (img_convert(transitionPicture, enc->pix_fmt, pict, pix_fmt, width, height) < 0) 
          {
             error = FrameActionError;
          }
+         sws_freeContext(img_convert_ctx);
          //img_copy(transitionPicture, enc->pix_fmt, pict, pix_fmt, width, height)
       }
       else 
