[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libbase/embedVideoDecoder.h lib...
From: |
Tomas Groth |
Subject: |
[Gnash-commit] gnash ChangeLog libbase/embedVideoDecoder.h lib... |
Date: |
Wed, 06 Jun 2007 15:41:13 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Tomas Groth <tgc> 07/06/06 15:41:13
Modified files:
. : ChangeLog
libbase : embedVideoDecoder.h embedVideoDecoderFfmpeg.cpp
embedVideoDecoderFfmpeg.h
embedVideoDecoderGst.cpp embedVideoDecoderGst.h
server : video_stream_instance.cpp
Log message:
* libbase/embedVideoDecoder.h: Added docs and made decodeFrame
return a auto_ptr.
* libbase/embedVideoDecoderFfmpeg.{cpp,h}: Made decodeFrame
return a auto_ptr.
* libbase/embedVideoDecoderGst.{cpp,h}: Made decodeFrame
return a auto_ptr, and fixed a deadlock.
* server/video_stream_instance.cpp:
embedVideoDecoder::decodeFrame
now returns a auto_ptr, adjust to that.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3473&r2=1.3474
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoder.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderFfmpeg.cpp?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderFfmpeg.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderGst.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderGst.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/video_stream_instance.cpp?cvsroot=gnash&r1=1.27&r2=1.28
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3473
retrieving revision 1.3474
diff -u -b -r1.3473 -r1.3474
--- ChangeLog 6 Jun 2007 13:42:38 -0000 1.3473
+++ ChangeLog 6 Jun 2007 15:41:11 -0000 1.3474
@@ -1,3 +1,14 @@
+2007-06-06 Tomas Groth Christensen <address@hidden>
+
+ * libbase/embedVideoDecoder.h: Added docs and made decodeFrame
+ return a auto_ptr.
+ * libbase/embedVideoDecoderFfmpeg.{cpp,h}: Made decodeFrame
+ return a auto_ptr.
+ * libbase/embedVideoDecoderGst.{cpp,h}: Made decodeFrame
+ return a auto_ptr, and fixed a deadlock.
+ * server/video_stream_instance.cpp: embedVideoDecoder::decodeFrame
+ now returns a auto_ptr, adjust to that.
+
2007-06-06 Udo Giacomozzi <address@hidden>
* backend/render_handler_agg.cpp: dynamic cast check
Index: libbase/embedVideoDecoder.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoder.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libbase/embedVideoDecoder.h 28 May 2007 15:41:01 -0000 1.6
+++ libbase/embedVideoDecoder.h 6 Jun 2007 15:41:12 -0000 1.7
@@ -19,7 +19,7 @@
//
//
-// $Id: embedVideoDecoder.h,v 1.6 2007/05/28 15:41:01 ann Exp $
+// $Id: embedVideoDecoder.h,v 1.7 2007/06/06 15:41:12 tgc Exp $
#ifndef __EMBEDVIDEODECODER_H__
#define __EMBEDVIDEODECODER_H__
@@ -29,16 +29,21 @@
#endif
#include "image.h"
+#include "log.h"
-//
-// Decoder for embedded video.
-//
+namespace gnash {
+
+///
+/// \brief
+/// The embedVideoDecoder is used to decodes a video frame which has been
+/// embedded in a SWF.
+///
class embedVideoDecoder
{
public:
- // This is copied from the render and should be changed if the original
is.
+ /// This is copied from the render and should be changed if the
original is.
enum videoOutputFormat
{
NONE,
@@ -46,6 +51,7 @@
RGB
};
+ /// Codecs type we know of
enum codecType
{
CODEC_H263 = 2, // H263/SVQ3 video codec
@@ -55,19 +61,50 @@
CODEC_SCREENVIDEO2 = 6 // Screenvideo2 codec
};
- // Assign handles however you like.
- virtual void createDecoder(
- int /*width*/,
+ ///
+ /// Sets up the decoder.
+ //
+ /// @param width
+ /// The width of the video
+ ///
+ /// @param height
+ /// The height of the video
+ ///
+ /// @param deblocking
+ /// Should a deblocking filter be used? 1 = off, 2 = on
+ ///
+ /// @param smoothing
+ /// Should the video be smoothed?
+ ///
+ /// @param format
+ /// The codec of the video, see codecType
+ ///
+ /// @param outputFormat
+ /// The outputFormat of the video, see videoOutputFormat
+ ///
+ virtual 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
- virtual image::image_base* decodeFrame(uint8_t* /*data*/, int
/*size*/) { return NULL; }
+ ///
+ /// gnash calls this when it wants to decode the given videoframe.
+ //
+ /// @param data
+ /// The video frame that is to be decoded.
+ ///
+ /// @param size
+ /// The sizes of the undecoded videoframe in bytes.
+ ///
+ /// @return a auto_ptr containing the image which is a result of the
decoding.
+ /// The caller owns the returned image.
+ ///
+ virtual std::auto_ptr<image::image_base> decodeFrame(uint8_t* /*data*/,
int /*size*/) { std::auto_ptr<image::image_base> i (NULL); return i; }
virtual ~embedVideoDecoder() {};
};
+} // end of gnash namespace
#endif // __EMBEDVIDEODECODER_H__
Index: libbase/embedVideoDecoderFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoderFfmpeg.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- libbase/embedVideoDecoderFfmpeg.cpp 31 May 2007 21:48:33 -0000 1.13
+++ libbase/embedVideoDecoderFfmpeg.cpp 6 Jun 2007 15:41:12 -0000 1.14
@@ -31,6 +31,8 @@
#include <boost/scoped_array.hpp>
+namespace gnash {
+
embedVideoDecoderFfmpeg::embedVideoDecoderFfmpeg() :
codec(NULL),
cc(NULL),
@@ -42,7 +44,7 @@
{
if (cc) avcodec_close(cc);
- if(decodedFrame) delete decodedFrame;
+ delete decodedFrame;
}
@@ -71,10 +73,12 @@
} else if (format == CODEC_SCREENVIDEO) {
codec = avcodec_find_decoder(CODEC_ID_FLASHSV);
} else {
+ gnash::log_error("Unsupported embedded video format, it might
help if you upgrade ffmpeg and recompile gnash");
return;
}
if (codec == NULL) {
+ gnash::log_error("Unsupported embedded video format, it might
help if you upgrade ffmpeg and recompile gnash");
return;
}
@@ -141,11 +145,18 @@
}
// gnash calls this when it wants you to decode the given videoframe
-image::image_base*
+std::auto_ptr<image::image_base>
embedVideoDecoderFfmpeg::decodeFrame(uint8_t* data, int size)
{
+ std::auto_ptr<image::image_base> ret_image;
- if (data == NULL || codec == NULL) return decodedFrame;
+ if (outputFormat == YUV) {
+ ret_image.reset(new image::yuv(width, height));
+ } else if (outputFormat == RGB) {
+ ret_image.reset(new image::rgb(width, height));
+ }
+
+ if (data == NULL || codec == NULL || size == 0) return ret_image;
// Allocate a frame to store the decoded frame in
AVFrame* frame = avcodec_alloc_frame();
@@ -158,7 +169,7 @@
if (outputFormat == NONE) { // NullGui?
av_free(frame);
- return NULL;
+ return ret_image;
} else if (outputFormat == YUV && cc->pix_fmt !=
PIX_FMT_YUV420P) {
//assert(0); // TODO
@@ -199,12 +210,13 @@
}
}
} else {
- return decodedFrame;
+ return ret_image;
}
- return decodedFrame;
+ ret_image->update(decodedFrame->m_data);
+ return ret_image;
}
-
+} // end of gnash namespace
#endif // USE_FFMPEG
Index: libbase/embedVideoDecoderFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoderFfmpeg.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libbase/embedVideoDecoderFfmpeg.h 31 May 2007 06:39:08 -0000 1.4
+++ libbase/embedVideoDecoderFfmpeg.h 6 Jun 2007 15:41:12 -0000 1.5
@@ -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.4 2007/05/31 06:39:08 strk Exp $
+// $Id: embedVideoDecoderFfmpeg.h,v 1.5 2007/06/06 15:41:12 tgc Exp $
#ifndef __EMBEDVIDEODECODERFFMPEG_H__
#define __EMBEDVIDEODECODERFFMPEG_H__
@@ -31,7 +31,7 @@
#include <ffmpeg/avcodec.h>
#include "image.h"
-
+namespace gnash {
class DSOEXPORT embedVideoDecoderFfmpeg: public embedVideoDecoder {
public:
@@ -48,7 +48,7 @@
int outputFormat);
// gnash calls this when it wants you to decode the given videoframe
- image::image_base* decodeFrame(uint8_t* data, int size);
+ std::auto_ptr<image::image_base> decodeFrame(uint8_t* data, int size);
/// Convert the given srcFrame to RGB24 pixel format.
//
@@ -80,6 +80,7 @@
};
+} // end of gnash namespace
#endif // USE_FFMPEG
Index: libbase/embedVideoDecoderGst.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoderGst.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libbase/embedVideoDecoderGst.cpp 28 May 2007 15:41:01 -0000 1.4
+++ libbase/embedVideoDecoderGst.cpp 6 Jun 2007 15:41:12 -0000 1.5
@@ -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: embedVideoDecoderGst.cpp,v 1.4 2007/05/28 15:41:01 ann Exp $
+// $Id: embedVideoDecoderGst.cpp,v 1.5 2007/06/06 15:41:12 tgc Exp $
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -25,6 +25,8 @@
#include "embedVideoDecoderGst.h"
+namespace gnash {
+
embedVideoDecoderGst::embedVideoDecoderGst() :
pipeline(NULL),
input(NULL),
@@ -33,16 +35,19 @@
output(NULL),
decoder(NULL),
colorspace(NULL),
- decodedFrame(NULL)
+ decodedFrame(NULL),
+ stop(false)
{
}
embedVideoDecoderGst::~embedVideoDecoderGst()
{
- if(decodedFrame) delete decodedFrame;
+ delete decodedFrame;
if (pipeline) {
+ stop = true;
+ delete input_lock;
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pipeline));
}
@@ -120,7 +125,7 @@
// setup the video colorspaceconverter converter
colorspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
- // Find the decoder and init the parser
+ // Find the decoder
if (format == CODEC_H263) {
decoder = gst_element_factory_make ("ffdec_flv", NULL);
} else if (format == CODEC_VP6) {
@@ -128,10 +133,17 @@
} else if (format == CODEC_SCREENVIDEO) {
decoder = gst_element_factory_make ("ffdec_flashsv", NULL);
} else {
+ gnash::log_error("Unsupported embedded video format");
return;
}
- if (!pipeline || !input || !inputcaps || !videocaps || !output ||
!decoder || !colorspace) {
+ if (!pipeline || !input || !inputcaps || !videocaps || !output ||
!colorspace) {
+ gnash::log_error("Creation of Gstreamer baisc elements failed,
is your Gstreamer installation complete?");
+ return;
+ }
+
+ if (!decoder) {
+ gnash::log_error("Creation of decoder element failed, do you
have gstreamer-0.10-ffmpeg installed?");
return;
}
@@ -160,11 +172,19 @@
// gnash calls this when it wants you to decode the given videoframe
-image::image_base*
+std::auto_ptr<image::image_base>
embedVideoDecoderGst::decodeFrame(uint8_t* data, int size)
{
- if (data == NULL) return decodedFrame;
+ std::auto_ptr<image::image_base> ret_image;
+
+ if (outputFormat == YUV) {
+ ret_image.reset(new image::yuv(width, height));
+ } else if (outputFormat == RGB) {
+ ret_image.reset(new image::rgb(width, height));
+ }
+
+ if (data == NULL || size == 0) return ret_image;
frame = data;
frameSize = size;
@@ -173,7 +193,8 @@
output_lock = new boost::mutex::scoped_lock(output_mutex);
- return decodedFrame;
+ ret_image->update(decodedFrame->m_data);
+ return ret_image;
}
// The callback function which refills the buffer with data
@@ -182,6 +203,8 @@
{
embedVideoDecoderGst* decoder =
static_cast<embedVideoDecoderGst*>(user_data);
+ if (decoder->stop) return;
+
decoder->input_lock = new
boost::mutex::scoped_lock(decoder->input_mutex);
GST_BUFFER_SIZE(buffer) = decoder->frameSize;
@@ -195,6 +218,8 @@
{
embedVideoDecoderGst* decoder =
static_cast<embedVideoDecoderGst*>(user_data);
+ if (decoder->stop) return;
+
if (decoder->decodedFrame) {
if (decoder->outputFormat == YUV) {
@@ -228,4 +253,6 @@
}
+} // end of gnash namespace
+
#endif // SOUND_GST
Index: libbase/embedVideoDecoderGst.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoderGst.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libbase/embedVideoDecoderGst.h 28 May 2007 15:41:01 -0000 1.2
+++ libbase/embedVideoDecoderGst.h 6 Jun 2007 15:41:12 -0000 1.3
@@ -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: embedVideoDecoderGst.h,v 1.2 2007/05/28 15:41:01 ann Exp $
+// $Id: embedVideoDecoderGst.h,v 1.3 2007/06/06 15:41:12 tgc Exp $
#ifndef __EMBEDVIDEODECODERGST_H__
#define __EMBEDVIDEODECODERGST_H__
@@ -33,6 +33,7 @@
#include <boost/bind.hpp>
#include <boost/thread/mutex.hpp>
+namespace gnash {
class embedVideoDecoderGst : public embedVideoDecoder {
public:
@@ -49,7 +50,7 @@
int outputFormat);
// gnash calls this when it wants you to decode the given videoframe
- image::image_base* decodeFrame(uint8_t* data, int size);
+ std::auto_ptr<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);
@@ -65,11 +66,10 @@
/// Gstreamer objects
GstElement *input;
GstElement *inputcaps;
- GstElement *parser;
- GstElement *decoder;
GstElement *videocaps;
- GstElement *colorspace;
GstElement *output;
+ GstElement *decoder;
+ GstElement *colorspace;
/// mutexes and locks used to handle input and output.
boost::mutex input_mutex;
@@ -92,8 +92,11 @@
/// Last decoded frame
image::image_base* decodedFrame;
+ /// If we should stop this will be true
+ volatile bool stop;
};
+} // end of gnash namespace
#endif // SOUND_GST
Index: server/video_stream_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/video_stream_instance.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- server/video_stream_instance.cpp 4 Jun 2007 19:21:20 -0000 1.27
+++ server/video_stream_instance.cpp 6 Jun 2007 15:41:12 -0000 1.28
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// $Id: video_stream_instance.cpp,v 1.27 2007/06/04 19:21:20 strk Exp $
+// $Id: video_stream_instance.cpp,v 1.28 2007/06/06 15:41:12 tgc Exp $
#include "sprite_instance.h"
#include "video_stream_instance.h"
@@ -206,10 +206,10 @@
assert(m_def);
m_def->get_frame_data(current_frame, &data, &size);
- image::image_base* i = m_decoder->decodeFrame(data, size);
- if (i)
+ std::auto_ptr<image::image_base> i (
m_decoder->decodeFrame(data, size) );
+ if (i.get())
{
- gnash::render::drawVideoFrame(i, &m, &bounds);
+ gnash::render::drawVideoFrame(i.get(), &m, &bounds);
} else {
log_error(_("An error occured while decoding video
frame"));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libbase/embedVideoDecoder.h lib...,
Tomas Groth <=