List Info

Thread: problem with g_object properties




problem with g_object properties
user name
2006-04-28 12:33:25
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&qu
ot;));
    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


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
gstreamer-devel mailing list
gstreamer-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
problem with g_object properties
user name
2006-04-28 13:20:48
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 



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
gstreamer-devel mailing list
gstreamer-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )