On Fri, Nov 14, 2008 at 6:22 PM, Spencer, Matthew <[EMAIL PROTECTED]> wrote: > The problem I have with that approach however is that the elements will > be set to NULL after passing ownership to the bin, so I can no longer > use them in the functions. What I need is the ability to pass ownership > and change them into weak references for the rest of the function scope. > I don't suppose there is any way of achieving this is there?
With bin.add you take a ref of the element so you can keep them using in your function. Gr, Thijs > Matt > > -----Original Message----- > From: Thijs Vermeir [mailto:[EMAIL PROTECTED] > Sent: 14 November 2008 17:15 > To: Spencer, Matthew > Cc: vala-list@gnome.org > Subject: Re: [Vala] Problem with gstreamer bin > > On Fri, Nov 14, 2008 at 6:12 PM, Spencer, Matthew <[EMAIL PROTECTED]> > wrote: >> I thought it was something like this. Thanks for the feedback, this >> has fixed the problem. >> >> Reading through the documents, shouldn't I be able to do something > like: >> >> bin.add_many(#element1,#element2,#elemenr3) >> >> To indicate to valac the passing of ownership to the bin? > > Yes, that should also work. > > Gr, > Thijs > >> >> Matt >> >> -----Original Message----- >> From: Thijs Vermeir [mailto:[EMAIL PROTECTED] >> Sent: 14 November 2008 17:07 >> To: Spencer, Matthew >> Cc: vala-list@gnome.org >> Subject: Re: [Vala] Problem with gstreamer bin >> >> Hi, >> >> 2008/11/14 Spencer, Matthew <[EMAIL PROTECTED]>: >>> Hi Guys >>> >>> I am playing with Vala with a view to presenting information about it > >>> at our companies developer conference in a couple of weeks. With >>> this >> >>> in mind I am trying to build up a test application that shows video >>> playback using GStreamer. I am having problems with the following >> code: >>> >>> private Element createVideoBin() { >>> var bin=new Bin("videobin"); >>> var queue=ElementFactory.make("queue","queue"); >>> var sink=ElementFactory.make("autovideosink","videosink"); >>> var ghostPad=new GhostPad("sink",queue.get_pad("sink")); >>> bin.add_many(queue,sink); >>> queue.link(sink); >>> bin.add_pad(ghost); >>> return(bin); >>> } >> >> bin.add_many is the problem because the c function takes the >> ownership, but the bindings don't do it. Just use bin.add for every >> element as a workaround... >> >> Gr, >> Thijs >> >>> When attempting to use the returned bin, I get a segfault. This is >>> because (I think, on examining the generated C code) the elements are > >>> being unrefd before the bin is returned. I am sure this is not >> supposed to happen. >>> >>> I get a number of error messaged when running the app: >>> (mystreamer:16361): GStreamer-CRITICAL **: >>> Trying to dispose of object "videosink", but it still has a parent >>> "videobin". >>> You need to let the parent manage the object instead of unreffing the > >>> object directly. >>> >>> I am assuming this is because I need to inform the code that I wish >>> to >> >>> transfer ownership of the objects to the 'Bin', but how do I do this, > >>> and is there a way that this can be picked up by the compiler to >>> prevent this type of problem? >>> >>> Cheers >>> >>> Matt >>> ********************************************************************* >>> * >>> *********************************** >>> This e-mail is confidential, the property of NDS Ltd and intended for > >>> the addressee only. Any dissemination, copying or distribution of >>> this >> >>> message or any attachments by anyone other than the intended >>> recipient >> >>> is strictly prohibited. If you have received this message in error, >>> please immediately notify the [EMAIL PROTECTED] and destroy the >>> original message. Messages sent to and from NDS may be monitored. NDS > >>> cannot guarantee any message delivery method is secure or error-free. >>> Information could be intercepted, corrupted, lost, destroyed, arrive >> late or incomplete, or contain viruses. >>> We do not accept responsibility for any errors or omissions in this >>> message and/or attachment that arise as a result of transmission. You > >>> should carry out your own virus checks before opening any attachment. >>> Any views or opinions presented are solely those of the author and do > >>> not necessarily represent those of NDS. >>> >>> To protect the environment please do not print this e-mail unless >> necessary. >>> >>> NDS Limited Registered office: One Heathrow Boulevard, 286 Bath Road, > >>> West Drayton, Middlesex, UB7 0DQ, United Kingdom. A company >>> registered >> >>> in England and Wales Registered no. 3080780 VAT no. GB 603 8808 40-00 >>> ********************************************************************* >>> * >>> ************************************ >>> >>> _______________________________________________ >>> Vala-list mailing list >>> Vala-list@gnome.org >>> http://mail.gnome.org/mailman/listinfo/vala-list >>> >>> >> >> ********************************************************************** >> *********************************** >> This e-mail is confidential, the property of NDS Ltd and intended for > the addressee only. Any dissemination, copying or distribution of this > message or any attachments by anyone other than the intended recipient > is strictly prohibited. If you have received this message in error, > please immediately notify the [EMAIL PROTECTED] and destroy the > original message. Messages sent to and from NDS may be monitored. NDS > cannot guarantee any message delivery method is secure or error-free. > Information could be intercepted, corrupted, lost, destroyed, arrive > late or incomplete, or contain viruses. We do not accept responsibility > for any errors or omissions in this message and/or attachment that arise > as a result of transmission. You should carry out your own virus checks > before opening any attachment. Any views or opinions presented are > solely those of the author and do not necessarily represent those of > NDS. >> >> To protect the environment please do not print this e-mail unless > necessary. >> >> NDS Limited Registered office: One Heathrow Boulevard, 286 Bath Road, > West Drayton, Middlesex, UB7 0DQ, United Kingdom. A company registered > in England and Wales Registered no. 3080780 VAT no. GB 603 8808 40-00 >> ********************************************************************** >> ************************************ >> >> > > ********************************************************************************************************* > This e-mail is confidential, the property of NDS Ltd and intended for the > addressee only. Any dissemination, copying or distribution of this message > or any attachments by anyone other than the intended recipient is strictly > prohibited. If you have received this message in error, please immediately > notify the [EMAIL PROTECTED] and destroy the original message. Messages sent > to and from NDS may be monitored. NDS cannot guarantee any message delivery > method is secure or error-free. Information could be intercepted, corrupted, > lost, destroyed, arrive late or incomplete, or contain viruses. We do not > accept responsibility for any errors or omissions in this message and/or > attachment that arise as a result of transmission. You should carry out your > own virus checks before opening any attachment. Any views or opinions > presented are solely those of the author and do not necessarily represent > those of NDS. > > To protect the environment please do not print this e-mail unless necessary. > > NDS Limited Registered office: One Heathrow Boulevard, 286 Bath Road, West > Drayton, Middlesex, UB7 0DQ, United Kingdom. A company registered in England > and Wales Registered no. 3080780 VAT no. GB 603 8808 40-00 > ********************************************************************************************************** > > _______________________________________________ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list