mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 07:46:38 +00:00
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:
parent
7c157ea543
commit
f0e5bb0a33
8 changed files with 390 additions and 382 deletions
|
@ -26,8 +26,8 @@
|
|||
#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
|
||||
|
@ -52,71 +52,71 @@ 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;
|
||||
|
@ -126,9 +126,9 @@ gst_basesink_class_init (GstBaseSinkClass * klass)
|
|||
|
||||
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",
|
||||
|
@ -146,18 +146,18 @@ gst_basesink_class_init (GstBaseSinkClass * klass)
|
|||
"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;
|
||||
|
@ -182,7 +182,7 @@ gst_basesink_pad_getcaps (GstPad * pad)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesink_pad_setcaps (GstPad * pad, GstCaps * caps)
|
||||
gst_base_sink_pad_setcaps (GstPad * pad, GstCaps * caps)
|
||||
{
|
||||
GstBaseSinkClass *bclass;
|
||||
GstBaseSink *bsink;
|
||||
|
@ -198,7 +198,7 @@ gst_basesink_pad_setcaps (GstPad * pad, GstCaps * caps)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -217,7 +217,7 @@ gst_basesink_pad_buffer_alloc (GstPad * pad, guint64 offset, guint size,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
|
||||
gst_base_sink_init (GstBaseSink * basesink, gpointer g_class)
|
||||
{
|
||||
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");
|
||||
|
||||
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;
|
||||
|
@ -243,7 +243,7 @@ gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_basesink_finalize (GObject * object)
|
||||
gst_base_sink_finalize (GObject * object)
|
||||
{
|
||||
GstBaseSink *basesink;
|
||||
|
||||
|
@ -255,31 +255,31 @@ gst_basesink_finalize (GObject * object)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -289,7 +289,7 @@ gst_basesink_set_clock (GstElement * element, GstClock * clock)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -300,13 +300,13 @@ gst_basesink_set_property (GObject * object, guint prop_id,
|
|||
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:
|
||||
|
@ -322,7 +322,7 @@ gst_basesink_set_property (GObject * object, guint prop_id,
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -369,7 +369,7 @@ gst_base_sink_buffer_alloc (GstBaseSink * sink, guint64 offset, guint size,
|
|||
|
||||
/* 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;
|
||||
|
@ -387,10 +387,10 @@ gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
|
|||
|
||||
/* 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;
|
||||
|
@ -423,7 +423,7 @@ gst_basesink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad)
|
|||
|
||||
/* 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;
|
||||
|
@ -525,7 +525,7 @@ no_preroll:
|
|||
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;
|
||||
|
@ -539,7 +539,7 @@ flushing:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesink_event (GstPad * pad, GstEvent * event)
|
||||
gst_base_sink_event (GstPad * pad, GstEvent * event)
|
||||
{
|
||||
GstBaseSink *basesink;
|
||||
gboolean result = TRUE;
|
||||
|
@ -558,7 +558,8 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -570,7 +571,8 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
|
|||
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;
|
||||
}
|
||||
|
@ -585,7 +587,7 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
|
|||
/* 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) {
|
||||
|
@ -621,7 +623,7 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
|
|||
* 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;
|
||||
|
@ -646,7 +648,7 @@ gst_basesink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
|
|||
* 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;
|
||||
|
||||
|
@ -696,7 +698,7 @@ gst_basesink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
|||
* 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;
|
||||
|
@ -761,12 +763,12 @@ gst_basesink_handle_event (GstBaseSink * basesink, GstEvent * event)
|
|||
* 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)
|
||||
|
@ -781,14 +783,14 @@ gst_basesink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -796,7 +798,7 @@ gst_basesink_chain (GstPad * pad, GstBuffer * buf)
|
|||
/* 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;
|
||||
|
@ -810,7 +812,7 @@ gst_basesink_loop (GstPad * pad)
|
|||
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;
|
||||
|
||||
|
@ -823,7 +825,7 @@ paused:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad)
|
||||
gst_base_sink_deactivate (GstBaseSink * basesink, GstPad * pad)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
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 */
|
||||
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 */
|
||||
|
@ -854,7 +856,7 @@ gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesink_activate_push (GstPad * pad, gboolean active)
|
||||
gst_base_sink_activate_push (GstPad * pad, gboolean active)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
GstBaseSink *basesink;
|
||||
|
@ -865,7 +867,7 @@ gst_basesink_activate_push (GstPad * pad, gboolean active)
|
|||
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;
|
||||
|
||||
|
@ -874,7 +876,7 @@ gst_basesink_activate_push (GstPad * pad, gboolean active)
|
|||
|
||||
/* 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;
|
||||
|
@ -884,16 +886,17 @@ gst_basesink_activate_pull (GstPad * pad, gboolean active)
|
|||
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);
|
||||
|
@ -921,7 +924,7 @@ gst_basesink_change_state (GstElement * 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;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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
|
||||
|
@ -28,12 +28,12 @@
|
|||
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)
|
||||
|
@ -43,12 +43,12 @@ typedef struct _GstBaseSinkClass GstBaseSinkClass;
|
|||
|
||||
/* 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 */
|
||||
|
@ -56,13 +56,13 @@ struct _GstBaseSink {
|
|||
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;
|
||||
|
@ -81,7 +81,7 @@ struct _GstBaseSinkClass {
|
|||
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
|
||||
|
@ -94,7 +94,7 @@ struct _GstBaseSinkClass {
|
|||
GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer);
|
||||
};
|
||||
|
||||
GType gst_basesink_get_type(void);
|
||||
GType gst_base_sink_get_type(void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
|
||||
#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
|
||||
|
@ -54,69 +54,69 @@ 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;
|
||||
|
@ -126,8 +126,8 @@ gst_basesrc_class_init (GstBaseSrcClass * klass)
|
|||
|
||||
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",
|
||||
|
@ -144,11 +144,12 @@ gst_basesrc_class_init (GstBaseSrcClass * klass)
|
|||
"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;
|
||||
|
@ -159,12 +160,12 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class)
|
|||
|
||||
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 ();
|
||||
|
@ -183,7 +184,7 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -191,7 +192,7 @@ gst_basesrc_set_live (GstBaseSrc * src, gboolean live)
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_basesrc_is_live (GstBaseSrc * src)
|
||||
gst_base_src_is_live (GstBaseSrc * src)
|
||||
{
|
||||
gboolean result;
|
||||
|
||||
|
@ -203,18 +204,18 @@ gst_basesrc_is_live (GstBaseSrc * src)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -232,13 +233,13 @@ gst_basesrc_query (GstPad * pad, GstQuery * query)
|
|||
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,
|
||||
|
@ -270,7 +271,7 @@ gst_basesrc_query (GstPad * pad, GstQuery * query)
|
|||
|
||||
#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 |
|
||||
|
@ -285,7 +286,7 @@ gst_basesrc_get_event_mask (GstPad * pad)
|
|||
#endif
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
|
||||
gst_base_src_do_seek (GstBaseSrc * src, GstEvent * event)
|
||||
{
|
||||
GstFormat format;
|
||||
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));
|
||||
|
||||
/* unblock streaming thread */
|
||||
gst_basesrc_unlock (src);
|
||||
gst_base_src_unlock (src);
|
||||
|
||||
/* grab streaming lock */
|
||||
GST_STREAM_LOCK (src->srcpad);
|
||||
|
@ -359,7 +360,7 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
|
|||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
|
@ -377,7 +378,7 @@ error:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
|
||||
gst_base_src_event_handler (GstPad * pad, GstEvent * event)
|
||||
{
|
||||
GstBaseSrc *src;
|
||||
GstBaseSrcClass *bclass;
|
||||
|
@ -391,7 +392,7 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
|
|||
|
||||
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;
|
||||
|
@ -410,7 +411,7 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
|
|||
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;
|
||||
|
@ -421,8 +422,8 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -434,11 +435,11 @@ gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
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);
|
||||
|
@ -447,7 +448,7 @@ gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -471,7 +472,7 @@ gst_basesrc_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -537,22 +538,22 @@ unexpected_length:
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -560,7 +561,7 @@ gst_basesrc_loop (GstPad * 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)
|
||||
goto eos;
|
||||
|
||||
|
@ -588,7 +589,7 @@ pause:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_unlock (GstBaseSrc * basesrc)
|
||||
gst_base_src_unlock (GstBaseSrc * basesrc)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
gboolean result = FALSE;
|
||||
|
@ -613,7 +614,7 @@ gst_basesrc_unlock (GstBaseSrc * basesrc)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size)
|
||||
gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
gboolean result = FALSE;
|
||||
|
@ -629,7 +630,7 @@ gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_is_seekable (GstBaseSrc * basesrc)
|
||||
gst_base_src_is_seekable (GstBaseSrc * basesrc)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
|
||||
|
@ -645,7 +646,7 @@ gst_basesrc_is_seekable (GstBaseSrc * basesrc)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_start (GstBaseSrc * basesrc)
|
||||
gst_base_src_start (GstBaseSrc * basesrc)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
gboolean result;
|
||||
|
@ -684,7 +685,7 @@ gst_basesrc_start (GstBaseSrc * basesrc)
|
|||
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
|
||||
|
@ -707,7 +708,7 @@ could_not_start:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_stop (GstBaseSrc * basesrc)
|
||||
gst_base_src_stop (GstBaseSrc * basesrc)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
gboolean result = TRUE;
|
||||
|
@ -726,7 +727,7 @@ gst_basesrc_stop (GstBaseSrc * basesrc)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
|
||||
gst_base_src_deactivate (GstBaseSrc * basesrc, GstPad * pad)
|
||||
{
|
||||
gboolean result;
|
||||
|
||||
|
@ -736,7 +737,7 @@ gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
|
|||
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);
|
||||
|
@ -745,7 +746,7 @@ gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_activate_push (GstPad * pad, gboolean active)
|
||||
gst_base_src_activate_push (GstPad * pad, gboolean active)
|
||||
{
|
||||
GstBaseSrc *basesrc;
|
||||
|
||||
|
@ -753,12 +754,12 @@ gst_basesrc_activate_push (GstPad * pad, gboolean active)
|
|||
|
||||
/* 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:
|
||||
|
@ -769,7 +770,7 @@ error_start:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_activate_pull (GstPad * pad, gboolean active)
|
||||
gst_base_src_activate_pull (GstPad * pad, gboolean active)
|
||||
{
|
||||
GstBaseSrc *basesrc;
|
||||
|
||||
|
@ -777,17 +778,17 @@ gst_basesrc_activate_pull (GstPad * pad, gboolean active)
|
|||
|
||||
/* 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:
|
||||
|
@ -798,7 +799,7 @@ error_start:
|
|||
}
|
||||
|
||||
static GstElementStateReturn
|
||||
gst_basesrc_change_state (GstElement * element)
|
||||
gst_base_src_change_state (GstElement * element)
|
||||
{
|
||||
GstBaseSrc *basesrc;
|
||||
GstElementStateReturn result = GST_STATE_SUCCESS;
|
||||
|
@ -844,7 +845,7 @@ gst_basesrc_change_state (GstElement * element)
|
|||
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:
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
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))
|
||||
|
@ -139,10 +139,10 @@ struct _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
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#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
|
||||
|
@ -52,71 +52,71 @@ 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;
|
||||
|
@ -126,9 +126,9 @@ gst_basesink_class_init (GstBaseSinkClass * klass)
|
|||
|
||||
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",
|
||||
|
@ -146,18 +146,18 @@ gst_basesink_class_init (GstBaseSinkClass * klass)
|
|||
"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;
|
||||
|
@ -182,7 +182,7 @@ gst_basesink_pad_getcaps (GstPad * pad)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesink_pad_setcaps (GstPad * pad, GstCaps * caps)
|
||||
gst_base_sink_pad_setcaps (GstPad * pad, GstCaps * caps)
|
||||
{
|
||||
GstBaseSinkClass *bclass;
|
||||
GstBaseSink *bsink;
|
||||
|
@ -198,7 +198,7 @@ gst_basesink_pad_setcaps (GstPad * pad, GstCaps * caps)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -217,7 +217,7 @@ gst_basesink_pad_buffer_alloc (GstPad * pad, guint64 offset, guint size,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
|
||||
gst_base_sink_init (GstBaseSink * basesink, gpointer g_class)
|
||||
{
|
||||
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");
|
||||
|
||||
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;
|
||||
|
@ -243,7 +243,7 @@ gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_basesink_finalize (GObject * object)
|
||||
gst_base_sink_finalize (GObject * object)
|
||||
{
|
||||
GstBaseSink *basesink;
|
||||
|
||||
|
@ -255,31 +255,31 @@ gst_basesink_finalize (GObject * object)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -289,7 +289,7 @@ gst_basesink_set_clock (GstElement * element, GstClock * clock)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -300,13 +300,13 @@ gst_basesink_set_property (GObject * object, guint prop_id,
|
|||
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:
|
||||
|
@ -322,7 +322,7 @@ gst_basesink_set_property (GObject * object, guint prop_id,
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -369,7 +369,7 @@ gst_base_sink_buffer_alloc (GstBaseSink * sink, guint64 offset, guint size,
|
|||
|
||||
/* 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;
|
||||
|
@ -387,10 +387,10 @@ gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ gst_basesink_preroll_queue_empty (GstBaseSink * basesink, GstPad * pad)
|
|||
|
||||
/* 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;
|
||||
|
@ -423,7 +423,7 @@ gst_basesink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad)
|
|||
|
||||
/* 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;
|
||||
|
@ -525,7 +525,7 @@ no_preroll:
|
|||
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;
|
||||
|
@ -539,7 +539,7 @@ flushing:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesink_event (GstPad * pad, GstEvent * event)
|
||||
gst_base_sink_event (GstPad * pad, GstEvent * event)
|
||||
{
|
||||
GstBaseSink *basesink;
|
||||
gboolean result = TRUE;
|
||||
|
@ -558,7 +558,8 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -570,7 +571,8 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
|
|||
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;
|
||||
}
|
||||
|
@ -585,7 +587,7 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
|
|||
/* 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) {
|
||||
|
@ -621,7 +623,7 @@ gst_basesink_event (GstPad * pad, GstEvent * event)
|
|||
* 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;
|
||||
|
@ -646,7 +648,7 @@ gst_basesink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
|
|||
* 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;
|
||||
|
||||
|
@ -696,7 +698,7 @@ gst_basesink_do_sync (GstBaseSink * basesink, GstBuffer * buffer)
|
|||
* 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;
|
||||
|
@ -761,12 +763,12 @@ gst_basesink_handle_event (GstBaseSink * basesink, GstEvent * event)
|
|||
* 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)
|
||||
|
@ -781,14 +783,14 @@ gst_basesink_handle_buffer (GstBaseSink * basesink, GstBuffer * buf)
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -796,7 +798,7 @@ gst_basesink_chain (GstPad * pad, GstBuffer * buf)
|
|||
/* 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;
|
||||
|
@ -810,7 +812,7 @@ gst_basesink_loop (GstPad * pad)
|
|||
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;
|
||||
|
||||
|
@ -823,7 +825,7 @@ paused:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad)
|
||||
gst_base_sink_deactivate (GstBaseSink * basesink, GstPad * pad)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
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 */
|
||||
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 */
|
||||
|
@ -854,7 +856,7 @@ gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesink_activate_push (GstPad * pad, gboolean active)
|
||||
gst_base_sink_activate_push (GstPad * pad, gboolean active)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
GstBaseSink *basesink;
|
||||
|
@ -865,7 +867,7 @@ gst_basesink_activate_push (GstPad * pad, gboolean active)
|
|||
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;
|
||||
|
||||
|
@ -874,7 +876,7 @@ gst_basesink_activate_push (GstPad * pad, gboolean active)
|
|||
|
||||
/* 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;
|
||||
|
@ -884,16 +886,17 @@ gst_basesink_activate_pull (GstPad * pad, gboolean active)
|
|||
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);
|
||||
|
@ -921,7 +924,7 @@ gst_basesink_change_state (GstElement * 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;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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
|
||||
|
@ -28,12 +28,12 @@
|
|||
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)
|
||||
|
@ -43,12 +43,12 @@ typedef struct _GstBaseSinkClass GstBaseSinkClass;
|
|||
|
||||
/* 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 */
|
||||
|
@ -56,13 +56,13 @@ struct _GstBaseSink {
|
|||
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;
|
||||
|
@ -81,7 +81,7 @@ struct _GstBaseSinkClass {
|
|||
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
|
||||
|
@ -94,7 +94,7 @@ struct _GstBaseSinkClass {
|
|||
GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer);
|
||||
};
|
||||
|
||||
GType gst_basesink_get_type(void);
|
||||
GType gst_base_sink_get_type(void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
|
||||
#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
|
||||
|
@ -54,69 +54,69 @@ 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;
|
||||
|
@ -126,8 +126,8 @@ gst_basesrc_class_init (GstBaseSrcClass * klass)
|
|||
|
||||
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",
|
||||
|
@ -144,11 +144,12 @@ gst_basesrc_class_init (GstBaseSrcClass * klass)
|
|||
"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;
|
||||
|
@ -159,12 +160,12 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class)
|
|||
|
||||
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 ();
|
||||
|
@ -183,7 +184,7 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -191,7 +192,7 @@ gst_basesrc_set_live (GstBaseSrc * src, gboolean live)
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_basesrc_is_live (GstBaseSrc * src)
|
||||
gst_base_src_is_live (GstBaseSrc * src)
|
||||
{
|
||||
gboolean result;
|
||||
|
||||
|
@ -203,18 +204,18 @@ gst_basesrc_is_live (GstBaseSrc * src)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -232,13 +233,13 @@ gst_basesrc_query (GstPad * pad, GstQuery * query)
|
|||
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,
|
||||
|
@ -270,7 +271,7 @@ gst_basesrc_query (GstPad * pad, GstQuery * query)
|
|||
|
||||
#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 |
|
||||
|
@ -285,7 +286,7 @@ gst_basesrc_get_event_mask (GstPad * pad)
|
|||
#endif
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
|
||||
gst_base_src_do_seek (GstBaseSrc * src, GstEvent * event)
|
||||
{
|
||||
GstFormat format;
|
||||
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));
|
||||
|
||||
/* unblock streaming thread */
|
||||
gst_basesrc_unlock (src);
|
||||
gst_base_src_unlock (src);
|
||||
|
||||
/* grab streaming lock */
|
||||
GST_STREAM_LOCK (src->srcpad);
|
||||
|
@ -359,7 +360,7 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
|
|||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
|
@ -377,7 +378,7 @@ error:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
|
||||
gst_base_src_event_handler (GstPad * pad, GstEvent * event)
|
||||
{
|
||||
GstBaseSrc *src;
|
||||
GstBaseSrcClass *bclass;
|
||||
|
@ -391,7 +392,7 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
|
|||
|
||||
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;
|
||||
|
@ -410,7 +411,7 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
|
|||
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;
|
||||
|
@ -421,8 +422,8 @@ gst_basesrc_event_handler (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -434,11 +435,11 @@ gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
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);
|
||||
|
@ -447,7 +448,7 @@ gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -471,7 +472,7 @@ gst_basesrc_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -537,22 +538,22 @@ unexpected_length:
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -560,7 +561,7 @@ gst_basesrc_loop (GstPad * 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)
|
||||
goto eos;
|
||||
|
||||
|
@ -588,7 +589,7 @@ pause:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_unlock (GstBaseSrc * basesrc)
|
||||
gst_base_src_unlock (GstBaseSrc * basesrc)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
gboolean result = FALSE;
|
||||
|
@ -613,7 +614,7 @@ gst_basesrc_unlock (GstBaseSrc * basesrc)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size)
|
||||
gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
gboolean result = FALSE;
|
||||
|
@ -629,7 +630,7 @@ gst_basesrc_get_size (GstBaseSrc * basesrc, guint64 * size)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_is_seekable (GstBaseSrc * basesrc)
|
||||
gst_base_src_is_seekable (GstBaseSrc * basesrc)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
|
||||
|
@ -645,7 +646,7 @@ gst_basesrc_is_seekable (GstBaseSrc * basesrc)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_start (GstBaseSrc * basesrc)
|
||||
gst_base_src_start (GstBaseSrc * basesrc)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
gboolean result;
|
||||
|
@ -684,7 +685,7 @@ gst_basesrc_start (GstBaseSrc * basesrc)
|
|||
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
|
||||
|
@ -707,7 +708,7 @@ could_not_start:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_stop (GstBaseSrc * basesrc)
|
||||
gst_base_src_stop (GstBaseSrc * basesrc)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
gboolean result = TRUE;
|
||||
|
@ -726,7 +727,7 @@ gst_basesrc_stop (GstBaseSrc * basesrc)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
|
||||
gst_base_src_deactivate (GstBaseSrc * basesrc, GstPad * pad)
|
||||
{
|
||||
gboolean result;
|
||||
|
||||
|
@ -736,7 +737,7 @@ gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
|
|||
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);
|
||||
|
@ -745,7 +746,7 @@ gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_activate_push (GstPad * pad, gboolean active)
|
||||
gst_base_src_activate_push (GstPad * pad, gboolean active)
|
||||
{
|
||||
GstBaseSrc *basesrc;
|
||||
|
||||
|
@ -753,12 +754,12 @@ gst_basesrc_activate_push (GstPad * pad, gboolean active)
|
|||
|
||||
/* 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:
|
||||
|
@ -769,7 +770,7 @@ error_start:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_basesrc_activate_pull (GstPad * pad, gboolean active)
|
||||
gst_base_src_activate_pull (GstPad * pad, gboolean active)
|
||||
{
|
||||
GstBaseSrc *basesrc;
|
||||
|
||||
|
@ -777,17 +778,17 @@ gst_basesrc_activate_pull (GstPad * pad, gboolean active)
|
|||
|
||||
/* 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:
|
||||
|
@ -798,7 +799,7 @@ error_start:
|
|||
}
|
||||
|
||||
static GstElementStateReturn
|
||||
gst_basesrc_change_state (GstElement * element)
|
||||
gst_base_src_change_state (GstElement * element)
|
||||
{
|
||||
GstBaseSrc *basesrc;
|
||||
GstElementStateReturn result = GST_STATE_SUCCESS;
|
||||
|
@ -844,7 +845,7 @@ gst_basesrc_change_state (GstElement * element)
|
|||
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:
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
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))
|
||||
|
@ -139,10 +139,10 @@ struct _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
|
||||
|
||||
|
|
Loading…
Reference in a new issue