#include "gstbasesink.h"
#include <gst/gstmarshal.h>
-GST_DEBUG_CATEGORY_STATIC (gst_basesink_debug);
-#define GST_CAT_DEFAULT gst_basesink_debug
+GST_DEBUG_CATEGORY_STATIC (gst_base_sink_debug);
+#define GST_CAT_DEFAULT gst_base_sink_debug
/* BaseSink signals and properties */
enum
static GstElementClass *parent_class = NULL;
-static void gst_basesink_base_init (gpointer g_class);
-static void gst_basesink_class_init (GstBaseSinkClass * klass);
-static void gst_basesink_init (GstBaseSink * trans, gpointer g_class);
-static void gst_basesink_finalize (GObject * object);
+static void gst_base_sink_base_init (gpointer g_class);
+static void gst_base_sink_class_init (GstBaseSinkClass * klass);
+static void gst_base_sink_init (GstBaseSink * trans, gpointer g_class);
+static void gst_base_sink_finalize (GObject * object);
GType
-gst_basesink_get_type (void)
+gst_base_sink_get_type (void)
{
- static GType basesink_type = 0;
+ static GType base_sink_type = 0;
- if (!basesink_type) {
- static const GTypeInfo basesink_info = {
+ if (!base_sink_type) {
+ static const GTypeInfo base_sink_info = {
sizeof (GstBaseSinkClass),
- (GBaseInitFunc) gst_basesink_base_init,
+ (GBaseInitFunc) gst_base_sink_base_init,
NULL,
- (GClassInitFunc) gst_basesink_class_init,
+ (GClassInitFunc) gst_base_sink_class_init,
NULL,
NULL,
sizeof (GstBaseSink),
0,
- (GInstanceInitFunc) gst_basesink_init,
+ (GInstanceInitFunc) gst_base_sink_init,
};
- basesink_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstBaseSink", &basesink_info, G_TYPE_FLAG_ABSTRACT);
+ base_sink_type = g_type_register_static (GST_TYPE_ELEMENT,
+ "GstBaseSink", &base_sink_info, G_TYPE_FLAG_ABSTRACT);
}
- return basesink_type;
+ return base_sink_type;
}
-static void gst_basesink_set_clock (GstElement * element, GstClock * clock);
+static void gst_base_sink_set_clock (GstElement * element, GstClock * clock);
-static void gst_basesink_set_property (GObject * object, guint prop_id,
+static void gst_base_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
-static void gst_basesink_get_property (GObject * object, guint prop_id,
+static void gst_base_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstCaps *gst_base_sink_get_caps (GstBaseSink * sink);
static gboolean gst_base_sink_set_caps (GstBaseSink * sink, GstCaps * caps);
static GstFlowReturn gst_base_sink_buffer_alloc (GstBaseSink * sink,
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
-static void gst_basesink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
+static void gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end);
-static GstElementStateReturn gst_basesink_change_state (GstElement * element);
+static GstElementStateReturn gst_base_sink_change_state (GstElement * element);
-static GstFlowReturn gst_basesink_chain (GstPad * pad, GstBuffer * buffer);
-static void gst_basesink_loop (GstPad * pad);
-static GstFlowReturn gst_basesink_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_basesink_activate_push (GstPad * pad, gboolean active);
-static gboolean gst_basesink_activate_pull (GstPad * pad, gboolean active);
-static gboolean gst_basesink_event (GstPad * pad, GstEvent * event);
-static inline GstFlowReturn gst_basesink_handle_buffer (GstBaseSink * basesink,
+static GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer);
+static void gst_base_sink_loop (GstPad * pad);
+static GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer);
+static gboolean gst_base_sink_activate_push (GstPad * pad, gboolean active);
+static gboolean gst_base_sink_activate_pull (GstPad * pad, gboolean active);
+static gboolean gst_base_sink_event (GstPad * pad, GstEvent * event);
+static inline GstFlowReturn gst_base_sink_handle_buffer (GstBaseSink * basesink,
GstBuffer * buf);
-static inline gboolean gst_basesink_handle_event (GstBaseSink * basesink,
+static inline gboolean gst_base_sink_handle_event (GstBaseSink * basesink,
GstEvent * event);
static void
-gst_basesink_base_init (gpointer g_class)
+gst_base_sink_base_init (gpointer g_class)
{
- GST_DEBUG_CATEGORY_INIT (gst_basesink_debug, "basesink", 0,
+ GST_DEBUG_CATEGORY_INIT (gst_base_sink_debug, "basesink", 0,
"basesink element");
}
static void
-gst_basesink_class_init (GstBaseSinkClass * klass)
+gst_base_sink_class_init (GstBaseSinkClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_basesink_finalize);
- gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_basesink_set_property);
- gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_basesink_get_property);
+ gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_base_sink_finalize);
+ gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_base_sink_set_property);
+ gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_base_sink_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_LOOP,
g_param_spec_boolean ("has-loop", "has-loop",
"Number of buffers to queue during preroll", 0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
- gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_basesink_set_clock);
+ gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_base_sink_set_clock);
gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_basesink_change_state);
+ GST_DEBUG_FUNCPTR (gst_base_sink_change_state);
klass->get_caps = GST_DEBUG_FUNCPTR (gst_base_sink_get_caps);
klass->set_caps = GST_DEBUG_FUNCPTR (gst_base_sink_set_caps);
klass->buffer_alloc = GST_DEBUG_FUNCPTR (gst_base_sink_buffer_alloc);
- klass->get_times = GST_DEBUG_FUNCPTR (gst_basesink_get_times);
+ klass->get_times = GST_DEBUG_FUNCPTR (gst_base_sink_get_times);
}
static GstCaps *
-gst_basesink_pad_getcaps (GstPad * pad)
+gst_base_sink_pad_getcaps (GstPad * pad)
{
GstBaseSinkClass *bclass;
GstBaseSink *bsink;
}
static gboolean
-gst_basesink_pad_setcaps (GstPad * pad, GstCaps * caps)
+gst_base_sink_pad_setcaps (GstPad * pad, GstCaps * caps)
{
GstBaseSinkClass *bclass;
GstBaseSink *bsink;
}
static GstFlowReturn
-gst_basesink_pad_buffer_alloc (GstPad * pad, guint64 offset, guint size,
+gst_base_sink_pad_buffer_alloc (GstPad * pad, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buf)
{
GstBaseSinkClass *bclass;
}
static void
-gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
+gst_base_sink_init (GstBaseSink * basesink, gpointer g_class)
{
GstPadTemplate *pad_template;
basesink->sinkpad = gst_pad_new_from_template (pad_template, "sink");
gst_pad_set_getcaps_function (basesink->sinkpad,
- GST_DEBUG_FUNCPTR (gst_basesink_pad_getcaps));
+ GST_DEBUG_FUNCPTR (gst_base_sink_pad_getcaps));
gst_pad_set_setcaps_function (basesink->sinkpad,
- GST_DEBUG_FUNCPTR (gst_basesink_pad_setcaps));
+ GST_DEBUG_FUNCPTR (gst_base_sink_pad_setcaps));
gst_pad_set_bufferalloc_function (basesink->sinkpad,
- GST_DEBUG_FUNCPTR (gst_basesink_pad_buffer_alloc));
+ GST_DEBUG_FUNCPTR (gst_base_sink_pad_buffer_alloc));
gst_element_add_pad (GST_ELEMENT (basesink), basesink->sinkpad);
basesink->pad_mode = GST_ACTIVATE_NONE;
}
static void
-gst_basesink_finalize (GObject * object)
+gst_base_sink_finalize (GObject * object)
{
GstBaseSink *basesink;
}
static void
-gst_basesink_set_pad_functions (GstBaseSink * this, GstPad * pad)
+gst_base_sink_set_pad_functions (GstBaseSink * this, GstPad * pad)
{
gst_pad_set_activatepush_function (pad,
- GST_DEBUG_FUNCPTR (gst_basesink_activate_push));
+ GST_DEBUG_FUNCPTR (gst_base_sink_activate_push));
gst_pad_set_activatepull_function (pad,
- GST_DEBUG_FUNCPTR (gst_basesink_activate_pull));
- gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_basesink_event));
+ GST_DEBUG_FUNCPTR (gst_base_sink_activate_pull));
+ gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_base_sink_event));
if (this->has_chain)
- gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_basesink_chain));
+ gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_base_sink_chain));
else
gst_pad_set_chain_function (pad, NULL);
}
static void
-gst_basesink_set_all_pad_functions (GstBaseSink * this)
+gst_base_sink_set_all_pad_functions (GstBaseSink * this)
{
GList *l;
for (l = GST_ELEMENT_PADS (this); l; l = l->next)
- gst_basesink_set_pad_functions (this, (GstPad *) l->data);
+ gst_base_sink_set_pad_functions (this, (GstPad *) l->data);
}
static void
-gst_basesink_set_clock (GstElement * element, GstClock * clock)
+gst_base_sink_set_clock (GstElement * element, GstClock * clock)
{
GstBaseSink *sink;
}
static void
-gst_basesink_set_property (GObject * object, guint prop_id,
+gst_base_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstBaseSink *sink;
case PROP_HAS_LOOP:
GST_LOCK (sink);
sink->has_loop = g_value_get_boolean (value);
- gst_basesink_set_all_pad_functions (sink);
+ gst_base_sink_set_all_pad_functions (sink);
GST_UNLOCK (sink);
break;
case PROP_HAS_CHAIN:
GST_LOCK (sink);
sink->has_chain = g_value_get_boolean (value);
- gst_basesink_set_all_pad_functions (sink);
+ gst_base_sink_set_all_pad_functions (sink);
GST_UNLOCK (sink);
break;
case PROP_PREROLL_QUEUE_LEN:
}
static void
-gst_basesink_get_property (GObject * object, guint prop_id, GValue * value,
+gst_base_sink_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstBaseSink *sink;
/* with PREROLL_LOCK */
static GstFlowReturn
-gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
+gst_base_sink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
{
GstMiniObject *obj;
GQueue *q = basesink->preroll_queue;
if (GST_IS_BUFFER (obj)) {
GST_DEBUG ("poped buffer %p", obj);
- ret = gst_basesink_handle_buffer (basesink, GST_BUFFER (obj));
+ ret = gst_base_sink_handle_buffer (basesink, GST_BUFFER (obj));
} else {
GST_DEBUG ("poped event %p", obj);
- gst_basesink_handle_event (basesink, GST_EVENT (obj));
+ gst_base_sink_handle_event (basesink, GST_EVENT (obj));
ret = GST_FLOW_OK;
}
/* with PREROLL_LOCK */
static void
-gst_basesink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad)
+gst_base_sink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad)
{
GstMiniObject *obj;
GQueue *q = basesink->preroll_queue;
/* with STREAM_LOCK */
static GstFlowReturn
-gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad,
+gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
GstMiniObject * obj)
{
gint length;
GST_DEBUG ("no preroll needed");
/* maybe it was another sink that blocked in preroll, need to check for
buffers to drain */
- ret = gst_basesink_preroll_queue_empty (basesink, pad);
+ ret = gst_base_sink_preroll_queue_empty (basesink, pad);
GST_PREROLL_UNLOCK (pad);
return ret;
}
static gboolean
-gst_basesink_event (GstPad * pad, GstEvent * event)
+gst_base_sink_event (GstPad * pad, GstEvent * event)
{
GstBaseSink *basesink;
gboolean result = TRUE;
GST_STREAM_LOCK (pad);
/* EOS also finishes the preroll */
- ret = gst_basesink_handle_object (basesink, pad, GST_MINI_OBJECT (event));
+ ret =
+ gst_base_sink_handle_object (basesink, pad, GST_MINI_OBJECT (event));
GST_STREAM_UNLOCK (pad);
break;
}
if (basesink->clock) {
//gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value;
}
- ret = gst_basesink_handle_object (basesink, pad, GST_MINI_OBJECT (event));
+ ret =
+ gst_base_sink_handle_object (basesink, pad, GST_MINI_OBJECT (event));
GST_STREAM_UNLOCK (pad);
break;
}
/* we need preroll after the flush */
basesink->need_preroll = TRUE;
/* unlock from a possible state change/preroll */
- gst_basesink_preroll_queue_flush (basesink, pad);
+ gst_base_sink_preroll_queue_flush (basesink, pad);
GST_LOCK (basesink);
if (basesink->clock_id) {
* timestamps on a buffer, subclasses cna override
*/
static void
-gst_basesink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
+gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end)
{
GstClockTime timestamp, duration;
* 5) unref the clockid again
*/
static gboolean
-gst_basesink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
+gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
{
gboolean result = TRUE;
* 3) unref the event
*/
static inline gboolean
-gst_basesink_handle_event (GstBaseSink * basesink, GstEvent * event)
+gst_base_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
{
GstBaseSinkClass *bclass;
gboolean ret;
* 3) unref the buffer
*/
static inline GstFlowReturn
-gst_basesink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
+gst_base_sink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
{
GstBaseSinkClass *bclass;
GstFlowReturn ret;
- gst_basesink_do_sync (basesink, buf);
+ gst_base_sink_do_sync (basesink, buf);
bclass = GST_BASESINK_GET_CLASS (basesink);
if (bclass->render)
}
static GstFlowReturn
-gst_basesink_chain (GstPad * pad, GstBuffer * buf)
+gst_base_sink_chain (GstPad * pad, GstBuffer * buf)
{
GstBaseSink *basesink;
GstFlowReturn result;
basesink = GST_BASESINK (GST_OBJECT_PARENT (pad));
- result = gst_basesink_handle_object (basesink, pad, GST_MINI_OBJECT (buf));
+ result = gst_base_sink_handle_object (basesink, pad, GST_MINI_OBJECT (buf));
return result;
}
/* FIXME, not all sinks can operate in pull mode
*/
static void
-gst_basesink_loop (GstPad * pad)
+gst_base_sink_loop (GstPad * pad)
{
GstBaseSink *basesink;
GstBuffer *buf = NULL;
if (result != GST_FLOW_OK)
goto paused;
- result = gst_basesink_chain (pad, buf);
+ result = gst_base_sink_chain (pad, buf);
if (result != GST_FLOW_OK)
goto paused;
}
static gboolean
-gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad)
+gst_base_sink_deactivate (GstBaseSink * basesink, GstPad * pad)
{
gboolean result = FALSE;
GstBaseSinkClass *bclass;
/* flush out the data thread if it's locked in finish_preroll */
basesink->need_preroll = FALSE;
- gst_basesink_preroll_queue_flush (basesink, pad);
+ gst_base_sink_preroll_queue_flush (basesink, pad);
GST_PREROLL_UNLOCK (pad);
/* step 2, make sure streaming finishes */
}
static gboolean
-gst_basesink_activate_push (GstPad * pad, gboolean active)
+gst_base_sink_activate_push (GstPad * pad, gboolean active)
{
gboolean result = FALSE;
GstBaseSink *basesink;
g_return_val_if_fail (basesink->has_chain, FALSE);
result = TRUE;
} else {
- result = gst_basesink_deactivate (basesink, pad);
+ result = gst_base_sink_deactivate (basesink, pad);
}
basesink->pad_mode = GST_ACTIVATE_PUSH;
/* this won't get called until we implement an activate function */
static gboolean
-gst_basesink_activate_pull (GstPad * pad, gboolean active)
+gst_base_sink_activate_pull (GstPad * pad, gboolean active)
{
gboolean result = FALSE;
GstBaseSink *basesink;
if (active) {
/* if we have a scheduler we can start the task */
g_return_val_if_fail (basesink->has_loop, FALSE);
- result = gst_pad_start_task (pad, (GstTaskFunction) gst_basesink_loop, pad);
+ result =
+ gst_pad_start_task (pad, (GstTaskFunction) gst_base_sink_loop, pad);
} else {
- result = gst_basesink_deactivate (basesink, pad);
+ result = gst_base_sink_deactivate (basesink, pad);
}
return result;
}
static GstElementStateReturn
-gst_basesink_change_state (GstElement * element)
+gst_base_sink_change_state (GstElement * element)
{
GstElementStateReturn ret = GST_STATE_SUCCESS;
GstBaseSink *basesink = GST_BASESINK (element);
* we are pushing and syncing the buffers, better start a new
* thread to do this. */
if (basesink->eos) {
- gst_basesink_preroll_queue_empty (basesink, basesink->sinkpad);
+ gst_base_sink_preroll_queue_empty (basesink, basesink->sinkpad);
}
/* don't need the preroll anymore */
basesink->need_preroll = FALSE;
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
- * gstbasesink.h:
+ * gstbasesink.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
G_BEGIN_DECLS
-#define GST_TYPE_BASESINK (gst_basesink_get_type())
-#define GST_BASESINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASESINK,GstBaseSink))
-#define GST_BASESINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASESINK,GstBaseSinkClass))
+#define GST_TYPE_BASESINK (gst_base_sink_get_type())
+#define GST_BASESINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASESINK,GstBaseSink))
+#define GST_BASESINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASESINK,GstBaseSinkClass))
#define GST_BASESINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASESINK, GstBaseSinkClass))
-#define GST_IS_BASESINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASESINK))
-#define GST_IS_BASESINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASESINK))
+#define GST_IS_BASESINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASESINK))
+#define GST_IS_BASESINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASESINK))
#define GST_BASESINK_CLOCK(obj) (GST_BASESINK (obj)->clock)
#define GST_BASESINK_PAD(obj) (GST_BASESINK (obj)->sinkpad)
/* a base class for implementing chain based sinks
*
- * Preroll, EOS, state changes are all handled.
+ * Preroll, EOS, state changes are all handled.
*/
struct _GstBaseSink {
- GstElement element;
+ GstElement element;
- GstPad *sinkpad;
+ GstPad *sinkpad;
GstActivateMode pad_mode;
/*< protected >*/ /* with PREROLL_LOCK */
gint preroll_queue_max_len;
guint64 offset;
- gboolean has_loop;
- gboolean has_chain;
+ gboolean has_loop;
+ gboolean has_chain;
- GstClock *clock;
+ GstClock *clock;
GstClockID clock_id;
GstClockTime end_time;
-
+
gboolean eos;
gboolean need_preroll;
gboolean have_preroll;
GstCaps *caps, GstBuffer **buf);
/* get the start and end times for syncing on this buffer */
- void (*get_times) (GstBaseSink *sink, GstBuffer *buffer,
+ void (*get_times) (GstBaseSink *sink, GstBuffer *buffer,
GstClockTime *start, GstClockTime *end);
/* unlock any pending access to the resource. subclasses should unlock
GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer);
};
-GType gst_basesink_get_type(void);
+GType gst_base_sink_get_type(void);
G_END_DECLS
#define DEFAULT_BLOCKSIZE 4096
-GST_DEBUG_CATEGORY_STATIC (gst_basesrc_debug);
-#define GST_CAT_DEFAULT gst_basesrc_debug
+GST_DEBUG_CATEGORY_STATIC (gst_base_src_debug);
+#define GST_CAT_DEFAULT gst_base_src_debug
/* BaseSrc signals and args */
enum
static GstElementClass *parent_class = NULL;
-static void gst_basesrc_base_init (gpointer g_class);
-static void gst_basesrc_class_init (GstBaseSrcClass * klass);
-static void gst_basesrc_init (GstBaseSrc * src, gpointer g_class);
+static void gst_base_src_base_init (gpointer g_class);
+static void gst_base_src_class_init (GstBaseSrcClass * klass);
+static void gst_base_src_init (GstBaseSrc * src, gpointer g_class);
GType
-gst_basesrc_get_type (void)
+gst_base_src_get_type (void)
{
- static GType basesrc_type = 0;
+ static GType base_src_type = 0;
- if (!basesrc_type) {
- static const GTypeInfo basesrc_info = {
+ if (!base_src_type) {
+ static const GTypeInfo base_src_info = {
sizeof (GstBaseSrcClass),
- (GBaseInitFunc) gst_basesrc_base_init,
+ (GBaseInitFunc) gst_base_src_base_init,
NULL,
- (GClassInitFunc) gst_basesrc_class_init,
+ (GClassInitFunc) gst_base_src_class_init,
NULL,
NULL,
sizeof (GstBaseSrc),
0,
- (GInstanceInitFunc) gst_basesrc_init,
+ (GInstanceInitFunc) gst_base_src_init,
};
- basesrc_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstBaseSrc", &basesrc_info, G_TYPE_FLAG_ABSTRACT);
+ base_src_type = g_type_register_static (GST_TYPE_ELEMENT,
+ "GstBaseSrc", &base_src_info, G_TYPE_FLAG_ABSTRACT);
}
- return basesrc_type;
+ return base_src_type;
}
-static gboolean gst_basesrc_activate_push (GstPad * pad, gboolean active);
-static gboolean gst_basesrc_activate_pull (GstPad * pad, gboolean active);
-static void gst_basesrc_set_property (GObject * object, guint prop_id,
+static gboolean gst_base_src_activate_push (GstPad * pad, gboolean active);
+static gboolean gst_base_src_activate_pull (GstPad * pad, gboolean active);
+static void gst_base_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
-static void gst_basesrc_get_property (GObject * object, guint prop_id,
+static void gst_base_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static gboolean gst_basesrc_event_handler (GstPad * pad, GstEvent * event);
+static gboolean gst_base_src_event_handler (GstPad * pad, GstEvent * event);
-static gboolean gst_basesrc_query (GstPad * pad, GstQuery * query);
+static gboolean gst_base_src_query (GstPad * pad, GstQuery * query);
#if 0
-static const GstEventMask *gst_basesrc_get_event_mask (GstPad * pad);
+static const GstEventMask *gst_base_src_get_event_mask (GstPad * pad);
#endif
-static gboolean gst_basesrc_unlock (GstBaseSrc * basesrc);
-static gboolean gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size);
-static gboolean gst_basesrc_start (GstBaseSrc * basesrc);
-static gboolean gst_basesrc_stop (GstBaseSrc * basesrc);
+static gboolean gst_base_src_unlock (GstBaseSrc * basesrc);
+static gboolean gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size);
+static gboolean gst_base_src_start (GstBaseSrc * basesrc);
+static gboolean gst_base_src_stop (GstBaseSrc * basesrc);
-static GstElementStateReturn gst_basesrc_change_state (GstElement * element);
+static GstElementStateReturn gst_base_src_change_state (GstElement * element);
-static void gst_basesrc_set_dataflow_funcs (GstBaseSrc * this);
-static void gst_basesrc_loop (GstPad * pad);
-static gboolean gst_basesrc_check_get_range (GstPad * pad);
-static GstFlowReturn gst_basesrc_get_range (GstPad * pad, guint64 offset,
+static void gst_base_src_set_dataflow_funcs (GstBaseSrc * this);
+static void gst_base_src_loop (GstPad * pad);
+static gboolean gst_base_src_check_get_range (GstPad * pad);
+static GstFlowReturn gst_base_src_get_range (GstPad * pad, guint64 offset,
guint length, GstBuffer ** buf);
static void
-gst_basesrc_base_init (gpointer g_class)
+gst_base_src_base_init (gpointer g_class)
{
- GST_DEBUG_CATEGORY_INIT (gst_basesrc_debug, "basesrc", 0, "basesrc element");
+ GST_DEBUG_CATEGORY_INIT (gst_base_src_debug, "basesrc", 0, "basesrc element");
}
static void
-gst_basesrc_class_init (GstBaseSrcClass * klass)
+gst_base_src_class_init (GstBaseSrcClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_basesrc_set_property);
- gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_basesrc_get_property);
+ gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_base_src_set_property);
+ gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_base_src_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BLOCKSIZE,
g_param_spec_ulong ("blocksize", "Block size",
"True if the element should expose a getrange function", TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
- gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_basesrc_change_state);
+ gstelement_class->change_state =
+ GST_DEBUG_FUNCPTR (gst_base_src_change_state);
}
static void
-gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class)
+gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class)
{
GstPad *pad;
GstPadTemplate *pad_template;
pad = gst_pad_new_from_template (pad_template, "src");
- gst_pad_set_activatepush_function (pad, gst_basesrc_activate_push);
- gst_pad_set_activatepull_function (pad, gst_basesrc_activate_pull);
- gst_pad_set_event_function (pad, gst_basesrc_event_handler);
- gst_pad_set_query_function (pad, gst_basesrc_query);
+ gst_pad_set_activatepush_function (pad, gst_base_src_activate_push);
+ gst_pad_set_activatepull_function (pad, gst_base_src_activate_pull);
+ gst_pad_set_event_function (pad, gst_base_src_event_handler);
+ gst_pad_set_query_function (pad, gst_base_src_query);
- gst_pad_set_checkgetrange_function (pad, gst_basesrc_check_get_range);
+ gst_pad_set_checkgetrange_function (pad, gst_base_src_check_get_range);
basesrc->is_live = FALSE;
basesrc->live_lock = g_mutex_new ();
}
void
-gst_basesrc_set_live (GstBaseSrc * src, gboolean live)
+gst_base_src_set_live (GstBaseSrc * src, gboolean live)
{
GST_LIVE_LOCK (src);
src->is_live = live;
}
gboolean
-gst_basesrc_is_live (GstBaseSrc * src)
+gst_base_src_is_live (GstBaseSrc * src)
{
gboolean result;
}
static void
-gst_basesrc_set_dataflow_funcs (GstBaseSrc * this)
+gst_base_src_set_dataflow_funcs (GstBaseSrc * this)
{
GST_DEBUG ("updating dataflow functions");
if (this->has_getrange)
- gst_pad_set_getrange_function (this->srcpad, gst_basesrc_get_range);
+ gst_pad_set_getrange_function (this->srcpad, gst_base_src_get_range);
else
gst_pad_set_getrange_function (this->srcpad, NULL);
}
static gboolean
-gst_basesrc_query (GstPad * pad, GstQuery * query)
+gst_base_src_query (GstPad * pad, GstQuery * query)
{
gboolean b;
guint64 ui64;
switch (format) {
case GST_FORMAT_DEFAULT:
case GST_FORMAT_BYTES:
- b = gst_basesrc_get_size (src, &ui64);
+ b = gst_base_src_get_size (src, &ui64);
/* better to make get_size take an int64 */
i64 = b ? (gint64) ui64 : -1;
gst_query_set_position (query, GST_FORMAT_BYTES, src->offset, i64);
return TRUE;
case GST_FORMAT_PERCENT:
- b = gst_basesrc_get_size (src, &ui64);
+ b = gst_base_src_get_size (src, &ui64);
i64 = GST_FORMAT_PERCENT_MAX;
i64 *= b ? (src->offset / (gdouble) ui64) : 1.0;
gst_query_set_position (query, GST_FORMAT_PERCENT,
#if 0
static const GstEventMask *
-gst_basesrc_get_event_mask (GstPad * pad)
+gst_base_src_get_event_mask (GstPad * pad)
{
static const GstEventMask masks[] = {
{GST_EVENT_SEEK, GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_SET |
#endif
static gboolean
-gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
+gst_base_src_do_seek (GstBaseSrc * src, GstEvent * event)
{
GstFormat format;
gint64 offset;
gst_pad_push_event (src->srcpad, gst_event_new_flush (FALSE));
/* unblock streaming thread */
- gst_basesrc_unlock (src);
+ gst_base_src_unlock (src);
/* grab streaming lock */
GST_STREAM_LOCK (src->srcpad);
}
/* and restart the task */
- gst_pad_start_task (src->srcpad, (GstTaskFunction) gst_basesrc_loop,
+ gst_pad_start_task (src->srcpad, (GstTaskFunction) gst_base_src_loop,
src->srcpad);
GST_STREAM_UNLOCK (src->srcpad);
}
static gboolean
-gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
+gst_base_src_event_handler (GstPad * pad, GstEvent * event)
{
GstBaseSrc *src;
GstBaseSrcClass *bclass;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
- return gst_basesrc_do_seek (src, event);
+ return gst_base_src_do_seek (src, event);
case GST_EVENT_SIZE:
{
GstFormat format;
case GST_EVENT_FLUSH:
/* cancel any blocking getrange */
if (!GST_EVENT_FLUSH_DONE (event))
- gst_basesrc_unlock (src);
+ gst_base_src_unlock (src);
break;
default:
break;
}
static void
-gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value,
- GParamSpec * pspec)
+gst_base_src_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstBaseSrc *src;
break;
case PROP_HAS_LOOP:
src->has_loop = g_value_get_boolean (value);
- gst_basesrc_set_dataflow_funcs (src);
+ gst_base_src_set_dataflow_funcs (src);
break;
case PROP_HAS_GETRANGE:
src->has_getrange = g_value_get_boolean (value);
- gst_basesrc_set_dataflow_funcs (src);
+ gst_base_src_set_dataflow_funcs (src);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
static void
-gst_basesrc_get_property (GObject * object, guint prop_id, GValue * value,
+gst_base_src_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstBaseSrc *src;
}
static GstFlowReturn
-gst_basesrc_get_range (GstPad * pad, guint64 offset, guint length,
+gst_base_src_get_range (GstPad * pad, guint64 offset, guint length,
GstBuffer ** buf)
{
GstFlowReturn ret;
}
static gboolean
-gst_basesrc_check_get_range (GstPad * pad)
+gst_base_src_check_get_range (GstPad * pad)
{
GstBaseSrc *src;
src = GST_BASESRC (GST_OBJECT_PARENT (pad));
if (!GST_FLAG_IS_SET (src, GST_BASESRC_STARTED)) {
- gst_basesrc_start (src);
- gst_basesrc_stop (src);
+ gst_base_src_start (src);
+ gst_base_src_stop (src);
}
return src->seekable;
}
static void
-gst_basesrc_loop (GstPad * pad)
+gst_base_src_loop (GstPad * pad)
{
GstBaseSrc *src;
GstBuffer *buf = NULL;
src = GST_BASESRC (GST_OBJECT_PARENT (pad));
- ret = gst_basesrc_get_range (pad, src->offset, src->blocksize, &buf);
+ ret = gst_base_src_get_range (pad, src->offset, src->blocksize, &buf);
if (ret != GST_FLOW_OK)
goto eos;
}
static gboolean
-gst_basesrc_unlock (GstBaseSrc * basesrc)
+gst_base_src_unlock (GstBaseSrc * basesrc)
{
GstBaseSrcClass *bclass;
gboolean result = FALSE;
}
static gboolean
-gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size)
+gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size)
{
GstBaseSrcClass *bclass;
gboolean result = FALSE;
}
static gboolean
-gst_basesrc_is_seekable (GstBaseSrc * basesrc)
+gst_base_src_is_seekable (GstBaseSrc * basesrc)
{
GstBaseSrcClass *bclass;
}
static gboolean
-gst_basesrc_start (GstBaseSrc * basesrc)
+gst_base_src_start (GstBaseSrc * basesrc)
{
GstBaseSrcClass *bclass;
gboolean result;
basesrc->segment_end = -1;
/* check if we can seek, updates ->seekable */
- gst_basesrc_is_seekable (basesrc);
+ gst_base_src_is_seekable (basesrc);
/* run typefind */
#if 0
}
static gboolean
-gst_basesrc_stop (GstBaseSrc * basesrc)
+gst_base_src_stop (GstBaseSrc * basesrc)
{
GstBaseSrcClass *bclass;
gboolean result = TRUE;
}
static gboolean
-gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
+gst_base_src_deactivate (GstBaseSrc * basesrc, GstPad * pad)
{
gboolean result;
GST_LIVE_UNLOCK (basesrc);
/* step 1, unblock clock sync (if any) */
- gst_basesrc_unlock (basesrc);
+ gst_base_src_unlock (basesrc);
/* step 2, make sure streaming finishes */
result = gst_pad_stop_task (pad);
}
static gboolean
-gst_basesrc_activate_push (GstPad * pad, gboolean active)
+gst_base_src_activate_push (GstPad * pad, gboolean active)
{
GstBaseSrc *basesrc;
/* prepare subclass first */
if (active) {
- if (!gst_basesrc_start (basesrc))
+ if (!gst_base_src_start (basesrc))
goto error_start;
- return gst_pad_start_task (pad, (GstTaskFunction) gst_basesrc_loop, pad);
+ return gst_pad_start_task (pad, (GstTaskFunction) gst_base_src_loop, pad);
} else {
- return gst_basesrc_deactivate (basesrc, pad);
+ return gst_base_src_deactivate (basesrc, pad);
}
error_start:
}
static gboolean
-gst_basesrc_activate_pull (GstPad * pad, gboolean active)
+gst_base_src_activate_pull (GstPad * pad, gboolean active)
{
GstBaseSrc *basesrc;
/* prepare subclass first */
if (active) {
- if (!gst_basesrc_start (basesrc))
+ if (!gst_base_src_start (basesrc))
goto error_start;
if (!basesrc->seekable) {
- gst_basesrc_stop (basesrc);
+ gst_base_src_stop (basesrc);
return FALSE;
}
return TRUE;
} else {
- return gst_basesrc_deactivate (basesrc, pad);
+ return gst_base_src_deactivate (basesrc, pad);
}
error_start:
}
static GstElementStateReturn
-gst_basesrc_change_state (GstElement * element)
+gst_base_src_change_state (GstElement * element)
{
GstBaseSrc *basesrc;
GstElementStateReturn result = GST_STATE_SUCCESS;
GST_LIVE_UNLOCK (element);
break;
case GST_STATE_PAUSED_TO_READY:
- if (!gst_basesrc_stop (basesrc))
+ if (!gst_base_src_stop (basesrc))
result = GST_STATE_FAILURE;
break;
case GST_STATE_READY_TO_NULL:
G_BEGIN_DECLS
-#define GST_TYPE_BASESRC (gst_basesrc_get_type())
+#define GST_TYPE_BASESRC (gst_base_src_get_type())
#define GST_BASESRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASESRC,GstBaseSrc))
#define GST_BASESRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASESRC,GstBaseSrcClass))
#define GST_BASESRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASESRC, GstBaseSrcClass))
GstBuffer **buf);
};
-GType gst_basesrc_get_type(void);
+GType gst_base_src_get_type(void);
-void gst_basesrc_set_live (GstBaseSrc *src, gboolean live);
-gboolean gst_basesrc_is_live (GstBaseSrc *src);
+void gst_base_src_set_live (GstBaseSrc *src, gboolean live);
+gboolean gst_base_src_is_live (GstBaseSrc *src);
G_END_DECLS
#include "gstbasesink.h"
#include <gst/gstmarshal.h>
-GST_DEBUG_CATEGORY_STATIC (gst_basesink_debug);
-#define GST_CAT_DEFAULT gst_basesink_debug
+GST_DEBUG_CATEGORY_STATIC (gst_base_sink_debug);
+#define GST_CAT_DEFAULT gst_base_sink_debug
/* BaseSink signals and properties */
enum
static GstElementClass *parent_class = NULL;
-static void gst_basesink_base_init (gpointer g_class);
-static void gst_basesink_class_init (GstBaseSinkClass * klass);
-static void gst_basesink_init (GstBaseSink * trans, gpointer g_class);
-static void gst_basesink_finalize (GObject * object);
+static void gst_base_sink_base_init (gpointer g_class);
+static void gst_base_sink_class_init (GstBaseSinkClass * klass);
+static void gst_base_sink_init (GstBaseSink * trans, gpointer g_class);
+static void gst_base_sink_finalize (GObject * object);
GType
-gst_basesink_get_type (void)
+gst_base_sink_get_type (void)
{
- static GType basesink_type = 0;
+ static GType base_sink_type = 0;
- if (!basesink_type) {
- static const GTypeInfo basesink_info = {
+ if (!base_sink_type) {
+ static const GTypeInfo base_sink_info = {
sizeof (GstBaseSinkClass),
- (GBaseInitFunc) gst_basesink_base_init,
+ (GBaseInitFunc) gst_base_sink_base_init,
NULL,
- (GClassInitFunc) gst_basesink_class_init,
+ (GClassInitFunc) gst_base_sink_class_init,
NULL,
NULL,
sizeof (GstBaseSink),
0,
- (GInstanceInitFunc) gst_basesink_init,
+ (GInstanceInitFunc) gst_base_sink_init,
};
- basesink_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstBaseSink", &basesink_info, G_TYPE_FLAG_ABSTRACT);
+ base_sink_type = g_type_register_static (GST_TYPE_ELEMENT,
+ "GstBaseSink", &base_sink_info, G_TYPE_FLAG_ABSTRACT);
}
- return basesink_type;
+ return base_sink_type;
}
-static void gst_basesink_set_clock (GstElement * element, GstClock * clock);
+static void gst_base_sink_set_clock (GstElement * element, GstClock * clock);
-static void gst_basesink_set_property (GObject * object, guint prop_id,
+static void gst_base_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
-static void gst_basesink_get_property (GObject * object, guint prop_id,
+static void gst_base_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstCaps *gst_base_sink_get_caps (GstBaseSink * sink);
static gboolean gst_base_sink_set_caps (GstBaseSink * sink, GstCaps * caps);
static GstFlowReturn gst_base_sink_buffer_alloc (GstBaseSink * sink,
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
-static void gst_basesink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
+static void gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end);
-static GstElementStateReturn gst_basesink_change_state (GstElement * element);
+static GstElementStateReturn gst_base_sink_change_state (GstElement * element);
-static GstFlowReturn gst_basesink_chain (GstPad * pad, GstBuffer * buffer);
-static void gst_basesink_loop (GstPad * pad);
-static GstFlowReturn gst_basesink_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_basesink_activate_push (GstPad * pad, gboolean active);
-static gboolean gst_basesink_activate_pull (GstPad * pad, gboolean active);
-static gboolean gst_basesink_event (GstPad * pad, GstEvent * event);
-static inline GstFlowReturn gst_basesink_handle_buffer (GstBaseSink * basesink,
+static GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer);
+static void gst_base_sink_loop (GstPad * pad);
+static GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer);
+static gboolean gst_base_sink_activate_push (GstPad * pad, gboolean active);
+static gboolean gst_base_sink_activate_pull (GstPad * pad, gboolean active);
+static gboolean gst_base_sink_event (GstPad * pad, GstEvent * event);
+static inline GstFlowReturn gst_base_sink_handle_buffer (GstBaseSink * basesink,
GstBuffer * buf);
-static inline gboolean gst_basesink_handle_event (GstBaseSink * basesink,
+static inline gboolean gst_base_sink_handle_event (GstBaseSink * basesink,
GstEvent * event);
static void
-gst_basesink_base_init (gpointer g_class)
+gst_base_sink_base_init (gpointer g_class)
{
- GST_DEBUG_CATEGORY_INIT (gst_basesink_debug, "basesink", 0,
+ GST_DEBUG_CATEGORY_INIT (gst_base_sink_debug, "basesink", 0,
"basesink element");
}
static void
-gst_basesink_class_init (GstBaseSinkClass * klass)
+gst_base_sink_class_init (GstBaseSinkClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_basesink_finalize);
- gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_basesink_set_property);
- gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_basesink_get_property);
+ gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_base_sink_finalize);
+ gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_base_sink_set_property);
+ gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_base_sink_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_LOOP,
g_param_spec_boolean ("has-loop", "has-loop",
"Number of buffers to queue during preroll", 0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
- gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_basesink_set_clock);
+ gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_base_sink_set_clock);
gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_basesink_change_state);
+ GST_DEBUG_FUNCPTR (gst_base_sink_change_state);
klass->get_caps = GST_DEBUG_FUNCPTR (gst_base_sink_get_caps);
klass->set_caps = GST_DEBUG_FUNCPTR (gst_base_sink_set_caps);
klass->buffer_alloc = GST_DEBUG_FUNCPTR (gst_base_sink_buffer_alloc);
- klass->get_times = GST_DEBUG_FUNCPTR (gst_basesink_get_times);
+ klass->get_times = GST_DEBUG_FUNCPTR (gst_base_sink_get_times);
}
static GstCaps *
-gst_basesink_pad_getcaps (GstPad * pad)
+gst_base_sink_pad_getcaps (GstPad * pad)
{
GstBaseSinkClass *bclass;
GstBaseSink *bsink;
}
static gboolean
-gst_basesink_pad_setcaps (GstPad * pad, GstCaps * caps)
+gst_base_sink_pad_setcaps (GstPad * pad, GstCaps * caps)
{
GstBaseSinkClass *bclass;
GstBaseSink *bsink;
}
static GstFlowReturn
-gst_basesink_pad_buffer_alloc (GstPad * pad, guint64 offset, guint size,
+gst_base_sink_pad_buffer_alloc (GstPad * pad, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buf)
{
GstBaseSinkClass *bclass;
}
static void
-gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
+gst_base_sink_init (GstBaseSink * basesink, gpointer g_class)
{
GstPadTemplate *pad_template;
basesink->sinkpad = gst_pad_new_from_template (pad_template, "sink");
gst_pad_set_getcaps_function (basesink->sinkpad,
- GST_DEBUG_FUNCPTR (gst_basesink_pad_getcaps));
+ GST_DEBUG_FUNCPTR (gst_base_sink_pad_getcaps));
gst_pad_set_setcaps_function (basesink->sinkpad,
- GST_DEBUG_FUNCPTR (gst_basesink_pad_setcaps));
+ GST_DEBUG_FUNCPTR (gst_base_sink_pad_setcaps));
gst_pad_set_bufferalloc_function (basesink->sinkpad,
- GST_DEBUG_FUNCPTR (gst_basesink_pad_buffer_alloc));
+ GST_DEBUG_FUNCPTR (gst_base_sink_pad_buffer_alloc));
gst_element_add_pad (GST_ELEMENT (basesink), basesink->sinkpad);
basesink->pad_mode = GST_ACTIVATE_NONE;
}
static void
-gst_basesink_finalize (GObject * object)
+gst_base_sink_finalize (GObject * object)
{
GstBaseSink *basesink;
}
static void
-gst_basesink_set_pad_functions (GstBaseSink * this, GstPad * pad)
+gst_base_sink_set_pad_functions (GstBaseSink * this, GstPad * pad)
{
gst_pad_set_activatepush_function (pad,
- GST_DEBUG_FUNCPTR (gst_basesink_activate_push));
+ GST_DEBUG_FUNCPTR (gst_base_sink_activate_push));
gst_pad_set_activatepull_function (pad,
- GST_DEBUG_FUNCPTR (gst_basesink_activate_pull));
- gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_basesink_event));
+ GST_DEBUG_FUNCPTR (gst_base_sink_activate_pull));
+ gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_base_sink_event));
if (this->has_chain)
- gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_basesink_chain));
+ gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_base_sink_chain));
else
gst_pad_set_chain_function (pad, NULL);
}
static void
-gst_basesink_set_all_pad_functions (GstBaseSink * this)
+gst_base_sink_set_all_pad_functions (GstBaseSink * this)
{
GList *l;
for (l = GST_ELEMENT_PADS (this); l; l = l->next)
- gst_basesink_set_pad_functions (this, (GstPad *) l->data);
+ gst_base_sink_set_pad_functions (this, (GstPad *) l->data);
}
static void
-gst_basesink_set_clock (GstElement * element, GstClock * clock)
+gst_base_sink_set_clock (GstElement * element, GstClock * clock)
{
GstBaseSink *sink;
}
static void
-gst_basesink_set_property (GObject * object, guint prop_id,
+gst_base_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstBaseSink *sink;
case PROP_HAS_LOOP:
GST_LOCK (sink);
sink->has_loop = g_value_get_boolean (value);
- gst_basesink_set_all_pad_functions (sink);
+ gst_base_sink_set_all_pad_functions (sink);
GST_UNLOCK (sink);
break;
case PROP_HAS_CHAIN:
GST_LOCK (sink);
sink->has_chain = g_value_get_boolean (value);
- gst_basesink_set_all_pad_functions (sink);
+ gst_base_sink_set_all_pad_functions (sink);
GST_UNLOCK (sink);
break;
case PROP_PREROLL_QUEUE_LEN:
}
static void
-gst_basesink_get_property (GObject * object, guint prop_id, GValue * value,
+gst_base_sink_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstBaseSink *sink;
/* with PREROLL_LOCK */
static GstFlowReturn
-gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
+gst_base_sink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
{
GstMiniObject *obj;
GQueue *q = basesink->preroll_queue;
if (GST_IS_BUFFER (obj)) {
GST_DEBUG ("poped buffer %p", obj);
- ret = gst_basesink_handle_buffer (basesink, GST_BUFFER (obj));
+ ret = gst_base_sink_handle_buffer (basesink, GST_BUFFER (obj));
} else {
GST_DEBUG ("poped event %p", obj);
- gst_basesink_handle_event (basesink, GST_EVENT (obj));
+ gst_base_sink_handle_event (basesink, GST_EVENT (obj));
ret = GST_FLOW_OK;
}
/* with PREROLL_LOCK */
static void
-gst_basesink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad)
+gst_base_sink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad)
{
GstMiniObject *obj;
GQueue *q = basesink->preroll_queue;
/* with STREAM_LOCK */
static GstFlowReturn
-gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad,
+gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
GstMiniObject * obj)
{
gint length;
GST_DEBUG ("no preroll needed");
/* maybe it was another sink that blocked in preroll, need to check for
buffers to drain */
- ret = gst_basesink_preroll_queue_empty (basesink, pad);
+ ret = gst_base_sink_preroll_queue_empty (basesink, pad);
GST_PREROLL_UNLOCK (pad);
return ret;
}
static gboolean
-gst_basesink_event (GstPad * pad, GstEvent * event)
+gst_base_sink_event (GstPad * pad, GstEvent * event)
{
GstBaseSink *basesink;
gboolean result = TRUE;
GST_STREAM_LOCK (pad);
/* EOS also finishes the preroll */
- ret = gst_basesink_handle_object (basesink, pad, GST_MINI_OBJECT (event));
+ ret =
+ gst_base_sink_handle_object (basesink, pad, GST_MINI_OBJECT (event));
GST_STREAM_UNLOCK (pad);
break;
}
if (basesink->clock) {
//gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value;
}
- ret = gst_basesink_handle_object (basesink, pad, GST_MINI_OBJECT (event));
+ ret =
+ gst_base_sink_handle_object (basesink, pad, GST_MINI_OBJECT (event));
GST_STREAM_UNLOCK (pad);
break;
}
/* we need preroll after the flush */
basesink->need_preroll = TRUE;
/* unlock from a possible state change/preroll */
- gst_basesink_preroll_queue_flush (basesink, pad);
+ gst_base_sink_preroll_queue_flush (basesink, pad);
GST_LOCK (basesink);
if (basesink->clock_id) {
* timestamps on a buffer, subclasses cna override
*/
static void
-gst_basesink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
+gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end)
{
GstClockTime timestamp, duration;
* 5) unref the clockid again
*/
static gboolean
-gst_basesink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
+gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
{
gboolean result = TRUE;
* 3) unref the event
*/
static inline gboolean
-gst_basesink_handle_event (GstBaseSink * basesink, GstEvent * event)
+gst_base_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
{
GstBaseSinkClass *bclass;
gboolean ret;
* 3) unref the buffer
*/
static inline GstFlowReturn
-gst_basesink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
+gst_base_sink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
{
GstBaseSinkClass *bclass;
GstFlowReturn ret;
- gst_basesink_do_sync (basesink, buf);
+ gst_base_sink_do_sync (basesink, buf);
bclass = GST_BASESINK_GET_CLASS (basesink);
if (bclass->render)
}
static GstFlowReturn
-gst_basesink_chain (GstPad * pad, GstBuffer * buf)
+gst_base_sink_chain (GstPad * pad, GstBuffer * buf)
{
GstBaseSink *basesink;
GstFlowReturn result;
basesink = GST_BASESINK (GST_OBJECT_PARENT (pad));
- result = gst_basesink_handle_object (basesink, pad, GST_MINI_OBJECT (buf));
+ result = gst_base_sink_handle_object (basesink, pad, GST_MINI_OBJECT (buf));
return result;
}
/* FIXME, not all sinks can operate in pull mode
*/
static void
-gst_basesink_loop (GstPad * pad)
+gst_base_sink_loop (GstPad * pad)
{
GstBaseSink *basesink;
GstBuffer *buf = NULL;
if (result != GST_FLOW_OK)
goto paused;
- result = gst_basesink_chain (pad, buf);
+ result = gst_base_sink_chain (pad, buf);
if (result != GST_FLOW_OK)
goto paused;
}
static gboolean
-gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad)
+gst_base_sink_deactivate (GstBaseSink * basesink, GstPad * pad)
{
gboolean result = FALSE;
GstBaseSinkClass *bclass;
/* flush out the data thread if it's locked in finish_preroll */
basesink->need_preroll = FALSE;
- gst_basesink_preroll_queue_flush (basesink, pad);
+ gst_base_sink_preroll_queue_flush (basesink, pad);
GST_PREROLL_UNLOCK (pad);
/* step 2, make sure streaming finishes */
}
static gboolean
-gst_basesink_activate_push (GstPad * pad, gboolean active)
+gst_base_sink_activate_push (GstPad * pad, gboolean active)
{
gboolean result = FALSE;
GstBaseSink *basesink;
g_return_val_if_fail (basesink->has_chain, FALSE);
result = TRUE;
} else {
- result = gst_basesink_deactivate (basesink, pad);
+ result = gst_base_sink_deactivate (basesink, pad);
}
basesink->pad_mode = GST_ACTIVATE_PUSH;
/* this won't get called until we implement an activate function */
static gboolean
-gst_basesink_activate_pull (GstPad * pad, gboolean active)
+gst_base_sink_activate_pull (GstPad * pad, gboolean active)
{
gboolean result = FALSE;
GstBaseSink *basesink;
if (active) {
/* if we have a scheduler we can start the task */
g_return_val_if_fail (basesink->has_loop, FALSE);
- result = gst_pad_start_task (pad, (GstTaskFunction) gst_basesink_loop, pad);
+ result =
+ gst_pad_start_task (pad, (GstTaskFunction) gst_base_sink_loop, pad);
} else {
- result = gst_basesink_deactivate (basesink, pad);
+ result = gst_base_sink_deactivate (basesink, pad);
}
return result;
}
static GstElementStateReturn
-gst_basesink_change_state (GstElement * element)
+gst_base_sink_change_state (GstElement * element)
{
GstElementStateReturn ret = GST_STATE_SUCCESS;
GstBaseSink *basesink = GST_BASESINK (element);
* we are pushing and syncing the buffers, better start a new
* thread to do this. */
if (basesink->eos) {
- gst_basesink_preroll_queue_empty (basesink, basesink->sinkpad);
+ gst_base_sink_preroll_queue_empty (basesink, basesink->sinkpad);
}
/* don't need the preroll anymore */
basesink->need_preroll = FALSE;
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
- * gstbasesink.h:
+ * gstbasesink.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
G_BEGIN_DECLS
-#define GST_TYPE_BASESINK (gst_basesink_get_type())
-#define GST_BASESINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASESINK,GstBaseSink))
-#define GST_BASESINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASESINK,GstBaseSinkClass))
+#define GST_TYPE_BASESINK (gst_base_sink_get_type())
+#define GST_BASESINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASESINK,GstBaseSink))
+#define GST_BASESINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASESINK,GstBaseSinkClass))
#define GST_BASESINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASESINK, GstBaseSinkClass))
-#define GST_IS_BASESINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASESINK))
-#define GST_IS_BASESINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASESINK))
+#define GST_IS_BASESINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASESINK))
+#define GST_IS_BASESINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASESINK))
#define GST_BASESINK_CLOCK(obj) (GST_BASESINK (obj)->clock)
#define GST_BASESINK_PAD(obj) (GST_BASESINK (obj)->sinkpad)
/* a base class for implementing chain based sinks
*
- * Preroll, EOS, state changes are all handled.
+ * Preroll, EOS, state changes are all handled.
*/
struct _GstBaseSink {
- GstElement element;
+ GstElement element;
- GstPad *sinkpad;
+ GstPad *sinkpad;
GstActivateMode pad_mode;
/*< protected >*/ /* with PREROLL_LOCK */
gint preroll_queue_max_len;
guint64 offset;
- gboolean has_loop;
- gboolean has_chain;
+ gboolean has_loop;
+ gboolean has_chain;
- GstClock *clock;
+ GstClock *clock;
GstClockID clock_id;
GstClockTime end_time;
-
+
gboolean eos;
gboolean need_preroll;
gboolean have_preroll;
GstCaps *caps, GstBuffer **buf);
/* get the start and end times for syncing on this buffer */
- void (*get_times) (GstBaseSink *sink, GstBuffer *buffer,
+ void (*get_times) (GstBaseSink *sink, GstBuffer *buffer,
GstClockTime *start, GstClockTime *end);
/* unlock any pending access to the resource. subclasses should unlock
GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer);
};
-GType gst_basesink_get_type(void);
+GType gst_base_sink_get_type(void);
G_END_DECLS
#define DEFAULT_BLOCKSIZE 4096
-GST_DEBUG_CATEGORY_STATIC (gst_basesrc_debug);
-#define GST_CAT_DEFAULT gst_basesrc_debug
+GST_DEBUG_CATEGORY_STATIC (gst_base_src_debug);
+#define GST_CAT_DEFAULT gst_base_src_debug
/* BaseSrc signals and args */
enum
static GstElementClass *parent_class = NULL;
-static void gst_basesrc_base_init (gpointer g_class);
-static void gst_basesrc_class_init (GstBaseSrcClass * klass);
-static void gst_basesrc_init (GstBaseSrc * src, gpointer g_class);
+static void gst_base_src_base_init (gpointer g_class);
+static void gst_base_src_class_init (GstBaseSrcClass * klass);
+static void gst_base_src_init (GstBaseSrc * src, gpointer g_class);
GType
-gst_basesrc_get_type (void)
+gst_base_src_get_type (void)
{
- static GType basesrc_type = 0;
+ static GType base_src_type = 0;
- if (!basesrc_type) {
- static const GTypeInfo basesrc_info = {
+ if (!base_src_type) {
+ static const GTypeInfo base_src_info = {
sizeof (GstBaseSrcClass),
- (GBaseInitFunc) gst_basesrc_base_init,
+ (GBaseInitFunc) gst_base_src_base_init,
NULL,
- (GClassInitFunc) gst_basesrc_class_init,
+ (GClassInitFunc) gst_base_src_class_init,
NULL,
NULL,
sizeof (GstBaseSrc),
0,
- (GInstanceInitFunc) gst_basesrc_init,
+ (GInstanceInitFunc) gst_base_src_init,
};
- basesrc_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstBaseSrc", &basesrc_info, G_TYPE_FLAG_ABSTRACT);
+ base_src_type = g_type_register_static (GST_TYPE_ELEMENT,
+ "GstBaseSrc", &base_src_info, G_TYPE_FLAG_ABSTRACT);
}
- return basesrc_type;
+ return base_src_type;
}
-static gboolean gst_basesrc_activate_push (GstPad * pad, gboolean active);
-static gboolean gst_basesrc_activate_pull (GstPad * pad, gboolean active);
-static void gst_basesrc_set_property (GObject * object, guint prop_id,
+static gboolean gst_base_src_activate_push (GstPad * pad, gboolean active);
+static gboolean gst_base_src_activate_pull (GstPad * pad, gboolean active);
+static void gst_base_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
-static void gst_basesrc_get_property (GObject * object, guint prop_id,
+static void gst_base_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static gboolean gst_basesrc_event_handler (GstPad * pad, GstEvent * event);
+static gboolean gst_base_src_event_handler (GstPad * pad, GstEvent * event);
-static gboolean gst_basesrc_query (GstPad * pad, GstQuery * query);
+static gboolean gst_base_src_query (GstPad * pad, GstQuery * query);
#if 0
-static const GstEventMask *gst_basesrc_get_event_mask (GstPad * pad);
+static const GstEventMask *gst_base_src_get_event_mask (GstPad * pad);
#endif
-static gboolean gst_basesrc_unlock (GstBaseSrc * basesrc);
-static gboolean gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size);
-static gboolean gst_basesrc_start (GstBaseSrc * basesrc);
-static gboolean gst_basesrc_stop (GstBaseSrc * basesrc);
+static gboolean gst_base_src_unlock (GstBaseSrc * basesrc);
+static gboolean gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size);
+static gboolean gst_base_src_start (GstBaseSrc * basesrc);
+static gboolean gst_base_src_stop (GstBaseSrc * basesrc);
-static GstElementStateReturn gst_basesrc_change_state (GstElement * element);
+static GstElementStateReturn gst_base_src_change_state (GstElement * element);
-static void gst_basesrc_set_dataflow_funcs (GstBaseSrc * this);
-static void gst_basesrc_loop (GstPad * pad);
-static gboolean gst_basesrc_check_get_range (GstPad * pad);
-static GstFlowReturn gst_basesrc_get_range (GstPad * pad, guint64 offset,
+static void gst_base_src_set_dataflow_funcs (GstBaseSrc * this);
+static void gst_base_src_loop (GstPad * pad);
+static gboolean gst_base_src_check_get_range (GstPad * pad);
+static GstFlowReturn gst_base_src_get_range (GstPad * pad, guint64 offset,
guint length, GstBuffer ** buf);
static void
-gst_basesrc_base_init (gpointer g_class)
+gst_base_src_base_init (gpointer g_class)
{
- GST_DEBUG_CATEGORY_INIT (gst_basesrc_debug, "basesrc", 0, "basesrc element");
+ GST_DEBUG_CATEGORY_INIT (gst_base_src_debug, "basesrc", 0, "basesrc element");
}
static void
-gst_basesrc_class_init (GstBaseSrcClass * klass)
+gst_base_src_class_init (GstBaseSrcClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_basesrc_set_property);
- gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_basesrc_get_property);
+ gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_base_src_set_property);
+ gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_base_src_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BLOCKSIZE,
g_param_spec_ulong ("blocksize", "Block size",
"True if the element should expose a getrange function", TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
- gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_basesrc_change_state);
+ gstelement_class->change_state =
+ GST_DEBUG_FUNCPTR (gst_base_src_change_state);
}
static void
-gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class)
+gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class)
{
GstPad *pad;
GstPadTemplate *pad_template;
pad = gst_pad_new_from_template (pad_template, "src");
- gst_pad_set_activatepush_function (pad, gst_basesrc_activate_push);
- gst_pad_set_activatepull_function (pad, gst_basesrc_activate_pull);
- gst_pad_set_event_function (pad, gst_basesrc_event_handler);
- gst_pad_set_query_function (pad, gst_basesrc_query);
+ gst_pad_set_activatepush_function (pad, gst_base_src_activate_push);
+ gst_pad_set_activatepull_function (pad, gst_base_src_activate_pull);
+ gst_pad_set_event_function (pad, gst_base_src_event_handler);
+ gst_pad_set_query_function (pad, gst_base_src_query);
- gst_pad_set_checkgetrange_function (pad, gst_basesrc_check_get_range);
+ gst_pad_set_checkgetrange_function (pad, gst_base_src_check_get_range);
basesrc->is_live = FALSE;
basesrc->live_lock = g_mutex_new ();
}
void
-gst_basesrc_set_live (GstBaseSrc * src, gboolean live)
+gst_base_src_set_live (GstBaseSrc * src, gboolean live)
{
GST_LIVE_LOCK (src);
src->is_live = live;
}
gboolean
-gst_basesrc_is_live (GstBaseSrc * src)
+gst_base_src_is_live (GstBaseSrc * src)
{
gboolean result;
}
static void
-gst_basesrc_set_dataflow_funcs (GstBaseSrc * this)
+gst_base_src_set_dataflow_funcs (GstBaseSrc * this)
{
GST_DEBUG ("updating dataflow functions");
if (this->has_getrange)
- gst_pad_set_getrange_function (this->srcpad, gst_basesrc_get_range);
+ gst_pad_set_getrange_function (this->srcpad, gst_base_src_get_range);
else
gst_pad_set_getrange_function (this->srcpad, NULL);
}
static gboolean
-gst_basesrc_query (GstPad * pad, GstQuery * query)
+gst_base_src_query (GstPad * pad, GstQuery * query)
{
gboolean b;
guint64 ui64;
switch (format) {
case GST_FORMAT_DEFAULT:
case GST_FORMAT_BYTES:
- b = gst_basesrc_get_size (src, &ui64);
+ b = gst_base_src_get_size (src, &ui64);
/* better to make get_size take an int64 */
i64 = b ? (gint64) ui64 : -1;
gst_query_set_position (query, GST_FORMAT_BYTES, src->offset, i64);
return TRUE;
case GST_FORMAT_PERCENT:
- b = gst_basesrc_get_size (src, &ui64);
+ b = gst_base_src_get_size (src, &ui64);
i64 = GST_FORMAT_PERCENT_MAX;
i64 *= b ? (src->offset / (gdouble) ui64) : 1.0;
gst_query_set_position (query, GST_FORMAT_PERCENT,
#if 0
static const GstEventMask *
-gst_basesrc_get_event_mask (GstPad * pad)
+gst_base_src_get_event_mask (GstPad * pad)
{
static const GstEventMask masks[] = {
{GST_EVENT_SEEK, GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_SET |
#endif
static gboolean
-gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
+gst_base_src_do_seek (GstBaseSrc * src, GstEvent * event)
{
GstFormat format;
gint64 offset;
gst_pad_push_event (src->srcpad, gst_event_new_flush (FALSE));
/* unblock streaming thread */
- gst_basesrc_unlock (src);
+ gst_base_src_unlock (src);
/* grab streaming lock */
GST_STREAM_LOCK (src->srcpad);
}
/* and restart the task */
- gst_pad_start_task (src->srcpad, (GstTaskFunction) gst_basesrc_loop,
+ gst_pad_start_task (src->srcpad, (GstTaskFunction) gst_base_src_loop,
src->srcpad);
GST_STREAM_UNLOCK (src->srcpad);
}
static gboolean
-gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
+gst_base_src_event_handler (GstPad * pad, GstEvent * event)
{
GstBaseSrc *src;
GstBaseSrcClass *bclass;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
- return gst_basesrc_do_seek (src, event);
+ return gst_base_src_do_seek (src, event);
case GST_EVENT_SIZE:
{
GstFormat format;
case GST_EVENT_FLUSH:
/* cancel any blocking getrange */
if (!GST_EVENT_FLUSH_DONE (event))
- gst_basesrc_unlock (src);
+ gst_base_src_unlock (src);
break;
default:
break;
}
static void
-gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value,
- GParamSpec * pspec)
+gst_base_src_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstBaseSrc *src;
break;
case PROP_HAS_LOOP:
src->has_loop = g_value_get_boolean (value);
- gst_basesrc_set_dataflow_funcs (src);
+ gst_base_src_set_dataflow_funcs (src);
break;
case PROP_HAS_GETRANGE:
src->has_getrange = g_value_get_boolean (value);
- gst_basesrc_set_dataflow_funcs (src);
+ gst_base_src_set_dataflow_funcs (src);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
static void
-gst_basesrc_get_property (GObject * object, guint prop_id, GValue * value,
+gst_base_src_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstBaseSrc *src;
}
static GstFlowReturn
-gst_basesrc_get_range (GstPad * pad, guint64 offset, guint length,
+gst_base_src_get_range (GstPad * pad, guint64 offset, guint length,
GstBuffer ** buf)
{
GstFlowReturn ret;
}
static gboolean
-gst_basesrc_check_get_range (GstPad * pad)
+gst_base_src_check_get_range (GstPad * pad)
{
GstBaseSrc *src;
src = GST_BASESRC (GST_OBJECT_PARENT (pad));
if (!GST_FLAG_IS_SET (src, GST_BASESRC_STARTED)) {
- gst_basesrc_start (src);
- gst_basesrc_stop (src);
+ gst_base_src_start (src);
+ gst_base_src_stop (src);
}
return src->seekable;
}
static void
-gst_basesrc_loop (GstPad * pad)
+gst_base_src_loop (GstPad * pad)
{
GstBaseSrc *src;
GstBuffer *buf = NULL;
src = GST_BASESRC (GST_OBJECT_PARENT (pad));
- ret = gst_basesrc_get_range (pad, src->offset, src->blocksize, &buf);
+ ret = gst_base_src_get_range (pad, src->offset, src->blocksize, &buf);
if (ret != GST_FLOW_OK)
goto eos;
}
static gboolean
-gst_basesrc_unlock (GstBaseSrc * basesrc)
+gst_base_src_unlock (GstBaseSrc * basesrc)
{
GstBaseSrcClass *bclass;
gboolean result = FALSE;
}
static gboolean
-gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size)
+gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size)
{
GstBaseSrcClass *bclass;
gboolean result = FALSE;
}
static gboolean
-gst_basesrc_is_seekable (GstBaseSrc * basesrc)
+gst_base_src_is_seekable (GstBaseSrc * basesrc)
{
GstBaseSrcClass *bclass;
}
static gboolean
-gst_basesrc_start (GstBaseSrc * basesrc)
+gst_base_src_start (GstBaseSrc * basesrc)
{
GstBaseSrcClass *bclass;
gboolean result;
basesrc->segment_end = -1;
/* check if we can seek, updates ->seekable */
- gst_basesrc_is_seekable (basesrc);
+ gst_base_src_is_seekable (basesrc);
/* run typefind */
#if 0
}
static gboolean
-gst_basesrc_stop (GstBaseSrc * basesrc)
+gst_base_src_stop (GstBaseSrc * basesrc)
{
GstBaseSrcClass *bclass;
gboolean result = TRUE;
}
static gboolean
-gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
+gst_base_src_deactivate (GstBaseSrc * basesrc, GstPad * pad)
{
gboolean result;
GST_LIVE_UNLOCK (basesrc);
/* step 1, unblock clock sync (if any) */
- gst_basesrc_unlock (basesrc);
+ gst_base_src_unlock (basesrc);
/* step 2, make sure streaming finishes */
result = gst_pad_stop_task (pad);
}
static gboolean
-gst_basesrc_activate_push (GstPad * pad, gboolean active)
+gst_base_src_activate_push (GstPad * pad, gboolean active)
{
GstBaseSrc *basesrc;
/* prepare subclass first */
if (active) {
- if (!gst_basesrc_start (basesrc))
+ if (!gst_base_src_start (basesrc))
goto error_start;
- return gst_pad_start_task (pad, (GstTaskFunction) gst_basesrc_loop, pad);
+ return gst_pad_start_task (pad, (GstTaskFunction) gst_base_src_loop, pad);
} else {
- return gst_basesrc_deactivate (basesrc, pad);
+ return gst_base_src_deactivate (basesrc, pad);
}
error_start:
}
static gboolean
-gst_basesrc_activate_pull (GstPad * pad, gboolean active)
+gst_base_src_activate_pull (GstPad * pad, gboolean active)
{
GstBaseSrc *basesrc;
/* prepare subclass first */
if (active) {
- if (!gst_basesrc_start (basesrc))
+ if (!gst_base_src_start (basesrc))
goto error_start;
if (!basesrc->seekable) {
- gst_basesrc_stop (basesrc);
+ gst_base_src_stop (basesrc);
return FALSE;
}
return TRUE;
} else {
- return gst_basesrc_deactivate (basesrc, pad);
+ return gst_base_src_deactivate (basesrc, pad);
}
error_start:
}
static GstElementStateReturn
-gst_basesrc_change_state (GstElement * element)
+gst_base_src_change_state (GstElement * element)
{
GstBaseSrc *basesrc;
GstElementStateReturn result = GST_STATE_SUCCESS;
GST_LIVE_UNLOCK (element);
break;
case GST_STATE_PAUSED_TO_READY:
- if (!gst_basesrc_stop (basesrc))
+ if (!gst_base_src_stop (basesrc))
result = GST_STATE_FAILURE;
break;
case GST_STATE_READY_TO_NULL:
G_BEGIN_DECLS
-#define GST_TYPE_BASESRC (gst_basesrc_get_type())
+#define GST_TYPE_BASESRC (gst_base_src_get_type())
#define GST_BASESRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASESRC,GstBaseSrc))
#define GST_BASESRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASESRC,GstBaseSrcClass))
#define GST_BASESRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASESRC, GstBaseSrcClass))
GstBuffer **buf);
};
-GType gst_basesrc_get_type(void);
+GType gst_base_src_get_type(void);
-void gst_basesrc_set_live (GstBaseSrc *src, gboolean live);
-gboolean gst_basesrc_is_live (GstBaseSrc *src);
+void gst_base_src_set_live (GstBaseSrc *src, gboolean live);
+gboolean gst_base_src_is_live (GstBaseSrc *src);
G_END_DECLS