[pygtk] newbie issues with Python GStreamer

Pablo Rodríguez oinos at web.de
Thu Aug 7 02:57:58 WST 2008


Hi there,

I'm totally new to programming (I can hardly understand Python only), 
although I managed to copy and paste code that seems to be able to 
record audio from mic to a file and to measure recording time 
(http://ousia.justfree.com/newaudiorec.py.txt with minimal GUI at 
http://ousia.justfree.com/audiorec-glade.txt [sorry for the txt 
extensions, my hosting provider doesn't allow other ones]).

But I have found some issues with Python GStreamer and after struggling 
with them for some time, I'm afraid that I cannot find a solution myself.

I'd really appreciate, if anyone would be so kind to help me with the 
following issues:

I have created a variable self.playing setting it to True or False. I 
guess there is a proper form using self.player.get_state() and 
gst.STATE_PLAYING, but how can I write that in a single conditional? I 
don't have the slightest idea on how to do it.

According to what I understand from (Python) GStreamer documentation, 
the get_last_stream_time() method should return the already recorded 
time when invoked. Why does it always return 0 on my code? Am I missing 
something or doing something wrong?

The most important issue that I cannot avoid is that the recorded file 
doesn't contain all audio sent to the mic (before 
set_state(gst.STATE_NULL)). It seems that the recorded file doesn't get 
the final part of the data in the pipeline. It might be even so if I 
understood “Controlled shutdown of live sources in applications” (at 
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseSrc.html). 
There is an explanation on how to solve that, but I don't understand a 
word of it (and the code is Greek to me). Could anyone be so kind to 
adapt the code contained there to Python? (I guess it would be also 
useful for the “Python GStreamer Tutorial”.)

Thanks,


Pablo




More information about the pygtk mailing list