gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog libbase/embedVideoDecoderFfmpeg...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog libbase/embedVideoDecoderFfmpeg...
Date: Thu, 31 May 2007 06:39:08 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/05/31 06:39:08

Modified files:
        .              : ChangeLog 
        libbase        : embedVideoDecoderFfmpeg.cpp 
                         embedVideoDecoderFfmpeg.h 
        server/asobj   : NetStreamFfmpeg.cpp 

Log message:
                * libbase/embedVideoDecoderFfmpeg.{cpp,h}:
                  Make convertRGB24 a public static function.
                * server/asobj/NetStreamFfmpeg.cpp: use
                  embedVideoDecoderFfmpeg::convertRGB24, dropping the
                  duplicated implementation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3417&r2=1.3418
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderFfmpeg.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderFfmpeg.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.75&r2=1.76

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3417
retrieving revision 1.3418
diff -u -b -r1.3417 -r1.3418
--- ChangeLog   31 May 2007 01:52:12 -0000      1.3417
+++ ChangeLog   31 May 2007 06:39:07 -0000      1.3418
@@ -1,3 +1,11 @@
+2007-05-31 Sandro Santilli <address@hidden>
+
+       * libbase/embedVideoDecoderFfmpeg.{cpp,h}:
+         Make convertRGB24 a public static function.
+       * server/asobj/NetStreamFfmpeg.cpp: use
+         embedVideoDecoderFfmpeg::convertRGB24, dropping the
+         duplicated implementation.
+
 2007-05-31 Bastiaan Jacques <address@hidden>
 
        * server/asobj/NetStreamFfmpeg.cpp, 

Index: libbase/embedVideoDecoderFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoderFfmpeg.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- libbase/embedVideoDecoderFfmpeg.cpp 31 May 2007 01:52:13 -0000      1.9
+++ libbase/embedVideoDecoderFfmpeg.cpp 31 May 2007 06:39:07 -0000      1.10
@@ -87,19 +87,8 @@
        }
 }
 
-// FIXME: This function (and a lot of other code in this file) is
-//        duplicated in NetStreamFfmpeg.
-
-/// Convert the given srcFrame to RGB24 pixel format.
-//
-/// @param srcCtx The codec context with which srcFrame is associated.
-/// @param srcFrame The source frame to convert. The data and linesize members
-///                 of srcFrame will be changed to match the conversion.
-/// @return A pointer to the newly allocated and freshly converted video data.
-///         The caller owns the pointer! It must be freed with delete [] when
-///        the frame has been processed.
 uint8_t*
-convertRGB24(AVCodecContext* srcCtx, AVFrame* srcFrame)
+embedVideoDecoderFfmpeg::convertRGB24(AVCodecContext* srcCtx, AVFrame* 
srcFrame)
 {
        static SwsContext* context = NULL;
        int width = srcCtx->width, height = srcCtx->height;

Index: libbase/embedVideoDecoderFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoderFfmpeg.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libbase/embedVideoDecoderFfmpeg.h   28 May 2007 15:41:01 -0000      1.3
+++ libbase/embedVideoDecoderFfmpeg.h   31 May 2007 06:39:08 -0000      1.4
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-// $Id: embedVideoDecoderFfmpeg.h,v 1.3 2007/05/28 15:41:01 ann Exp $
+// $Id: embedVideoDecoderFfmpeg.h,v 1.4 2007/05/31 06:39:08 strk Exp $
 
 #ifndef __EMBEDVIDEODECODERFFMPEG_H__
 #define __EMBEDVIDEODECODERFFMPEG_H__
@@ -50,6 +50,16 @@
        // gnash calls this when it wants you to decode the given videoframe
        image::image_base*      decodeFrame(uint8_t* data, int size);
 
+       /// Convert the given srcFrame to RGB24 pixel format.
+       //
+       /// @param srcCtx The codec context with which srcFrame is associated.
+       /// @param srcFrame The source frame to convert. The data and linesize 
members
+       ///                 of srcFrame will be changed to match the conversion.
+       /// @return A pointer to the newly allocated and freshly converted 
video data.
+       ///         The caller owns the pointer! It must be freed with delete 
[] when
+       ///         the frame has been processed.
+       ///
+       static uint8_t* convertRGB24(AVCodecContext* srcCtx, AVFrame* srcFrame);
 
 private:
 

Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- server/asobj/NetStreamFfmpeg.cpp    31 May 2007 01:52:13 -0000      1.75
+++ server/asobj/NetStreamFfmpeg.cpp    31 May 2007 06:39:08 -0000      1.76
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: NetStreamFfmpeg.cpp,v 1.75 2007/05/31 01:52:13 bjacques Exp $ */
+/* $Id: NetStreamFfmpeg.cpp,v 1.76 2007/05/31 06:39:08 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -33,7 +33,8 @@
 #include "movie_root.h"
 #include "NetConnection.h"
 #include "sound_handler.h"
-//#include "action.h"
+#include "embedVideoDecoderFfmpeg.h"
+
 #include <boost/scoped_array.hpp>
 #include <ffmpeg/swscale.h>
 
@@ -864,60 +865,6 @@
        return true;
 }
 
-// FIXME: This function (and a lot of other code in this file) is
-//        duplicated in embedVideoDecoderFfmpeg.
-
-/// Convert the given srcFrame to RGB24 pixel format.
-//
-/// @param srcCtx The codec context with which srcFrame is associated.
-/// @param srcFrame The source frame to convert. The data and linesize members
-///                 of srcFrame will be changed to match the conversion.
-/// @return A pointer to the newly allocated and freshly converted video data.
-///         The caller owns the pointer! It must be freed with delete [] when
-///        the frame has been processed.
-uint8_t*
-convertRGB24(AVCodecContext* srcCtx, AVFrame* srcFrame)
-{
-       static SwsContext* context = NULL;
-       int width = srcCtx->width, height = srcCtx->height;
-
-       if (!context) {
-               context = sws_getContext(width, height, srcCtx->pix_fmt,
-                                        width, height, PIX_FMT_RGB24,
-                                        SWS_FAST_BILINEAR, NULL, NULL, NULL);
-               if (!context) {
-                       return NULL;
-               }
-       }
-
-       int bufsize = avpicture_get_size(PIX_FMT_RGB24, width, height);
-       if (bufsize == -1) {
-               return NULL;
-       }
-
-       uint8_t* buffer = new uint8_t[bufsize];
-       if (!buffer) {
-               return NULL;
-       }
-
-       AVPicture picture;
-
-       avpicture_fill(&picture, buffer, PIX_FMT_RGB24, width, height);
-
-
-       int rv = sws_scale(context, srcFrame->data, srcFrame->linesize, 0, 
-                          width, picture.data, picture.linesize);
-       if (rv == -1) {
-               delete [] buffer;
-               return NULL;
-       }
-
-       srcFrame->linesize[0] = picture.linesize[0];
-       srcFrame->data[0] = picture.data[0];
-
-       return buffer;
-}
-
 bool NetStreamFfmpeg::decodeVideo(AVPacket* packet)
 {
        if (!m_VCodecCtx) return false;
@@ -943,7 +890,7 @@
                        //img_convert((AVPicture*) pFrameYUV, PIX_FMT_YUV420P, 
(AVPicture*) pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);
 
                } else if (m_videoFrameFormat == render::RGB && 
m_VCodecCtx->pix_fmt != PIX_FMT_RGB24) {
-                       buffer.reset(convertRGB24(m_VCodecCtx, m_Frame));
+                       
buffer.reset(embedVideoDecoderFfmpeg::convertRGB24(m_VCodecCtx, m_Frame));
                }
 
                raw_mediadata_t* video = new raw_mediadata_t;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]