MediaPlayer Application failed - g_value_set_object failed.
Tim-Philipp Müller
t.i.m at zen.co.uk
Fri Jan 4 07:32:55 PST 2013
On Thu, 2013-01-03 at 20:29 -0800, Harikumar wrote:
Hi,
> I am creating the structure.
>
> struct plugin {
> MyPgmInfo *pgminfo;
> ...
> ...
> }
>
> In one of my save program method i allocate a memory for pgminfo.
> {
> MyPgmInfo *pgminfo;
> pgminfo = g_new0(sizeof(MyPgmInfo), 1);
> /* Save elements */
>
> /* Assign to global structure */
> plugin->pgminfo = pgminfo;
>
> }
Ok, things allocated like that are not GObjects (just putting GObject or
GstElement at the beginning of a structure doesn't make it a valid
object).
Objects are created using g_object_new (your_object_get_type (), NULL)
or so (and require all the GObject boilerplate stuff then).
Your property should probably be of a different type then.
You could make it a simple gpointer property - but then no memory
management is done at all, you just pass a pointer and hope it stays
valid as long as it's being used.
A step up from that is a 'boxed' property. You can easily create a boxed
GType for your custom structure by specifying a copy function and a free
function. Then the type system knows how to copy/free your struct and
can make a copy for the application when it does a g_object_get(). The
"copy"/"free" can also be a simple ref/unref of course.
Cheers
-Tim
More information about the gstreamer-devel
mailing list