diff options
-rw-r--r-- | docs/plugins/gst-plugins-bad-plugins.signals | 73 | ||||
-rw-r--r-- | docs/plugins/inspect/plugin-app.xml | 43 | ||||
-rw-r--r-- | gst-libs/gst/app/.gitignore | 2 | ||||
-rw-r--r-- | gst-libs/gst/app/Makefile.am | 35 | ||||
-rw-r--r-- | gst-libs/gst/app/gstapp-marshal.list | 4 | ||||
-rw-r--r-- | gst-libs/gst/app/gstappbuffer.c | 106 | ||||
-rw-r--r-- | gst-libs/gst/app/gstappbuffer.h | 64 | ||||
-rw-r--r-- | gst-libs/gst/app/gstappsink.c | 1016 | ||||
-rw-r--r-- | gst-libs/gst/app/gstappsink.h | 99 | ||||
-rw-r--r-- | gst-libs/gst/app/gstappsrc.c | 1165 | ||||
-rw-r--r-- | gst-libs/gst/app/gstappsrc.h | 120 | ||||
-rw-r--r-- | gst/app/Makefile.am | 8 | ||||
-rw-r--r-- | gst/app/gstapp.c | 42 |
13 files changed, 0 insertions, 2777 deletions
diff --git a/docs/plugins/gst-plugins-bad-plugins.signals b/docs/plugins/gst-plugins-bad-plugins.signals index 393baa132..a5ec9ad0e 100644 --- a/docs/plugins/gst-plugins-bad-plugins.signals +++ b/docs/plugins/gst-plugins-bad-plugins.signals @@ -1,39 +1,4 @@ <SIGNAL> -<NAME>GstAppSink::eos</NAME> -<RETURNS>void</RETURNS> -<FLAGS>l</FLAGS> -GstAppSink *gstappsink -</SIGNAL> - -<SIGNAL> -<NAME>GstAppSink::new-buffer</NAME> -<RETURNS>void</RETURNS> -<FLAGS>l</FLAGS> -GstAppSink *gstappsink -</SIGNAL> - -<SIGNAL> -<NAME>GstAppSink::new-preroll</NAME> -<RETURNS>void</RETURNS> -<FLAGS>l</FLAGS> -GstAppSink *gstappsink -</SIGNAL> - -<SIGNAL> -<NAME>GstAppSink::pull-buffer</NAME> -<RETURNS>GstBuffer*</RETURNS> -<FLAGS>la</FLAGS> -GstAppSink *gstappsink -</SIGNAL> - -<SIGNAL> -<NAME>GstAppSink::pull-preroll</NAME> -<RETURNS>GstBuffer*</RETURNS> -<FLAGS>la</FLAGS> -GstAppSink *gstappsink -</SIGNAL> - -<SIGNAL> <NAME>GstSwitch::block</NAME> <RETURNS>gint64</RETURNS> <FLAGS>l</FLAGS> @@ -76,44 +41,6 @@ gint64 arg3 </SIGNAL> <SIGNAL> -<NAME>GstAppSrc::end-of-stream</NAME> -<RETURNS>GstFlowReturn</RETURNS> -<FLAGS>la</FLAGS> -GstAppSrc *gstappsrc -</SIGNAL> - -<SIGNAL> -<NAME>GstAppSrc::enough-data</NAME> -<RETURNS>void</RETURNS> -<FLAGS>l</FLAGS> -GstAppSrc *gstappsrc -</SIGNAL> - -<SIGNAL> -<NAME>GstAppSrc::need-data</NAME> -<RETURNS>void</RETURNS> -<FLAGS>l</FLAGS> -GstAppSrc *gstappsrc -guint arg1 -</SIGNAL> - -<SIGNAL> -<NAME>GstAppSrc::push-buffer</NAME> -<RETURNS>GstFlowReturn</RETURNS> -<FLAGS>la</FLAGS> -GstAppSrc *gstappsrc -GstBuffer *arg1 -</SIGNAL> - -<SIGNAL> -<NAME>GstAppSrc::seek-data</NAME> -<RETURNS>gboolean</RETURNS> -<FLAGS>l</FLAGS> -GstAppSrc *gstappsrc -guint64 arg1 -</SIGNAL> - -<SIGNAL> <NAME>GstDivxEnc::frame-encoded</NAME> <RETURNS>void</RETURNS> <FLAGS>l</FLAGS> diff --git a/docs/plugins/inspect/plugin-app.xml b/docs/plugins/inspect/plugin-app.xml deleted file mode 100644 index 72c2948f9..000000000 --- a/docs/plugins/inspect/plugin-app.xml +++ /dev/null @@ -1,43 +0,0 @@ -<plugin> - <name>app</name> - <description>Elements used to communicate with applications</description> - <filename>../../gst/app/.libs/libgstapp.so</filename> - <basename>libgstapp.so</basename> - <version>0.10.9.1</version> - <license>LGPL</license> - <source>gst-plugins-bad</source> - <package>GStreamer Bad Plug-ins CVS/prerelease</package> - <origin>Unknown package origin</origin> - <elements> - <element> - <name>appsink</name> - <longname>AppSink</longname> - <class>Generic/Sink</class> - <description>Allow the application to get access to raw buffer</description> - <author>David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com></author> - <pads> - <caps> - <name>sink</name> - <direction>sink</direction> - <presence>always</presence> - <details>ANY</details> - </caps> - </pads> - </element> - <element> - <name>appsrc</name> - <longname>AppSrc</longname> - <class>Generic/Src</class> - <description>Allow the application to feed buffers to a pipeline</description> - <author>David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com></author> - <pads> - <caps> - <name>src</name> - <direction>source</direction> - <presence>always</presence> - <details>ANY</details> - </caps> - </pads> - </element> - </elements> -</plugin>
\ No newline at end of file diff --git a/gst-libs/gst/app/.gitignore b/gst-libs/gst/app/.gitignore deleted file mode 100644 index 9f0ae4be9..000000000 --- a/gst-libs/gst/app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -gstapp-marshal.c -gstapp-marshal.h diff --git a/gst-libs/gst/app/Makefile.am b/gst-libs/gst/app/Makefile.am deleted file mode 100644 index af10a4ae5..000000000 --- a/gst-libs/gst/app/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -lib_LTLIBRARIES = libgstapp-@GST_MAJORMINOR@.la - -glib_enum_define = GST_APP -glib_enum_prefix = gst_app - -include $(top_srcdir)/common/glib-gen.mak - -built_sources = gstapp-marshal.c -built_headers = gstapp-marshal.h - -BUILT_SOURCES = $(built_sources) $(built_headers) - -nodist_libgstapp_@GST_MAJORMINOR@_la_SOURCES = \ - $(built_sources) - -libgstapp_@GST_MAJORMINOR@_la_SOURCES = gstappsrc.c gstappbuffer.c gstappsink.c -libgstapp_@GST_MAJORMINOR@_la_CFLAGS = \ - $(GST_PLUGINS_BAD_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) \ - $(GST_BASE_CFLAGS) \ - $(GST_CFLAGS) -libgstapp_@GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS) -libgstapp_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_ALL_LDFLAGS) -libgstapp_@GST_MAJORMINOR@_la_LIBTOOLFLAGS = --tag=disable-static - -libgstapp_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/app -libgstapp_@GST_MAJORMINOR@include_HEADERS = \ - gstappsrc.h \ - gstappbuffer.h \ - gstappsink.h - -CLEANFILES = $(BUILT_SOURCES) - -EXTRA_DIST = gstapp-marshal.list - diff --git a/gst-libs/gst/app/gstapp-marshal.list b/gst-libs/gst/app/gstapp-marshal.list deleted file mode 100644 index a5d8bdc8b..000000000 --- a/gst-libs/gst/app/gstapp-marshal.list +++ /dev/null @@ -1,4 +0,0 @@ -VOID:UINT -BOOLEAN:UINT64 -ENUM:OBJECT -ENUM:VOID diff --git a/gst-libs/gst/app/gstappbuffer.c b/gst-libs/gst/app/gstappbuffer.c deleted file mode 100644 index 06f354f86..000000000 --- a/gst-libs/gst/app/gstappbuffer.c +++ /dev/null @@ -1,106 +0,0 @@ -/* GStreamer - * Copyright (C) 2007 David Schleef <ds@schleef.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> -#include <gst/base/gstpushsrc.h> - -#include <string.h> - -#include "gstappbuffer.h" - -static void gst_app_buffer_init (GstAppBuffer * buffer, gpointer g_class); -static void gst_app_buffer_class_init (gpointer g_class, gpointer class_data); -static void gst_app_buffer_finalize (GstAppBuffer * buffer); - -static GstBufferClass *parent_class; - -GType -gst_app_buffer_get_type (void) -{ - static GType _gst_app_buffer_type; - - if (G_UNLIKELY (_gst_app_buffer_type == 0)) { - static const GTypeInfo app_buffer_info = { - sizeof (GstBufferClass), - NULL, - NULL, - gst_app_buffer_class_init, - NULL, - NULL, - sizeof (GstAppBuffer), - 0, - (GInstanceInitFunc) gst_app_buffer_init, - NULL - }; - _gst_app_buffer_type = g_type_register_static (GST_TYPE_BUFFER, - "GstAppBuffer", &app_buffer_info, 0); - } - return _gst_app_buffer_type; -} - -static void -gst_app_buffer_init (GstAppBuffer * buffer, gpointer g_class) -{ - -} - -static void -gst_app_buffer_class_init (gpointer g_class, gpointer class_data) -{ - GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class); - - mini_object_class->finalize = - (GstMiniObjectFinalizeFunction) gst_app_buffer_finalize; - - parent_class = g_type_class_peek_parent (g_class); -} - -static void -gst_app_buffer_finalize (GstAppBuffer * buffer) -{ - g_return_if_fail (buffer != NULL); - g_return_if_fail (GST_IS_APP_BUFFER (buffer)); - - if (buffer->finalize) { - buffer->finalize (buffer->priv); - } - - GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (buffer)); -} - -GstBuffer * -gst_app_buffer_new (void *data, int length, - GstAppBufferFinalizeFunc finalize, void *priv) -{ - GstAppBuffer *buffer; - - buffer = (GstAppBuffer *) gst_mini_object_new (GST_TYPE_APP_BUFFER); - - GST_BUFFER_DATA (buffer) = data; - GST_BUFFER_SIZE (buffer) = length; - - buffer->finalize = finalize; - buffer->priv = priv; - - return GST_BUFFER (buffer); -} diff --git a/gst-libs/gst/app/gstappbuffer.h b/gst-libs/gst/app/gstappbuffer.h deleted file mode 100644 index 532f2ae25..000000000 --- a/gst-libs/gst/app/gstappbuffer.h +++ /dev/null @@ -1,64 +0,0 @@ -/* GStreamer - * Copyright (C) 2007 David Schleef <ds@schleef.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _GST_APP_BUFFER_H_ -#define _GST_APP_BUFFER_H_ - -#include <gst/gst.h> - -G_BEGIN_DECLS - -#define GST_TYPE_APP_BUFFER \ - (gst_app_buffer_get_type()) -#define GST_APP_BUFFER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_BUFFER,GstAppBuffer)) -#define GST_APP_BUFFER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_BUFFER,GstAppBufferClass)) -#define GST_IS_APP_BUFFER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_BUFFER)) -#define GST_IS_APP_BUFFER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_BUFFER)) - -typedef struct _GstAppBuffer GstAppBuffer; -typedef struct _GstAppBufferClass GstAppBufferClass; -typedef void (*GstAppBufferFinalizeFunc) (void *priv); - -struct _GstAppBuffer -{ - GstBuffer buffer; - - /*< private >*/ - GstAppBufferFinalizeFunc finalize; - void *priv; -}; - -struct _GstAppBufferClass -{ - GstBufferClass buffer_class; -}; - -GType gst_app_buffer_get_type(void); - -GstBuffer *gst_app_buffer_new (void *data, int length, - GstAppBufferFinalizeFunc finalize, void *priv); - -G_END_DECLS - -#endif - diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c deleted file mode 100644 index d738a11b5..000000000 --- a/gst-libs/gst/app/gstappsink.c +++ /dev/null @@ -1,1016 +0,0 @@ -/* GStreamer - * Copyright (C) 2007 David Schleef <ds@schleef.org> - * (C) 2008 Wim Taymans <wim.taymans@gmail.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/** - * SECTION:element-appsink - * @see_also: #GstBaseSink, appsrc - * - * Appsink is a sink plugin that supports many different methods for making - * the application get a handle on the GStreamer data in a pipeline. - * - * appsink can be used by linking to the gstappsink.h header file to access the - * methods or by using the appsink action signals and properties. - * - * The normal way of retrieving buffers from appsink is by using the - * gst_app_sink_pull_buffer() and gst_app_sink_pull_preroll() methods. - * These methods block until a buffer becomes available in the sink or when the - * sink is shut down or reaches EOS. - * - * Appsink will internally use a queue to collect buffers from the streaming - * thread. If the application is not pulling buffers fast enough, this queue - * will consume a lot of memory over time. The "max-buffers" property can be - * used to limit the queue size. The "drop" property controls whether the - * streaming thread blocks or if older buffers are dropped when the maximum - * queue size is reached. Note that blocking the streaming thread can negatively - * affect real-time performance and should be avoided. - * - * If a blocking behaviour is not desirable, setting the "emit-signals" property - * to %TRUE will make appsink emit the "new-buffer" and "new-preroll" signals - * when a buffer can be pulled without blocking. - * - * The "caps" property on appsink can be used to control the formats that - * appsink can receive. This property can contain non-fixed caps, the format of - * the pulled buffers can be obtained by getting the buffer caps. - * - * If one of the pull-preroll or pull-buffer methods return %NULL, the appsink - * is stopped or in the EOS state. You can check for the EOS state with the - * "eos" property or with the gst_app_sink_is_eos() method. - * - * The eos signal can also be used to be informed when the EOS state is reached - * to avoid polling. - * - * Last reviewed on 2008-12-17 (0.10.10) - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> -#include <gst/base/gstbasesink.h> -#include <gst/gstbuffer.h> - -#include <string.h> - -#include "gstappsink.h" - - -GST_DEBUG_CATEGORY (app_sink_debug); -#define GST_CAT_DEFAULT app_sink_debug - -enum -{ - /* signals */ - SIGNAL_EOS, - SIGNAL_NEW_PREROLL, - SIGNAL_NEW_BUFFER, - - /* actions */ - SIGNAL_PULL_PREROLL, - SIGNAL_PULL_BUFFER, - - LAST_SIGNAL -}; - -#define DEFAULT_PROP_EOS TRUE -#define DEFAULT_PROP_EMIT_SIGNALS FALSE -#define DEFAULT_PROP_MAX_BUFFERS 0 -#define DEFAULT_PROP_DROP FALSE - -enum -{ - PROP_0, - PROP_CAPS, - PROP_EOS, - PROP_EMIT_SIGNALS, - PROP_MAX_BUFFERS, - PROP_DROP, - PROP_LAST -}; - -static GstStaticPadTemplate gst_app_sink_template = -GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - 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 gboolean gst_app_sink_unlock_start (GstBaseSink * bsink); -static gboolean gst_app_sink_unlock_stop (GstBaseSink * bsink); -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); - - GST_DEBUG_CATEGORY_INIT (app_sink_debug, "appsink", 0, "appsink element"); - - gst_element_class_set_details_simple (element_class, "AppSink", - "Generic/Sink", - "Allow the application to get access to raw buffer", - "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>"); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_app_sink_template)); -} - -static void -gst_app_sink_class_init (GstAppSinkClass * klass) -{ - 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; - - g_object_class_install_property (gobject_class, PROP_CAPS, - g_param_spec_boxed ("caps", "Caps", - "The allowed caps for the sink pad", GST_TYPE_CAPS, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, PROP_EOS, - g_param_spec_boolean ("eos", "EOS", - "Check if the sink is EOS or not started", DEFAULT_PROP_EOS, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, PROP_EMIT_SIGNALS, - g_param_spec_boolean ("emit-signals", "Emit signals", - "Emit new-preroll and new-buffer signals", DEFAULT_PROP_EMIT_SIGNALS, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, PROP_MAX_BUFFERS, - g_param_spec_uint ("max-buffers", "Max Buffers", - "The maximum number of buffers to queue internally (0 = unlimited)", - 0, G_MAXUINT, DEFAULT_PROP_MAX_BUFFERS, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, PROP_DROP, - g_param_spec_boolean ("drop", "Drop", - "Drop old buffers when the buffer queue is filled", DEFAULT_PROP_DROP, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - * GstAppSink::eos: - * @appsink: the appsink element that emited the signal - * - * Signal that the end-of-stream has been reached. This signal is emited from - * the steaming thread. - */ - 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 - * - * Signal that a new preroll buffer is available. - * - * This signal is emited from the steaming thread and only when the - * "emit-signals" property is %TRUE. - * - * The new preroll buffer can be retrieved with the "pull-preroll" action - * signal or gst_app_sink_pull_preroll() either from this signal callback - * or from any other thread. - * - * Note that this signal is only emited when the "emit-signals" property is - * set to %TRUE, which it is not by default for performance reasons. - */ - 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__VOID, G_TYPE_NONE, 0, G_TYPE_NONE); - /** - * GstAppSink::new-buffer: - * @appsink: the appsink element that emited the signal - * - * Signal that a new buffer is available. - * - * This signal is emited from the steaming thread and only when the - * "emit-signals" property is %TRUE. - * - * The new buffer can be retrieved with the "pull-buffer" action - * signal or gst_app_sink_pull_buffer() either from this signal callback - * or from any other thread. - * - * Note that this signal is only emited when the "emit-signals" property is - * set to %TRUE, which it is not by default for performance reasons. - */ - 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__VOID, G_TYPE_NONE, 0, G_TYPE_NONE); - - /** - * GstAppSink::pull-preroll: - * @appsink: the appsink element to emit this signal on - * - * 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() or the "pull-buffer" action signal. - * - * 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. - */ - gst_app_sink_signals[SIGNAL_PULL_PREROLL] = - g_signal_new ("pull-preroll", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, 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 - * - * 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. It's possible to control the behaviour of the queue with - * the "drop" and "max-buffers" properties. - * - * 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. - */ - gst_app_sink_signals[SIGNAL_PULL_PREROLL] = - g_signal_new ("pull-buffer", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSinkClass, - pull_buffer), NULL, NULL, gst_app_marshal_OBJECT__VOID, - GST_TYPE_BUFFER, 0, G_TYPE_NONE); - - basesink_class->unlock = gst_app_sink_unlock_start; - basesink_class->unlock_stop = gst_app_sink_unlock_stop; - 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 (); - - appsink->emit_signals = DEFAULT_PROP_EMIT_SIGNALS; - appsink->max_buffers = DEFAULT_PROP_MAX_BUFFERS; - appsink->drop = DEFAULT_PROP_DROP; -} - -static void -gst_app_sink_dispose (GObject * obj) -{ - GstAppSink *appsink = GST_APP_SINK (obj); - GstBuffer *buffer; - - GST_OBJECT_LOCK (appsink); - if (appsink->caps) { - gst_caps_unref (appsink->caps); - appsink->caps = NULL; - } - GST_OBJECT_UNLOCK (appsink); - - g_mutex_lock (appsink->mutex); - if (appsink->preroll) { - gst_buffer_unref (appsink->preroll); - appsink->preroll = NULL; - } - while ((buffer = g_queue_pop_head (appsink->queue))) - gst_buffer_unref (buffer); - g_mutex_unlock (appsink->mutex); - - G_OBJECT_CLASS (parent_class)->dispose (obj); -} - -static void -gst_app_sink_finalize (GObject * obj) -{ - 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) -{ - GstAppSink *appsink = GST_APP_SINK (object); - - switch (prop_id) { - case PROP_CAPS: - gst_app_sink_set_caps (appsink, gst_value_get_caps (value)); - break; - case PROP_EMIT_SIGNALS: - gst_app_sink_set_emit_signals (appsink, g_value_get_boolean (value)); - break; - case PROP_MAX_BUFFERS: - gst_app_sink_set_max_buffers (appsink, g_value_get_uint (value)); - break; - case PROP_DROP: - gst_app_sink_set_drop (appsink, g_value_get_boolean (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_app_sink_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstAppSink *appsink = GST_APP_SINK (object); - - 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; - case PROP_EMIT_SIGNALS: - g_value_set_boolean (value, gst_app_sink_get_emit_signals (appsink)); - break; - case PROP_MAX_BUFFERS: - g_value_set_uint (value, gst_app_sink_get_max_buffers (appsink)); - break; - case PROP_DROP: - g_value_set_boolean (value, gst_app_sink_get_drop (appsink)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static gboolean -gst_app_sink_unlock_start (GstBaseSink * bsink) -{ - GstAppSink *appsink = GST_APP_SINK (bsink); - - g_mutex_lock (appsink->mutex); - GST_DEBUG_OBJECT (appsink, "unlock start"); - appsink->flushing = TRUE; - g_cond_signal (appsink->cond); - g_mutex_unlock (appsink->mutex); - - return TRUE; -} - -static gboolean -gst_app_sink_unlock_stop (GstBaseSink * bsink) -{ - GstAppSink *appsink = GST_APP_SINK (bsink); - - g_mutex_lock (appsink->mutex); - GST_DEBUG_OBJECT (appsink, "unlock stop"); - appsink->flushing = FALSE; - g_cond_signal (appsink->cond); - g_mutex_unlock (appsink->mutex); - - return TRUE; -} - -static void -gst_app_sink_flush_unlocked (GstAppSink * appsink) -{ - GstBuffer *buffer; - - GST_DEBUG_OBJECT (appsink, "flush stop 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 -gst_app_sink_start (GstBaseSink * psink) -{ - GstAppSink *appsink = GST_APP_SINK (psink); - - g_mutex_lock (appsink->mutex); - GST_DEBUG_OBJECT (appsink, "starting"); - appsink->started = TRUE; - g_mutex_unlock (appsink->mutex); - - return TRUE; -} - -static gboolean -gst_app_sink_stop (GstBaseSink * psink) -{ - GstAppSink *appsink = GST_APP_SINK (psink); - - g_mutex_lock (appsink->mutex); - GST_DEBUG_OBJECT (appsink, "stopping"); - appsink->flushing = TRUE; - appsink->started = FALSE; - gst_app_sink_flush_unlocked (appsink); - g_mutex_unlock (appsink->mutex); - - return TRUE; -} - -static gboolean -gst_app_sink_event (GstBaseSink * sink, GstEvent * event) -{ - GstAppSink *appsink = GST_APP_SINK (sink); - - switch (event->type) { - case GST_EVENT_EOS: - - 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); - - /* emit EOS now */ - g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_EOS], 0); - break; - case GST_EVENT_FLUSH_START: - /* we don't have to do anything here, the base class will call unlock - * which will make sure we exit the _render method */ - GST_DEBUG_OBJECT (appsink, "received 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); - gboolean emit; - - g_mutex_lock (appsink->mutex); - if (appsink->flushing) - goto flushing; - - GST_DEBUG_OBJECT (appsink, "setting preroll buffer %p", buffer); - gst_buffer_replace (&appsink->preroll, buffer); - g_cond_signal (appsink->cond); - emit = appsink->emit_signals; - g_mutex_unlock (appsink->mutex); - - if (emit) - g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_PREROLL], 0); - - return GST_FLOW_OK; - -flushing: - { - GST_DEBUG_OBJECT (appsink, "we are flushing"); - g_mutex_unlock (appsink->mutex); - return GST_FLOW_WRONG_STATE; - } -} - -static GstFlowReturn -gst_app_sink_render (GstBaseSink * psink, GstBuffer * buffer) -{ - GstAppSink *appsink = GST_APP_SINK (psink); - gboolean emit; - - g_mutex_lock (appsink->mutex); - if (appsink->flushing) - goto flushing; - - GST_DEBUG_OBJECT (appsink, "pushing render buffer %p on queue (%d)", - buffer, appsink->queue->length); - - while (appsink->max_buffers > 0 && - appsink->queue->length >= appsink->max_buffers) { - if (appsink->drop) { - GstBuffer *buf; - - /* we need to drop the oldest buffer and try again */ - buf = g_queue_pop_head (appsink->queue); - GST_DEBUG_OBJECT (appsink, "dropping old buffer %p", buf); - gst_buffer_unref (buf); - } else { - GST_DEBUG_OBJECT (appsink, "waiting for free space, length %d >= %d", - appsink->queue->length, appsink->max_buffers); - /* wait for a buffer to be removed or flush */ - g_cond_wait (appsink->cond, appsink->mutex); - if (appsink->flushing) - goto flushing; - } - } - /* we need to ref the buffer when pushing it in the queue */ - g_queue_push_tail (appsink->queue, gst_buffer_ref (buffer)); - g_cond_signal (appsink->cond); - emit = appsink->emit_signals; - g_mutex_unlock (appsink->mutex); - - if (emit) - g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_BUFFER], 0); - - return GST_FLOW_OK; - -flushing: - { - GST_DEBUG_OBJECT (appsink, "we are flushing"); - g_mutex_unlock (appsink->mutex); - return GST_FLOW_WRONG_STATE; - } -} - -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: a #GstAppSink - * @caps: caps to set - * - * Set the capabilities on the appsink element. This function takes - * 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, const GstCaps * caps) -{ - GstCaps *old; - - g_return_if_fail (appsink != NULL); - g_return_if_fail (GST_IS_APP_SINK (appsink)); - - GST_OBJECT_LOCK (appsink); - GST_DEBUG_OBJECT (appsink, "setting caps to %" GST_PTR_FORMAT, caps); - if ((old = appsink->caps) != 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_is_eos (GstAppSink * appsink) -{ - gboolean ret; - - g_return_val_if_fail (appsink != NULL, FALSE); - g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE); - - g_mutex_lock (appsink->mutex); - 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_set_emit_signals: - * @appsink: a #GstAppSink - * @emit: the new state - * - * Make appsink emit the "new-preroll" and "new-buffer" signals. This option is - * by default disabled because signal emission is expensive and unneeded when - * the application prefers to operate in pull mode. - */ -void -gst_app_sink_set_emit_signals (GstAppSink * appsink, gboolean emit) -{ - g_return_if_fail (GST_IS_APP_SINK (appsink)); - - g_mutex_lock (appsink->mutex); - appsink->emit_signals = emit; - g_mutex_unlock (appsink->mutex); -} - -/** - * gst_app_sink_get_emit_signals: - * @appsink: a #GstAppSink - * - * Check if appsink will emit the "new-preroll" and "new-buffer" signals. - * - * Returns: %TRUE if @appsink is emiting the "new-preroll" and "new-buffer" - * signals. - */ -gboolean -gst_app_sink_get_emit_signals (GstAppSink * appsink) -{ - gboolean result; - - g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE); - - g_mutex_lock (appsink->mutex); - result = appsink->emit_signals; - g_mutex_unlock (appsink->mutex); - - return result; -} - -/** - * gst_app_sink_set_max_buffers: - * @appsink: a #GstAppSink - * @max: the maximum number of buffers to queue - * - * Set the maximum amount of buffers that can be queued in @appsink. After this - * amount of buffers are queued in appsink, any more buffers will block upstream - * elements until a buffer is pulled from @appsink. - */ -void -gst_app_sink_set_max_buffers (GstAppSink * appsink, guint max) -{ - g_return_if_fail (GST_IS_APP_SINK (appsink)); - - g_mutex_lock (appsink->mutex); - if (max != appsink->max_buffers) { - appsink->max_buffers = max; - /* signal the change */ - g_cond_signal (appsink->cond); - } - g_mutex_unlock (appsink->mutex); -} - -/** - * gst_app_sink_get_max_buffers: - * @appsink: a #GstAppSink - * - * Get the maximum amount of buffers that can be queued in @appsink. - * - * Returns: The maximum amount of buffers that can be queued. - */ -guint -gst_app_sink_get_max_buffers (GstAppSink * appsink) -{ - guint result; - - g_return_val_if_fail (GST_IS_APP_SINK (appsink), 0); - - g_mutex_lock (appsink->mutex); - result = appsink->max_buffers; - g_mutex_unlock (appsink->mutex); - - return result; -} - -/** - * gst_app_sink_set_drop: - * @appsink: a #GstAppSink - * @emit: the new state - * - * Instruct @appsink to drop old buffers when the maximum amount of queued - * buffers is reached. - */ -void -gst_app_sink_set_drop (GstAppSink * appsink, gboolean drop) -{ - g_return_if_fail (GST_IS_APP_SINK (appsink)); - - g_mutex_lock (appsink->mutex); - if (appsink->drop != drop) { - appsink->drop = drop; - /* signal the change */ - g_cond_signal (appsink->cond); - } - g_mutex_unlock (appsink->mutex); -} - -/** - * gst_app_sink_get_drop: - * @appsink: a #GstAppSink - * - * Check if @appsink will drop old buffers when the maximum amount of queued - * buffers is reached. - * - * Returns: %TRUE if @appsink is dropping old buffers when the queue is - * filled. - */ -gboolean -gst_app_sink_get_drop (GstAppSink * appsink) -{ - gboolean result; - - g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE); - - g_mutex_lock (appsink->mutex); - result = appsink->drop; - g_mutex_unlock (appsink->mutex); - - return result; -} - -/** - * 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) -{ - 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 (!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); - GST_DEBUG_OBJECT (appsink, "we have a buffer %p", buf); - g_cond_signal (appsink->cond); - 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; - } -} diff --git a/gst-libs/gst/app/gstappsink.h b/gst-libs/gst/app/gstappsink.h deleted file mode 100644 index f3e468614..000000000 --- a/gst-libs/gst/app/gstappsink.h +++ /dev/null @@ -1,99 +0,0 @@ -/* GStreamer - * Copyright (C) 2007 David Schleef <ds@schleef.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _GST_APP_SINK_H_ -#define _GST_APP_SINK_H_ - -#include <gst/gst.h> -#include <gst/base/gstbasesink.h> - -G_BEGIN_DECLS - -#define GST_TYPE_APP_SINK \ - (gst_app_sink_get_type()) -#define GST_APP_SINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_SINK,GstAppSink)) -#define GST_APP_SINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_SINK,GstAppSinkClass)) -#define GST_IS_APP_SINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SINK)) -#define GST_IS_APP_SINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SINK)) - -typedef struct _GstAppSink GstAppSink; -typedef struct _GstAppSinkClass GstAppSinkClass; - -struct _GstAppSink -{ - GstBaseSink basesink; - - /*< private >*/ - GstCaps *caps; - gboolean emit_signals; - guint max_buffers; - gboolean drop; - - GCond *cond; - GMutex *mutex; - GQueue *queue; - GstBuffer *preroll; - gboolean flushing; - 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, const GstCaps *caps); -GstCaps * gst_app_sink_get_caps (GstAppSink *appsink); - -gboolean gst_app_sink_is_eos (GstAppSink *appsink); - -void gst_app_sink_set_emit_signals (GstAppSink *appsink, gboolean emit); -gboolean gst_app_sink_get_emit_signals (GstAppSink *appsink); - -void gst_app_sink_set_max_buffers (GstAppSink *appsink, guint max); -guint gst_app_sink_get_max_buffers (GstAppSink *appsink); - -void gst_app_sink_set_drop (GstAppSink *appsink, gboolean drop); -gboolean gst_app_sink_get_drop (GstAppSink *appsink); - -GstBuffer * gst_app_sink_pull_preroll (GstAppSink *appsink); -GstBuffer * gst_app_sink_pull_buffer (GstAppSink *appsink); - -G_END_DECLS - -#endif - diff --git a/gst-libs/gst/app/gstappsrc.c b/gst-libs/gst/app/gstappsrc.c deleted file mode 100644 index 05f682a5d..000000000 --- a/gst-libs/gst/app/gstappsrc.c +++ /dev/null @@ -1,1165 +0,0 @@ -/* GStreamer - * Copyright (C) 2007 David Schleef <ds@schleef.org> - * (C) 2008 Wim Taymans <wim.taymans@gmail.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/** - * SECTION:element-appsrc - * @see_also: #GstBaseSrc, appsink - * - * The appsrc element can be used by applications to insert data into a - * GStreamer pipeline. - * - * appsrc can be used by linking to the gstappsrc.h header file to access the - * methods or by using the appsrc action signals. - * - * Before operating appsrc, the caps property must be set to a fixed caps - * describing the format of the data that will be pushed with appsrc. - * - * The main way of handing data to the appsrc element is by calling the - * gst_app_src_push_buffer() method or by emiting the push-buffer action signal. - * This will put the buffer onto a queue from which appsrc will read from in its - * streaming thread. It is important to note that data transport will not happen - * from the thread that performed the push-buffer call. - * - * The "max-bytes" property controls how much data can be queued in appsrc - * before appsrc considers the queue full. A filled internal queue will always - * signal the "enough-data" signal, which signals the application that it should - * stop pushing data into appsrc. The "block" property will cause appsrc to - * block the push-buffer method until free data becomes available again. - * - * When the internal queue is running out of data, the "need-data" signal is - * emited, which signals the application that it should start pushing more data - * into appsrc. - * - * In addition to the "need-data" and "enough-data" signals, appsrc can emit the - * "seek-data" signal when the "stream-mode" property is set to "seekable" or - * "random-access". The signal argument will contain the new desired position in - * the stream expressed in the unit set with the "format" property. After - * receiving the seek-data signal, the application should push-buffers from the - * new position. - * - * These signals allow the application to operate the appsrc in two different - * ways: - * - * The push model, in which the application repeadedly calls the push-buffer method - * with a new buffer. Optionally, the queue size in the appsrc can be controlled - * with the enough-data and need-data signals by respectively stopping/starting - * the push-buffer calls. This is a typical mode of operation for the - * stream-type "stream" and "seekable". Use this model when implementing various - * network protocols or hardware devices. - * - * The pull model where the need-data signal triggers the next push-buffer call. - * This mode is typically used in the "random-access" stream-type. Use this - * model for file access or other randomly accessable sources. In this mode, a - * buffer of exactly the amount of bytes given by the need-data signal should be - * pushed into appsrc. - * - * In all modes, the size property on appsrc should contain the total stream - * size in bytes. Setting this property is mandatory in the random-access mode. - * For the stream and seekable modes, setting this property is optional but - * recommended. - * - * When the application is finished pushing data into appsrc, it should call - * gst_app_src_end_of_stream() or emit the end-of-stream action signal. After - * this call, no more buffers can be pushed into appsrc until a flushing seek - * happened or the state of the appsrc has gone through READY. - * - * Last reviewed on 2008-12-17 (0.10.10) - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> -#include <gst/base/gstbasesrc.h> - -#include <string.h> - -#include "gstapp-marshal.h" -#include "gstappsrc.h" - - -GST_DEBUG_CATEGORY (app_src_debug); -#define GST_CAT_DEFAULT app_src_debug - -enum -{ - /* signals */ - SIGNAL_NEED_DATA, - SIGNAL_ENOUGH_DATA, - SIGNAL_SEEK_DATA, - - /* actions */ - SIGNAL_PUSH_BUFFER, - SIGNAL_END_OF_STREAM, - - LAST_SIGNAL -}; - -#define DEFAULT_PROP_SIZE -1 -#define DEFAULT_PROP_STREAM_TYPE GST_APP_STREAM_TYPE_STREAM -#define DEFAULT_PROP_MAX_BYTES 200000 -#define DEFAULT_PROP_FORMAT GST_FORMAT_BYTES -#define DEFAULT_PROP_BLOCK FALSE -#define DEFAULT_PROP_IS_LIVE FALSE - -enum -{ - PROP_0, - PROP_CAPS, - PROP_SIZE, - PROP_STREAM_TYPE, - PROP_MAX_BYTES, - PROP_FORMAT, - PROP_BLOCK, - PROP_IS_LIVE, - - PROP_LAST -}; - -static GstStaticPadTemplate gst_app_src_template = -GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - - -#define GST_TYPE_APP_STREAM_TYPE (stream_type_get_type ()) -static GType -stream_type_get_type (void) -{ - static GType stream_type_type = 0; - static const GEnumValue stream_type[] = { - {GST_APP_STREAM_TYPE_STREAM, "Stream", "stream"}, - {GST_APP_STREAM_TYPE_SEEKABLE, "Seekable", "seekable"}, - {GST_APP_STREAM_TYPE_RANDOM_ACCESS, "Random Access", "random-access"}, - {0, NULL, NULL}, - }; - - if (!stream_type_type) { - stream_type_type = g_enum_register_static ("GstAppStreamType", stream_type); - } - return stream_type_type; -} - -static void gst_app_src_uri_handler_init (gpointer g_iface, - gpointer iface_data); - -static void gst_app_src_dispose (GObject * object); -static void gst_app_src_finalize (GObject * object); - -static void gst_app_src_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_app_src_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static GstFlowReturn gst_app_src_create (GstBaseSrc * bsrc, - guint64 offset, guint size, GstBuffer ** buf); -static gboolean gst_app_src_start (GstBaseSrc * bsrc); -static gboolean gst_app_src_stop (GstBaseSrc * bsrc); -static gboolean gst_app_src_unlock (GstBaseSrc * bsrc); -static gboolean gst_app_src_unlock_stop (GstBaseSrc * bsrc); -static gboolean gst_app_src_do_seek (GstBaseSrc * src, GstSegment * segment); -static gboolean gst_app_src_is_seekable (GstBaseSrc * src); -static gboolean gst_app_src_check_get_range (GstBaseSrc * src); -static gboolean gst_app_src_do_get_size (GstBaseSrc * src, guint64 * size); -static GstFlowReturn gst_app_src_push_buffer_action (GstAppSrc * appsrc, - GstBuffer * buffer); - -static guint gst_app_src_signals[LAST_SIGNAL] = { 0 }; - -static void -_do_init (GType filesrc_type) -{ - static const GInterfaceInfo urihandler_info = { - gst_app_src_uri_handler_init, - NULL, - NULL - }; - g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER, - &urihandler_info); -} - -GST_BOILERPLATE_FULL (GstAppSrc, gst_app_src, GstBaseSrc, GST_TYPE_BASE_SRC, - _do_init); - -static void -gst_app_src_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - GST_DEBUG_CATEGORY_INIT (app_src_debug, "appsrc", 0, "appsrc element"); - - gst_element_class_set_details_simple (element_class, "AppSrc", - "Generic/Src", - "Allow the application to feed buffers to a pipeline", - "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>"); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_app_src_template)); -} - -static void -gst_app_src_class_init (GstAppSrcClass * klass) -{ - GObjectClass *gobject_class = (GObjectClass *) klass; - GstBaseSrcClass *basesrc_class = (GstBaseSrcClass *) klass; - - gobject_class->dispose = gst_app_src_dispose; - gobject_class->finalize = gst_app_src_finalize; - - gobject_class->set_property = gst_app_src_set_property; - gobject_class->get_property = gst_app_src_get_property; - - /** - * GstAppSrc::caps - * - * The GstCaps that will negotiated downstream and will be put - * on outgoing buffers. - */ - g_object_class_install_property (gobject_class, PROP_CAPS, - g_param_spec_boxed ("caps", "Caps", - "The allowed caps for the src pad", GST_TYPE_CAPS, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GstAppSrc::format - * - * The format to use for segment events. When the source is producing - * timestamped buffers this property should be set to GST_FORMAT_TIME. - */ - g_object_class_install_property (gobject_class, PROP_FORMAT, - g_param_spec_enum ("format", "Format", - "The format of the segment events and seek", GST_TYPE_FORMAT, - DEFAULT_PROP_FORMAT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GstAppSrc::size - * - * The total size in bytes of the data stream. If the total size is known, it - * is recommended to configure it with this property. - */ - g_object_class_install_property (gobject_class, PROP_SIZE, - g_param_spec_int64 ("size", "Size", - "The size of the data stream in bytes (-1 if unknown)", - -1, G_MAXINT64, DEFAULT_PROP_SIZE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GstAppSrc::stream-type - * - * The type of stream that this source is producing. For seekable streams the - * application should connect to the seek-data signal. - */ - g_object_class_install_property (gobject_class, PROP_STREAM_TYPE, - g_param_spec_enum ("stream-type", "Stream Type", - "the type of the stream", GST_TYPE_APP_STREAM_TYPE, - DEFAULT_PROP_STREAM_TYPE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GstAppSrc::max-bytes - * - * The maximum amount of bytes that can be queued internally. - * After the maximum amount of bytes are queued, appsrc will emit the - * "enough-data" signal. - */ - g_object_class_install_property (gobject_class, PROP_MAX_BYTES, - g_param_spec_uint64 ("max-bytes", "Max bytes", - "The maximum number of bytes to queue internally (0 = unlimited)", - 0, G_MAXUINT64, DEFAULT_PROP_MAX_BYTES, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GstAppSrc::block - * - * When max-bytes are queued and after the enough-data signal has been emited, - * block any further push-buffer calls until the amount of queued bytes drops - * below the max-bytes limit. - */ - g_object_class_install_property (gobject_class, PROP_BLOCK, - g_param_spec_boolean ("block", "Block", - "Block push-buffer when max-bytes are queued", - DEFAULT_PROP_BLOCK, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - * GstAppSrc::is-live - * - * Instruct the source to behave like a live source. This includes that it - * will only push out buffers in the PLAYING state. - */ - g_object_class_install_property (gobject_class, PROP_IS_LIVE, - g_param_spec_boolean ("is-live", "Is Live", - "Whether to act as a live source", - DEFAULT_PROP_IS_LIVE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - * GstAppSrc::need-data: - * @appsrc: the appsrc element that emited the signal - * @length: the amount of bytes needed. - * - * Signal that the source needs more data. In the callback or from another - * thread you should call push-buffer or end-of-stream. - * - * @length is just a hint and when it is set to -1, any number of bytes can be - * pushed into @appsrc. - * - * You can call push-buffer multiple times until the enough-data signal is - * fired. - */ - gst_app_src_signals[SIGNAL_NEED_DATA] = - g_signal_new ("need-data", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstAppSrcClass, need_data), - NULL, NULL, gst_app_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); - - /** - * GstAppSrc::enough-data: - * @appsrc: the appsrc element that emited the signal - * - * Signal that the source has enough data. It is recommended that the - * application stops calling push-buffer until the need-data signal is - * emited again to avoid excessive buffer queueing. - */ - gst_app_src_signals[SIGNAL_ENOUGH_DATA] = - g_signal_new ("enough-data", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstAppSrcClass, enough_data), - NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE); - - /** - * GstAppSrc::seek-data: - * @appsrc: the appsrc element that emited the signal - * @offset: the offset to seek to - * - * Seek to the given offset. The next push-buffer should produce buffers from - * the new @offset. - * This callback is only called for seekable stream types. - * - * Returns: %TRUE if the seek succeeded. - */ - gst_app_src_signals[SIGNAL_SEEK_DATA] = - g_signal_new ("seek-data", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstAppSrcClass, seek_data), - NULL, NULL, gst_app_marshal_BOOLEAN__UINT64, G_TYPE_BOOLEAN, 1, - G_TYPE_UINT64); - - /** - * GstAppSrc::push-buffer: - * @appsrc: the appsrc - * @buffer: a buffer to push - * - * Adds a buffer to the queue of buffers that the appsrc element will - * push to its source pad. This function does not take ownership of the - * buffer so the buffer needs to be unreffed after calling this function. - * - * When the block property is TRUE, this function can block until free space - * becomes available in the queue. - */ - gst_app_src_signals[SIGNAL_PUSH_BUFFER] = - g_signal_new ("push-buffer", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSrcClass, - push_buffer), NULL, NULL, gst_app_marshal_ENUM__OBJECT, - GST_TYPE_FLOW_RETURN, 1, GST_TYPE_BUFFER); - - /** - * GstAppSrc::end-of-stream: - * @appsrc: the appsrc - * - * Notify @appsrc that no more buffer are available. - */ - gst_app_src_signals[SIGNAL_END_OF_STREAM] = - g_signal_new ("end-of-stream", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSrcClass, - end_of_stream), NULL, NULL, gst_app_marshal_ENUM__VOID, - GST_TYPE_FLOW_RETURN, 0, G_TYPE_NONE); - - basesrc_class->create = gst_app_src_create; - basesrc_class->start = gst_app_src_start; - basesrc_class->stop = gst_app_src_stop; - basesrc_class->unlock = gst_app_src_unlock; - basesrc_class->unlock_stop = gst_app_src_unlock_stop; - basesrc_class->do_seek = gst_app_src_do_seek; - basesrc_class->is_seekable = gst_app_src_is_seekable; - basesrc_class->check_get_range = gst_app_src_check_get_range; - basesrc_class->get_size = gst_app_src_do_get_size; - - klass->push_buffer = gst_app_src_push_buffer_action; - klass->end_of_stream = gst_app_src_end_of_stream; -} - -static void -gst_app_src_init (GstAppSrc * appsrc, GstAppSrcClass * klass) -{ - appsrc->mutex = g_mutex_new (); - appsrc->cond = g_cond_new (); - appsrc->queue = g_queue_new (); - - appsrc->size = DEFAULT_PROP_SIZE; - appsrc->stream_type = DEFAULT_PROP_STREAM_TYPE; - appsrc->max_bytes = DEFAULT_PROP_MAX_BYTES; - appsrc->format = DEFAULT_PROP_FORMAT; - appsrc->block = DEFAULT_PROP_BLOCK; - - gst_base_src_set_live (GST_BASE_SRC (appsrc), DEFAULT_PROP_IS_LIVE); -} - -static void -gst_app_src_flush_queued (GstAppSrc * src) -{ - GstBuffer *buf; - - while ((buf = g_queue_pop_head (src->queue))) - gst_buffer_unref (buf); -} - -static void -gst_app_src_dispose (GObject * obj) -{ - GstAppSrc *appsrc = GST_APP_SRC (obj); - - if (appsrc->caps) { - gst_caps_unref (appsrc->caps); - appsrc->caps = NULL; - } - gst_app_src_flush_queued (appsrc); - - G_OBJECT_CLASS (parent_class)->dispose (obj); -} - -static void -gst_app_src_finalize (GObject * obj) -{ - GstAppSrc *appsrc = GST_APP_SRC (obj); - - g_mutex_free (appsrc->mutex); - g_cond_free (appsrc->cond); - g_queue_free (appsrc->queue); - - G_OBJECT_CLASS (parent_class)->finalize (obj); -} - -static void -gst_app_src_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstAppSrc *appsrc = GST_APP_SRC (object); - - switch (prop_id) { - case PROP_CAPS: - gst_app_src_set_caps (appsrc, gst_value_get_caps (value)); - break; - case PROP_SIZE: - gst_app_src_set_size (appsrc, g_value_get_int64 (value)); - break; - case PROP_STREAM_TYPE: - gst_app_src_set_stream_type (appsrc, g_value_get_enum (value)); - break; - case PROP_MAX_BYTES: - gst_app_src_set_max_bytes (appsrc, g_value_get_uint64 (value)); - break; - case PROP_FORMAT: - appsrc->format = g_value_get_enum (value); - break; - case PROP_BLOCK: - appsrc->block = g_value_get_boolean (value); - break; - case PROP_IS_LIVE: - gst_base_src_set_live (GST_BASE_SRC (appsrc), - g_value_get_boolean (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_app_src_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstAppSrc *appsrc = GST_APP_SRC (object); - - switch (prop_id) { - case PROP_CAPS: - { - GstCaps *caps; - - /* we're missing a _take_caps() function to transfer ownership */ - caps = gst_app_src_get_caps (appsrc); - gst_value_set_caps (value, caps); - if (caps) - gst_caps_unref (caps); - break; - } - case PROP_SIZE: - g_value_set_int64 (value, gst_app_src_get_size (appsrc)); - break; - case PROP_STREAM_TYPE: - g_value_set_enum (value, gst_app_src_get_stream_type (appsrc)); - break; - case PROP_MAX_BYTES: - g_value_set_uint64 (value, gst_app_src_get_max_bytes (appsrc)); - break; - case PROP_FORMAT: - g_value_set_enum (value, appsrc->format); - break; - case PROP_BLOCK: - g_value_set_boolean (value, appsrc->block); - break; - case PROP_IS_LIVE: - g_value_set_boolean (value, gst_base_src_is_live (GST_BASE_SRC (appsrc))); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static gboolean -gst_app_src_unlock (GstBaseSrc * bsrc) -{ - GstAppSrc *appsrc = GST_APP_SRC (bsrc); - - g_mutex_lock (appsrc->mutex); - GST_DEBUG_OBJECT (appsrc, "unlock start"); - appsrc->flushing = TRUE; - g_cond_broadcast (appsrc->cond); - g_mutex_unlock (appsrc->mutex); - - return TRUE; -} - -static gboolean -gst_app_src_unlock_stop (GstBaseSrc * bsrc) -{ - GstAppSrc *appsrc = GST_APP_SRC (bsrc); - - g_mutex_lock (appsrc->mutex); - GST_DEBUG_OBJECT (appsrc, "unlock stop"); - appsrc->flushing = FALSE; - g_cond_broadcast (appsrc->cond); - g_mutex_unlock (appsrc->mutex); - - return TRUE; -} - -static gboolean -gst_app_src_start (GstBaseSrc * bsrc) -{ - GstAppSrc *appsrc = GST_APP_SRC (bsrc); - - g_mutex_lock (appsrc->mutex); - GST_DEBUG_OBJECT (appsrc, "starting"); - appsrc->started = TRUE; - /* set the offset to -1 so that we always do a first seek. This is only used - * in random-access mode. */ - appsrc->offset = -1; - appsrc->flushing = FALSE; - g_mutex_unlock (appsrc->mutex); - - gst_base_src_set_format (bsrc, appsrc->format); - - return TRUE; -} - -static gboolean -gst_app_src_stop (GstBaseSrc * bsrc) -{ - GstAppSrc *appsrc = GST_APP_SRC (bsrc); - - g_mutex_lock (appsrc->mutex); - GST_DEBUG_OBJECT (appsrc, "stopping"); - appsrc->is_eos = FALSE; - appsrc->flushing = TRUE; - appsrc->started = FALSE; - gst_app_src_flush_queued (appsrc); - g_mutex_unlock (appsrc->mutex); - - return TRUE; -} - -static gboolean -gst_app_src_is_seekable (GstBaseSrc * src) -{ - GstAppSrc *appsrc = GST_APP_SRC (src); - gboolean res = FALSE; - - switch (appsrc->stream_type) { - case GST_APP_STREAM_TYPE_STREAM: - break; - case GST_APP_STREAM_TYPE_SEEKABLE: - case GST_APP_STREAM_TYPE_RANDOM_ACCESS: - res = TRUE; - break; - } - return res; -} - -static gboolean -gst_app_src_check_get_range (GstBaseSrc * src) -{ - GstAppSrc *appsrc = GST_APP_SRC (src); - gboolean res = FALSE; - - switch (appsrc->stream_type) { - case GST_APP_STREAM_TYPE_STREAM: - case GST_APP_STREAM_TYPE_SEEKABLE: - break; - case GST_APP_STREAM_TYPE_RANDOM_ACCESS: - res = TRUE; - break; - } - return res; -} - -static gboolean -gst_app_src_do_get_size (GstBaseSrc * src, guint64 * size) -{ - GstAppSrc *appsrc = GST_APP_SRC (src); - - *size = gst_app_src_get_size (appsrc); - - return TRUE; -} - -/* will be called in push mode */ -static gboolean -gst_app_src_do_seek (GstBaseSrc * src, GstSegment * segment) -{ - GstAppSrc *appsrc = GST_APP_SRC (src); - gint64 desired_position; - gboolean res = FALSE; - - desired_position = segment->last_stop; - - GST_DEBUG_OBJECT (appsrc, "seeking to %" G_GINT64_FORMAT ", format %s", - desired_position, gst_format_get_name (segment->format)); - - /* no need to try to seek in streaming mode */ - if (appsrc->stream_type == GST_APP_STREAM_TYPE_STREAM) - return TRUE; - - g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_SEEK_DATA], 0, - desired_position, &res); - - if (res) { - GST_DEBUG_OBJECT (appsrc, "flushing queue"); - gst_app_src_flush_queued (appsrc); - } else { - GST_WARNING_OBJECT (appsrc, "seek failed"); - } - - return res; -} - -static GstFlowReturn -gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size, - GstBuffer ** buf) -{ - GstAppSrc *appsrc = GST_APP_SRC (bsrc); - GstFlowReturn ret; - - g_mutex_lock (appsrc->mutex); - /* check flushing first */ - if (G_UNLIKELY (appsrc->flushing)) - goto flushing; - - if (appsrc->stream_type == GST_APP_STREAM_TYPE_RANDOM_ACCESS) { - /* if we are dealing with a random-access stream, issue a seek if the offset - * changed. */ - if (G_UNLIKELY (appsrc->offset != offset)) { - gboolean res; - - g_mutex_unlock (appsrc->mutex); - - GST_DEBUG_OBJECT (appsrc, - "we are at %" G_GINT64_FORMAT ", seek to %" G_GINT64_FORMAT, - appsrc->offset, offset); - - g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_SEEK_DATA], 0, - offset, &res); - - if (G_UNLIKELY (!res)) - /* failing to seek is fatal */ - goto seek_error; - - g_mutex_lock (appsrc->mutex); - - appsrc->offset = offset; - } - } - - while (TRUE) { - /* return data as long as we have some */ - if (!g_queue_is_empty (appsrc->queue)) { - guint buf_size; - - *buf = g_queue_pop_head (appsrc->queue); - buf_size = GST_BUFFER_SIZE (*buf); - - GST_DEBUG_OBJECT (appsrc, "we have buffer %p of size %u", *buf, buf_size); - - appsrc->queued_bytes -= buf_size; - - /* only update the offset when in random_access mode */ - if (appsrc->stream_type == GST_APP_STREAM_TYPE_RANDOM_ACCESS) { - appsrc->offset += buf_size; - } - - gst_buffer_set_caps (*buf, appsrc->caps); - - /* signal that we removed an item */ - g_cond_broadcast (appsrc->cond); - - ret = GST_FLOW_OK; - break; - } else { - g_mutex_unlock (appsrc->mutex); - - /* we have no data, we need some. We fire the signal with the size hint. */ - g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_NEED_DATA], 0, size, - NULL); - - g_mutex_lock (appsrc->mutex); - /* we can be flushing now because we released the lock */ - if (G_UNLIKELY (appsrc->flushing)) - goto flushing; - - /* if we have a buffer now, continue the loop and try to return it. In - * random-access mode (where a buffer is normally pushed in the above - * signal) we can still be empty because the pushed buffer got flushed or - * when the application pushes the requested buffer later, we support both - * possiblities. */ - if (!g_queue_is_empty (appsrc->queue)) - continue; - - /* no buffer yet, maybe we are EOS, if not, block for more data. */ - } - - /* check EOS */ - if (G_UNLIKELY (appsrc->is_eos)) - goto eos; - - /* nothing to return, wait a while for new data or flushing. */ - g_cond_wait (appsrc->cond, appsrc->mutex); - } - g_mutex_unlock (appsrc->mutex); - - return ret; - - /* ERRORS */ -flushing: - { - GST_DEBUG_OBJECT (appsrc, "we are flushing"); - g_mutex_unlock (appsrc->mutex); - return GST_FLOW_WRONG_STATE; - } -eos: - { - GST_DEBUG_OBJECT (appsrc, "we are EOS"); - g_mutex_unlock (appsrc->mutex); - return GST_FLOW_UNEXPECTED; - } -seek_error: - { - GST_ELEMENT_ERROR (appsrc, RESOURCE, READ, ("failed to seek"), - GST_ERROR_SYSTEM); - return GST_FLOW_ERROR; - } -} - -/* external API */ - -/** - * gst_app_src_set_caps: - * @appsrc: a #GstAppSrc - * @caps: caps to set - * - * Set the capabilities on the appsrc element. This function takes - * a copy of the caps structure. After calling this method, the source will - * only produce caps that match @caps. @caps must be fixed and the caps on the - * buffers must match the caps or left NULL. - */ -void -gst_app_src_set_caps (GstAppSrc * appsrc, const GstCaps * caps) -{ - GstCaps *old; - - g_return_if_fail (GST_IS_APP_SRC (appsrc)); - - GST_OBJECT_LOCK (appsrc); - GST_DEBUG_OBJECT (appsrc, "setting caps to %" GST_PTR_FORMAT, caps); - if ((old = appsrc->caps) != caps) { - if (caps) - appsrc->caps = gst_caps_copy (caps); - else - appsrc->caps = NULL; - if (old) - gst_caps_unref (old); - } - GST_OBJECT_UNLOCK (appsrc); -} - -/** - * gst_app_src_get_caps: - * @appsrc: a #GstAppSrc - * - * Get the configured caps on @appsrc. - * - * Returns: the #GstCaps produced by the source. gst_caps_unref() after usage. - */ -GstCaps * -gst_app_src_get_caps (GstAppSrc * appsrc) -{ - GstCaps *caps; - - g_return_val_if_fail (appsrc != NULL, NULL); - g_return_val_if_fail (GST_IS_APP_SRC (appsrc), NULL); - - GST_OBJECT_LOCK (appsrc); - if ((caps = appsrc->caps)) - gst_caps_ref (caps); - GST_DEBUG_OBJECT (appsrc, "getting caps of %" GST_PTR_FORMAT, caps); - GST_OBJECT_UNLOCK (appsrc); - - return caps; -} - -/** - * gst_app_src_set_size: - * @appsrc: a #GstAppSrc - * @size: the size to set - * - * Set the size of the stream in bytes. A value of -1 means that the size is - * not known. - */ -void -gst_app_src_set_size (GstAppSrc * appsrc, gint64 size) -{ - g_return_if_fail (appsrc != NULL); - g_return_if_fail (GST_IS_APP_SRC (appsrc)); - - GST_OBJECT_LOCK (appsrc); - GST_DEBUG_OBJECT (appsrc, "setting size of %" G_GINT64_FORMAT, size); - appsrc->size = size; - GST_OBJECT_UNLOCK (appsrc); -} - -/** - * gst_app_src_get_size: - * @appsrc: a #GstAppSrc - * - * Get the size of the stream in bytes. A value of -1 means that the size is - * not known. - * - * Returns: the size of the stream previously set with gst_app_src_set_size(); - */ -gint64 -gst_app_src_get_size (GstAppSrc * appsrc) -{ - gint64 size; - - g_return_val_if_fail (appsrc != NULL, -1); - g_return_val_if_fail (GST_IS_APP_SRC (appsrc), -1); - - GST_OBJECT_LOCK (appsrc); - size = appsrc->size; - GST_DEBUG_OBJECT (appsrc, "getting size of %" G_GINT64_FORMAT, size); - GST_OBJECT_UNLOCK (appsrc); - - return size; -} - -/** - * gst_app_src_set_stream_type: - * @appsrc: a #GstAppSrc - * @type: the new state - * - * Set the stream type on @appsrc. For seekable streams, the "seek" signal must - * be connected to. - * - * A stream_type stream - */ -void -gst_app_src_set_stream_type (GstAppSrc * appsrc, GstAppStreamType type) -{ - g_return_if_fail (appsrc != NULL); - g_return_if_fail (GST_IS_APP_SRC (appsrc)); - - GST_OBJECT_LOCK (appsrc); - GST_DEBUG_OBJECT (appsrc, "setting stream_type of %d", type); - appsrc->stream_type = type; - GST_OBJECT_UNLOCK (appsrc); -} - -/** - * gst_app_src_get_stream_type: - * @appsrc: a #GstAppSrc - * - * Get the stream type. Control the stream type of @appsrc - * with gst_app_src_set_stream_type(). - * - * Returns: the stream type. - */ -GstAppStreamType -gst_app_src_get_stream_type (GstAppSrc * appsrc) -{ - gboolean stream_type; - - g_return_val_if_fail (appsrc != NULL, FALSE); - g_return_val_if_fail (GST_IS_APP_SRC (appsrc), FALSE); - - GST_OBJECT_LOCK (appsrc); - stream_type = appsrc->stream_type; - GST_DEBUG_OBJECT (appsrc, "getting stream_type of %d", stream_type); - GST_OBJECT_UNLOCK (appsrc); - - return stream_type; -} - -/** - * gst_app_src_set_max_bytes: - * @appsrc: a #GstAppSrc - * @max: the maximum number of bytes to queue - * - * Set the maximum amount of bytes that can be queued in @appsrc. - * After the maximum amount of bytes are queued, @appsrc will emit the - * "enough-data" signal. - */ -void -gst_app_src_set_max_bytes (GstAppSrc * appsrc, guint64 max) -{ - g_return_if_fail (GST_IS_APP_SRC (appsrc)); - - g_mutex_lock (appsrc->mutex); - if (max != appsrc->max_bytes) { - GST_DEBUG_OBJECT (appsrc, "setting max-bytes to %" G_GUINT64_FORMAT, max); - appsrc->max_bytes = max; - /* signal the change */ - g_cond_broadcast (appsrc->cond); - } - g_mutex_unlock (appsrc->mutex); -} - -/** - * gst_app_src_get_max_bytes: - * @appsrc: a #GstAppSrc - * - * Get the maximum amount of bytes that can be queued in @appsrc. - * - * Returns: The maximum amount of bytes that can be queued. - */ -guint64 -gst_app_src_get_max_bytes (GstAppSrc * appsrc) -{ - guint64 result; - - g_return_val_if_fail (GST_IS_APP_SRC (appsrc), 0); - - g_mutex_lock (appsrc->mutex); - result = appsrc->max_bytes; - GST_DEBUG_OBJECT (appsrc, "getting max-bytes of %" G_GUINT64_FORMAT, result); - g_mutex_unlock (appsrc->mutex); - - return result; -} - -static GstFlowReturn -gst_app_src_push_buffer_full (GstAppSrc * appsrc, GstBuffer * buffer, - gboolean steal_ref) -{ - gboolean first = TRUE; - - g_return_val_if_fail (appsrc, GST_FLOW_ERROR); - g_return_val_if_fail (GST_IS_APP_SRC (appsrc), GST_FLOW_ERROR); - g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR); - - g_mutex_lock (appsrc->mutex); - - while (TRUE) { - /* can't accept buffers when we are flushing or EOS */ - if (appsrc->flushing) - goto flushing; - - if (appsrc->is_eos) - goto eos; - - if (appsrc->max_bytes && appsrc->queued_bytes >= appsrc->max_bytes) { - GST_DEBUG_OBJECT (appsrc, "queue filled (%" G_GUINT64_FORMAT " >= %" - G_GUINT64_FORMAT ")", appsrc->queued_bytes, appsrc->max_bytes); - - if (first) { - /* only signal on the first push */ - g_mutex_unlock (appsrc->mutex); - - g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_ENOUGH_DATA], 0, - NULL); - - g_mutex_lock (appsrc->mutex); - /* continue to check for flushing/eos after releasing the lock */ - first = FALSE; - continue; - } - if (appsrc->block) { - GST_DEBUG_OBJECT (appsrc, "waiting for free space"); - /* we are filled, wait until a buffer gets popped or when we - * flush. */ - g_cond_wait (appsrc->cond, appsrc->mutex); - } else { - /* no need to wait for free space, we just pump more data into the - * queue hoping that the caller reacts to the enough-data signal and - * stops pushing buffers. */ - break; - } - } else - break; - } - - GST_DEBUG_OBJECT (appsrc, "queueing buffer %p", buffer); - if (!steal_ref) - gst_buffer_ref (buffer); - g_queue_push_tail (appsrc->queue, buffer); - appsrc->queued_bytes += GST_BUFFER_SIZE (buffer); - g_cond_broadcast (appsrc->cond); - g_mutex_unlock (appsrc->mutex); - - return GST_FLOW_OK; - - /* ERRORS */ -flushing: - { - GST_DEBUG_OBJECT (appsrc, "refuse buffer %p, we are flushing", buffer); - if (steal_ref) - gst_buffer_unref (buffer); - g_mutex_unlock (appsrc->mutex); - return GST_FLOW_WRONG_STATE; - } -eos: - { - GST_DEBUG_OBJECT (appsrc, "refuse buffer %p, we are EOS", buffer); - if (steal_ref) - gst_buffer_unref (buffer); - g_mutex_unlock (appsrc->mutex); - return GST_FLOW_UNEXPECTED; - } -} - -/** - * gst_app_src_push_buffer: - * @appsrc: a #GstAppSrc - * @buffer: a #GstBuffer to push - * - * Adds a buffer to the queue of buffers that the appsrc element will - * push to its source pad. This function takes ownership of the buffer. - * - * Returns: #GST_FLOW_OK when the buffer was successfuly queued. - * #GST_FLOW_WRONG_STATE when @appsrc is not PAUSED or PLAYING. - * #GST_FLOW_UNEXPECTED when EOS occured. - */ -GstFlowReturn -gst_app_src_push_buffer (GstAppSrc * appsrc, GstBuffer * buffer) -{ - return gst_app_src_push_buffer_full (appsrc, buffer, TRUE); -} - -/* push a buffer without stealing the ref of the buffer. This is used for the - * action signal. */ -static GstFlowReturn -gst_app_src_push_buffer_action (GstAppSrc * appsrc, GstBuffer * buffer) -{ - return gst_app_src_push_buffer_full (appsrc, buffer, FALSE); -} - -/** - * gst_app_src_end_of_stream: - * @appsrc: a #GstAppSrc - * - * Indicates to the appsrc element that the last buffer queued in the - * element is the last buffer of the stream. - * - * Returns: #GST_FLOW_OK when the EOS was successfuly queued. - * #GST_FLOW_WRONG_STATE when @appsrc is not PAUSED or PLAYING. - */ -GstFlowReturn -gst_app_src_end_of_stream (GstAppSrc * appsrc) -{ - g_return_val_if_fail (appsrc, GST_FLOW_ERROR); - g_return_val_if_fail (GST_IS_APP_SRC (appsrc), GST_FLOW_ERROR); - - g_mutex_lock (appsrc->mutex); - /* can't accept buffers when we are flushing. We can accept them when we are - * EOS although it will not do anything. */ - if (appsrc->flushing) - goto flushing; - - GST_DEBUG_OBJECT (appsrc, "sending EOS"); - appsrc->is_eos = TRUE; - g_cond_broadcast (appsrc->cond); - g_mutex_unlock (appsrc->mutex); - - return GST_FLOW_OK; - - /* ERRORS */ -flushing: - { - GST_DEBUG_OBJECT (appsrc, "refuse EOS, we are flushing"); - return GST_FLOW_WRONG_STATE; - } -} - -/*** GSTURIHANDLER INTERFACE *************************************************/ - -static GstURIType -gst_app_src_uri_get_type (void) -{ - return GST_URI_SRC; -} - -static gchar ** -gst_app_src_uri_get_protocols (void) -{ - static gchar *protocols[] = { "appsrc", NULL }; - - return protocols; -} - -static const gchar * -gst_app_src_uri_get_uri (GstURIHandler * handler) -{ - return "appsrc"; -} - -static gboolean -gst_app_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) -{ - gchar *protocol; - gboolean ret; - - protocol = gst_uri_get_protocol (uri); - ret = !strcmp (protocol, "appsrc"); - g_free (protocol); - - return ret; -} - -static void -gst_app_src_uri_handler_init (gpointer g_iface, gpointer iface_data) -{ - GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface; - - iface->get_type = gst_app_src_uri_get_type; - iface->get_protocols = gst_app_src_uri_get_protocols; - iface->get_uri = gst_app_src_uri_get_uri; - iface->set_uri = gst_app_src_uri_set_uri; -} diff --git a/gst-libs/gst/app/gstappsrc.h b/gst-libs/gst/app/gstappsrc.h deleted file mode 100644 index e23fa66b8..000000000 --- a/gst-libs/gst/app/gstappsrc.h +++ /dev/null @@ -1,120 +0,0 @@ -/* GStreamer - * Copyright (C) 2007 David Schleef <ds@schleef.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _GST_APP_SRC_H_ -#define _GST_APP_SRC_H_ - -#include <gst/gst.h> -#include <gst/base/gstpushsrc.h> - -G_BEGIN_DECLS - -#define GST_TYPE_APP_SRC \ - (gst_app_src_get_type()) -#define GST_APP_SRC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_SRC,GstAppSrc)) -#define GST_APP_SRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_SRC,GstAppSrcClass)) -#define GST_IS_APP_SRC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SRC)) -#define GST_IS_APP_SRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SRC)) - -typedef struct _GstAppSrc GstAppSrc; -typedef struct _GstAppSrcClass GstAppSrcClass; - -/** - * GstAppStreamType: - * @GST_APP_STREAM_TYPE_STREAM: No seeking is supported in the stream, such as a - * live stream. - * @GST_APP_STREAM_TYPE_SEEKABLE: The stream is seekable but seeking might not - * be very fast, such as data from a webserver. - * @GST_APP_STREAM_TYPE_RANDOM_ACCESS: The stream is seekable and seeking is fast, - * such as in a local file. - * - * The stream type. - */ -typedef enum -{ - GST_APP_STREAM_TYPE_STREAM, - GST_APP_STREAM_TYPE_SEEKABLE, - GST_APP_STREAM_TYPE_RANDOM_ACCESS -} GstAppStreamType; - -struct _GstAppSrc -{ - GstBaseSrc basesrc; - - /*< private >*/ - GCond *cond; - GMutex *mutex; - GQueue *queue; - - GstCaps *caps; - gint64 size; - GstAppStreamType stream_type; - guint64 max_bytes; - GstFormat format; - gboolean block; - - gboolean flushing; - gboolean started; - gboolean is_eos; - guint64 queued_bytes; - guint64 offset; - GstAppStreamType current_type; -}; - -struct _GstAppSrcClass -{ - GstBaseSrcClass basesrc_class; - - /* signals */ - void (*need_data) (GstAppSrc *src, guint length); - void (*enough_data) (GstAppSrc *src); - gboolean (*seek_data) (GstAppSrc *src, guint64 offset); - - /* actions */ - GstFlowReturn (*push_buffer) (GstAppSrc *src, GstBuffer *buffer); - GstFlowReturn (*end_of_stream) (GstAppSrc *src); -}; - -GType gst_app_src_get_type(void); - -GST_DEBUG_CATEGORY_EXTERN (app_src_debug); - -void gst_app_src_set_caps (GstAppSrc *appsrc, const GstCaps *caps); -GstCaps* gst_app_src_get_caps (GstAppSrc *appsrc); - -void gst_app_src_set_size (GstAppSrc *appsrc, gint64 size); -gint64 gst_app_src_get_size (GstAppSrc *appsrc); - -void gst_app_src_set_stream_type (GstAppSrc *appsrc, GstAppStreamType type); -GstAppStreamType gst_app_src_get_stream_type (GstAppSrc *appsrc); - -void gst_app_src_set_max_bytes (GstAppSrc *appsrc, guint64 max); -guint64 gst_app_src_get_max_bytes (GstAppSrc *appsrc); - -GstFlowReturn gst_app_src_push_buffer (GstAppSrc *appsrc, GstBuffer *buffer); -GstFlowReturn gst_app_src_end_of_stream (GstAppSrc *appsrc); - -G_END_DECLS - -#endif - diff --git a/gst/app/Makefile.am b/gst/app/Makefile.am deleted file mode 100644 index 178ed4e82..000000000 --- a/gst/app/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -plugin_LTLIBRARIES = libgstapp.la - -libgstapp_la_SOURCES = gstapp.c -libgstapp_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) -libgstapp_la_LIBADD = $(GST_BASE_LIBS) $(top_builddir)/gst-libs/gst/app/libgstapp-@GST_MAJORMINOR@.la -libgstapp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstapp_la_LIBTOOLFLAGS = --tag=disable-static - diff --git a/gst/app/gstapp.c b/gst/app/gstapp.c deleted file mode 100644 index 098fbdd20..000000000 --- a/gst/app/gstapp.c +++ /dev/null @@ -1,42 +0,0 @@ -/* GStreamer - * Copyright (C) 2007 David Schleef <ds@schleef.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> - -#include <gst/app/gstappsrc.h> -#include <gst/app/gstappsink.h> - -static gboolean -plugin_init (GstPlugin * plugin) -{ - gst_element_register (plugin, "appsrc", GST_RANK_NONE, GST_TYPE_APP_SRC); - gst_element_register (plugin, "appsink", GST_RANK_NONE, GST_TYPE_APP_SINK); - - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "app", - "Elements used to communicate with applications", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) |