[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libbase/Makefile.am libbase/emb...
From: |
Tomas Groth |
Subject: |
[Gnash-commit] gnash ChangeLog libbase/Makefile.am libbase/emb... |
Date: |
Fri, 09 Feb 2007 16:40:42 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Tomas Groth <tgc> 07/02/09 16:40:42
Modified files:
. : ChangeLog
libbase : Makefile.am embedVideoDecoder.h
embedVideoDecoderFfmpeg.cpp
server/parser : Makefile.am video_stream_def.cpp
video_stream_def.h
Added files:
libbase : embedVideoDecoderGst.cpp embedVideoDecoderGst.h
Log message:
* libbase/Makefile.am: Added embedVideoDecoderGst.{cpp,h}.
* libbase/embedVideoDecoderGst.{cpp,h}: Added. Use Gstreamer to decode
embedded video.
* libbase/embedVideoDecoder.h, libbase/embedVideoDecoderFfmpeg.cpp:
Added support for more codecs.
* server/parser/Makefile.am, server/parser/video_stream_def.cpp,
server/parser/video_stream_def.h: Added support for using Gstreamer
to decode embedded video.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2291&r2=1.2292
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/Makefile.am?cvsroot=gnash&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoder.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderFfmpeg.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderGst.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderGst.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/Makefile.am?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/video_stream_def.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/video_stream_def.h?cvsroot=gnash&r1=1.3&r2=1.4
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2291
retrieving revision 1.2292
diff -u -b -r1.2291 -r1.2292
--- ChangeLog 9 Feb 2007 14:47:15 -0000 1.2291
+++ ChangeLog 9 Feb 2007 16:40:42 -0000 1.2292
@@ -1,3 +1,14 @@
+2007-02-09 Tomas Groth Christensen <address@hidden>
+
+ * libbase/Makefile.am: Added embedVideoDecoderGst.{cpp,h}.
+ * libbase/embedVideoDecoderGst.{cpp,h}: Added. Use Gstreamer to decode
+ embedded video.
+ * libbase/embedVideoDecoder.h, libbase/embedVideoDecoderFfmpeg.cpp:
+ Added support for more codecs.
+ * server/parser/Makefile.am, server/parser/video_stream_def.cpp,
+ server/parser/video_stream_def.h: Added support for using Gstreamer
+ to decode embedded video.
+
2007-02-09 Sandro Santilli <address@hidden>
* testsuite/actionscript.all/dejagnu_so_init.as: made use
Index: libbase/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/libbase/Makefile.am,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- libbase/Makefile.am 8 Feb 2007 13:25:41 -0000 1.56
+++ libbase/Makefile.am 9 Feb 2007 16:40:42 -0000 1.57
@@ -133,8 +133,8 @@
URL.h
if USE_SOUND_GST
-libgnashbase_la_SOURCES += gstgnashsrc.c
-noinst_HEADERS += gstgnashsrc.h
+libgnashbase_la_SOURCES += gstgnashsrc.c embedVideoDecoderGst.cpp
+noinst_HEADERS += gstgnashsrc.h embedVideoDecoderGst.h
libgnashbase_la_CPPFLAGS += $(GSTREAMER_CFLAGS)
libgnashbase_la_LIBADD += $(GSTREAMER_LIBS) -lgstbase-0.10
endif
Index: libbase/embedVideoDecoder.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoder.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libbase/embedVideoDecoder.h 8 Feb 2007 14:40:20 -0000 1.2
+++ libbase/embedVideoDecoder.h 9 Feb 2007 16:40:42 -0000 1.3
@@ -18,7 +18,7 @@
//
//
-// $Id: embedVideoDecoder.h,v 1.2 2007/02/08 14:40:20 tgc Exp $
+// $Id: embedVideoDecoder.h,v 1.3 2007/02/09 16:40:42 tgc Exp $
#ifndef __EMBEDVIDEODECODER_H__
#define __EMBEDVIDEODECODER_H__
@@ -37,6 +37,7 @@
{
public:
+ // This is copied from the render and should be changed if the original
is.
enum videoOutputFormat
{
NONE,
Index: libbase/embedVideoDecoderFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoderFfmpeg.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libbase/embedVideoDecoderFfmpeg.cpp 8 Feb 2007 14:40:20 -0000 1.2
+++ libbase/embedVideoDecoderFfmpeg.cpp 9 Feb 2007 16:40:42 -0000 1.3
@@ -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.2 2007/02/08 14:40:20 tgc Exp $
+// $Id: embedVideoDecoderFfmpeg.cpp,v 1.3 2007/02/09 16:40:42 tgc Exp $
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -48,6 +48,8 @@
codec = avcodec_find_decoder(CODEC_ID_FLV1);
} else if (format == CODEC_VP6) {
codec = avcodec_find_decoder(CODEC_ID_VP6F);
+ } else if (format == CODEC_SCREENVIDEO) {
+ codec = avcodec_find_decoder(CODEC_ID_FLASHSV);
} else {
return;
}
Index: server/parser/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/parser/Makefile.am,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/parser/Makefile.am 1 Dec 2006 16:35:38 -0000 1.20
+++ server/parser/Makefile.am 9 Feb 2007 16:40:42 -0000 1.21
@@ -18,7 +18,7 @@
#
#
-# $Id: Makefile.am,v 1.20 2006/12/01 16:35:38 strk Exp $
+# $Id: Makefile.am,v 1.21 2007/02/09 16:40:42 tgc Exp $
AUTOMAKE_OPTIONS =
@@ -77,6 +77,10 @@
-avoid-version \
$(BOOST_LIBS)
+if USE_SOUND_GST
+AM_CPPFLAGS += $(GSTREAMER_CFLAGS)
+endif
+
# Rebuild with GCC 4.x Mudflap support
mudflap:
@echo "Rebuilding with GCC Mudflap support"
Index: server/parser/video_stream_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/video_stream_def.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/parser/video_stream_def.cpp 8 Feb 2007 23:30:15 -0000 1.4
+++ server/parser/video_stream_def.cpp 9 Feb 2007 16:40:42 -0000 1.5
@@ -15,13 +15,18 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// $Id: video_stream_def.cpp,v 1.4 2007/02/08 23:30:15 tgc Exp $
+// $Id: video_stream_def.cpp,v 1.5 2007/02/09 16:40:42 tgc Exp $
-#include "embedVideoDecoderFfmpeg.h"
#include "video_stream_def.h"
#include "video_stream_instance.h"
#include "render.h"
+#ifdef USE_FFMPEG
+#include "embedVideoDecoderFfmpeg.h"
+#elif defined(SOUND_GST)
+#include "embedVideoDecoderGst.h"
+#endif
+
namespace gnash {
video_stream_definition::video_stream_definition(uint16_t char_id)
@@ -92,11 +97,12 @@
#ifdef USE_FFMPEG
decoder = new embedVideoDecoderFfmpeg();
-//#elif defined(SOUND_GST)
-// decoder = new embedVideoDecoderGst();
+#elif defined(SOUND_GST)
+ decoder = new embedVideoDecoderGst();
#else
decoder = new embedVideoDecoder();
#endif
+
decoder->createDecoder(
m_width,
m_height,
Index: server/parser/video_stream_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/video_stream_def.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/parser/video_stream_def.h 8 Feb 2007 13:25:42 -0000 1.3
+++ server/parser/video_stream_def.h 9 Feb 2007 16:40:42 -0000 1.4
@@ -15,11 +15,15 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// $Id: video_stream_def.h,v 1.3 2007/02/08 13:25:42 tgc Exp $
+// $Id: video_stream_def.h,v 1.4 2007/02/09 16:40:42 tgc Exp $
#ifndef GNASH_VIDEO_STREAM_DEF_H
#define GNASH_VIDEO_STREAM_DEF_H
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "character_def.h"
#include "stream.h" // for read()
#include "movie_definition.h"
Index: libbase/embedVideoDecoderGst.cpp
===================================================================
RCS file: libbase/embedVideoDecoderGst.cpp
diff -N libbase/embedVideoDecoderGst.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libbase/embedVideoDecoderGst.cpp 9 Feb 2007 16:40:42 -0000 1.1
@@ -0,0 +1,219 @@
+//
+// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// 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 $
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef SOUND_GST
+
+#include "embedVideoDecoderGst.h"
+
+embedVideoDecoderGst::embedVideoDecoderGst()
+{
+}
+
+void
+embedVideoDecoderGst::createDecoder(int widthi, int heighti, int deblockingi,
bool smoothingi, int formati, int outputFormati)
+{
+ // Save video attributes
+ width = widthi;
+ height = heighti;
+ deblocking = deblockingi;
+ smoothing = smoothingi;
+ format = formati;
+ outputFormat = outputFormati;
+
+ // For now only H263/SVQ3, VP6 and screenvideo1 is supported
+ if (format != CODEC_H263 && format != CODEC_VP6 && format !=
CODEC_SCREENVIDEO) return;
+
+ // init GStreamer
+ gst_init (NULL, NULL);
+
+ // setup the pipeline
+ pipeline = gst_pipeline_new (NULL);
+
+ // Setup the pipeline elements
+
+ // setup fake source
+ input = gst_element_factory_make ("fakesrc", NULL);
+ g_object_set (G_OBJECT (input), "sizetype", 3, /*"can-activate-pull",
FALSE,*/ "signal-handoffs", TRUE, NULL);
+ // Setup the callback
+ g_signal_connect (input, "handoff", G_CALLBACK
(embedVideoDecoderGst::callback_handoff), this);
+
+ // Setup the input capsfilter
+ inputcaps = gst_element_factory_make ("capsfilter", NULL);
+ GstCaps* caps;
+ if (format == CODEC_H263) {
+ caps = gst_caps_new_simple ("video/x-flash-video",
+ "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height,
+ "framerate", GST_TYPE_FRACTION, 25, 1,
+ "flvversion", G_TYPE_INT, 1,
+ NULL);
+ } else if (format == CODEC_VP6) {
+ caps = gst_caps_new_simple ("video/x-vp6-flash",
+ "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height,
+ "framerate", GST_TYPE_FRACTION, 25, 1,
+ NULL);
+ } else if (format == CODEC_SCREENVIDEO) {
+ caps = gst_caps_new_simple ("video/x-flash-screen",
+ "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height,
+ "framerate", GST_TYPE_FRACTION, 25, 1,
+ NULL);
+ }
+ g_object_set (G_OBJECT (inputcaps), "caps", caps, NULL);
+ gst_caps_unref (caps);
+
+ // Setup the capsfilter which demands either YUV or RGB videoframe
format
+ videocaps = gst_element_factory_make ("capsfilter", NULL);
+ if (outputFormat == YUV) {
+ caps = gst_caps_new_simple ("video/x-raw-yuv", NULL);
+ } else {
+ caps = gst_caps_new_simple ("video/x-raw-rgb", NULL);
+ }
+ g_object_set (G_OBJECT (videocaps), "caps", caps, NULL);
+ gst_caps_unref (caps);
+
+ // setup the videosink with callback
+ output = gst_element_factory_make ("fakesink", NULL);
+ g_object_set (G_OBJECT (output), "signal-handoffs", TRUE, NULL);
+ g_signal_connect (output, "handoff", G_CALLBACK
(embedVideoDecoderGst::callback_output), this);
+
+ // setup the video colorspaceconverter converter
+ colorspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
+
+ // Find the decoder and init the parser
+ if (format == CODEC_H263) {
+ decoder = gst_element_factory_make ("ffdec_flv", NULL);
+ } else if (format == CODEC_VP6) {
+ decoder = gst_element_factory_make ("ffdec_vp6f", NULL);
+ } else if (format == CODEC_SCREENVIDEO) {
+ decoder = gst_element_factory_make ("ffdec_flashsv", NULL);
+ } else {
+ return;
+ }
+
+ if (!pipeline || !input || !inputcaps || !videocaps || !output ||
!decoder || !colorspace) {
+ return;
+ }
+
+ // Put the elemets in the pipeline and link them
+ gst_bin_add_many (GST_BIN (pipeline), input, inputcaps, decoder,
colorspace, videocaps, output, NULL);
+
+ // link the elements
+ gst_element_link_many(input, inputcaps, decoder, colorspace, videocaps,
output, NULL);
+
+ // This make callback_handoff wait for data
+ input_lock = new boost::mutex::scoped_lock(input_mutex);
+
+ // This make decodeFrame wait for data
+ output_lock = new boost::mutex::scoped_lock(output_mutex);
+
+ // Determine required buffer size and allocate buffer
+ if (outputFormat == YUV) {
+ decodedFrame = new image::yuv(width, height);
+ } else if (outputFormat == RGB) {
+ decodedFrame = new image::rgb(width, height);
+ }
+
+ // Start "playing"
+ 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*
+embedVideoDecoderGst::decodeFrame(uint8_t* data, int size)
+{
+
+ if (data == NULL) return decodedFrame;
+
+ frame = data;
+ frameSize = size;
+
+ delete input_lock;
+
+ output_lock = new boost::mutex::scoped_lock(output_mutex);
+
+ return decodedFrame;
+}
+
+// The callback function which refills the buffer with data
+void
+embedVideoDecoderGst::callback_handoff (GstElement * /*c*/, GstBuffer *buffer,
GstPad* /*pad*/, gpointer user_data)
+{
+ embedVideoDecoderGst* decoder =
static_cast<embedVideoDecoderGst*>(user_data);
+
+ decoder->input_lock = new
boost::mutex::scoped_lock(decoder->input_mutex);
+
+ GST_BUFFER_SIZE(buffer) = decoder->frameSize;
+
+ GST_BUFFER_DATA(buffer) = decoder->frame;
+}
+
+// The callback function which passes the decoded video frame
+void
+embedVideoDecoderGst::callback_output (GstElement * /*c*/, GstBuffer *buffer,
GstPad* /*pad*/, gpointer user_data)
+{
+ embedVideoDecoderGst* decoder =
static_cast<embedVideoDecoderGst*>(user_data);
+
+ if (decoder->decodedFrame) {
+
+ if (decoder->outputFormat == YUV) {
+ assert(0);
+
+ /* image::yuv* yuvframe =
static_cast<image::yuv*>(decoder->decodedFrame);
+ int copied = 0;
+ uint8_t* ptr = GST_BUFFER_DATA(buffer);
+ for (int i = 0; i < 3 ; i++)
+ {
+ int shift = (i == 0 ? 0 : 1);
+ uint8_t* yuv_factor = m_Frame->data[i];
+ int h = ns->videoheight >> shift;
+ int w = ns->videowidth >> shift;
+ for (int j = 0; j < h; j++)
+ {
+ copied += w;
+ assert(copied <= yuvframe->size());
+ memcpy(ptr, yuv_factor, w);
+ yuv_factor += m_Frame->linesize[i];
+ ptr += w;
+ }
+ }
+ video->m_size = copied;*/
+ } else {
+ decoder->decodedFrame->update(GST_BUFFER_DATA(buffer));
+ }
+ }
+
+ delete decoder->output_lock;
+
+}
+
+#endif // SOUND_GST
Index: libbase/embedVideoDecoderGst.h
===================================================================
RCS file: libbase/embedVideoDecoderGst.h
diff -N libbase/embedVideoDecoderGst.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libbase/embedVideoDecoderGst.h 9 Feb 2007 16:40:42 -0000 1.1
@@ -0,0 +1,99 @@
+//
+// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// 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.h,v 1.1 2007/02/09 16:40:42 tgc Exp $
+
+#ifndef __EMBEDVIDEODECODERGST_H__
+#define __EMBEDVIDEODECODERGST_H__
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef SOUND_GST
+
+#include "embedVideoDecoder.h"
+#include <gst/gst.h>
+#include "image.h"
+#include <boost/thread/thread.hpp>
+#include <boost/bind.hpp>
+#include <boost/thread/mutex.hpp>
+
+
+class embedVideoDecoderGst : public embedVideoDecoder {
+public:
+ embedVideoDecoderGst();
+
+ ~embedVideoDecoderGst();
+
+ void createDecoder(
+ int width,
+ int height,
+ int deblocking,
+ bool smoothing,
+ int format,
+ int outputFormat);
+
+ // gnash calls this when it wants you to decode the given videoframe
+ image::image_base* decodeFrame(uint8_t* data, int size);
+
+ // Callback functions used to handle input and output
+ static void callback_handoff (GstElement * /*c*/, GstBuffer *buffer,
GstPad* /*pad*/, gpointer user_data);
+ static void callback_output (GstElement* /*c*/, GstBuffer *buffer,
GstPad* /*pad*/, gpointer user_data);
+
+private:
+
+ // gstreamer pipeline objects
+
+ /// the main bin containing the elements
+ GstElement *pipeline;
+
+ /// Gstreamer objects
+ GstElement *input;
+ GstElement *inputcaps;
+ GstElement *parser;
+ GstElement *decoder;
+ GstElement *videocaps;
+ GstElement *colorspace;
+ GstElement *output;
+
+ /// mutexes and locks used to handle input and output.
+ boost::mutex input_mutex;
+ boost::mutex output_mutex;
+ boost::mutex::scoped_lock *input_lock;
+ boost::mutex::scoped_lock *output_lock;
+
+ /// Info from the video tag header. Might be usefull...
+ uint32_t width;
+ uint32_t height;
+ int deblocking;
+ bool smoothing;
+ int format;
+ int outputFormat;
+
+ /// Input data and size for current frame
+ uint8_t* frame;
+ int frameSize;
+
+ /// Last decoded frame
+ image::image_base* decodedFrame;
+
+};
+
+
+#endif // SOUND_GST
+
+#endif // __EMBEDVIDEODECODERGST_H__
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libbase/Makefile.am libbase/emb...,
Tomas Groth <=