[gst-devel] problem with g_object properties
Corentin Baron
corentin.baron at inrialpes.fr
Fri Apr 28 05:34:04 CEST 2006
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
More information about the gstreamer-devel
mailing list