[Vala] How to keep an object alive if it's going out of scope
- From: "Jaap A. Haitsma" <jaap haitsma org>
- To: vala-list <vala-list gnome org>
- Subject: [Vala] How to keep an object alive if it's going out of scope
- Date: Mon, 2 Jun 2008 08:16:44 +0200
Hi,
I'm working on porting cheese to vala. I'm running into a problem when
trying to convert gst-audio-play.c [1] to vala.
The gst-audio-play has a function play_file and what it does is the
following in semi vala code
public static play_file (string filename) {
var audio = new Audio (filename);
audio.play (); // Playing starts in another thread
// In vala audio gets unreffed here, but I want it to be unreffed
after it receives an EOS (end of stream) in the other thread
}
How can I get this to work in vala. I could ofcourse make sure there
is just one Audio object which I create at the start of the program,
but that has the disadvantage that I can just play one stream at the
time. I'd like to see that if a user calll play_file 10 times that she
hears the 10 files.
Thanks
Jaap
[1] http://svn.gnome.org/viewvc/cheese/trunk/src/gst-audio-play.c?revision=384&view=markup
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]