tools: flesh out element-maker templates
This commit is contained in:
parent
90a2cd5cc5
commit
fbbb708e9f
@ -209,7 +209,7 @@ generate | sed \
|
|||||||
-e "s/GstReplace/$GstReplace/g" \
|
-e "s/GstReplace/$GstReplace/g" \
|
||||||
-e "s/gst_replace/$gst_replace/g" \
|
-e "s/gst_replace/$gst_replace/g" \
|
||||||
-e "s/gstreplace/$gstreplace/g" \
|
-e "s/gstreplace/$gstreplace/g" \
|
||||||
-e "s/replace/$replace/g" >myexample.c
|
-e "s/replace/$replace/g" >$gstreplace.c
|
||||||
|
|
||||||
generate_header | sed \
|
generate_header | sed \
|
||||||
-e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \
|
-e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \
|
||||||
@ -221,13 +221,13 @@ generate_header | sed \
|
|||||||
-e "s/GstReplace/$GstReplace/g" \
|
-e "s/GstReplace/$GstReplace/g" \
|
||||||
-e "s/gst_replace/$gst_replace/g" \
|
-e "s/gst_replace/$gst_replace/g" \
|
||||||
-e "s/gstreplace/$gstreplace/g" \
|
-e "s/gstreplace/$gstreplace/g" \
|
||||||
-e "s/replace/$replace/g" >myexample.h
|
-e "s/replace/$replace/g" >$gstreplace.h
|
||||||
|
|
||||||
gst-indent myexample.c
|
gst-indent $gstreplace.c
|
||||||
|
|
||||||
echo pkg is $pkg
|
echo pkg is $pkg
|
||||||
|
|
||||||
gcc -Wall $(pkg-config --cflags gstreamer-0.10 $pkg) -c -o myexample.o myexample.c
|
gcc -Wall $(pkg-config --cflags gstreamer-0.10 $pkg) -c -o $gstreplace.o $gstreplace.c
|
||||||
gcc -shared -o myexample.so myexample.o $(pkg-config --libs gstreamer-0.10 $pkg)
|
gcc -shared -o $gstreplace.so $gstreplace.o $(pkg-config --libs gstreamer-0.10 $pkg)
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ gst_replace_dispose (GObject * object)
|
|||||||
|
|
||||||
/* clean up as possible. may be called multiple times */
|
/* clean up as possible. may be called multiple times */
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -30,9 +30,23 @@ static gboolean gst_replace_unlock_stop (GstBaseSink * sink);
|
|||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_replace_render_list (GstBaseSink * sink, GstBufferList * buffer_list);
|
gst_replace_render_list (GstBaseSink * sink, GstBufferList * buffer_list);
|
||||||
% declare-class
|
% declare-class
|
||||||
GstBaseSink *base_sink_class = GST_BASE_SINK (klass);
|
GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
|
||||||
% set-methods
|
% set-methods
|
||||||
base_sink_class-> = GST_DEBUG_FUNCPTR (gst_replace_);
|
base_sink_class->get_caps = GST_DEBUG_FUNCPTR (gst_replace_get_caps);
|
||||||
|
base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
|
||||||
|
base_sink_class->buffer_alloc = GST_DEBUG_FUNCPTR (gst_replace_buffer_alloc);
|
||||||
|
base_sink_class->get_times = GST_DEBUG_FUNCPTR (gst_replace_get_times);
|
||||||
|
base_sink_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
|
||||||
|
base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
|
||||||
|
base_sink_class->unlock = GST_DEBUG_FUNCPTR (gst_replace_unlock);
|
||||||
|
base_sink_class->event = GST_DEBUG_FUNCPTR (gst_replace_event);
|
||||||
|
base_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_replace_preroll);
|
||||||
|
base_sink_class->render = GST_DEBUG_FUNCPTR (gst_replace_render);
|
||||||
|
base_sink_class->async_play = GST_DEBUG_FUNCPTR (gst_replace_async_play);
|
||||||
|
base_sink_class->activate_pull = GST_DEBUG_FUNCPTR (gst_replace_activate_pull);
|
||||||
|
base_sink_class->fixate = GST_DEBUG_FUNCPTR (gst_replace_fixate);
|
||||||
|
base_sink_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_replace_unlock_stop);
|
||||||
|
base_sink_class->render_list = GST_DEBUG_FUNCPTR (gst_replace_render_list);
|
||||||
% methods
|
% methods
|
||||||
|
|
||||||
|
|
||||||
@ -40,12 +54,14 @@ static GstCaps *
|
|||||||
gst_replace_get_caps (GstBaseSink * sink)
|
gst_replace_get_caps (GstBaseSink * sink)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_set_caps (GstBaseSink * sink, GstCaps * caps)
|
gst_replace_set_caps (GstBaseSink * sink, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
@ -53,6 +69,7 @@ gst_replace_buffer_alloc (GstBaseSink * sink, guint64 offset, guint size,
|
|||||||
GstCaps * caps, GstBuffer ** buf)
|
GstCaps * caps, GstBuffer ** buf)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -66,48 +83,56 @@ static gboolean
|
|||||||
gst_replace_start (GstBaseSink * sink)
|
gst_replace_start (GstBaseSink * sink)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_stop (GstBaseSink * sink)
|
gst_replace_stop (GstBaseSink * sink)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_unlock (GstBaseSink * sink)
|
gst_replace_unlock (GstBaseSink * sink)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_event (GstBaseSink * sink, GstEvent * event)
|
gst_replace_event (GstBaseSink * sink, GstEvent * event)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_replace_preroll (GstBaseSink * sink, GstBuffer * buffer)
|
gst_replace_preroll (GstBaseSink * sink, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_replace_render (GstBaseSink * sink, GstBuffer * buffer)
|
gst_replace_render (GstBaseSink * sink, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
gst_replace_async_play (GstBaseSink * sink)
|
gst_replace_async_play (GstBaseSink * sink)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return GST_STATE_CHANGE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_activate_pull (GstBaseSink * sink, gboolean active)
|
gst_replace_activate_pull (GstBaseSink * sink, gboolean active)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -120,11 +145,16 @@ static gboolean
|
|||||||
gst_replace_unlock_stop (GstBaseSink * sink)
|
gst_replace_unlock_stop (GstBaseSink * sink)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_replace_render_list (GstBaseSink * sink, GstBufferList * buffer_list)
|
gst_replace_render_list (GstBaseSink * sink, GstBufferList * buffer_list)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
% end
|
% end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,119 +32,205 @@ static gboolean
|
|||||||
gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
|
gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
|
||||||
GstSegment * segment);
|
GstSegment * segment);
|
||||||
% declare-class
|
% declare-class
|
||||||
GstBaseSrc *base_src_class = GST_BASE_SRC (klass);
|
GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
|
||||||
% set-methods
|
% set-methods
|
||||||
base_src_class-> = GST_DEBUG_FUNCPTR (gst_replace_);
|
base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_replace_get_caps);
|
||||||
|
base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
|
||||||
|
base_src_class->negotiate = GST_DEBUG_FUNCPTR (gst_replace_negotiate);
|
||||||
|
base_src_class->newsegment = GST_DEBUG_FUNCPTR (gst_replace_newsegment);
|
||||||
|
base_src_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
|
||||||
|
base_src_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
|
||||||
|
base_src_class->get_times = GST_DEBUG_FUNCPTR (gst_replace_get_times);
|
||||||
|
base_src_class->get_size = GST_DEBUG_FUNCPTR (gst_replace_get_size);
|
||||||
|
base_src_class->is_seekable = GST_DEBUG_FUNCPTR (gst_replace_is_seekable);
|
||||||
|
base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_replace_unlock);
|
||||||
|
base_src_class->event = GST_DEBUG_FUNCPTR (gst_replace_event);
|
||||||
|
base_src_class->create = GST_DEBUG_FUNCPTR (gst_replace_create);
|
||||||
|
base_src_class->do_seek = GST_DEBUG_FUNCPTR (gst_replace_do_seek);
|
||||||
|
base_src_class->query = GST_DEBUG_FUNCPTR (gst_replace_query);
|
||||||
|
base_src_class->check_get_range = GST_DEBUG_FUNCPTR (gst_replace_check_get_range);
|
||||||
|
base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_replace_fixate);
|
||||||
|
base_src_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_replace_unlock_stop);
|
||||||
|
base_src_class->prepare_seek_segment = GST_DEBUG_FUNCPTR (gst_replace_prepare_seek_segment);
|
||||||
|
|
||||||
% methods
|
% methods
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
gst_replace_get_caps (GstBaseSrc * src)
|
gst_replace_get_caps (GstBaseSrc * src)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "get_caps");
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps)
|
gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "set_caps");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_negotiate (GstBaseSrc * src)
|
gst_replace_negotiate (GstBaseSrc * src)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "negotiate");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_newsegment (GstBaseSrc * src)
|
gst_replace_newsegment (GstBaseSrc * src)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "newsegment");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_start (GstBaseSrc * src)
|
gst_replace_start (GstBaseSrc * src)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "start");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_stop (GstBaseSrc * src)
|
gst_replace_stop (GstBaseSrc * src)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "stop");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
|
gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
|
||||||
GstClockTime * start, GstClockTime * end)
|
GstClockTime * start, GstClockTime * end)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "get_times");
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_get_size (GstBaseSrc * src, guint64 * size)
|
gst_replace_get_size (GstBaseSrc * src, guint64 * size)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "get_size");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_is_seekable (GstBaseSrc * src)
|
gst_replace_is_seekable (GstBaseSrc * src)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "is_seekable");
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_unlock (GstBaseSrc * src)
|
gst_replace_unlock (GstBaseSrc * src)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "unlock");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_event (GstBaseSrc * src, GstEvent * event)
|
gst_replace_event (GstBaseSrc * src, GstEvent * event)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "event");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_replace_create (GstBaseSrc * src, guint64 offset, guint size,
|
gst_replace_create (GstBaseSrc * src, guint64 offset, guint size,
|
||||||
GstBuffer ** buf)
|
GstBuffer ** buf)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "create");
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_do_seek (GstBaseSrc * src, GstSegment * segment)
|
gst_replace_do_seek (GstBaseSrc * src, GstSegment * segment)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "do_seek");
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_query (GstBaseSrc * src, GstQuery * query)
|
gst_replace_query (GstBaseSrc * src, GstQuery * query)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "query");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_check_get_range (GstBaseSrc * src)
|
gst_replace_check_get_range (GstBaseSrc * src)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "get_range");
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_replace_fixate (GstBaseSrc * src, GstCaps * caps)
|
gst_replace_fixate (GstBaseSrc * src, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "fixate");
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_unlock_stop (GstBaseSrc * src)
|
gst_replace_unlock_stop (GstBaseSrc * src)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "stop");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
|
gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
|
||||||
GstSegment * segment)
|
GstSegment * segment)
|
||||||
{
|
{
|
||||||
|
GstReplace *replace = GST_REPLACE (src);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (replace, "seek_segment");
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
% end
|
% end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user