did s/bases(rc/ink)_/base_s(rc/ink)_/; wim wants to remove base completely, but that's for later

Original commit message from CVS:
did s/bases(rc/ink)_/base_s(rc/ink)_/; wim wants to remove base completely, but that's for later
This commit is contained in:
Thomas Vander Stichele 2005-06-28 12:01:49 +00:00
parent 7c157ea543
commit f0e5bb0a33
8 changed files with 390 additions and 382 deletions

View file

@ -26,8 +26,8 @@
#include "gstbasesink.h" #include "gstbasesink.h"
#include <gst/gstmarshal.h> #include <gst/gstmarshal.h>
GST_DEBUG_CATEGORY_STATIC (gst_basesink_debug); GST_DEBUG_CATEGORY_STATIC (gst_base_sink_debug);
#define GST_CAT_DEFAULT gst_basesink_debug #define GST_CAT_DEFAULT gst_base_sink_debug
/* BaseSink signals and properties */ /* BaseSink signals and properties */
enum enum
@ -52,71 +52,71 @@ enum
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
static void gst_basesink_base_init (gpointer g_class); static void gst_base_sink_base_init (gpointer g_class);
static void gst_basesink_class_init (GstBaseSinkClass * klass); static void gst_base_sink_class_init (GstBaseSinkClass * klass);
static void gst_basesink_init (GstBaseSink * trans, gpointer g_class); static void gst_base_sink_init (GstBaseSink * trans, gpointer g_class);
static void gst_basesink_finalize (GObject * object); static void gst_base_sink_finalize (GObject * object);
GType 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) { if (!base_sink_type) {
static const GTypeInfo basesink_info = { static const GTypeInfo base_sink_info = {
sizeof (GstBaseSinkClass), sizeof (GstBaseSinkClass),
(GBaseInitFunc) gst_basesink_base_init, (GBaseInitFunc) gst_base_sink_base_init,
NULL, NULL,
(GClassInitFunc) gst_basesink_class_init, (GClassInitFunc) gst_base_sink_class_init,
NULL, NULL,
NULL, NULL,
sizeof (GstBaseSink), sizeof (GstBaseSink),
0, 0,
(GInstanceInitFunc) gst_basesink_init, (GInstanceInitFunc) gst_base_sink_init,
}; };
basesink_type = g_type_register_static (GST_TYPE_ELEMENT, base_sink_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstBaseSink", &basesink_info, G_TYPE_FLAG_ABSTRACT); "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); 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); GValue * value, GParamSpec * pspec);
static GstCaps *gst_base_sink_get_caps (GstBaseSink * sink); static GstCaps *gst_base_sink_get_caps (GstBaseSink * sink);
static gboolean gst_base_sink_set_caps (GstBaseSink * sink, GstCaps * caps); static gboolean gst_base_sink_set_caps (GstBaseSink * sink, GstCaps * caps);
static GstFlowReturn gst_base_sink_buffer_alloc (GstBaseSink * sink, static GstFlowReturn gst_base_sink_buffer_alloc (GstBaseSink * sink,
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); 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); 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 GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer);
static void gst_basesink_loop (GstPad * pad); static void gst_base_sink_loop (GstPad * pad);
static GstFlowReturn gst_basesink_chain (GstPad * pad, GstBuffer * buffer); static GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_basesink_activate_push (GstPad * pad, gboolean active); static gboolean gst_base_sink_activate_push (GstPad * pad, gboolean active);
static gboolean gst_basesink_activate_pull (GstPad * pad, gboolean active); static gboolean gst_base_sink_activate_pull (GstPad * pad, gboolean active);
static gboolean gst_basesink_event (GstPad * pad, GstEvent * event); static gboolean gst_base_sink_event (GstPad * pad, GstEvent * event);
static inline GstFlowReturn gst_basesink_handle_buffer (GstBaseSink * basesink, static inline GstFlowReturn gst_base_sink_handle_buffer (GstBaseSink * basesink,
GstBuffer * buf); GstBuffer * buf);
static inline gboolean gst_basesink_handle_event (GstBaseSink * basesink, static inline gboolean gst_base_sink_handle_event (GstBaseSink * basesink,
GstEvent * event); GstEvent * event);
static void 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"); "basesink element");
} }
static void static void
gst_basesink_class_init (GstBaseSinkClass * klass) gst_base_sink_class_init (GstBaseSinkClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
@ -126,9 +126,9 @@ gst_basesink_class_init (GstBaseSinkClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT); parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_basesink_finalize); gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_base_sink_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_basesink_set_property); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_base_sink_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_basesink_get_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_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_LOOP,
g_param_spec_boolean ("has-loop", "has-loop", g_param_spec_boolean ("has-loop", "has-loop",
@ -146,18 +146,18 @@ gst_basesink_class_init (GstBaseSinkClass * klass)
"Number of buffers to queue during preroll", 0, G_MAXUINT, 0, "Number of buffers to queue during preroll", 0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); 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 = 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->get_caps = GST_DEBUG_FUNCPTR (gst_base_sink_get_caps);
klass->set_caps = GST_DEBUG_FUNCPTR (gst_base_sink_set_caps); klass->set_caps = GST_DEBUG_FUNCPTR (gst_base_sink_set_caps);
klass->buffer_alloc = GST_DEBUG_FUNCPTR (gst_base_sink_buffer_alloc); 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 * static GstCaps *
gst_basesink_pad_getcaps (GstPad * pad) gst_base_sink_pad_getcaps (GstPad * pad)
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
GstBaseSink *bsink; GstBaseSink *bsink;
@ -182,7 +182,7 @@ gst_basesink_pad_getcaps (GstPad * pad)
} }
static gboolean static gboolean
gst_basesink_pad_setcaps (GstPad * pad, GstCaps * caps) gst_base_sink_pad_setcaps (GstPad * pad, GstCaps * caps)
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
GstBaseSink *bsink; GstBaseSink *bsink;
@ -198,7 +198,7 @@ gst_basesink_pad_setcaps (GstPad * pad, GstCaps * caps)
} }
static GstFlowReturn 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) GstCaps * caps, GstBuffer ** buf)
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
@ -217,7 +217,7 @@ gst_basesink_pad_buffer_alloc (GstPad * pad, guint64 offset, guint size,
} }
static void static void
gst_basesink_init (GstBaseSink * basesink, gpointer g_class) gst_base_sink_init (GstBaseSink * basesink, gpointer g_class)
{ {
GstPadTemplate *pad_template; GstPadTemplate *pad_template;
@ -228,11 +228,11 @@ gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
basesink->sinkpad = gst_pad_new_from_template (pad_template, "sink"); basesink->sinkpad = gst_pad_new_from_template (pad_template, "sink");
gst_pad_set_getcaps_function (basesink->sinkpad, 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_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_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); gst_element_add_pad (GST_ELEMENT (basesink), basesink->sinkpad);
basesink->pad_mode = GST_ACTIVATE_NONE; basesink->pad_mode = GST_ACTIVATE_NONE;
@ -243,7 +243,7 @@ gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
} }
static void static void
gst_basesink_finalize (GObject * object) gst_base_sink_finalize (GObject * object)
{ {
GstBaseSink *basesink; GstBaseSink *basesink;
@ -255,31 +255,31 @@ gst_basesink_finalize (GObject * object)
} }
static void 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_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_pad_set_activatepull_function (pad,
GST_DEBUG_FUNCPTR (gst_basesink_activate_pull)); GST_DEBUG_FUNCPTR (gst_base_sink_activate_pull));
gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_basesink_event)); gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_base_sink_event));
if (this->has_chain) 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 else
gst_pad_set_chain_function (pad, NULL); gst_pad_set_chain_function (pad, NULL);
} }
static void static void
gst_basesink_set_all_pad_functions (GstBaseSink * this) gst_base_sink_set_all_pad_functions (GstBaseSink * this)
{ {
GList *l; GList *l;
for (l = GST_ELEMENT_PADS (this); l; l = l->next) 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 static void
gst_basesink_set_clock (GstElement * element, GstClock * clock) gst_base_sink_set_clock (GstElement * element, GstClock * clock)
{ {
GstBaseSink *sink; GstBaseSink *sink;
@ -289,7 +289,7 @@ gst_basesink_set_clock (GstElement * element, GstClock * clock)
} }
static void 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) const GValue * value, GParamSpec * pspec)
{ {
GstBaseSink *sink; GstBaseSink *sink;
@ -300,13 +300,13 @@ gst_basesink_set_property (GObject * object, guint prop_id,
case PROP_HAS_LOOP: case PROP_HAS_LOOP:
GST_LOCK (sink); GST_LOCK (sink);
sink->has_loop = g_value_get_boolean (value); 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); GST_UNLOCK (sink);
break; break;
case PROP_HAS_CHAIN: case PROP_HAS_CHAIN:
GST_LOCK (sink); GST_LOCK (sink);
sink->has_chain = g_value_get_boolean (value); 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); GST_UNLOCK (sink);
break; break;
case PROP_PREROLL_QUEUE_LEN: case PROP_PREROLL_QUEUE_LEN:
@ -322,7 +322,7 @@ gst_basesink_set_property (GObject * object, guint prop_id,
} }
static void 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) GParamSpec * pspec)
{ {
GstBaseSink *sink; GstBaseSink *sink;
@ -369,7 +369,7 @@ gst_base_sink_buffer_alloc (GstBaseSink * sink, guint64 offset, guint size,
/* with PREROLL_LOCK */ /* with PREROLL_LOCK */
static GstFlowReturn static GstFlowReturn
gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad) gst_base_sink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
{ {
GstMiniObject *obj; GstMiniObject *obj;
GQueue *q = basesink->preroll_queue; GQueue *q = basesink->preroll_queue;
@ -387,10 +387,10 @@ gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
if (GST_IS_BUFFER (obj)) { if (GST_IS_BUFFER (obj)) {
GST_DEBUG ("poped buffer %p", 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 { } else {
GST_DEBUG ("poped event %p", obj); 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; ret = GST_FLOW_OK;
} }
@ -403,7 +403,7 @@ gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
/* with PREROLL_LOCK */ /* with PREROLL_LOCK */
static void static void
gst_basesink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad) gst_base_sink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad)
{ {
GstMiniObject *obj; GstMiniObject *obj;
GQueue *q = basesink->preroll_queue; GQueue *q = basesink->preroll_queue;
@ -423,7 +423,7 @@ gst_basesink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad)
/* with STREAM_LOCK */ /* with STREAM_LOCK */
static GstFlowReturn static GstFlowReturn
gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad, gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
GstMiniObject * obj) GstMiniObject * obj)
{ {
gint length; gint length;
@ -525,7 +525,7 @@ no_preroll:
GST_DEBUG ("no preroll needed"); GST_DEBUG ("no preroll needed");
/* maybe it was another sink that blocked in preroll, need to check for /* maybe it was another sink that blocked in preroll, need to check for
buffers to drain */ buffers to drain */
ret = gst_basesink_preroll_queue_empty (basesink, pad); ret = gst_base_sink_preroll_queue_empty (basesink, pad);
GST_PREROLL_UNLOCK (pad); GST_PREROLL_UNLOCK (pad);
return ret; return ret;
@ -539,7 +539,7 @@ flushing:
} }
static gboolean static gboolean
gst_basesink_event (GstPad * pad, GstEvent * event) gst_base_sink_event (GstPad * pad, GstEvent * event)
{ {
GstBaseSink *basesink; GstBaseSink *basesink;
gboolean result = TRUE; gboolean result = TRUE;
@ -558,7 +558,8 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
GST_STREAM_LOCK (pad); GST_STREAM_LOCK (pad);
/* EOS also finishes the preroll */ /* 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); GST_STREAM_UNLOCK (pad);
break; break;
} }
@ -570,7 +571,8 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
if (basesink->clock) { if (basesink->clock) {
//gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value; //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); GST_STREAM_UNLOCK (pad);
break; break;
} }
@ -585,7 +587,7 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
/* we need preroll after the flush */ /* we need preroll after the flush */
basesink->need_preroll = TRUE; basesink->need_preroll = TRUE;
/* unlock from a possible state change/preroll */ /* 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); GST_LOCK (basesink);
if (basesink->clock_id) { if (basesink->clock_id) {
@ -621,7 +623,7 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
* timestamps on a buffer, subclasses cna override * timestamps on a buffer, subclasses cna override
*/ */
static void static void
gst_basesink_get_times (GstBaseSink * basesink, GstBuffer * buffer, gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end) GstClockTime * start, GstClockTime * end)
{ {
GstClockTime timestamp, duration; GstClockTime timestamp, duration;
@ -646,7 +648,7 @@ gst_basesink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
* 5) unref the clockid again * 5) unref the clockid again
*/ */
static gboolean static gboolean
gst_basesink_do_sync (GstBaseSink * basesink, GstBuffer * buffer) gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
{ {
gboolean result = TRUE; gboolean result = TRUE;
@ -696,7 +698,7 @@ gst_basesink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
* 3) unref the event * 3) unref the event
*/ */
static inline gboolean static inline gboolean
gst_basesink_handle_event (GstBaseSink * basesink, GstEvent * event) gst_base_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
gboolean ret; gboolean ret;
@ -761,12 +763,12 @@ gst_basesink_handle_event (GstBaseSink * basesink, GstEvent * event)
* 3) unref the buffer * 3) unref the buffer
*/ */
static inline GstFlowReturn static inline GstFlowReturn
gst_basesink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf) gst_base_sink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
GstFlowReturn ret; GstFlowReturn ret;
gst_basesink_do_sync (basesink, buf); gst_base_sink_do_sync (basesink, buf);
bclass = GST_BASESINK_GET_CLASS (basesink); bclass = GST_BASESINK_GET_CLASS (basesink);
if (bclass->render) if (bclass->render)
@ -781,14 +783,14 @@ gst_basesink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
} }
static GstFlowReturn static GstFlowReturn
gst_basesink_chain (GstPad * pad, GstBuffer * buf) gst_base_sink_chain (GstPad * pad, GstBuffer * buf)
{ {
GstBaseSink *basesink; GstBaseSink *basesink;
GstFlowReturn result; GstFlowReturn result;
basesink = GST_BASESINK (GST_OBJECT_PARENT (pad)); 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; return result;
} }
@ -796,7 +798,7 @@ gst_basesink_chain (GstPad * pad, GstBuffer * buf)
/* FIXME, not all sinks can operate in pull mode /* FIXME, not all sinks can operate in pull mode
*/ */
static void static void
gst_basesink_loop (GstPad * pad) gst_base_sink_loop (GstPad * pad)
{ {
GstBaseSink *basesink; GstBaseSink *basesink;
GstBuffer *buf = NULL; GstBuffer *buf = NULL;
@ -810,7 +812,7 @@ gst_basesink_loop (GstPad * pad)
if (result != GST_FLOW_OK) if (result != GST_FLOW_OK)
goto paused; goto paused;
result = gst_basesink_chain (pad, buf); result = gst_base_sink_chain (pad, buf);
if (result != GST_FLOW_OK) if (result != GST_FLOW_OK)
goto paused; goto paused;
@ -823,7 +825,7 @@ paused:
} }
static gboolean static gboolean
gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad) gst_base_sink_deactivate (GstBaseSink * basesink, GstPad * pad)
{ {
gboolean result = FALSE; gboolean result = FALSE;
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
@ -844,7 +846,7 @@ gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad)
/* flush out the data thread if it's locked in finish_preroll */ /* flush out the data thread if it's locked in finish_preroll */
basesink->need_preroll = FALSE; basesink->need_preroll = FALSE;
gst_basesink_preroll_queue_flush (basesink, pad); gst_base_sink_preroll_queue_flush (basesink, pad);
GST_PREROLL_UNLOCK (pad); GST_PREROLL_UNLOCK (pad);
/* step 2, make sure streaming finishes */ /* step 2, make sure streaming finishes */
@ -854,7 +856,7 @@ gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad)
} }
static gboolean static gboolean
gst_basesink_activate_push (GstPad * pad, gboolean active) gst_base_sink_activate_push (GstPad * pad, gboolean active)
{ {
gboolean result = FALSE; gboolean result = FALSE;
GstBaseSink *basesink; GstBaseSink *basesink;
@ -865,7 +867,7 @@ gst_basesink_activate_push (GstPad * pad, gboolean active)
g_return_val_if_fail (basesink->has_chain, FALSE); g_return_val_if_fail (basesink->has_chain, FALSE);
result = TRUE; result = TRUE;
} else { } else {
result = gst_basesink_deactivate (basesink, pad); result = gst_base_sink_deactivate (basesink, pad);
} }
basesink->pad_mode = GST_ACTIVATE_PUSH; basesink->pad_mode = GST_ACTIVATE_PUSH;
@ -874,7 +876,7 @@ gst_basesink_activate_push (GstPad * pad, gboolean active)
/* this won't get called until we implement an activate function */ /* this won't get called until we implement an activate function */
static gboolean static gboolean
gst_basesink_activate_pull (GstPad * pad, gboolean active) gst_base_sink_activate_pull (GstPad * pad, gboolean active)
{ {
gboolean result = FALSE; gboolean result = FALSE;
GstBaseSink *basesink; GstBaseSink *basesink;
@ -884,16 +886,17 @@ gst_basesink_activate_pull (GstPad * pad, gboolean active)
if (active) { if (active) {
/* if we have a scheduler we can start the task */ /* if we have a scheduler we can start the task */
g_return_val_if_fail (basesink->has_loop, FALSE); 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 { } else {
result = gst_basesink_deactivate (basesink, pad); result = gst_base_sink_deactivate (basesink, pad);
} }
return result; return result;
} }
static GstElementStateReturn static GstElementStateReturn
gst_basesink_change_state (GstElement * element) gst_base_sink_change_state (GstElement * element)
{ {
GstElementStateReturn ret = GST_STATE_SUCCESS; GstElementStateReturn ret = GST_STATE_SUCCESS;
GstBaseSink *basesink = GST_BASESINK (element); GstBaseSink *basesink = GST_BASESINK (element);
@ -921,7 +924,7 @@ gst_basesink_change_state (GstElement * element)
* we are pushing and syncing the buffers, better start a new * we are pushing and syncing the buffers, better start a new
* thread to do this. */ * thread to do this. */
if (basesink->eos) { 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 */ /* don't need the preroll anymore */
basesink->need_preroll = FALSE; basesink->need_preroll = FALSE;

View file

@ -28,7 +28,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_BASESINK (gst_basesink_get_type()) #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(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_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_BASESINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASESINK, GstBaseSinkClass))
@ -94,7 +94,7 @@ struct _GstBaseSinkClass {
GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer); GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer);
}; };
GType gst_basesink_get_type(void); GType gst_base_sink_get_type(void);
G_END_DECLS G_END_DECLS

View file

@ -34,8 +34,8 @@
#define DEFAULT_BLOCKSIZE 4096 #define DEFAULT_BLOCKSIZE 4096
GST_DEBUG_CATEGORY_STATIC (gst_basesrc_debug); GST_DEBUG_CATEGORY_STATIC (gst_base_src_debug);
#define GST_CAT_DEFAULT gst_basesrc_debug #define GST_CAT_DEFAULT gst_base_src_debug
/* BaseSrc signals and args */ /* BaseSrc signals and args */
enum enum
@ -54,69 +54,69 @@ enum
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
static void gst_basesrc_base_init (gpointer g_class); static void gst_base_src_base_init (gpointer g_class);
static void gst_basesrc_class_init (GstBaseSrcClass * klass); static void gst_base_src_class_init (GstBaseSrcClass * klass);
static void gst_basesrc_init (GstBaseSrc * src, gpointer g_class); static void gst_base_src_init (GstBaseSrc * src, gpointer g_class);
GType 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) { if (!base_src_type) {
static const GTypeInfo basesrc_info = { static const GTypeInfo base_src_info = {
sizeof (GstBaseSrcClass), sizeof (GstBaseSrcClass),
(GBaseInitFunc) gst_basesrc_base_init, (GBaseInitFunc) gst_base_src_base_init,
NULL, NULL,
(GClassInitFunc) gst_basesrc_class_init, (GClassInitFunc) gst_base_src_class_init,
NULL, NULL,
NULL, NULL,
sizeof (GstBaseSrc), sizeof (GstBaseSrc),
0, 0,
(GInstanceInitFunc) gst_basesrc_init, (GInstanceInitFunc) gst_base_src_init,
}; };
basesrc_type = g_type_register_static (GST_TYPE_ELEMENT, base_src_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstBaseSrc", &basesrc_info, G_TYPE_FLAG_ABSTRACT); "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_base_src_activate_push (GstPad * pad, gboolean active);
static gboolean gst_basesrc_activate_pull (GstPad * pad, gboolean active); static gboolean gst_base_src_activate_pull (GstPad * pad, gboolean active);
static void gst_basesrc_set_property (GObject * object, guint prop_id, static void gst_base_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); 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); 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 #if 0
static const GstEventMask *gst_basesrc_get_event_mask (GstPad * pad); static const GstEventMask *gst_base_src_get_event_mask (GstPad * pad);
#endif #endif
static gboolean gst_basesrc_unlock (GstBaseSrc * basesrc); static gboolean gst_base_src_unlock (GstBaseSrc * basesrc);
static gboolean gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size); static gboolean gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size);
static gboolean gst_basesrc_start (GstBaseSrc * basesrc); static gboolean gst_base_src_start (GstBaseSrc * basesrc);
static gboolean gst_basesrc_stop (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_base_src_set_dataflow_funcs (GstBaseSrc * this);
static void gst_basesrc_loop (GstPad * pad); static void gst_base_src_loop (GstPad * pad);
static gboolean gst_basesrc_check_get_range (GstPad * pad); static gboolean gst_base_src_check_get_range (GstPad * pad);
static GstFlowReturn gst_basesrc_get_range (GstPad * pad, guint64 offset, static GstFlowReturn gst_base_src_get_range (GstPad * pad, guint64 offset,
guint length, GstBuffer ** buf); guint length, GstBuffer ** buf);
static void 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 static void
gst_basesrc_class_init (GstBaseSrcClass * klass) gst_base_src_class_init (GstBaseSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
@ -126,8 +126,8 @@ gst_basesrc_class_init (GstBaseSrcClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT); parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_basesrc_set_property); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_base_src_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_basesrc_get_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_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BLOCKSIZE,
g_param_spec_ulong ("blocksize", "Block size", g_param_spec_ulong ("blocksize", "Block size",
@ -144,11 +144,12 @@ gst_basesrc_class_init (GstBaseSrcClass * klass)
"True if the element should expose a getrange function", TRUE, "True if the element should expose a getrange function", TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); 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 static void
gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class) gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class)
{ {
GstPad *pad; GstPad *pad;
GstPadTemplate *pad_template; GstPadTemplate *pad_template;
@ -159,12 +160,12 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class)
pad = gst_pad_new_from_template (pad_template, "src"); pad = gst_pad_new_from_template (pad_template, "src");
gst_pad_set_activatepush_function (pad, gst_basesrc_activate_push); gst_pad_set_activatepush_function (pad, gst_base_src_activate_push);
gst_pad_set_activatepull_function (pad, gst_basesrc_activate_pull); gst_pad_set_activatepull_function (pad, gst_base_src_activate_pull);
gst_pad_set_event_function (pad, gst_basesrc_event_handler); gst_pad_set_event_function (pad, gst_base_src_event_handler);
gst_pad_set_query_function (pad, gst_basesrc_query); 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->is_live = FALSE;
basesrc->live_lock = g_mutex_new (); basesrc->live_lock = g_mutex_new ();
@ -183,7 +184,7 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class)
} }
void void
gst_basesrc_set_live (GstBaseSrc * src, gboolean live) gst_base_src_set_live (GstBaseSrc * src, gboolean live)
{ {
GST_LIVE_LOCK (src); GST_LIVE_LOCK (src);
src->is_live = live; src->is_live = live;
@ -191,7 +192,7 @@ gst_basesrc_set_live (GstBaseSrc * src, gboolean live)
} }
gboolean gboolean
gst_basesrc_is_live (GstBaseSrc * src) gst_base_src_is_live (GstBaseSrc * src)
{ {
gboolean result; gboolean result;
@ -203,18 +204,18 @@ gst_basesrc_is_live (GstBaseSrc * src)
} }
static void static void
gst_basesrc_set_dataflow_funcs (GstBaseSrc * this) gst_base_src_set_dataflow_funcs (GstBaseSrc * this)
{ {
GST_DEBUG ("updating dataflow functions"); GST_DEBUG ("updating dataflow functions");
if (this->has_getrange) 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 else
gst_pad_set_getrange_function (this->srcpad, NULL); gst_pad_set_getrange_function (this->srcpad, NULL);
} }
static gboolean static gboolean
gst_basesrc_query (GstPad * pad, GstQuery * query) gst_base_src_query (GstPad * pad, GstQuery * query)
{ {
gboolean b; gboolean b;
guint64 ui64; guint64 ui64;
@ -232,13 +233,13 @@ gst_basesrc_query (GstPad * pad, GstQuery * query)
switch (format) { switch (format) {
case GST_FORMAT_DEFAULT: case GST_FORMAT_DEFAULT:
case GST_FORMAT_BYTES: 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 */ /* better to make get_size take an int64 */
i64 = b ? (gint64) ui64 : -1; i64 = b ? (gint64) ui64 : -1;
gst_query_set_position (query, GST_FORMAT_BYTES, src->offset, i64); gst_query_set_position (query, GST_FORMAT_BYTES, src->offset, i64);
return TRUE; return TRUE;
case GST_FORMAT_PERCENT: 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 = GST_FORMAT_PERCENT_MAX;
i64 *= b ? (src->offset / (gdouble) ui64) : 1.0; i64 *= b ? (src->offset / (gdouble) ui64) : 1.0;
gst_query_set_position (query, GST_FORMAT_PERCENT, gst_query_set_position (query, GST_FORMAT_PERCENT,
@ -270,7 +271,7 @@ gst_basesrc_query (GstPad * pad, GstQuery * query)
#if 0 #if 0
static const GstEventMask * static const GstEventMask *
gst_basesrc_get_event_mask (GstPad * pad) gst_base_src_get_event_mask (GstPad * pad)
{ {
static const GstEventMask masks[] = { static const GstEventMask masks[] = {
{GST_EVENT_SEEK, GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_SET | {GST_EVENT_SEEK, GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_SET |
@ -285,7 +286,7 @@ gst_basesrc_get_event_mask (GstPad * pad)
#endif #endif
static gboolean static gboolean
gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event) gst_base_src_do_seek (GstBaseSrc * src, GstEvent * event)
{ {
GstFormat format; GstFormat format;
gint64 offset; gint64 offset;
@ -339,7 +340,7 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
gst_pad_push_event (src->srcpad, gst_event_new_flush (FALSE)); gst_pad_push_event (src->srcpad, gst_event_new_flush (FALSE));
/* unblock streaming thread */ /* unblock streaming thread */
gst_basesrc_unlock (src); gst_base_src_unlock (src);
/* grab streaming lock */ /* grab streaming lock */
GST_STREAM_LOCK (src->srcpad); GST_STREAM_LOCK (src->srcpad);
@ -359,7 +360,7 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
} }
/* and restart the task */ /* 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); src->srcpad);
GST_STREAM_UNLOCK (src->srcpad); GST_STREAM_UNLOCK (src->srcpad);
@ -377,7 +378,7 @@ error:
} }
static gboolean static gboolean
gst_basesrc_event_handler (GstPad * pad, GstEvent * event) gst_base_src_event_handler (GstPad * pad, GstEvent * event)
{ {
GstBaseSrc *src; GstBaseSrc *src;
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
@ -391,7 +392,7 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK: case GST_EVENT_SEEK:
return gst_basesrc_do_seek (src, event); return gst_base_src_do_seek (src, event);
case GST_EVENT_SIZE: case GST_EVENT_SIZE:
{ {
GstFormat format; GstFormat format;
@ -410,7 +411,7 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
case GST_EVENT_FLUSH: case GST_EVENT_FLUSH:
/* cancel any blocking getrange */ /* cancel any blocking getrange */
if (!GST_EVENT_FLUSH_DONE (event)) if (!GST_EVENT_FLUSH_DONE (event))
gst_basesrc_unlock (src); gst_base_src_unlock (src);
break; break;
default: default:
break; break;
@ -421,8 +422,8 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
} }
static void static void
gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value, gst_base_src_set_property (GObject * object, guint prop_id,
GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
GstBaseSrc *src; GstBaseSrc *src;
@ -434,11 +435,11 @@ gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value,
break; break;
case PROP_HAS_LOOP: case PROP_HAS_LOOP:
src->has_loop = g_value_get_boolean (value); src->has_loop = g_value_get_boolean (value);
gst_basesrc_set_dataflow_funcs (src); gst_base_src_set_dataflow_funcs (src);
break; break;
case PROP_HAS_GETRANGE: case PROP_HAS_GETRANGE:
src->has_getrange = g_value_get_boolean (value); src->has_getrange = g_value_get_boolean (value);
gst_basesrc_set_dataflow_funcs (src); gst_base_src_set_dataflow_funcs (src);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -447,7 +448,7 @@ gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value,
} }
static void 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) GParamSpec * pspec)
{ {
GstBaseSrc *src; GstBaseSrc *src;
@ -471,7 +472,7 @@ gst_basesrc_get_property (GObject * object, guint prop_id, GValue * value,
} }
static GstFlowReturn 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) GstBuffer ** buf)
{ {
GstFlowReturn ret; GstFlowReturn ret;
@ -537,22 +538,22 @@ unexpected_length:
} }
static gboolean static gboolean
gst_basesrc_check_get_range (GstPad * pad) gst_base_src_check_get_range (GstPad * pad)
{ {
GstBaseSrc *src; GstBaseSrc *src;
src = GST_BASESRC (GST_OBJECT_PARENT (pad)); src = GST_BASESRC (GST_OBJECT_PARENT (pad));
if (!GST_FLAG_IS_SET (src, GST_BASESRC_STARTED)) { if (!GST_FLAG_IS_SET (src, GST_BASESRC_STARTED)) {
gst_basesrc_start (src); gst_base_src_start (src);
gst_basesrc_stop (src); gst_base_src_stop (src);
} }
return src->seekable; return src->seekable;
} }
static void static void
gst_basesrc_loop (GstPad * pad) gst_base_src_loop (GstPad * pad)
{ {
GstBaseSrc *src; GstBaseSrc *src;
GstBuffer *buf = NULL; GstBuffer *buf = NULL;
@ -560,7 +561,7 @@ gst_basesrc_loop (GstPad * pad)
src = GST_BASESRC (GST_OBJECT_PARENT (pad)); 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) if (ret != GST_FLOW_OK)
goto eos; goto eos;
@ -588,7 +589,7 @@ pause:
} }
static gboolean static gboolean
gst_basesrc_unlock (GstBaseSrc * basesrc) gst_base_src_unlock (GstBaseSrc * basesrc)
{ {
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
gboolean result = FALSE; gboolean result = FALSE;
@ -613,7 +614,7 @@ gst_basesrc_unlock (GstBaseSrc * basesrc)
} }
static gboolean static gboolean
gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size) gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size)
{ {
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
gboolean result = FALSE; gboolean result = FALSE;
@ -629,7 +630,7 @@ gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size)
} }
static gboolean static gboolean
gst_basesrc_is_seekable (GstBaseSrc * basesrc) gst_base_src_is_seekable (GstBaseSrc * basesrc)
{ {
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
@ -645,7 +646,7 @@ gst_basesrc_is_seekable (GstBaseSrc * basesrc)
} }
static gboolean static gboolean
gst_basesrc_start (GstBaseSrc * basesrc) gst_base_src_start (GstBaseSrc * basesrc)
{ {
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
gboolean result; gboolean result;
@ -684,7 +685,7 @@ gst_basesrc_start (GstBaseSrc * basesrc)
basesrc->segment_end = -1; basesrc->segment_end = -1;
/* check if we can seek, updates ->seekable */ /* check if we can seek, updates ->seekable */
gst_basesrc_is_seekable (basesrc); gst_base_src_is_seekable (basesrc);
/* run typefind */ /* run typefind */
#if 0 #if 0
@ -707,7 +708,7 @@ could_not_start:
} }
static gboolean static gboolean
gst_basesrc_stop (GstBaseSrc * basesrc) gst_base_src_stop (GstBaseSrc * basesrc)
{ {
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
gboolean result = TRUE; gboolean result = TRUE;
@ -726,7 +727,7 @@ gst_basesrc_stop (GstBaseSrc * basesrc)
} }
static gboolean static gboolean
gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad) gst_base_src_deactivate (GstBaseSrc * basesrc, GstPad * pad)
{ {
gboolean result; gboolean result;
@ -736,7 +737,7 @@ gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
GST_LIVE_UNLOCK (basesrc); GST_LIVE_UNLOCK (basesrc);
/* step 1, unblock clock sync (if any) */ /* step 1, unblock clock sync (if any) */
gst_basesrc_unlock (basesrc); gst_base_src_unlock (basesrc);
/* step 2, make sure streaming finishes */ /* step 2, make sure streaming finishes */
result = gst_pad_stop_task (pad); result = gst_pad_stop_task (pad);
@ -745,7 +746,7 @@ gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
} }
static gboolean static gboolean
gst_basesrc_activate_push (GstPad * pad, gboolean active) gst_base_src_activate_push (GstPad * pad, gboolean active)
{ {
GstBaseSrc *basesrc; GstBaseSrc *basesrc;
@ -753,12 +754,12 @@ gst_basesrc_activate_push (GstPad * pad, gboolean active)
/* prepare subclass first */ /* prepare subclass first */
if (active) { if (active) {
if (!gst_basesrc_start (basesrc)) if (!gst_base_src_start (basesrc))
goto error_start; 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 { } else {
return gst_basesrc_deactivate (basesrc, pad); return gst_base_src_deactivate (basesrc, pad);
} }
error_start: error_start:
@ -769,7 +770,7 @@ error_start:
} }
static gboolean static gboolean
gst_basesrc_activate_pull (GstPad * pad, gboolean active) gst_base_src_activate_pull (GstPad * pad, gboolean active)
{ {
GstBaseSrc *basesrc; GstBaseSrc *basesrc;
@ -777,17 +778,17 @@ gst_basesrc_activate_pull (GstPad * pad, gboolean active)
/* prepare subclass first */ /* prepare subclass first */
if (active) { if (active) {
if (!gst_basesrc_start (basesrc)) if (!gst_base_src_start (basesrc))
goto error_start; goto error_start;
if (!basesrc->seekable) { if (!basesrc->seekable) {
gst_basesrc_stop (basesrc); gst_base_src_stop (basesrc);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} else { } else {
return gst_basesrc_deactivate (basesrc, pad); return gst_base_src_deactivate (basesrc, pad);
} }
error_start: error_start:
@ -798,7 +799,7 @@ error_start:
} }
static GstElementStateReturn static GstElementStateReturn
gst_basesrc_change_state (GstElement * element) gst_base_src_change_state (GstElement * element)
{ {
GstBaseSrc *basesrc; GstBaseSrc *basesrc;
GstElementStateReturn result = GST_STATE_SUCCESS; GstElementStateReturn result = GST_STATE_SUCCESS;
@ -844,7 +845,7 @@ gst_basesrc_change_state (GstElement * element)
GST_LIVE_UNLOCK (element); GST_LIVE_UNLOCK (element);
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_PAUSED_TO_READY:
if (!gst_basesrc_stop (basesrc)) if (!gst_base_src_stop (basesrc))
result = GST_STATE_FAILURE; result = GST_STATE_FAILURE;
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_READY_TO_NULL:

View file

@ -28,7 +28,7 @@
G_BEGIN_DECLS 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(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_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)) #define GST_BASESRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASESRC, GstBaseSrcClass))
@ -139,10 +139,10 @@ struct _GstBaseSrcClass {
GstBuffer **buf); GstBuffer **buf);
}; };
GType gst_basesrc_get_type(void); GType gst_base_src_get_type(void);
void gst_basesrc_set_live (GstBaseSrc *src, gboolean live); void gst_base_src_set_live (GstBaseSrc *src, gboolean live);
gboolean gst_basesrc_is_live (GstBaseSrc *src); gboolean gst_base_src_is_live (GstBaseSrc *src);
G_END_DECLS G_END_DECLS

View file

@ -26,8 +26,8 @@
#include "gstbasesink.h" #include "gstbasesink.h"
#include <gst/gstmarshal.h> #include <gst/gstmarshal.h>
GST_DEBUG_CATEGORY_STATIC (gst_basesink_debug); GST_DEBUG_CATEGORY_STATIC (gst_base_sink_debug);
#define GST_CAT_DEFAULT gst_basesink_debug #define GST_CAT_DEFAULT gst_base_sink_debug
/* BaseSink signals and properties */ /* BaseSink signals and properties */
enum enum
@ -52,71 +52,71 @@ enum
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
static void gst_basesink_base_init (gpointer g_class); static void gst_base_sink_base_init (gpointer g_class);
static void gst_basesink_class_init (GstBaseSinkClass * klass); static void gst_base_sink_class_init (GstBaseSinkClass * klass);
static void gst_basesink_init (GstBaseSink * trans, gpointer g_class); static void gst_base_sink_init (GstBaseSink * trans, gpointer g_class);
static void gst_basesink_finalize (GObject * object); static void gst_base_sink_finalize (GObject * object);
GType 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) { if (!base_sink_type) {
static const GTypeInfo basesink_info = { static const GTypeInfo base_sink_info = {
sizeof (GstBaseSinkClass), sizeof (GstBaseSinkClass),
(GBaseInitFunc) gst_basesink_base_init, (GBaseInitFunc) gst_base_sink_base_init,
NULL, NULL,
(GClassInitFunc) gst_basesink_class_init, (GClassInitFunc) gst_base_sink_class_init,
NULL, NULL,
NULL, NULL,
sizeof (GstBaseSink), sizeof (GstBaseSink),
0, 0,
(GInstanceInitFunc) gst_basesink_init, (GInstanceInitFunc) gst_base_sink_init,
}; };
basesink_type = g_type_register_static (GST_TYPE_ELEMENT, base_sink_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstBaseSink", &basesink_info, G_TYPE_FLAG_ABSTRACT); "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); 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); GValue * value, GParamSpec * pspec);
static GstCaps *gst_base_sink_get_caps (GstBaseSink * sink); static GstCaps *gst_base_sink_get_caps (GstBaseSink * sink);
static gboolean gst_base_sink_set_caps (GstBaseSink * sink, GstCaps * caps); static gboolean gst_base_sink_set_caps (GstBaseSink * sink, GstCaps * caps);
static GstFlowReturn gst_base_sink_buffer_alloc (GstBaseSink * sink, static GstFlowReturn gst_base_sink_buffer_alloc (GstBaseSink * sink,
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); 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); 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 GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer);
static void gst_basesink_loop (GstPad * pad); static void gst_base_sink_loop (GstPad * pad);
static GstFlowReturn gst_basesink_chain (GstPad * pad, GstBuffer * buffer); static GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_basesink_activate_push (GstPad * pad, gboolean active); static gboolean gst_base_sink_activate_push (GstPad * pad, gboolean active);
static gboolean gst_basesink_activate_pull (GstPad * pad, gboolean active); static gboolean gst_base_sink_activate_pull (GstPad * pad, gboolean active);
static gboolean gst_basesink_event (GstPad * pad, GstEvent * event); static gboolean gst_base_sink_event (GstPad * pad, GstEvent * event);
static inline GstFlowReturn gst_basesink_handle_buffer (GstBaseSink * basesink, static inline GstFlowReturn gst_base_sink_handle_buffer (GstBaseSink * basesink,
GstBuffer * buf); GstBuffer * buf);
static inline gboolean gst_basesink_handle_event (GstBaseSink * basesink, static inline gboolean gst_base_sink_handle_event (GstBaseSink * basesink,
GstEvent * event); GstEvent * event);
static void 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"); "basesink element");
} }
static void static void
gst_basesink_class_init (GstBaseSinkClass * klass) gst_base_sink_class_init (GstBaseSinkClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
@ -126,9 +126,9 @@ gst_basesink_class_init (GstBaseSinkClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT); parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_basesink_finalize); gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_base_sink_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_basesink_set_property); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_base_sink_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_basesink_get_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_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_LOOP,
g_param_spec_boolean ("has-loop", "has-loop", g_param_spec_boolean ("has-loop", "has-loop",
@ -146,18 +146,18 @@ gst_basesink_class_init (GstBaseSinkClass * klass)
"Number of buffers to queue during preroll", 0, G_MAXUINT, 0, "Number of buffers to queue during preroll", 0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); 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 = 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->get_caps = GST_DEBUG_FUNCPTR (gst_base_sink_get_caps);
klass->set_caps = GST_DEBUG_FUNCPTR (gst_base_sink_set_caps); klass->set_caps = GST_DEBUG_FUNCPTR (gst_base_sink_set_caps);
klass->buffer_alloc = GST_DEBUG_FUNCPTR (gst_base_sink_buffer_alloc); 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 * static GstCaps *
gst_basesink_pad_getcaps (GstPad * pad) gst_base_sink_pad_getcaps (GstPad * pad)
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
GstBaseSink *bsink; GstBaseSink *bsink;
@ -182,7 +182,7 @@ gst_basesink_pad_getcaps (GstPad * pad)
} }
static gboolean static gboolean
gst_basesink_pad_setcaps (GstPad * pad, GstCaps * caps) gst_base_sink_pad_setcaps (GstPad * pad, GstCaps * caps)
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
GstBaseSink *bsink; GstBaseSink *bsink;
@ -198,7 +198,7 @@ gst_basesink_pad_setcaps (GstPad * pad, GstCaps * caps)
} }
static GstFlowReturn 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) GstCaps * caps, GstBuffer ** buf)
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
@ -217,7 +217,7 @@ gst_basesink_pad_buffer_alloc (GstPad * pad, guint64 offset, guint size,
} }
static void static void
gst_basesink_init (GstBaseSink * basesink, gpointer g_class) gst_base_sink_init (GstBaseSink * basesink, gpointer g_class)
{ {
GstPadTemplate *pad_template; GstPadTemplate *pad_template;
@ -228,11 +228,11 @@ gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
basesink->sinkpad = gst_pad_new_from_template (pad_template, "sink"); basesink->sinkpad = gst_pad_new_from_template (pad_template, "sink");
gst_pad_set_getcaps_function (basesink->sinkpad, 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_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_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); gst_element_add_pad (GST_ELEMENT (basesink), basesink->sinkpad);
basesink->pad_mode = GST_ACTIVATE_NONE; basesink->pad_mode = GST_ACTIVATE_NONE;
@ -243,7 +243,7 @@ gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
} }
static void static void
gst_basesink_finalize (GObject * object) gst_base_sink_finalize (GObject * object)
{ {
GstBaseSink *basesink; GstBaseSink *basesink;
@ -255,31 +255,31 @@ gst_basesink_finalize (GObject * object)
} }
static void 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_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_pad_set_activatepull_function (pad,
GST_DEBUG_FUNCPTR (gst_basesink_activate_pull)); GST_DEBUG_FUNCPTR (gst_base_sink_activate_pull));
gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_basesink_event)); gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_base_sink_event));
if (this->has_chain) 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 else
gst_pad_set_chain_function (pad, NULL); gst_pad_set_chain_function (pad, NULL);
} }
static void static void
gst_basesink_set_all_pad_functions (GstBaseSink * this) gst_base_sink_set_all_pad_functions (GstBaseSink * this)
{ {
GList *l; GList *l;
for (l = GST_ELEMENT_PADS (this); l; l = l->next) 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 static void
gst_basesink_set_clock (GstElement * element, GstClock * clock) gst_base_sink_set_clock (GstElement * element, GstClock * clock)
{ {
GstBaseSink *sink; GstBaseSink *sink;
@ -289,7 +289,7 @@ gst_basesink_set_clock (GstElement * element, GstClock * clock)
} }
static void 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) const GValue * value, GParamSpec * pspec)
{ {
GstBaseSink *sink; GstBaseSink *sink;
@ -300,13 +300,13 @@ gst_basesink_set_property (GObject * object, guint prop_id,
case PROP_HAS_LOOP: case PROP_HAS_LOOP:
GST_LOCK (sink); GST_LOCK (sink);
sink->has_loop = g_value_get_boolean (value); 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); GST_UNLOCK (sink);
break; break;
case PROP_HAS_CHAIN: case PROP_HAS_CHAIN:
GST_LOCK (sink); GST_LOCK (sink);
sink->has_chain = g_value_get_boolean (value); 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); GST_UNLOCK (sink);
break; break;
case PROP_PREROLL_QUEUE_LEN: case PROP_PREROLL_QUEUE_LEN:
@ -322,7 +322,7 @@ gst_basesink_set_property (GObject * object, guint prop_id,
} }
static void 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) GParamSpec * pspec)
{ {
GstBaseSink *sink; GstBaseSink *sink;
@ -369,7 +369,7 @@ gst_base_sink_buffer_alloc (GstBaseSink * sink, guint64 offset, guint size,
/* with PREROLL_LOCK */ /* with PREROLL_LOCK */
static GstFlowReturn static GstFlowReturn
gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad) gst_base_sink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
{ {
GstMiniObject *obj; GstMiniObject *obj;
GQueue *q = basesink->preroll_queue; GQueue *q = basesink->preroll_queue;
@ -387,10 +387,10 @@ gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
if (GST_IS_BUFFER (obj)) { if (GST_IS_BUFFER (obj)) {
GST_DEBUG ("poped buffer %p", 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 { } else {
GST_DEBUG ("poped event %p", obj); 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; ret = GST_FLOW_OK;
} }
@ -403,7 +403,7 @@ gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
/* with PREROLL_LOCK */ /* with PREROLL_LOCK */
static void static void
gst_basesink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad) gst_base_sink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad)
{ {
GstMiniObject *obj; GstMiniObject *obj;
GQueue *q = basesink->preroll_queue; GQueue *q = basesink->preroll_queue;
@ -423,7 +423,7 @@ gst_basesink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad)
/* with STREAM_LOCK */ /* with STREAM_LOCK */
static GstFlowReturn static GstFlowReturn
gst_basesink_handle_object (GstBaseSink * basesink, GstPad * pad, gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
GstMiniObject * obj) GstMiniObject * obj)
{ {
gint length; gint length;
@ -525,7 +525,7 @@ no_preroll:
GST_DEBUG ("no preroll needed"); GST_DEBUG ("no preroll needed");
/* maybe it was another sink that blocked in preroll, need to check for /* maybe it was another sink that blocked in preroll, need to check for
buffers to drain */ buffers to drain */
ret = gst_basesink_preroll_queue_empty (basesink, pad); ret = gst_base_sink_preroll_queue_empty (basesink, pad);
GST_PREROLL_UNLOCK (pad); GST_PREROLL_UNLOCK (pad);
return ret; return ret;
@ -539,7 +539,7 @@ flushing:
} }
static gboolean static gboolean
gst_basesink_event (GstPad * pad, GstEvent * event) gst_base_sink_event (GstPad * pad, GstEvent * event)
{ {
GstBaseSink *basesink; GstBaseSink *basesink;
gboolean result = TRUE; gboolean result = TRUE;
@ -558,7 +558,8 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
GST_STREAM_LOCK (pad); GST_STREAM_LOCK (pad);
/* EOS also finishes the preroll */ /* 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); GST_STREAM_UNLOCK (pad);
break; break;
} }
@ -570,7 +571,8 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
if (basesink->clock) { if (basesink->clock) {
//gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value; //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); GST_STREAM_UNLOCK (pad);
break; break;
} }
@ -585,7 +587,7 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
/* we need preroll after the flush */ /* we need preroll after the flush */
basesink->need_preroll = TRUE; basesink->need_preroll = TRUE;
/* unlock from a possible state change/preroll */ /* 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); GST_LOCK (basesink);
if (basesink->clock_id) { if (basesink->clock_id) {
@ -621,7 +623,7 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
* timestamps on a buffer, subclasses cna override * timestamps on a buffer, subclasses cna override
*/ */
static void static void
gst_basesink_get_times (GstBaseSink * basesink, GstBuffer * buffer, gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end) GstClockTime * start, GstClockTime * end)
{ {
GstClockTime timestamp, duration; GstClockTime timestamp, duration;
@ -646,7 +648,7 @@ gst_basesink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
* 5) unref the clockid again * 5) unref the clockid again
*/ */
static gboolean static gboolean
gst_basesink_do_sync (GstBaseSink * basesink, GstBuffer * buffer) gst_base_sink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
{ {
gboolean result = TRUE; gboolean result = TRUE;
@ -696,7 +698,7 @@ gst_basesink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
* 3) unref the event * 3) unref the event
*/ */
static inline gboolean static inline gboolean
gst_basesink_handle_event (GstBaseSink * basesink, GstEvent * event) gst_base_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
gboolean ret; gboolean ret;
@ -761,12 +763,12 @@ gst_basesink_handle_event (GstBaseSink * basesink, GstEvent * event)
* 3) unref the buffer * 3) unref the buffer
*/ */
static inline GstFlowReturn static inline GstFlowReturn
gst_basesink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf) gst_base_sink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
GstFlowReturn ret; GstFlowReturn ret;
gst_basesink_do_sync (basesink, buf); gst_base_sink_do_sync (basesink, buf);
bclass = GST_BASESINK_GET_CLASS (basesink); bclass = GST_BASESINK_GET_CLASS (basesink);
if (bclass->render) if (bclass->render)
@ -781,14 +783,14 @@ gst_basesink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
} }
static GstFlowReturn static GstFlowReturn
gst_basesink_chain (GstPad * pad, GstBuffer * buf) gst_base_sink_chain (GstPad * pad, GstBuffer * buf)
{ {
GstBaseSink *basesink; GstBaseSink *basesink;
GstFlowReturn result; GstFlowReturn result;
basesink = GST_BASESINK (GST_OBJECT_PARENT (pad)); 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; return result;
} }
@ -796,7 +798,7 @@ gst_basesink_chain (GstPad * pad, GstBuffer * buf)
/* FIXME, not all sinks can operate in pull mode /* FIXME, not all sinks can operate in pull mode
*/ */
static void static void
gst_basesink_loop (GstPad * pad) gst_base_sink_loop (GstPad * pad)
{ {
GstBaseSink *basesink; GstBaseSink *basesink;
GstBuffer *buf = NULL; GstBuffer *buf = NULL;
@ -810,7 +812,7 @@ gst_basesink_loop (GstPad * pad)
if (result != GST_FLOW_OK) if (result != GST_FLOW_OK)
goto paused; goto paused;
result = gst_basesink_chain (pad, buf); result = gst_base_sink_chain (pad, buf);
if (result != GST_FLOW_OK) if (result != GST_FLOW_OK)
goto paused; goto paused;
@ -823,7 +825,7 @@ paused:
} }
static gboolean static gboolean
gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad) gst_base_sink_deactivate (GstBaseSink * basesink, GstPad * pad)
{ {
gboolean result = FALSE; gboolean result = FALSE;
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
@ -844,7 +846,7 @@ gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad)
/* flush out the data thread if it's locked in finish_preroll */ /* flush out the data thread if it's locked in finish_preroll */
basesink->need_preroll = FALSE; basesink->need_preroll = FALSE;
gst_basesink_preroll_queue_flush (basesink, pad); gst_base_sink_preroll_queue_flush (basesink, pad);
GST_PREROLL_UNLOCK (pad); GST_PREROLL_UNLOCK (pad);
/* step 2, make sure streaming finishes */ /* step 2, make sure streaming finishes */
@ -854,7 +856,7 @@ gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad)
} }
static gboolean static gboolean
gst_basesink_activate_push (GstPad * pad, gboolean active) gst_base_sink_activate_push (GstPad * pad, gboolean active)
{ {
gboolean result = FALSE; gboolean result = FALSE;
GstBaseSink *basesink; GstBaseSink *basesink;
@ -865,7 +867,7 @@ gst_basesink_activate_push (GstPad * pad, gboolean active)
g_return_val_if_fail (basesink->has_chain, FALSE); g_return_val_if_fail (basesink->has_chain, FALSE);
result = TRUE; result = TRUE;
} else { } else {
result = gst_basesink_deactivate (basesink, pad); result = gst_base_sink_deactivate (basesink, pad);
} }
basesink->pad_mode = GST_ACTIVATE_PUSH; basesink->pad_mode = GST_ACTIVATE_PUSH;
@ -874,7 +876,7 @@ gst_basesink_activate_push (GstPad * pad, gboolean active)
/* this won't get called until we implement an activate function */ /* this won't get called until we implement an activate function */
static gboolean static gboolean
gst_basesink_activate_pull (GstPad * pad, gboolean active) gst_base_sink_activate_pull (GstPad * pad, gboolean active)
{ {
gboolean result = FALSE; gboolean result = FALSE;
GstBaseSink *basesink; GstBaseSink *basesink;
@ -884,16 +886,17 @@ gst_basesink_activate_pull (GstPad * pad, gboolean active)
if (active) { if (active) {
/* if we have a scheduler we can start the task */ /* if we have a scheduler we can start the task */
g_return_val_if_fail (basesink->has_loop, FALSE); 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 { } else {
result = gst_basesink_deactivate (basesink, pad); result = gst_base_sink_deactivate (basesink, pad);
} }
return result; return result;
} }
static GstElementStateReturn static GstElementStateReturn
gst_basesink_change_state (GstElement * element) gst_base_sink_change_state (GstElement * element)
{ {
GstElementStateReturn ret = GST_STATE_SUCCESS; GstElementStateReturn ret = GST_STATE_SUCCESS;
GstBaseSink *basesink = GST_BASESINK (element); GstBaseSink *basesink = GST_BASESINK (element);
@ -921,7 +924,7 @@ gst_basesink_change_state (GstElement * element)
* we are pushing and syncing the buffers, better start a new * we are pushing and syncing the buffers, better start a new
* thread to do this. */ * thread to do this. */
if (basesink->eos) { 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 */ /* don't need the preroll anymore */
basesink->need_preroll = FALSE; basesink->need_preroll = FALSE;

View file

@ -28,7 +28,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_BASESINK (gst_basesink_get_type()) #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(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_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_BASESINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASESINK, GstBaseSinkClass))
@ -94,7 +94,7 @@ struct _GstBaseSinkClass {
GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer); GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer);
}; };
GType gst_basesink_get_type(void); GType gst_base_sink_get_type(void);
G_END_DECLS G_END_DECLS

View file

@ -34,8 +34,8 @@
#define DEFAULT_BLOCKSIZE 4096 #define DEFAULT_BLOCKSIZE 4096
GST_DEBUG_CATEGORY_STATIC (gst_basesrc_debug); GST_DEBUG_CATEGORY_STATIC (gst_base_src_debug);
#define GST_CAT_DEFAULT gst_basesrc_debug #define GST_CAT_DEFAULT gst_base_src_debug
/* BaseSrc signals and args */ /* BaseSrc signals and args */
enum enum
@ -54,69 +54,69 @@ enum
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
static void gst_basesrc_base_init (gpointer g_class); static void gst_base_src_base_init (gpointer g_class);
static void gst_basesrc_class_init (GstBaseSrcClass * klass); static void gst_base_src_class_init (GstBaseSrcClass * klass);
static void gst_basesrc_init (GstBaseSrc * src, gpointer g_class); static void gst_base_src_init (GstBaseSrc * src, gpointer g_class);
GType 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) { if (!base_src_type) {
static const GTypeInfo basesrc_info = { static const GTypeInfo base_src_info = {
sizeof (GstBaseSrcClass), sizeof (GstBaseSrcClass),
(GBaseInitFunc) gst_basesrc_base_init, (GBaseInitFunc) gst_base_src_base_init,
NULL, NULL,
(GClassInitFunc) gst_basesrc_class_init, (GClassInitFunc) gst_base_src_class_init,
NULL, NULL,
NULL, NULL,
sizeof (GstBaseSrc), sizeof (GstBaseSrc),
0, 0,
(GInstanceInitFunc) gst_basesrc_init, (GInstanceInitFunc) gst_base_src_init,
}; };
basesrc_type = g_type_register_static (GST_TYPE_ELEMENT, base_src_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstBaseSrc", &basesrc_info, G_TYPE_FLAG_ABSTRACT); "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_base_src_activate_push (GstPad * pad, gboolean active);
static gboolean gst_basesrc_activate_pull (GstPad * pad, gboolean active); static gboolean gst_base_src_activate_pull (GstPad * pad, gboolean active);
static void gst_basesrc_set_property (GObject * object, guint prop_id, static void gst_base_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); 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); 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 #if 0
static const GstEventMask *gst_basesrc_get_event_mask (GstPad * pad); static const GstEventMask *gst_base_src_get_event_mask (GstPad * pad);
#endif #endif
static gboolean gst_basesrc_unlock (GstBaseSrc * basesrc); static gboolean gst_base_src_unlock (GstBaseSrc * basesrc);
static gboolean gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size); static gboolean gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size);
static gboolean gst_basesrc_start (GstBaseSrc * basesrc); static gboolean gst_base_src_start (GstBaseSrc * basesrc);
static gboolean gst_basesrc_stop (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_base_src_set_dataflow_funcs (GstBaseSrc * this);
static void gst_basesrc_loop (GstPad * pad); static void gst_base_src_loop (GstPad * pad);
static gboolean gst_basesrc_check_get_range (GstPad * pad); static gboolean gst_base_src_check_get_range (GstPad * pad);
static GstFlowReturn gst_basesrc_get_range (GstPad * pad, guint64 offset, static GstFlowReturn gst_base_src_get_range (GstPad * pad, guint64 offset,
guint length, GstBuffer ** buf); guint length, GstBuffer ** buf);
static void 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 static void
gst_basesrc_class_init (GstBaseSrcClass * klass) gst_base_src_class_init (GstBaseSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
@ -126,8 +126,8 @@ gst_basesrc_class_init (GstBaseSrcClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT); parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_basesrc_set_property); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_base_src_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_basesrc_get_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_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BLOCKSIZE,
g_param_spec_ulong ("blocksize", "Block size", g_param_spec_ulong ("blocksize", "Block size",
@ -144,11 +144,12 @@ gst_basesrc_class_init (GstBaseSrcClass * klass)
"True if the element should expose a getrange function", TRUE, "True if the element should expose a getrange function", TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); 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 static void
gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class) gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class)
{ {
GstPad *pad; GstPad *pad;
GstPadTemplate *pad_template; GstPadTemplate *pad_template;
@ -159,12 +160,12 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class)
pad = gst_pad_new_from_template (pad_template, "src"); pad = gst_pad_new_from_template (pad_template, "src");
gst_pad_set_activatepush_function (pad, gst_basesrc_activate_push); gst_pad_set_activatepush_function (pad, gst_base_src_activate_push);
gst_pad_set_activatepull_function (pad, gst_basesrc_activate_pull); gst_pad_set_activatepull_function (pad, gst_base_src_activate_pull);
gst_pad_set_event_function (pad, gst_basesrc_event_handler); gst_pad_set_event_function (pad, gst_base_src_event_handler);
gst_pad_set_query_function (pad, gst_basesrc_query); 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->is_live = FALSE;
basesrc->live_lock = g_mutex_new (); basesrc->live_lock = g_mutex_new ();
@ -183,7 +184,7 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class)
} }
void void
gst_basesrc_set_live (GstBaseSrc * src, gboolean live) gst_base_src_set_live (GstBaseSrc * src, gboolean live)
{ {
GST_LIVE_LOCK (src); GST_LIVE_LOCK (src);
src->is_live = live; src->is_live = live;
@ -191,7 +192,7 @@ gst_basesrc_set_live (GstBaseSrc * src, gboolean live)
} }
gboolean gboolean
gst_basesrc_is_live (GstBaseSrc * src) gst_base_src_is_live (GstBaseSrc * src)
{ {
gboolean result; gboolean result;
@ -203,18 +204,18 @@ gst_basesrc_is_live (GstBaseSrc * src)
} }
static void static void
gst_basesrc_set_dataflow_funcs (GstBaseSrc * this) gst_base_src_set_dataflow_funcs (GstBaseSrc * this)
{ {
GST_DEBUG ("updating dataflow functions"); GST_DEBUG ("updating dataflow functions");
if (this->has_getrange) 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 else
gst_pad_set_getrange_function (this->srcpad, NULL); gst_pad_set_getrange_function (this->srcpad, NULL);
} }
static gboolean static gboolean
gst_basesrc_query (GstPad * pad, GstQuery * query) gst_base_src_query (GstPad * pad, GstQuery * query)
{ {
gboolean b; gboolean b;
guint64 ui64; guint64 ui64;
@ -232,13 +233,13 @@ gst_basesrc_query (GstPad * pad, GstQuery * query)
switch (format) { switch (format) {
case GST_FORMAT_DEFAULT: case GST_FORMAT_DEFAULT:
case GST_FORMAT_BYTES: 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 */ /* better to make get_size take an int64 */
i64 = b ? (gint64) ui64 : -1; i64 = b ? (gint64) ui64 : -1;
gst_query_set_position (query, GST_FORMAT_BYTES, src->offset, i64); gst_query_set_position (query, GST_FORMAT_BYTES, src->offset, i64);
return TRUE; return TRUE;
case GST_FORMAT_PERCENT: 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 = GST_FORMAT_PERCENT_MAX;
i64 *= b ? (src->offset / (gdouble) ui64) : 1.0; i64 *= b ? (src->offset / (gdouble) ui64) : 1.0;
gst_query_set_position (query, GST_FORMAT_PERCENT, gst_query_set_position (query, GST_FORMAT_PERCENT,
@ -270,7 +271,7 @@ gst_basesrc_query (GstPad * pad, GstQuery * query)
#if 0 #if 0
static const GstEventMask * static const GstEventMask *
gst_basesrc_get_event_mask (GstPad * pad) gst_base_src_get_event_mask (GstPad * pad)
{ {
static const GstEventMask masks[] = { static const GstEventMask masks[] = {
{GST_EVENT_SEEK, GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_SET | {GST_EVENT_SEEK, GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_SET |
@ -285,7 +286,7 @@ gst_basesrc_get_event_mask (GstPad * pad)
#endif #endif
static gboolean static gboolean
gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event) gst_base_src_do_seek (GstBaseSrc * src, GstEvent * event)
{ {
GstFormat format; GstFormat format;
gint64 offset; gint64 offset;
@ -339,7 +340,7 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
gst_pad_push_event (src->srcpad, gst_event_new_flush (FALSE)); gst_pad_push_event (src->srcpad, gst_event_new_flush (FALSE));
/* unblock streaming thread */ /* unblock streaming thread */
gst_basesrc_unlock (src); gst_base_src_unlock (src);
/* grab streaming lock */ /* grab streaming lock */
GST_STREAM_LOCK (src->srcpad); GST_STREAM_LOCK (src->srcpad);
@ -359,7 +360,7 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
} }
/* and restart the task */ /* 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); src->srcpad);
GST_STREAM_UNLOCK (src->srcpad); GST_STREAM_UNLOCK (src->srcpad);
@ -377,7 +378,7 @@ error:
} }
static gboolean static gboolean
gst_basesrc_event_handler (GstPad * pad, GstEvent * event) gst_base_src_event_handler (GstPad * pad, GstEvent * event)
{ {
GstBaseSrc *src; GstBaseSrc *src;
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
@ -391,7 +392,7 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK: case GST_EVENT_SEEK:
return gst_basesrc_do_seek (src, event); return gst_base_src_do_seek (src, event);
case GST_EVENT_SIZE: case GST_EVENT_SIZE:
{ {
GstFormat format; GstFormat format;
@ -410,7 +411,7 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
case GST_EVENT_FLUSH: case GST_EVENT_FLUSH:
/* cancel any blocking getrange */ /* cancel any blocking getrange */
if (!GST_EVENT_FLUSH_DONE (event)) if (!GST_EVENT_FLUSH_DONE (event))
gst_basesrc_unlock (src); gst_base_src_unlock (src);
break; break;
default: default:
break; break;
@ -421,8 +422,8 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
} }
static void static void
gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value, gst_base_src_set_property (GObject * object, guint prop_id,
GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
GstBaseSrc *src; GstBaseSrc *src;
@ -434,11 +435,11 @@ gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value,
break; break;
case PROP_HAS_LOOP: case PROP_HAS_LOOP:
src->has_loop = g_value_get_boolean (value); src->has_loop = g_value_get_boolean (value);
gst_basesrc_set_dataflow_funcs (src); gst_base_src_set_dataflow_funcs (src);
break; break;
case PROP_HAS_GETRANGE: case PROP_HAS_GETRANGE:
src->has_getrange = g_value_get_boolean (value); src->has_getrange = g_value_get_boolean (value);
gst_basesrc_set_dataflow_funcs (src); gst_base_src_set_dataflow_funcs (src);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -447,7 +448,7 @@ gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value,
} }
static void 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) GParamSpec * pspec)
{ {
GstBaseSrc *src; GstBaseSrc *src;
@ -471,7 +472,7 @@ gst_basesrc_get_property (GObject * object, guint prop_id, GValue * value,
} }
static GstFlowReturn 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) GstBuffer ** buf)
{ {
GstFlowReturn ret; GstFlowReturn ret;
@ -537,22 +538,22 @@ unexpected_length:
} }
static gboolean static gboolean
gst_basesrc_check_get_range (GstPad * pad) gst_base_src_check_get_range (GstPad * pad)
{ {
GstBaseSrc *src; GstBaseSrc *src;
src = GST_BASESRC (GST_OBJECT_PARENT (pad)); src = GST_BASESRC (GST_OBJECT_PARENT (pad));
if (!GST_FLAG_IS_SET (src, GST_BASESRC_STARTED)) { if (!GST_FLAG_IS_SET (src, GST_BASESRC_STARTED)) {
gst_basesrc_start (src); gst_base_src_start (src);
gst_basesrc_stop (src); gst_base_src_stop (src);
} }
return src->seekable; return src->seekable;
} }
static void static void
gst_basesrc_loop (GstPad * pad) gst_base_src_loop (GstPad * pad)
{ {
GstBaseSrc *src; GstBaseSrc *src;
GstBuffer *buf = NULL; GstBuffer *buf = NULL;
@ -560,7 +561,7 @@ gst_basesrc_loop (GstPad * pad)
src = GST_BASESRC (GST_OBJECT_PARENT (pad)); 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) if (ret != GST_FLOW_OK)
goto eos; goto eos;
@ -588,7 +589,7 @@ pause:
} }
static gboolean static gboolean
gst_basesrc_unlock (GstBaseSrc * basesrc) gst_base_src_unlock (GstBaseSrc * basesrc)
{ {
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
gboolean result = FALSE; gboolean result = FALSE;
@ -613,7 +614,7 @@ gst_basesrc_unlock (GstBaseSrc * basesrc)
} }
static gboolean static gboolean
gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size) gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size)
{ {
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
gboolean result = FALSE; gboolean result = FALSE;
@ -629,7 +630,7 @@ gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size)
} }
static gboolean static gboolean
gst_basesrc_is_seekable (GstBaseSrc * basesrc) gst_base_src_is_seekable (GstBaseSrc * basesrc)
{ {
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
@ -645,7 +646,7 @@ gst_basesrc_is_seekable (GstBaseSrc * basesrc)
} }
static gboolean static gboolean
gst_basesrc_start (GstBaseSrc * basesrc) gst_base_src_start (GstBaseSrc * basesrc)
{ {
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
gboolean result; gboolean result;
@ -684,7 +685,7 @@ gst_basesrc_start (GstBaseSrc * basesrc)
basesrc->segment_end = -1; basesrc->segment_end = -1;
/* check if we can seek, updates ->seekable */ /* check if we can seek, updates ->seekable */
gst_basesrc_is_seekable (basesrc); gst_base_src_is_seekable (basesrc);
/* run typefind */ /* run typefind */
#if 0 #if 0
@ -707,7 +708,7 @@ could_not_start:
} }
static gboolean static gboolean
gst_basesrc_stop (GstBaseSrc * basesrc) gst_base_src_stop (GstBaseSrc * basesrc)
{ {
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
gboolean result = TRUE; gboolean result = TRUE;
@ -726,7 +727,7 @@ gst_basesrc_stop (GstBaseSrc * basesrc)
} }
static gboolean static gboolean
gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad) gst_base_src_deactivate (GstBaseSrc * basesrc, GstPad * pad)
{ {
gboolean result; gboolean result;
@ -736,7 +737,7 @@ gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
GST_LIVE_UNLOCK (basesrc); GST_LIVE_UNLOCK (basesrc);
/* step 1, unblock clock sync (if any) */ /* step 1, unblock clock sync (if any) */
gst_basesrc_unlock (basesrc); gst_base_src_unlock (basesrc);
/* step 2, make sure streaming finishes */ /* step 2, make sure streaming finishes */
result = gst_pad_stop_task (pad); result = gst_pad_stop_task (pad);
@ -745,7 +746,7 @@ gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
} }
static gboolean static gboolean
gst_basesrc_activate_push (GstPad * pad, gboolean active) gst_base_src_activate_push (GstPad * pad, gboolean active)
{ {
GstBaseSrc *basesrc; GstBaseSrc *basesrc;
@ -753,12 +754,12 @@ gst_basesrc_activate_push (GstPad * pad, gboolean active)
/* prepare subclass first */ /* prepare subclass first */
if (active) { if (active) {
if (!gst_basesrc_start (basesrc)) if (!gst_base_src_start (basesrc))
goto error_start; 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 { } else {
return gst_basesrc_deactivate (basesrc, pad); return gst_base_src_deactivate (basesrc, pad);
} }
error_start: error_start:
@ -769,7 +770,7 @@ error_start:
} }
static gboolean static gboolean
gst_basesrc_activate_pull (GstPad * pad, gboolean active) gst_base_src_activate_pull (GstPad * pad, gboolean active)
{ {
GstBaseSrc *basesrc; GstBaseSrc *basesrc;
@ -777,17 +778,17 @@ gst_basesrc_activate_pull (GstPad * pad, gboolean active)
/* prepare subclass first */ /* prepare subclass first */
if (active) { if (active) {
if (!gst_basesrc_start (basesrc)) if (!gst_base_src_start (basesrc))
goto error_start; goto error_start;
if (!basesrc->seekable) { if (!basesrc->seekable) {
gst_basesrc_stop (basesrc); gst_base_src_stop (basesrc);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} else { } else {
return gst_basesrc_deactivate (basesrc, pad); return gst_base_src_deactivate (basesrc, pad);
} }
error_start: error_start:
@ -798,7 +799,7 @@ error_start:
} }
static GstElementStateReturn static GstElementStateReturn
gst_basesrc_change_state (GstElement * element) gst_base_src_change_state (GstElement * element)
{ {
GstBaseSrc *basesrc; GstBaseSrc *basesrc;
GstElementStateReturn result = GST_STATE_SUCCESS; GstElementStateReturn result = GST_STATE_SUCCESS;
@ -844,7 +845,7 @@ gst_basesrc_change_state (GstElement * element)
GST_LIVE_UNLOCK (element); GST_LIVE_UNLOCK (element);
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_PAUSED_TO_READY:
if (!gst_basesrc_stop (basesrc)) if (!gst_base_src_stop (basesrc))
result = GST_STATE_FAILURE; result = GST_STATE_FAILURE;
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_READY_TO_NULL:

View file

@ -28,7 +28,7 @@
G_BEGIN_DECLS 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(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_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)) #define GST_BASESRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASESRC, GstBaseSrcClass))
@ -139,10 +139,10 @@ struct _GstBaseSrcClass {
GstBuffer **buf); GstBuffer **buf);
}; };
GType gst_basesrc_get_type(void); GType gst_base_src_get_type(void);
void gst_basesrc_set_live (GstBaseSrc *src, gboolean live); void gst_base_src_set_live (GstBaseSrc *src, gboolean live);
gboolean gst_basesrc_is_live (GstBaseSrc *src); gboolean gst_base_src_is_live (GstBaseSrc *src);
G_END_DECLS G_END_DECLS