mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
275 lines
6.5 KiB
C
275 lines
6.5 KiB
C
/* vim: set filetype=c: */
|
|
|
|
% instance-members
|
|
GstPad *srcpad;
|
|
% prototypes
|
|
|
|
static GstCaps* gst_replace_src_getcaps (GstPad *pad);
|
|
static gboolean gst_replace_src_setcaps (GstPad *pad, GstCaps *caps);
|
|
static gboolean gst_replace_src_acceptcaps (GstPad *pad, GstCaps *caps);
|
|
static void gst_replace_src_fixatecaps (GstPad *pad, GstCaps *caps);
|
|
static gboolean gst_replace_src_activate (GstPad *pad);
|
|
static gboolean gst_replace_src_activatepush (GstPad *pad, gboolean active);
|
|
static gboolean gst_replace_src_activatepull (GstPad *pad, gboolean active);
|
|
static GstPadLinkReturn gst_replace_src_link (GstPad *pad, GstPad *peer);
|
|
static void gst_replace_src_unlink (GstPad *pad);
|
|
static GstFlowReturn gst_replace_src_getrange (GstPad *pad, guint64 offset, guint length,
|
|
GstBuffer **buffer);
|
|
static gboolean gst_replace_src_event (GstPad *pad, GstEvent *event);
|
|
static gboolean gst_replace_src_query (GstPad *pad, GstQuery *query);
|
|
static GstIterator * gst_replace_src_iterintlink (GstPad *pad);
|
|
|
|
% pad-template
|
|
static GstStaticPadTemplate gst_replace_src_template =
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
GST_PAD_SRC,
|
|
GST_PAD_ALWAYS,
|
|
GST_STATIC_CAPS ("application/unknown")
|
|
);
|
|
|
|
% base-init
|
|
gst_element_class_add_static_pad_template (element_class,
|
|
&gst_replace_src_template);
|
|
% instance-init
|
|
|
|
replace->srcpad = gst_pad_new_from_static_template (&gst_replace_src_template
|
|
,
|
|
"src");
|
|
gst_pad_set_getcaps_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_getcaps));
|
|
gst_pad_set_setcaps_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_setcaps));
|
|
gst_pad_set_acceptcaps_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_acceptcaps));
|
|
gst_pad_set_fixatecaps_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_fixatecaps));
|
|
gst_pad_set_activate_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_activate));
|
|
gst_pad_set_activatepush_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_activatepush));
|
|
gst_pad_set_activatepull_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_activatepull));
|
|
gst_pad_set_link_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_link));
|
|
gst_pad_set_unlink_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_unlink));
|
|
gst_pad_set_getrange_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_getrange));
|
|
gst_pad_set_event_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_event));
|
|
gst_pad_set_query_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_query));
|
|
gst_pad_set_iterate_internal_links_function (replace->srcpad,
|
|
GST_DEBUG_FUNCPTR(gst_replace_src_iterintlink));
|
|
gst_element_add_pad (GST_ELEMENT(replace), replace->srcpad);
|
|
|
|
|
|
% methods
|
|
|
|
static GstCaps*
|
|
gst_replace_src_getcaps (GstPad *pad)
|
|
{
|
|
GstReplace *replace;
|
|
GstCaps *caps;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "getcaps");
|
|
|
|
caps = gst_pad_get_pad_template_caps (pad);
|
|
|
|
gst_object_unref (replace);
|
|
return caps;
|
|
}
|
|
|
|
static gboolean
|
|
gst_replace_src_setcaps (GstPad *pad, GstCaps *caps)
|
|
{
|
|
GstReplace *replace;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "setcaps");
|
|
|
|
|
|
gst_object_unref (replace);
|
|
return TRUE;
|
|
}
|
|
|
|
static gboolean
|
|
gst_replace_src_acceptcaps (GstPad *pad, GstCaps *caps)
|
|
{
|
|
GstReplace *replace;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "acceptcaps");
|
|
|
|
|
|
gst_object_unref (replace);
|
|
return TRUE;
|
|
}
|
|
|
|
static void
|
|
gst_replace_src_fixatecaps (GstPad *pad, GstCaps *caps)
|
|
{
|
|
GstReplace *replace;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "fixatecaps");
|
|
|
|
|
|
gst_object_unref (replace);
|
|
}
|
|
|
|
static gboolean
|
|
gst_replace_src_activate (GstPad *pad)
|
|
{
|
|
GstReplace *replace;
|
|
gboolean ret;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "activate");
|
|
|
|
if (gst_pad_check_pull_range (pad)) {
|
|
GST_DEBUG_OBJECT (pad, "activating pull");
|
|
ret = gst_pad_activate_pull (pad, TRUE);
|
|
} else {
|
|
GST_DEBUG_OBJECT (pad, "activating push");
|
|
ret = gst_pad_activate_push (pad, TRUE);
|
|
}
|
|
|
|
gst_object_unref (replace);
|
|
return ret;
|
|
}
|
|
|
|
static gboolean
|
|
gst_replace_src_activatepush (GstPad *pad, gboolean active)
|
|
{
|
|
GstReplace *replace;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "activatepush");
|
|
|
|
|
|
gst_object_unref (replace);
|
|
return TRUE;
|
|
}
|
|
|
|
static gboolean
|
|
gst_replace_src_activatepull (GstPad *pad, gboolean active)
|
|
{
|
|
GstReplace *replace;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "activatepull");
|
|
|
|
|
|
gst_object_unref (replace);
|
|
return TRUE;
|
|
}
|
|
|
|
static GstPadLinkReturn
|
|
gst_replace_src_link (GstPad *pad, GstPad *peer)
|
|
{
|
|
GstReplace *replace;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "link");
|
|
|
|
|
|
gst_object_unref (replace);
|
|
return GST_PAD_LINK_OK;
|
|
}
|
|
|
|
static void
|
|
gst_replace_src_unlink (GstPad *pad)
|
|
{
|
|
GstReplace *replace;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "unlink");
|
|
|
|
|
|
gst_object_unref (replace);
|
|
}
|
|
|
|
static GstFlowReturn
|
|
gst_replace_src_getrange (GstPad *pad, guint64 offset, guint length,
|
|
GstBuffer **buffer)
|
|
{
|
|
GstReplace *replace;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "getrange");
|
|
|
|
|
|
gst_object_unref (replace);
|
|
return GST_FLOW_OK;
|
|
}
|
|
|
|
static gboolean
|
|
gst_replace_src_event (GstPad *pad, GstEvent *event)
|
|
{
|
|
gboolean res;
|
|
GstReplace *replace;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "event");
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
default:
|
|
res = gst_pad_event_default (pad, event);
|
|
break;
|
|
}
|
|
|
|
gst_object_unref (replace);
|
|
return res;
|
|
}
|
|
|
|
static gboolean
|
|
gst_replace_src_query (GstPad *pad, GstQuery *query)
|
|
{
|
|
gboolean res;
|
|
GstReplace *replace;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "query");
|
|
|
|
switch (GST_QUERY_TYPE(query)) {
|
|
default:
|
|
res = gst_pad_query_default (pad, query);
|
|
break;
|
|
}
|
|
|
|
gst_object_unref (replace);
|
|
return res;
|
|
}
|
|
|
|
static GstIterator *
|
|
gst_replace_src_iterintlink (GstPad *pad)
|
|
{
|
|
GstReplace *replace;
|
|
GstIterator *iter;
|
|
|
|
replace = GST_REPLACE (gst_pad_get_parent (pad));
|
|
|
|
GST_DEBUG_OBJECT(replace, "iterintlink");
|
|
|
|
iter = gst_pad_iterate_internal_links_default (pad);
|
|
|
|
gst_object_unref (replace);
|
|
return iter;
|
|
}
|
|
|
|
% end
|
|
|