[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libbase/BitsReader.cpp libbase/...
From: |
Tomas Groth |
Subject: |
[Gnash-commit] gnash ChangeLog libbase/BitsReader.cpp libbase/... |
Date: |
Thu, 04 Oct 2007 09:37:51 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Tomas Groth <tgc> 07/10/04 09:37:51
Modified files:
. : ChangeLog
libbase : BitsReader.cpp BitsReader.h
libmedia : AudioDecoder.h AudioDecoderNellymoser.cpp
AudioDecoderNellymoser.h AudioDecoderSimple.cpp
AudioDecoderSimple.h MediaBuffer.h
MediaDecoder.h MediaParser.h SoundInfo.h
VideoDecoder.h
libmedia/gst : VideoDecoderGst.h gstappbuffer.c gstappbuffer.h
gstappsink.c gstappsink.h gstappsrc.c
gstappsrc.h sound_handler_gst.h
Log message:
2007-10-04 Tomas Groth Christensen <address@hidden>
* libmedia/gst/gstappsink.{c,h}: Updated to match latest
gstreamer cvs.
* libmedia/*: Fix cvs is tags.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4518&r2=1.4519
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/BitsReader.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/BitsReader.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/AudioDecoder.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/AudioDecoderNellymoser.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/AudioDecoderNellymoser.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/AudioDecoderSimple.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/AudioDecoderSimple.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/MediaBuffer.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/MediaDecoder.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/MediaParser.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/SoundInfo.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/VideoDecoder.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/gst/VideoDecoderGst.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/gst/gstappbuffer.c?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/gst/gstappbuffer.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/gst/gstappsink.c?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/gst/gstappsink.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/gst/gstappsrc.c?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/gst/gstappsrc.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/gst/sound_handler_gst.h?cvsroot=gnash&r1=1.2&r2=1.3
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4518
retrieving revision 1.4519
diff -u -b -r1.4518 -r1.4519
--- ChangeLog 4 Oct 2007 08:18:11 -0000 1.4518
+++ ChangeLog 4 Oct 2007 09:37:49 -0000 1.4519
@@ -1,3 +1,8 @@
+2007-10-04 Tomas Groth Christensen <address@hidden>
+
+ * libmedia/gst/gstappsink.{c,h}: Updated to match latest gstreamer cvs.
+ * libmedia/*: Fix cvs is tags.
+
2007-10-04 Sandro Santilli <address@hidden>
* testsuite/actionscript.all/MovieClip.as: add test showing
Index: libbase/BitsReader.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/BitsReader.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libbase/BitsReader.cpp 3 Oct 2007 21:43:04 -0000 1.1
+++ libbase/BitsReader.cpp 4 Oct 2007 09:37:49 -0000 1.2
@@ -17,6 +17,8 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
+// $Id: BitsReader.cpp,v 1.2 2007/10/04 09:37:49 tgc Exp $
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Index: libbase/BitsReader.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/BitsReader.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libbase/BitsReader.h 3 Oct 2007 21:43:04 -0000 1.1
+++ libbase/BitsReader.h 4 Oct 2007 09:37:49 -0000 1.2
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-
+// $Id: BitsReader.h,v 1.2 2007/10/04 09:37:49 tgc Exp $
#ifndef BITSREADER_H
#define BITSREADER_H
Index: libmedia/AudioDecoder.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/AudioDecoder.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libmedia/AudioDecoder.h 1 Oct 2007 08:51:19 -0000 1.3
+++ libmedia/AudioDecoder.h 4 Oct 2007 09:37:50 -0000 1.4
@@ -16,7 +16,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:
+// $Id: AudioDecoder.h,v 1.4 2007/10/04 09:37:50 tgc Exp $
#ifndef __AUDIODECODER_H__
#define __AUDIODECODER_H__
Index: libmedia/AudioDecoderNellymoser.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/AudioDecoderNellymoser.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/AudioDecoderNellymoser.cpp 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/AudioDecoderNellymoser.cpp 4 Oct 2007 09:37:50 -0000 1.3
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// Id:
+// $Id: AudioDecoderNellymoser.cpp,v 1.3 2007/10/04 09:37:50 tgc Exp $
// This file incorporates work covered by the following copyright and
permission
// notice:
Index: libmedia/AudioDecoderNellymoser.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/AudioDecoderNellymoser.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/AudioDecoderNellymoser.h 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/AudioDecoderNellymoser.h 4 Oct 2007 09:37:50 -0000 1.3
@@ -16,7 +16,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:
+// $Id: AudioDecoderNellymoser.h,v 1.3 2007/10/04 09:37:50 tgc Exp $
// This file incorporates work covered by the following copyright and
permission
// notice:
Index: libmedia/AudioDecoderSimple.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/AudioDecoderSimple.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/AudioDecoderSimple.cpp 3 Oct 2007 21:43:05 -0000 1.2
+++ libmedia/AudioDecoderSimple.cpp 4 Oct 2007 09:37:50 -0000 1.3
@@ -17,6 +17,8 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
+// $Id: AudioDecoderSimple.cpp,v 1.3 2007/10/04 09:37:50 tgc Exp $
+
#include <boost/scoped_array.hpp>
#include "AudioDecoderSimple.h"
Index: libmedia/AudioDecoderSimple.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/AudioDecoderSimple.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/AudioDecoderSimple.h 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/AudioDecoderSimple.h 4 Oct 2007 09:37:50 -0000 1.3
@@ -16,7 +16,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:
+// $Id: AudioDecoderSimple.h,v 1.3 2007/10/04 09:37:50 tgc Exp $
#ifndef __AUDIODECODERSIMPLE_H__
#define __AUDIODECODERSIMPLE_H__
Index: libmedia/MediaBuffer.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/MediaBuffer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/MediaBuffer.h 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/MediaBuffer.h 4 Oct 2007 09:37:50 -0000 1.3
@@ -16,7 +16,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:
+// $Id: MediaBuffer.h,v 1.3 2007/10/04 09:37:50 tgc Exp $
#ifndef __MEDIABUFFER_H__
#define __MEDIABUFFER_H__
Index: libmedia/MediaDecoder.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/MediaDecoder.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/MediaDecoder.h 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/MediaDecoder.h 4 Oct 2007 09:37:50 -0000 1.3
@@ -16,7 +16,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:
+// $Id: MediaDecoder.h,v 1.3 2007/10/04 09:37:50 tgc Exp $
#ifndef __MEDIADECODER_H__
#define __MEDIADECODER_H__
Index: libmedia/MediaParser.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/MediaParser.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libmedia/MediaParser.h 1 Oct 2007 08:51:19 -0000 1.3
+++ libmedia/MediaParser.h 4 Oct 2007 09:37:50 -0000 1.4
@@ -16,7 +16,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:
+// $Id: MediaParser.h,v 1.4 2007/10/04 09:37:50 tgc Exp $
#ifndef __MEDIAPARSER_H__
#define __MEDIAPARSER_H__
Index: libmedia/SoundInfo.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/SoundInfo.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libmedia/SoundInfo.h 27 Sep 2007 23:59:53 -0000 1.1
+++ libmedia/SoundInfo.h 4 Oct 2007 09:37:50 -0000 1.2
@@ -18,7 +18,7 @@
//
//
-// $Id:
+// $Id: SoundInfo.h,v 1.2 2007/10/04 09:37:50 tgc Exp $
#ifndef __SOUNDINFO_H__
#define __SOUNDINFO_H__
Index: libmedia/VideoDecoder.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/VideoDecoder.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libmedia/VideoDecoder.h 1 Oct 2007 08:51:19 -0000 1.3
+++ libmedia/VideoDecoder.h 4 Oct 2007 09:37:50 -0000 1.4
@@ -16,7 +16,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:
+// $Id: VideoDecoder.h,v 1.4 2007/10/04 09:37:50 tgc Exp $
#ifndef __VIDEODECODER_H__
#define __VIDEODECODER_H__
Index: libmedia/gst/VideoDecoderGst.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/gst/VideoDecoderGst.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libmedia/gst/VideoDecoderGst.h 28 Sep 2007 10:49:10 -0000 1.3
+++ libmedia/gst/VideoDecoderGst.h 4 Oct 2007 09:37:50 -0000 1.4
@@ -16,7 +16,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:
+// $Id: VideoDecoderGst.h,v 1.4 2007/10/04 09:37:50 tgc Exp $
#ifndef __VIDEODECODERGST_H__
#define __VIDEODECODERGST_H__
Index: libmedia/gst/gstappbuffer.c
===================================================================
RCS file: /sources/gnash/gnash/libmedia/gst/gstappbuffer.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/gst/gstappbuffer.c 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/gst/gstappbuffer.c 4 Oct 2007 09:37:50 -0000 1.3
@@ -17,7 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
-/* Id: */
+/* $Id: gstappbuffer.c,v 1.3 2007/10/04 09:37:50 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
Index: libmedia/gst/gstappbuffer.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/gst/gstappbuffer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/gst/gstappbuffer.h 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/gst/gstappbuffer.h 4 Oct 2007 09:37:50 -0000 1.3
@@ -17,7 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
-/* Id: */
+/* $Id: gstappbuffer.h,v 1.3 2007/10/04 09:37:50 tgc Exp $ */
#ifndef _GST_APP_BUFFER_H_
#define _GST_APP_BUFFER_H_
Index: libmedia/gst/gstappsink.c
===================================================================
RCS file: /sources/gnash/gnash/libmedia/gst/gstappsink.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/gst/gstappsink.c 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/gst/gstappsink.c 4 Oct 2007 09:37:50 -0000 1.3
@@ -17,7 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
-/* Id: */
+/* $Id: gstappsink.c,v 1.3 2007/10/04 09:37:50 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -25,6 +25,7 @@
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
+#include <gst/gstbuffer.h>
#include <string.h>
@@ -36,13 +37,29 @@
static const GstElementDetails app_sink_details =
GST_ELEMENT_DETAILS ("AppSink",
- "FIXME",
- "FIXME",
- "autogenerated by makefilter");
+ "Generic/Sink",
+ "Allow the application to get access to raw buffer",
+ "David Schleef <address@hidden>, Wim Taymans <address@hidden");
enum
{
- PROP_0
+ /* signals */
+ SIGNAL_EOS,
+ SIGNAL_NEW_PREROLL,
+ SIGNAL_NEW_BUFFER,
+
+ /* acions */
+ SIGNAL_PULL_PREROLL,
+ SIGNAL_PULL_BUFFER,
+
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_CAPS,
+ PROP_EOS
};
static GstStaticPadTemplate gst_app_sink_template =
@@ -51,33 +68,70 @@
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
+static void gst_app_sink_dispose (GObject * object);
+static void gst_app_sink_finalize (GObject * object);
+
static void gst_app_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_app_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static void gst_app_sink_dispose (GObject * object);
+
static gboolean gst_app_sink_start (GstBaseSink * psink);
static gboolean gst_app_sink_stop (GstBaseSink * psink);
static gboolean gst_app_sink_event (GstBaseSink * sink, GstEvent * event);
+static GstFlowReturn gst_app_sink_preroll (GstBaseSink * psink,
+ GstBuffer * buffer);
static GstFlowReturn gst_app_sink_render (GstBaseSink * psink,
GstBuffer * buffer);
+static GstCaps *gst_app_sink_getcaps (GstBaseSink * psink);
+
+static guint gst_app_sink_signals[LAST_SIGNAL] = { 0 };
GST_BOILERPLATE (GstAppSink, gst_app_sink, GstBaseSink, GST_TYPE_BASE_SINK);
+void
+gst_app_marshal_OBJECT__VOID (GClosure * closure,
+ GValue * return_value,
+ guint n_param_values,
+ const GValue * param_values,
+ gpointer invocation_hint, gpointer marshal_data)
+{
+ typedef GstBuffer *(*GMarshalFunc_OBJECT__VOID) (gpointer data1,
+ gpointer data2);
+ register GMarshalFunc_OBJECT__VOID callback;
+ register GCClosure *cc = (GCClosure *) closure;
+ register gpointer data1, data2;
+ GstBuffer *v_return;
+
+ g_return_if_fail (return_value != NULL);
+ g_return_if_fail (n_param_values == 1);
+
+ if (G_CCLOSURE_SWAP_DATA (closure)) {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ } else {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback =
+ (GMarshalFunc_OBJECT__VOID) (marshal_data ? marshal_data : cc->callback);
+
+ v_return = callback (data1, data2);
+
+ gst_value_take_buffer (return_value, v_return);
+}
+
static void
gst_app_sink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- //GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
-
GST_DEBUG_CATEGORY_INIT (app_sink_debug, "appsink", 0, "appsink element");
gst_element_class_set_details (element_class, &app_sink_details);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_app_sink_template));
-
}
static void
@@ -86,14 +140,94 @@
GObjectClass *gobject_class = (GObjectClass *) klass;
GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
+ gobject_class->dispose = gst_app_sink_dispose;
+ gobject_class->finalize = gst_app_sink_finalize;
+
gobject_class->set_property = gst_app_sink_set_property;
gobject_class->get_property = gst_app_sink_get_property;
- gobject_class->dispose = gst_app_sink_dispose;
+
+ g_object_class_install_property (gobject_class, PROP_CAPS,
+ g_param_spec_boxed ("caps", "Caps",
+ "The caps of the sink pad", GST_TYPE_CAPS, G_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class, PROP_EOS,
+ g_param_spec_boolean ("eos", "EOS",
+ "Check if the sink is EOS", TRUE, G_PARAM_READABLE));
+
+ /**
+ * GstAppSink::eos:
+ * @appsink: the appsink element that emited the signal
+ *
+ * Signal that the end-of-stream has been reached.
+ */
+ gst_app_sink_signals[SIGNAL_EOS] =
+ g_signal_new ("eos", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstAppSinkClass, eos),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
+ /**
+ * GstAppSink::new-preroll:
+ * @appsink: the appsink element that emited the signal
+ * @buffer: the buffer that caused the preroll
+ *
+ * Signal that a new preroll buffer is available.
+ */
+ gst_app_sink_signals[SIGNAL_NEW_PREROLL] =
+ g_signal_new ("new-preroll", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstAppSinkClass, new_preroll),
+ NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 0,
+ GST_TYPE_BUFFER);
+ /**
+ * GstAppSink::new-buffer:
+ * @appsink: the appsink element that emited the signal
+ * @buffer: the buffer that is available
+ *
+ * Signal that a new buffer is available.
+ */
+ gst_app_sink_signals[SIGNAL_NEW_BUFFER] =
+ g_signal_new ("new-buffer", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstAppSinkClass, new_buffer),
+ NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 0,
+ GST_TYPE_BUFFER);
+
+ /**
+ * GstAppSink::pull-preroll:
+ * @appsink: the appsink element to emit this signal on
+ *
+ * Get the last preroll buffer on @appsink.
+ */
+ gst_app_sink_signals[SIGNAL_PULL_PREROLL] =
+ g_signal_new ("pull-preroll", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstAppSinkClass, pull_preroll), NULL,
+ NULL, gst_app_marshal_OBJECT__VOID, GST_TYPE_BUFFER, 0, G_TYPE_NONE);
+ /**
+ * GstAppSink::pull-buffer:
+ * @appsink: the appsink element to emit this signal on
+ *
+ * Get the next buffer buffer on @appsink.
+ */
+ gst_app_sink_signals[SIGNAL_PULL_PREROLL] =
+ g_signal_new ("pull-buffer", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstAppSinkClass, pull_buffer),
+ NULL, NULL, gst_app_marshal_OBJECT__VOID, GST_TYPE_BUFFER, 0,
+ G_TYPE_NONE);
basesink_class->start = gst_app_sink_start;
basesink_class->stop = gst_app_sink_stop;
basesink_class->event = gst_app_sink_event;
+ basesink_class->preroll = gst_app_sink_preroll;
basesink_class->render = gst_app_sink_render;
+ basesink_class->get_caps = gst_app_sink_getcaps;
+
+ klass->pull_preroll = gst_app_sink_pull_preroll;
+ klass->pull_buffer = gst_app_sink_pull_buffer;
+}
+
+static void
+gst_app_sink_init (GstAppSink * appsink, GstAppSinkClass * klass)
+{
+ appsink->mutex = g_mutex_new ();
+ appsink->cond = g_cond_new ();
+ appsink->queue = g_queue_new ();
}
static void
@@ -105,61 +239,80 @@
gst_caps_unref (appsink->caps);
appsink->caps = NULL;
}
- if (appsink->mutex) {
- g_mutex_free (appsink->mutex);
- appsink->mutex = NULL;
- }
- if (appsink->cond) {
- g_cond_free (appsink->cond);
- appsink->cond = NULL;
- }
- if (appsink->queue) {
- g_queue_free (appsink->queue);
- appsink->queue = NULL;
+ if (appsink->preroll) {
+ gst_buffer_unref (appsink->preroll);
+ appsink->preroll = NULL;
}
+ g_queue_foreach (appsink->queue, (GFunc) gst_mini_object_unref, NULL);
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
static void
-gst_app_sink_init (GstAppSink * appsink, GstAppSinkClass * klass)
+gst_app_sink_finalize (GObject * obj)
{
- UNUSEDPAR(klass);
- appsink->mutex = g_mutex_new ();
- appsink->cond = g_cond_new ();
- appsink->queue = g_queue_new ();
+ GstAppSink *appsink = GST_APP_SINK (obj);
+
+ g_mutex_free (appsink->mutex);
+ g_cond_free (appsink->cond);
+ g_queue_free (appsink->queue);
+
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
}
static void
gst_app_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- UNUSEDPAR(value);
GstAppSink *appsink = GST_APP_SINK (object);
- GST_OBJECT_LOCK (appsink);
switch (prop_id) {
+ case PROP_CAPS:
+ gst_app_sink_set_caps (appsink, gst_value_get_caps (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
- GST_OBJECT_UNLOCK (appsink);
}
static void
gst_app_sink_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
- UNUSEDPAR(value);
GstAppSink *appsink = GST_APP_SINK (object);
- GST_OBJECT_LOCK (appsink);
switch (prop_id) {
+ case PROP_CAPS:
+ {
+ GstCaps *caps;
+
+ caps = gst_app_sink_get_caps (appsink);
+ gst_value_set_caps (value, caps);
+ if (caps)
+ gst_caps_unref (caps);
+ break;
+ }
+ case PROP_EOS:
+ g_value_set_boolean (value, gst_app_sink_is_eos (appsink));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
- GST_OBJECT_UNLOCK (appsink);
+}
+
+static void
+gst_app_sink_flush_unlocked (GstAppSink * appsink)
+{
+ GstBuffer *buffer;
+
+ GST_DEBUG_OBJECT (appsink, "flushing appsink");
+ appsink->is_eos = FALSE;
+ gst_buffer_replace (&appsink->preroll, NULL);
+ while ((buffer = g_queue_pop_head (appsink->queue)))
+ gst_buffer_unref (buffer);
+ g_cond_signal (appsink->cond);
}
static gboolean
@@ -167,7 +320,11 @@
{
GstAppSink *appsink = GST_APP_SINK (psink);
- appsink->end_of_stream = FALSE;
+ g_mutex_lock (appsink->mutex);
+ appsink->is_eos = FALSE;
+ appsink->started = TRUE;
+ GST_DEBUG_OBJECT (appsink, "starting");
+ g_mutex_unlock (appsink->mutex);
return TRUE;
}
@@ -175,8 +332,13 @@
static gboolean
gst_app_sink_stop (GstBaseSink * psink)
{
- UNUSEDPAR(psink);
- //GstAppSink *appsink = GST_APP_SINK(psink);
+ GstAppSink *appsink = GST_APP_SINK (psink);
+
+ g_mutex_lock (appsink->mutex);
+ GST_DEBUG_OBJECT (appsink, "stopping");
+ appsink->started = FALSE;
+ gst_app_sink_flush_unlocked (appsink);
+ g_mutex_unlock (appsink->mutex);
return TRUE;
}
@@ -188,14 +350,38 @@
switch (event->type) {
case GST_EVENT_EOS:
- appsink->end_of_stream = TRUE;
+ g_mutex_lock (appsink->mutex);
+ GST_DEBUG_OBJECT (appsink, "receiving EOS");
+ appsink->is_eos = TRUE;
+ g_cond_signal (appsink->cond);
+ g_mutex_unlock (appsink->mutex);
+ break;
+ case GST_EVENT_FLUSH_START:
+ break;
+ case GST_EVENT_FLUSH_STOP:
+ g_mutex_lock (appsink->mutex);
+ GST_DEBUG_OBJECT (appsink, "received FLUSH_STOP");
+ gst_app_sink_flush_unlocked (appsink);
+ g_mutex_unlock (appsink->mutex);
break;
default:
break;
}
+ return TRUE;
+}
+
+static GstFlowReturn
+gst_app_sink_preroll (GstBaseSink * psink, GstBuffer * buffer)
+{
+ GstAppSink *appsink = GST_APP_SINK (psink);
+
+ g_mutex_lock (appsink->mutex);
+ GST_DEBUG_OBJECT (appsink, "setting preroll buffer %p", buffer);
+ gst_buffer_replace (&appsink->preroll, buffer);
+ g_cond_signal (appsink->cond);
+ g_mutex_unlock (appsink->mutex);
- gst_object_unref (sink);
- return FALSE;
+ return GST_FLOW_OK;
}
static GstFlowReturn
@@ -204,6 +390,7 @@
GstAppSink *appsink = GST_APP_SINK (psink);
g_mutex_lock (appsink->mutex);
+ GST_DEBUG_OBJECT (appsink, "pushing render buffer %p on queue", buffer);
g_queue_push_tail (appsink->queue, gst_buffer_ref (buffer));
g_cond_signal (appsink->cond);
g_mutex_unlock (appsink->mutex);
@@ -211,30 +398,93 @@
return GST_FLOW_OK;
}
+static GstCaps *
+gst_app_sink_getcaps (GstBaseSink * psink)
+{
+ GstCaps *caps;
+ GstAppSink *appsink = GST_APP_SINK (psink);
+ GST_OBJECT_LOCK (appsink);
+ if ((caps = appsink->caps))
+ gst_caps_ref (caps);
+ GST_DEBUG_OBJECT (appsink, "got caps %" GST_PTR_FORMAT, caps);
+ GST_OBJECT_UNLOCK (appsink);
+
+ return caps;
+}
/* external API */
/**
* gst_app_sink_set_caps:
- * @appsink:
- * @caps:
+ * @appsink: a #GstAppSink
+ * @caps: caps to set
*
* Set the capabilities on the appsink element. This function takes
- * ownership of the caps structure.
+ * a copy of the caps structure. After calling this method, the sink will only
+ * accept caps that match @caps. If @caps is non-fixed, you must check the caps
+ * on the buffers to get the actual used caps.
*/
void
-gst_app_sink_set_caps (GstAppSink * appsink, GstCaps * caps)
+gst_app_sink_set_caps (GstAppSink * appsink, const GstCaps * caps)
{
+ GstCaps *old;
+
g_return_if_fail (appsink != NULL);
g_return_if_fail (GST_IS_APP_SINK (appsink));
- gst_caps_replace (&appsink->caps, caps);
+ GST_OBJECT_LOCK (appsink);
+ GST_DEBUG_OBJECT (appsink, "setting caps to %" GST_PTR_FORMAT, caps);
+ old = appsink->caps;
+ if (caps)
+ appsink->caps = gst_caps_copy (caps);
+ else
+ appsink->caps = NULL;
+ if (old)
+ gst_caps_unref (old);
+ GST_OBJECT_UNLOCK (appsink);
}
+/**
+ * gst_app_sink_get_caps:
+ * @appsink: a #GstAppSink
+ *
+ * Get the configured caps on @appsink.
+ *
+ * Returns: the #GstCaps accepted by the sink. gst_caps_unref() after usage.
+ */
+GstCaps *
+gst_app_sink_get_caps (GstAppSink * appsink)
+{
+ GstCaps *caps;
+
+ g_return_val_if_fail (appsink != NULL, NULL);
+ g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
+
+ GST_OBJECT_LOCK (appsink);
+ if ((caps = appsink->caps))
+ gst_caps_ref (caps);
+ GST_DEBUG_OBJECT (appsink, "getting caps of %" GST_PTR_FORMAT, caps);
+ GST_OBJECT_UNLOCK (appsink);
+
+ return caps;
+}
+
+/**
+ * gst_app_sink_is_eos:
+ * @appsink: a #GstAppSink
+ *
+ * Check if @appsink is EOS, which is when no more buffers can be pulled
because
+ * an EOS event was received.
+ *
+ * This function also returns %TRUE when the appsink is not in the PAUSED or
+ * PLAYING state.
+ *
+ * Returns: %TRUE if no more buffers can be pulled and the appsink is EOS.
+ */
gboolean
-gst_app_sink_end_of_stream (GstAppSink * appsink)
+gst_app_sink_is_eos (GstAppSink * appsink)
{
gboolean ret;
@@ -242,16 +492,115 @@
g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
g_mutex_lock (appsink->mutex);
- if (appsink->end_of_stream && g_queue_is_empty (appsink->queue)) {
+ if (!appsink->started)
+ goto not_started;
+
+ if (appsink->is_eos && g_queue_is_empty (appsink->queue)) {
+ GST_DEBUG_OBJECT (appsink, "we are EOS and the queue is empty");
ret = TRUE;
} else {
+ GST_DEBUG_OBJECT (appsink, "we are not yet EOS");
ret = FALSE;
}
g_mutex_unlock (appsink->mutex);
return ret;
+
+not_started:
+ {
+ GST_DEBUG_OBJECT (appsink, "we are stopped, return TRUE");
+ g_mutex_unlock (appsink->mutex);
+ return TRUE;
+ }
}
+/**
+ * gst_app_sink_pull_preroll:
+ * @appsink: a #GstAppSink
+ *
+ * Get the last preroll buffer in @appsink. This was the buffer that caused the
+ * appsink to preroll in the PAUSED state. This buffer can be pulled many times
+ * and remains available to the application even after EOS.
+ *
+ * This function is typically used when dealing with a pipeline in the PAUSED
+ * state. Calling this function after doing a seek will give the buffer right
+ * after the seek position.
+ *
+ * Note that the preroll buffer will also be returned as the first buffer
+ * when calling gst_app_sink_pull_buffer().
+ *
+ * If an EOS event was received before any buffers, this function returns
+ * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
+ *
+ * This function blocks until a preroll buffer or EOS is received or the
appsink
+ * element is set to the READY/NULL state.
+ *
+ * Returns: a #GstBuffer or NULL when the appsink is stopped or EOS.
+ */
+GstBuffer *
+gst_app_sink_pull_preroll (GstAppSink * appsink)
+{
+ GstBuffer *buf = NULL;
+
+ g_return_val_if_fail (appsink != NULL, NULL);
+ g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
+
+ g_mutex_lock (appsink->mutex);
+
+ while (TRUE) {
+ GST_DEBUG_OBJECT (appsink, "trying to grab a buffer");
+ if (!appsink->started)
+ goto not_started;
+
+ if (appsink->preroll != NULL)
+ break;
+
+ if (appsink->is_eos)
+ goto eos;
+
+ /* nothing to return, wait */
+ GST_DEBUG_OBJECT (appsink, "waiting for the preroll buffer");
+ g_cond_wait (appsink->cond, appsink->mutex);
+ }
+ buf = gst_buffer_ref (appsink->preroll);
+ GST_DEBUG_OBJECT (appsink, "we have the preroll buffer %p", buf);
+ g_mutex_unlock (appsink->mutex);
+
+ return buf;
+
+ /* special conditions */
+eos:
+ {
+ GST_DEBUG_OBJECT (appsink, "we are EOS, return NULL");
+ g_mutex_unlock (appsink->mutex);
+ return NULL;
+ }
+not_started:
+ {
+ GST_DEBUG_OBJECT (appsink, "we are stopped, return NULL");
+ g_mutex_unlock (appsink->mutex);
+ return NULL;
+ }
+}
+
+/**
+ * gst_app_sink_pull_buffer:
+ * @appsink: a #GstAppSink
+ *
+ * This function blocks until a buffer or EOS becomes available or the appsink
+ * element is set to the READY/NULL state.
+ *
+ * This function will only return buffers when the appsink is in the PLAYING
+ * state. All rendered buffers will be put in a queue so that the application
+ * can pull buffers at its own rate. Note that when the application does not
+ * pull buffers fast enough, the queued buffers could consume a lot of memory,
+ * especially when dealing with raw video frames.
+ *
+ * If an EOS event was received before any buffers, this function returns
+ * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
+ *
+ * Returns: a #GstBuffer or NULL when the appsink is stopped or EOS.
+ */
GstBuffer *
gst_app_sink_pull_buffer (GstAppSink * appsink)
{
@@ -261,15 +610,39 @@
g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
g_mutex_lock (appsink->mutex);
- while (g_queue_is_empty (appsink->queue)) {
- if (appsink->end_of_stream)
- goto out;
+ while (TRUE) {
+ GST_DEBUG_OBJECT (appsink, "trying to grab a buffer");
+ if (!appsink->started)
+ goto not_started;
+
+ if (!g_queue_is_empty (appsink->queue))
+ break;
+
+ if (appsink->is_eos)
+ goto eos;
+
+ /* nothing to return, wait */
+ GST_DEBUG_OBJECT (appsink, "waiting for a buffer");
g_cond_wait (appsink->cond, appsink->mutex);
}
buf = g_queue_pop_head (appsink->queue);
-out:
+ GST_DEBUG_OBJECT (appsink, "we have a buffer %p", buf);
g_mutex_unlock (appsink->mutex);
return buf;
+
+ /* special conditions */
+eos:
+ {
+ GST_DEBUG_OBJECT (appsink, "we are EOS, return NULL");
+ g_mutex_unlock (appsink->mutex);
+ return NULL;
+ }
+not_started:
+ {
+ GST_DEBUG_OBJECT (appsink, "we are stopped, return NULL");
+ g_mutex_unlock (appsink->mutex);
+ return NULL;
+ }
}
Index: libmedia/gst/gstappsink.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/gst/gstappsink.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/gst/gstappsink.h 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/gst/gstappsink.h 4 Oct 2007 09:37:50 -0000 1.3
@@ -17,13 +17,11 @@
* Boston, MA 02111-1307, USA.
*/
-/* Id: */
+/* $Id: gstappsink.h,v 1.3 2007/10/04 09:37:50 tgc Exp $ */
#ifndef _GST_APP_SINK_H_
#define _GST_APP_SINK_H_
-#define UNUSEDPAR(x) { x = x; }
-
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
@@ -53,21 +51,36 @@
GCond *cond;
GMutex *mutex;
GQueue *queue;
- gboolean end_of_stream;
+ GstBuffer *preroll;
+ gboolean started;
+ gboolean is_eos;
};
struct _GstAppSinkClass
{
GstBaseSinkClass basesink_class;
+
+ /* signals */
+ gboolean (*eos) (GstAppSink *sink);
+ gboolean (*new_preroll) (GstAppSink *sink);
+ gboolean (*new_buffer) (GstAppSink *sink);
+
+ /* actions */
+ GstBuffer * (*pull_preroll) (GstAppSink *sink);
+ GstBuffer * (*pull_buffer) (GstAppSink *sink);
};
GType gst_app_sink_get_type(void);
GST_DEBUG_CATEGORY_EXTERN (app_sink_debug);
-void gst_app_sink_set_caps (GstAppSink *appsink, GstCaps *caps);
-gboolean gst_app_sink_end_of_stream (GstAppSink *appsink);
-GstBuffer *gst_app_sink_pull_buffer (GstAppSink *appsink);
+void gst_app_sink_set_caps (GstAppSink *appsink, const
GstCaps *caps);
+GstCaps * gst_app_sink_get_caps (GstAppSink *appsink);
+
+gboolean gst_app_sink_is_eos (GstAppSink *appsink);
+
+GstBuffer * gst_app_sink_pull_preroll (GstAppSink *appsink);
+GstBuffer * gst_app_sink_pull_buffer (GstAppSink *appsink);
G_END_DECLS
Index: libmedia/gst/gstappsrc.c
===================================================================
RCS file: /sources/gnash/gnash/libmedia/gst/gstappsrc.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/gst/gstappsrc.c 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/gst/gstappsrc.c 4 Oct 2007 09:37:50 -0000 1.3
@@ -17,7 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
-/* Id: */
+/* $Id: gstappsrc.c,v 1.3 2007/10/04 09:37:50 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
Index: libmedia/gst/gstappsrc.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/gst/gstappsrc.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/gst/gstappsrc.h 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/gst/gstappsrc.h 4 Oct 2007 09:37:50 -0000 1.3
@@ -17,7 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
-// Id:
+/* $Id: gstappsrc.h,v 1.3 2007/10/04 09:37:50 tgc Exp $ */
#ifndef _GST_APP_SRC_H_
#define _GST_APP_SRC_H_
Index: libmedia/gst/sound_handler_gst.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/gst/sound_handler_gst.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/gst/sound_handler_gst.h 28 Sep 2007 10:49:10 -0000 1.2
+++ libmedia/gst/sound_handler_gst.h 4 Oct 2007 09:37:50 -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:
+// $Id: sound_handler_gst.h,v 1.3 2007/10/04 09:37:50 tgc Exp $
#ifndef SOUND_HANDLER_GST_H
#define SOUND_HANDLER_GST_H
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libbase/BitsReader.cpp libbase/...,
Tomas Groth <=