Simple GValue and GstStructure Question

johnwesting john.blank.westing at gmail.com
Tue Feb 19 15:00:01 PST 2013


I apologize for trying to make my post easier for others to read by adding
the  tag to the 2 functions. I have read those documents, I still don't
understand. Here are the 2 functions I posted earlier:

void add_int_value_on_stack(GstStructure *struct, gint int_value)
{
   GValue gvalue = G_VALUE_INIT;

   g_value_init(&gvalue, G_TYPE_INT);

   g_value_set_int(&gvalue, int_value);

   // does gst_structure_set_value() create its own gvalue?
   gst_structure_set_value(struct, "field", &gvalue);

   // safe to unset?
   g_value_unset(&gvalue);
}

void add_int_value_on_heap(GstStructure *struct, gint int_value)
{
   GValue *gvalue;

   galue = malloc(sizeof(GValue));
   bzero(gvalue, sizeof(gvalue));

   // need to init if I malloced and zeroed??
   g_value_init(gvalue, G_TYPE_INT);

   g_value_set_int(gvalue, int_value);

   gst_structure_take_value(struct, "field", gvalue);
}




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Simple-GValue-and-GstStructure-Question-tp4658636p4658644.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list