No element "testsink"
iron_guitarist1987
jtrinidadperez at gmail.com
Mon Jul 16 13:39:27 PDT 2012
Hello all,
I've made a simple sink element that accepts a data structure as an input,
but when I try to run it i get the following:
$gst-launch testsrc ! testsink
WARNING: erroneous pipeline: no element "testsink"
$ gst-inspect testsink
Plugin Details:
Name: testsink
Description: inter sink element
Filename: /usr/lib/gstreamer-0.10/libTESTSINK.so
Version: 0.10
License: Proprietary
Source module: gst-plugins-inter
Binary package: INTER Plugins source release
Origin URL:
inter: testsink
1 features:
+-- 1 elements
Here is the code:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
#include <gst/video/video.h>
#include "gsttestsink.h"
#include "interfaces.h"
GST_DEBUG_CATEGORY_STATIC (gst_testsink_debug);
#define GST_CAT_DEFAULT gst_testsink_debug
/* prototypes */
static void gst_testsink_set_property (GObject * object,
guint property_id, const GValue * value, GParamSpec * pspec);
static void gst_testsink_get_property (GObject * object,
guint property_id, GValue * value, GParamSpec * pspec);
static void gst_testsink_dispose (GObject * object);
static void gst_testsink_finalize (GObject * object);
static GstCaps *gst_testsink_get_caps (GstBaseSink * sink);
static gboolean gst_testsink_set_caps (GstBaseSink * sink,
GstCaps * caps);
static GstFlowReturn gst_testsink_buffer_alloc (GstBaseSink * sink,
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
static void gst_testsink_get_times (GstBaseSink * sink,
GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
static gboolean gst_testsink_start (GstBaseSink * sink);
static gboolean gst_testsink_stop (GstBaseSink * sink);
static gboolean gst_testsink_unlock (GstBaseSink * sink);
static gboolean gst_testsink_event (GstBaseSink * sink,
GstEvent * event);
static GstFlowReturn gst_testsink_preroll (GstBaseSink * sink,
GstBuffer * buffer);
static GstFlowReturn gst_testsink_render (GstBaseSink * sink,
GstBuffer * buffer);
static GstStateChangeReturn gst_testsink_async_play (GstBaseSink *
sink);
static gboolean gst_testsink_activate_pull (GstBaseSink * sink,
gboolean active);
static gboolean gst_testsink_unlock_stop (GstBaseSink * sink);
enum
{
PROP_0
};
/* pad templates */
static GstStaticPadTemplate gst_testsink_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("struct/inter")
);
/* class initialization */
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_testsink_debug, "testsink", 0, \
"debug category for testsink element");
GST_BOILERPLATE_FULL (GstTestsink, gst_testsink, GstBaseSink,
GST_TYPE_BASE_SINK, DEBUG_INIT);
static void
gst_testsink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_testsink_sink_template));
gst_element_class_set_details_simple (element_class, "testsink",
"sink/inter", "A test sink for inter structures", "Jason Trinidad");
}
static void
gst_testsink_class_init (GstTestsinkClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
gobject_class->set_property = gst_testsink_set_property;
gobject_class->get_property = gst_testsink_get_property;
gobject_class->dispose = gst_testsink_dispose;
gobject_class->finalize = gst_testsink_finalize;
base_sink_class->get_caps = GST_DEBUG_FUNCPTR (gst_testsink_get_caps);
base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_testsink_set_caps);
if (0)
base_sink_class->buffer_alloc =
GST_DEBUG_FUNCPTR (gst_testsink_buffer_alloc);
base_sink_class->get_times =
GST_DEBUG_FUNCPTR (gst_testsink_get_times);
base_sink_class->start = GST_DEBUG_FUNCPTR (gst_testsink_start);
base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_testsink_stop);
base_sink_class->unlock = GST_DEBUG_FUNCPTR (gst_testsink_unlock);
if (0)
base_sink_class->event = GST_DEBUG_FUNCPTR (gst_testsink_event);
//if (0)
base_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_testsink_preroll);
base_sink_class->render = GST_DEBUG_FUNCPTR (gst_testsink_render);
if (0)
base_sink_class->async_play =
GST_DEBUG_FUNCPTR (gst_testsink_async_play);
if (0)
base_sink_class->activate_pull =
GST_DEBUG_FUNCPTR (gst_testsink_activate_pull);
base_sink_class->unlock_stop =
GST_DEBUG_FUNCPTR (gst_testsink_unlock_stop);
}
static void
gst_testsink_init (GstTestsink * testsink,
GstTestsinkClass * testsink_class)
{
testsink->sinkpad =
gst_pad_new_from_static_template (&gst_testsink_sink_template,
"sink");
}
void
gst_testsink_set_property (GObject * object, guint property_id,
const GValue * value, GParamSpec * pspec)
{
/* GstTestsink *testsink = GST_TESTSINK (object); */
switch (property_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
void
gst_testsink_get_property (GObject * object, guint property_id,
GValue * value, GParamSpec * pspec)
{
/* GstTestsink *testsink = GST_TESTSINK (object); */
switch (property_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
void
gst_testsink_dispose (GObject * object)
{
/* GstTestsink *testsink = GST_TESTSINK (object); */
/* clean up as possible. may be called multiple times */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
void
gst_testsink_finalize (GObject * object)
{
/* GstTestsink *testsink = GST_TESTSINK (object); */
/* clean up object here */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GstCaps *
gst_testsink_get_caps (GstBaseSink * sink)
{
return NULL;
}
static gboolean
gst_testsink_set_caps (GstBaseSink * sink, GstCaps * caps)
{
return TRUE;
}
static GstFlowReturn
gst_testsink_buffer_alloc (GstBaseSink * sink, guint64 offset,
guint size, GstCaps * caps, GstBuffer ** buf)
{
return GST_FLOW_ERROR;
}
static void
gst_testsink_get_times (GstBaseSink * sink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end)
{
GstTestsink *testsink = GST_TESTSINK (sink);
if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) {
*start = GST_BUFFER_TIMESTAMP (buffer);
if (GST_BUFFER_DURATION_IS_VALID (buffer)) {
*end = *start + GST_BUFFER_DURATION (buffer);
}
}
}
static gboolean
gst_testsink_start (GstBaseSink * sink)
{
return TRUE;
}
static gboolean
gst_testsink_stop (GstBaseSink * sink)
{
GstTestsink *testsink = GST_TESTSINK (sink);
return TRUE;
}
static gboolean
gst_testsink_unlock (GstBaseSink * sink)
{
return TRUE;
}
static gboolean
gst_testsink_event (GstBaseSink * sink, GstEvent * event)
{
return TRUE;
}
static GstFlowReturn
gst_testsink_preroll (GstBaseSink * sink, GstBuffer * buffer)
{
//return gst_testsink_render (sink, buffer);
return GST_FLOW_OK;
}
static GstFlowReturn
gst_testsink_render (GstBaseSink * sink, GstBuffer * buffer)
{
GstTestsink *testsink = GST_TESTSINK (sink);
InterDetectedObjectSet *inter;
inter = (InterDetectedObjectSet *) GST_BUFFER_DATA (buffer);
g_print("%d\n", inter->boundingBoxHeight);
return GST_FLOW_OK;
}
static GstStateChangeReturn
gst_testsink_async_play (GstBaseSink * sink)
{
return GST_STATE_CHANGE_SUCCESS;
}
static gboolean
gst_testsink_activate_pull (GstBaseSink * sink, gboolean active)
{
return TRUE;
}
static gboolean
gst_testsink_unlock_stop (GstBaseSink * sink)
{
return TRUE;
}
static gboolean
testsink_init (GstPlugin * testsink)
{
/* debug category for fltering log messages
*
* exchange the string 'Template georeg' with your description
*/
GST_DEBUG_CATEGORY_INIT (gst_testsink_debug, "testsink",
0, "INTER Sink");
return gst_element_register (testsink, "inter", GST_RANK_NONE,
GST_TYPE_TESTSINK);
}
#ifndef PACKAGE
#define PACKAGE "testsink"
#endif
/* gstreamer looks for this structure to register georeg
*/
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"testsink",
"INTER sink element",
testsink_init,
VERSION,
"Proprietary",
GST_PACKAGE_NAME,
"http://inter.eoir.com/"
)
Thank you
-----
The greatest trick the devil ever pulled was convincing the World that Java was better than C++.
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/No-element-testsink-tp4655623.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list