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; };
All your bases are belong to us.
|
On Mon, Jul 02, 2012 at 07:04:15AM -0700, iron_guitarist1987 wrote:
> 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) [...] > 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; What is CgmSet ? > buf = gst_buffer_new_allocate(NULL, sizeof(cgm), NULL); > buf = &cgm; Here you are overwriting the value returned by gst_buffer_new_allocate() with CgmSet which is local to the function and will be destroyed when the function returns. > > *buffer = buf; > > return GST_FLOW_OK; > } Cheers, -- GPG-Key: 0xA3FD0DF7 - 9F73 032E EAC9 F7AD 951F 280E CB66 8E29 A3FD 0DF7 Debian User and Developer. Homepage: www.foolab.org _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Sorry, it's supposed to say typedef struct CgmDetectedObjectSet, instead of CgmSet.
It is defined in the header file as typedef struct _CgmDetectedObjectSet CgmDetectedObjectSet; struct _CgmDetectedObjectSet { gdouble sigma1; gdouble sigma2; gdouble rho12; CgmDetectedObjectSet * next; };
All your bases are belong to us.
|
Anyone have any recommendations? Thanks.
All your bases are belong to us.
|
On Tue, Jul 3, 2012 at 12:44 PM, iron_guitarist1987
<[hidden email]> wrote: > Anyone have any recommendations? Thanks. Several issues, the primary one being that you aren't treating the GstBuffer as an object; data is but one property of a buffer, you must also specify size, timestamp, etc. You need to malloc or new the struct and set it using GST_BUFFER_DATA and GST_BUFFER_MALLOCDATA, or preferably use gst_pad_alloc_buffer which does all of this and can be more efficient. -Josh _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
I'm sorry for being naive, but I'm still learning gstreamer. I changed my create function, but now I'm getting the following:
$ gst-launch cgmtestsrc ! fakesink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Caught SIGSEGV accessing address 0xc5ae2e Spinning. Please run 'gdb gst-launch 5078' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core. ^CCaught interrupt -- handling interrupt. Interrupt: Stopping pipeline ... ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... 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); CgmDetectedObjectSet* cgm; static CgmDetectedObjectSet * prev; gint8 len; //Setting some default values for testing. cgm->boundingBoxHeight = 50; cgm->boundingBoxTopLeftCornerX=0; cgm->boundingBoxTopLeftCornerY=50; cgm->boundingBoxWidth=50; len = sizeof(cgm); GST_BUFFER_MALLOCDATA (buffer) = g_malloc (len); GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buf); GST_BUFFER_SIZE (buffer) = len; GST_BUFFER_DATA (buffer) = &cgm; return GST_FLOW_OK; }
All your bases are belong to us.
|
Free forum by Nabble | Edit this page |