From: Corentin B. <cor...@in...> - 2006-04-28 12:33:44
|
Hello, I'm writing a gstreamer plugin for a video streaming library we use at work (called blinky, but that's not the point here), and I've got a problem with my plugin's properties. When I set the property at first, it seems correctly set, but alas when I set the state of my test pipeline to PLAYING the property is broken. Here's the set_property function of my plugin (the g_print()s deserve to be deleted): static void gst_blinkysrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GstBlinkySrc *filter; g_return_if_fail (GST_IS_BLINKYSRC (object)); filter = GST_BLINKYSRC (object); switch (prop_id) { case ARG_SILENT: filter->silent = g_value_get_boolean (value); g_print("gstblinky: set silent to %s\n", (filter->silent==TRUE?"true":"false")); break; case ARG_BL_DEVICE: filter->blinkydevice = g_value_get_string(value); g_print("gstblinky: set device to %s\n", filter->blinkydevice); break; case ARG_BL_SYNCHRONIZE: filter->blinkysync = g_value_get_boolean(value); g_print("gstblinky: set sync to %s\n", (filter->blinkysync==TRUE?"true":"false")); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } here's my test program instanciation and set_property() part: pipeline = gst_thread_new("blinkytest"); blinkysrc = gst_element_factory_make("BlinkySrc", "Source"); if (blinkysrc == NULL) { g_print("Error instanciating blinky source.\n"); return -1; } // Affichage d'infos sur le plugin : g_print(" * %s instanciated.\n", gst_element_get_name(blinkysrc)); videosink = gst_element_factory_make("autovideosink", "video"); g_print(" * %s instanciated.\n", gst_element_get_name(videosink)); g_object_set(G_OBJECT(blinkysrc), "sync", TRUE, NULL); g_object_set(G_OBJECT(blinkysrc), "silent", FALSE, NULL); g_object_set(G_OBJECT(blinkysrc), "device", argv[1], NULL); g_print(" * properties set for %s\n", gst_element_get_name(blinkysrc)); and here's the output of my test program: $ ./Debug/BlinkyGstTest 2 * Begin. * gst_init done. * argc checked. * Source instanciated. * video instanciated. gstblinky: set sync to true gstblinky: set silent to false gstblinky: set device to 2 * properties set for Source * elements connected and added to the bin connexion to blinky device \uffff\uffff... BlinkyConnexion_Create: blinkyBEOpen(\uffff\uffff) failed I think it could be a pointer problem, but the property seems correctly set first, and broken when I try to use it. Any gst_plugin pro out there who could help? thx, Corentin BARON |
From: Thomas V. S. <th...@ap...> - 2006-04-28 12:45:30
|
(SNIP) > I'm writing a gstreamer plugin for a video streaming library we use at > work (called blinky, but that's not the point here), and I've got a > problem with my plugin's properties. When I set the property at first, > it seems correctly set, but alas when I set the state of my test > pipeline to PLAYING the property is broken. You should also show were you register your object properties, it is possible you made a mistake there. Thomas |
From: Corentin B. <cor...@in...> - 2006-04-28 13:08:42
|
Thomas Vander Stichele wrote: >(SNIP) > > > >>I'm writing a gstreamer plugin for a video streaming library we use at >>work (called blinky, but that's not the point here), and I've got a >>problem with my plugin's properties. When I set the property at first, >>it seems correctly set, but alas when I set the state of my test >>pipeline to PLAYING the property is broken. >> >> > >You should also show were you register your object properties, it is >possible you made a mistake there. > >Thomas > > The properties are registered in the class_init function: static void gst_blinkysrc_class_init (GstBlinkySrcClass *klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; gobject_class = (GObjectClass*) klass; gstelement_class = (GstElementClass*) klass; parent_class = g_type_class_ref (GST_TYPE_ELEMENT); g_object_class_install_property (gobject_class, ARG_SILENT, g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?", FALSE, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_BL_DEVICE, g_param_spec_string ("device", "Device", "Blinky device to get data from.", "0", G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_BL_SYNCHRONIZE, g_param_spec_boolean ("sync", "Synchronize", "Synchronize with blinky device ?", FALSE, G_PARAM_READWRITE)); gobject_class->set_property = gst_blinkysrc_set_property; gobject_class->get_property = gst_blinkysrc_get_property; gstelement_class->change_state = gst_blinky_src_change_state; } I used a plugin template perl script made by Luca Ognibene to generate the skeleton of my plugin. Thx, Corentin. |
From: James \Doc\ L. <doc...@gm...> - 2006-04-28 13:20:28
|
On Fri, 2006-04-28 at 14:33 +0200, Corentin Baron wrote: > case ARG_BL_DEVICE: > filter->blinkydevice = g_value_get_string(value); > g_print("gstblinky: set device to %s\n", filter->blinkydevice); > break; You need to use g_value_dup_string here. You're using the GValue's copy of the string, which will get freed when the GValue is destroyed (before g_object_set finishes). Cheers, James "Doc" Livingston -- >> After all, everybody's got a water buffalo. -- Ben Coleman > in their machine room. -- Nix with the candlestick. -- Christian Bauernfeind |
From: Corentin B. <cor...@in...> - 2006-04-28 13:31:22
|
James "Doc" Livingston wrote: >On Fri, 2006-04-28 at 14:33 +0200, Corentin Baron wrote: > > >> case ARG_BL_DEVICE: >> filter->blinkydevice = g_value_get_string(value); >> g_print("gstblinky: set device to %s\n", filter->blinkydevice); >> break; >> >> > >You need to use g_value_dup_string here. You're using the GValue's copy >of the string, which will get freed when the GValue is destroyed (before >g_object_set finishes). > > >Cheers, > >James "Doc" Livingston > > That worked, thanks ! cheers, Corentin. |