gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog backend/sound_handler_sdl.cpp l...


From: Tomas Groth
Subject: [Gnash-commit] gnash ChangeLog backend/sound_handler_sdl.cpp l...
Date: Mon, 19 Feb 2007 21:45:41 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Tomas Groth <tgc>       07/02/19 21:45:41

Modified files:
        .              : ChangeLog 
        backend        : sound_handler_sdl.cpp 
        libbase        : embedVideoDecoderFfmpeg.cpp 
                         embedVideoDecoderGst.cpp 
        macros         : ffmpeg.m4 
        server/asobj   : NetStreamFfmpeg.cpp Sound.cpp SoundFfmpeg.cpp 
                         SoundGst.cpp 

Log message:
        * macros/ffmpeg.m4: The minimum LIBAVCODEC_VERSION is now 51.11.0.
          Also we can now handle if VP6 (FFMPEG_VP6) or avcodec_decode_audio2() 
          (FFMPEG_AUDIO2) is not supported by the used version of ffmpeg.
        * backend/sound_handler_sdl.cpp: Added support for FFMPEG_AUDIO2
        * libbase/embedVideoDecoderFfmpeg.cpp: Made use of the constructor and
          deconstructor. Added support for FFMPEG_VP6.
        * libbase/embedVideoDecoderGst.cpp: Made use of the constructor and
          deconstructor.
        * server/asobj/NetStreamFfmpeg.cpp: Added support for FFMPEG_AUDIO2.
        * server/asobj/Sound.cpp: Use the supplied name when searching for 
exports.
        * server/asobj/SoundFfmpeg.cpp: Added support for FFMPEG_AUDIO2.
          Made the deconstructor work better.
        * server/asobj/SoundGst.cpp: Made the deconstructor work better.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2397&r2=1.2398
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.cpp?cvsroot=gnash&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderFfmpeg.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderGst.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/macros/ffmpeg.m4?cvsroot=gnash&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Sound.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/SoundFfmpeg.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/SoundGst.cpp?cvsroot=gnash&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2397
retrieving revision 1.2398
diff -u -b -r1.2397 -r1.2398
--- ChangeLog   19 Feb 2007 21:40:32 -0000      1.2397
+++ ChangeLog   19 Feb 2007 21:45:40 -0000      1.2398
@@ -1,3 +1,19 @@
+2007-02-19 Tomas Groth Christensen <address@hidden>
+
+       * macros/ffmpeg.m4: The minimum LIBAVCODEC_VERSION is now 51.11.0.
+         Also we can now handle if VP6 (FFMPEG_VP6) or avcodec_decode_audio2() 
+         (FFMPEG_AUDIO2) is not supported by the used version of ffmpeg.
+       * backend/sound_handler_sdl.cpp: Added support for FFMPEG_AUDIO2
+       * libbase/embedVideoDecoderFfmpeg.cpp: Made use of the constructor and
+         deconstructor. Added support for FFMPEG_VP6.
+       * libbase/embedVideoDecoderGst.cpp: Made use of the constructor and
+         deconstructor.
+       * server/asobj/NetStreamFfmpeg.cpp: Added support for FFMPEG_AUDIO2.
+       * server/asobj/Sound.cpp: Use the supplied name when searching for 
exports.
+       * server/asobj/SoundFfmpeg.cpp: Added support for FFMPEG_AUDIO2.
+         Made the deconstructor work better.
+       * server/asobj/SoundGst.cpp: Made the deconstructor work better.
+
 2007-02-19 Sandro Santilli <address@hidden>
 
        * server/: DynamicShape.{cpp,h}, sprite_instance.{cpp,h}:

Index: backend/sound_handler_sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- backend/sound_handler_sdl.cpp       14 Feb 2007 20:41:48 -0000      1.46
+++ backend/sound_handler_sdl.cpp       19 Feb 2007 21:45:41 -0000      1.47
@@ -18,7 +18,7 @@
 // Based on sound_handler_sdl.cpp by Thatcher Ulrich http://tulrich.com 2003
 // which has been donated to the Public Domain.
 
-// $Id: sound_handler_sdl.cpp,v 1.46 2007/02/14 20:41:48 tgc Exp $
+// $Id: sound_handler_sdl.cpp,v 1.47 2007/02/19 21:45:41 tgc Exp $
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -830,7 +830,12 @@
                                                                        0 ,0);  
//pts, dts
 
                                                int tmp = 0;
+#ifdef FFMPEG_AUDIO2
+                                               outsize = 
AVCODEC_MAX_AUDIO_FRAME_SIZE;
+                                               tmp = 
avcodec_decode_audio2(sound->cc, (int16_t*)(tmp_raw_buffer), &outsize, frame, 
framesize);
+#else
                                                tmp = 
avcodec_decode_audio(sound->cc, (int16_t*)(tmp_raw_buffer), &outsize, frame, 
framesize);
+#endif
 
                                                if (bytes_decoded < 0 || tmp < 
0 || outsize < 0) {
                                                        gnash::log_error("Error 
while decoding MP3-stream. Upgrading ffmpeg/libavcodec might fix this 
issue.\n");

Index: libbase/embedVideoDecoderFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoderFfmpeg.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libbase/embedVideoDecoderFfmpeg.cpp 9 Feb 2007 16:40:42 -0000       1.3
+++ libbase/embedVideoDecoderFfmpeg.cpp 19 Feb 2007 21:45:41 -0000      1.4
@@ -14,7 +14,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.cpp,v 1.3 2007/02/09 16:40:42 tgc Exp $
+// $Id: embedVideoDecoderFfmpeg.cpp,v 1.4 2007/02/19 21:45:41 tgc Exp $
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -24,10 +24,21 @@
 
 #include "embedVideoDecoderFfmpeg.h"
 
-embedVideoDecoderFfmpeg::embedVideoDecoderFfmpeg()
+embedVideoDecoderFfmpeg::embedVideoDecoderFfmpeg() :
+       codec(NULL),
+       cc(NULL),
+       decodedFrame(NULL)
 {
 }
 
+embedVideoDecoderFfmpeg::~embedVideoDecoderFfmpeg()
+{
+       if (cc) avcodec_close(cc);
+
+       if(decodedFrame) delete decodedFrame;
+
+}
+
 void
 embedVideoDecoderFfmpeg::createDecoder(int widthi, int heighti, int 
deblockingi, bool smoothingi, int formati, int outputFormati)
 {
@@ -46,8 +57,10 @@
        // Find the decoder and init the parser
        if (format == CODEC_H263) {
                codec = avcodec_find_decoder(CODEC_ID_FLV1);
+#ifdef FFMPEG_VP6
        } else if (format == CODEC_VP6) {
                codec = avcodec_find_decoder(CODEC_ID_VP6F);
+#endif
        } else if (format == CODEC_SCREENVIDEO) {
                codec = avcodec_find_decoder(CODEC_ID_FLASHSV);
        } else {
@@ -71,19 +84,13 @@
        }
 }
 
-embedVideoDecoderFfmpeg::~embedVideoDecoderFfmpeg()
-{
-       if (decodedFrame) delete decodedFrame;
-
-       if (cc) avcodec_close(cc);
 
-}
 // gnash calls this when it wants you to decode the given videoframe
 image::image_base*
 embedVideoDecoderFfmpeg::decodeFrame(uint8_t* data, int size)
 {
 
-       if (data == NULL) return decodedFrame;
+       if (data == NULL || codec == NULL) return decodedFrame;
 
        // Allocate a frame to store the decoded frame in
        AVFrame* frame = avcodec_alloc_frame();

Index: libbase/embedVideoDecoderGst.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoderGst.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libbase/embedVideoDecoderGst.cpp    9 Feb 2007 16:40:42 -0000       1.1
+++ libbase/embedVideoDecoderGst.cpp    19 Feb 2007 21:45:41 -0000      1.2
@@ -14,7 +14,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: embedVideoDecoderGst.cpp,v 1.1 2007/02/09 16:40:42 tgc Exp $
+// $Id: embedVideoDecoderGst.cpp,v 1.2 2007/02/19 21:45:41 tgc Exp $
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -24,8 +24,27 @@
 
 #include "embedVideoDecoderGst.h"
 
-embedVideoDecoderGst::embedVideoDecoderGst()
+embedVideoDecoderGst::embedVideoDecoderGst() :
+       pipeline(NULL),
+       input(NULL),
+       inputcaps(NULL),
+       videocaps(NULL),
+       output(NULL),
+       decoder(NULL),
+       colorspace(NULL),
+       decodedFrame(NULL)
+
+{
+}
+
+embedVideoDecoderGst::~embedVideoDecoderGst()
 {
+       if(decodedFrame) delete decodedFrame;
+
+       if (pipeline) {
+               gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
+               gst_object_unref (GST_OBJECT (pipeline));
+       }
 }
 
 void
@@ -138,14 +157,6 @@
        gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
 }
 
-embedVideoDecoderGst::~embedVideoDecoderGst()
-{
-       if (decodedFrame) delete decodedFrame;
-
-       gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
-       gst_object_unref (GST_OBJECT (pipeline));
-
-}
 
 // gnash calls this when it wants you to decode the given videoframe
 image::image_base*

Index: macros/ffmpeg.m4
===================================================================
RCS file: /sources/gnash/gnash/macros/ffmpeg.m4,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- macros/ffmpeg.m4    9 Feb 2007 20:03:15 -0000       1.28
+++ macros/ffmpeg.m4    19 Feb 2007 21:45:41 -0000      1.29
@@ -14,7 +14,7 @@
 dnl  along with this program; if not, write to the Free Software
 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-dnl $Id: ffmpeg.m4,v 1.28 2007/02/09 20:03:15 rsavoye Exp $
+dnl $Id: ffmpeg.m4,v 1.29 2007/02/19 21:45:41 tgc Exp $
 
 AC_DEFUN([GNASH_PATH_FFMPEG],
 [
@@ -34,7 +34,7 @@
   if test x${cross_compiling} = xno; then
     if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_ffmpeg_incl}" = x; then
       $PKG_CONFIG --exists libavcodec && ac_cv_path_ffmpeg_incl=`$PKG_CONFIG 
--cflags libavcodec`
-      topdir=`$PKG_CONFIG --cflags-only-I libavcodec | cut -d ' ' -f 2 | sed 
-e 's:-I::'`
+      topdir=`$PKG_CONFIG --cflags-only-I libavcodec | sed -e 's:-I::' | sed 
-e 's: *$::'`
     fi
   fi
 
@@ -66,14 +66,25 @@
 dnl       AC_MSG_ERROR([])
 dnl     fi
 dnl   fi
-  ffmpeg_version=`$EGREP "define LIBAVCODEC_VERSION " ${topdir}/avcodec.h | 
cut -d ' ' -f 8 | tr -d '.'`
+
+  ffmpeg_num_version=`$EGREP "define LIBAVCODEC_VERSION " ${topdir}/avcodec.h 
| cut -d ' ' -f 8 | tr -d '.'`
 dnl   AC_EGREP_HEADER(avcodec_decode_audio2, ${topdir}/avcodec.h, 
[avfound=yes], [avfound=no])
-  if test $ffmpeg_version -lt 51290; then
-    AC_MSG_WARN([Wrong avcode version! 51.29.0 or greater required])
+  if test $ffmpeg_num_version -lt 51110; then
+    AC_MSG_WARN([Wrong ffmpeg/libavcodec version! 51.11.0 or greater required])
   else
     ffmpeg_version=ok
   fi
 
+  if test $ffmpeg_num_version -gt 51280; then
+    AC_DEFINE(FFMPEG_AUDIO2, 1, [Define if avcodec_decode_audio2 can be used.])
+  fi
+
+  if test $ffmpeg_num_version -lt 51270; then
+    AC_MSG_WARN([This version of ffmpeg/libavcodec is not able to play VP6 
encoded video!])
+  else
+    AC_DEFINE(FFMPEG_VP6, 1, [Define if ffmpeg can play VP6.])
+  fi
+
   if test x"${ac_cv_path_ffmpeg_incl}" != x ; then
     FFMPEG_CFLAGS="${ac_cv_path_ffmpeg_incl}"
   else

Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/asobj/NetStreamFfmpeg.cpp    14 Feb 2007 20:41:48 -0000      1.16
+++ server/asobj/NetStreamFfmpeg.cpp    19 Feb 2007 21:45:41 -0000      1.17
@@ -14,7 +14,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: NetStreamFfmpeg.cpp,v 1.16 2007/02/14 20:41:48 tgc Exp $ */
+/* $Id: NetStreamFfmpeg.cpp,v 1.17 2007/02/19 21:45:41 tgc Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -543,7 +543,12 @@
                        {
                                int frame_size;
                                uint8_t* ptr = (uint8_t*) 
malloc((AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2);
+#ifdef FFMPEG_AUDIO2
+                               frame_size = (AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) 
/ 2;
+                               if (avcodec_decode_audio2(m_ACodecCtx, 
(int16_t*) ptr, &frame_size, packet.data, packet.size) >= 0)
+#else
                                if (avcodec_decode_audio(m_ACodecCtx, 
(int16_t*) ptr, &frame_size, packet.data, packet.size) >= 0)
+#endif
                                {
 
                                        bool stereo = m_ACodecCtx->channels > 1 
? true : false;

Index: server/asobj/Sound.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Sound.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/asobj/Sound.cpp      16 Feb 2007 11:12:37 -0000      1.3
+++ server/asobj/Sound.cpp      19 Feb 2007 21:45:41 -0000      1.4
@@ -351,11 +351,11 @@
     // check the import.
     movie_definition* def = 
fn.env->get_target()->get_root_movie()->get_movie_definition();
     assert(def);
-    boost::intrusive_ptr<resource> res = 
def->get_exported_resource(so->soundName.c_str());
+       boost::intrusive_ptr<resource> res = def->get_exported_resource(name);
     if (res == NULL)
        {
                IF_VERBOSE_MALFORMED_SWF(
-           log_swferror("import error: resource '%s' is not exported", 
so->soundName.c_str());
+               log_swferror("import error: resource '%s' is not exported", 
name);
                );
            return;
        }

Index: server/asobj/SoundFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/SoundFfmpeg.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/asobj/SoundFfmpeg.cpp        14 Feb 2007 20:41:48 -0000      1.1
+++ server/asobj/SoundFfmpeg.cpp        19 Feb 2007 21:45:41 -0000      1.2
@@ -239,7 +239,6 @@
        AVPacket packet;
        int rc;
        bool loop = true;
-       int outputsamples = 0;
        uint8_t* ptr = new uint8_t[AVCODEC_MAX_AUDIO_FRAME_SIZE];
        bool ret = true;
        while (loop) {
@@ -254,7 +253,12 @@
                                {
                                        // Decode audio
                                        int frame_size;
+#ifdef FFMPEG_AUDIO2
+                                       frame_size = 
(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2;
+                                       if 
(avcodec_decode_audio2(so->audioCodecCtx, (int16_t*) ptr, &frame_size, 
packet.data, packet.size) >= 0)
+#else
                                        if 
(avcodec_decode_audio(so->audioCodecCtx, (int16_t*) ptr, &frame_size, 
packet.data, packet.size) >= 0)
+#endif
                                        {
 
                                                bool stereo = 
so->audioCodecCtx->channels > 1 ? true : false;
@@ -323,6 +327,7 @@
 }
 
 SoundFfmpeg::~SoundFfmpeg() {
+       if (externalSound) {
        if (leftOverData && leftOverSize) delete[] leftOverData;
 
        if (audioCodecCtx) avcodec_close(audioCodecCtx);
@@ -338,13 +343,13 @@
                audio_resample_close (resampleCtx);
        }
 
-/*     if (isAttached) {
+               /*      if (isAttached) {
                sound_handler* s = get_sound_handler();
                if (s) {
                        s->detach_aux_streamer(this);
                }
        }*/
-
+       }
 }
 
 void

Index: server/asobj/SoundGst.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/SoundGst.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/asobj/SoundGst.cpp   14 Feb 2007 20:41:48 -0000      1.1
+++ server/asobj/SoundGst.cpp   19 Feb 2007 21:45:41 -0000      1.2
@@ -212,13 +212,16 @@
 
 SoundGst::~SoundGst() {
 
+       if (externalSound && pipeline) {
        gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
        gst_object_unref (GST_OBJECT (pipeline));
+       }
 }
 
 void
 SoundGst::loadSound(std::string file, bool streaming)
 {
+       pipeline = NULL;
        remainingLoops = 0;
 
        if (connection) {




reply via email to

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