Linked list test src
iron_guitarist1987
jtrinidadperez at gmail.com
Mon Jul 2 07:04:15 PDT 2012
I'm trying to create a source element that outputs a linked list. I am
getting the following error:
gst-launch vpeftestsrc ! filesink location=test.log
..
Pipeline is PREROLLING ...
(gst-launch-0.10:16208): GStreamer-CRITICAL **: gst_buffer_create_sub:
assertion `buffer->mini_object.refcount > 0' failed
Caught SIGSEGV accessing address (nil)
Any suggestions? Thanks.
Code:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <gst/controller/gstcontroller.h>
#include <gst/gst.h>
#include "cgmtestsrc.h"
GST_DEBUG_CATEGORY_STATIC (cgm_test_src_debug);
#define GST_CAT_DEFAULT cgm_test_src_debug
enum
{
PROP_0,
PROP_LAST
};
static GstStaticPadTemplate gst_cgm_test_src_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("struct/cgm")
);
GST_BOILERPLATE (GstCgmtestsrc, gst_cgm_test_src, GstBaseSrc,
GST_TYPE_BASE_SRC);
static void gst_cgm_test_src_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_cgm_test_src_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_cgm_test_src_create (GstBaseSrc * basesrc,
guint64 offset, guint length, GstBuffer ** buffer);
static void
gst_cgm_test_src_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_cgm_test_src_src_template));
gst_element_class_set_details_simple (element_class,
"CGM test source", "struct/cgm",
"Creates a linked list",
"Jason Trinidad");
}
static void
gst_cgm_test_src_class_init (GstCgmtestsrcClass * klass)
{
GObjectClass *gobject_class;
GstBaseSrcClass *gstbasesrc_class;
gobject_class = (GObjectClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass;
gobject_class->set_property = gst_cgm_test_src_set_property;
gobject_class->get_property = gst_cgm_test_src_get_property;
gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_cgm_test_src_create);
}
static void
gst_cgm_test_src_init (GstCgmtestsrc * src, GstCgmtestsrcClass * g_class)
{
GstPad *pad = GST_BASE_SRC_PAD (src);
/* we operate in time */
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
gst_base_src_set_blocksize (GST_BASE_SRC (src), -1);
}
static GstFlowReturn
gst_cgm_test_src_create (GstBaseSrc * basesrc, guint64 offset,
guint length, GstBuffer ** buffer)
{
GstFlowReturn res;
GstCgmtestsrc *src;
src = GST_CGM_TEST_SRC (basesrc);
GstBuffer *buf;
CgmSet cgm;
buf = gst_buffer_new_allocate(NULL, sizeof(cgm), NULL);
buf = &cgm;
*buffer = buf;
return GST_FLOW_OK;
}
static void
gst_cgm_test_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstCgmtestsrc *src = GST_CGM_TEST_SRC (object);
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_cgm_test_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstCgmtestsrc *src = GST_CGM_TEST_SRC (object);
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static gboolean
plugin_init (GstPlugin * plugin)
{
/* initialize gst controller library */
gst_controller_init (NULL, NULL);
GST_DEBUG_CATEGORY_INIT (cgm_test_src_debug, "cgmtestsrc", 0,
"Cgm Test Source");
return gst_element_register (plugin, "cgmtestsrc",
GST_RANK_NONE, GST_TYPE_CGM_TEST_SRC);
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"cgmtestsrc",
"Creates test struct",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
This is what the struct looks like in the header file
typedef struct _CgmDetectedObjectSet CgmDetectedObjectSet;
struct _CgmDetectedObjectSet {
gdouble sigma1;
gdouble sigma2;
gdouble rho12;
CgmDetectedObjectSet * next;
};
-----
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/Linked-list-test-src-tp4655460.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list