gst_clock_id_wait_async equivalent in Python

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

gst_clock_id_wait_async equivalent in Python

EmbeddedMicro
I need an equivalent to gst_clock_id_wait_async() for python. I need to reproduce these lines from gst-plugins-good/tests/examples/spectrum/demo-audiotest.c

gst_clock_id_wait_async (clock_id, delayed_spectrum_update, (gpointer) spect);
gst_clock_id_unref (clock_id);

Here is what I have
import rb
import gst
import serial

class LEDcube(rb.Plugin):

        def activate(self, shell):
                self.max = -60
                self.spectrum = gst.element_factory_make("spectrum")
                self.spectrum.set_property('bands',70)
                self.spectrum.set_property('interval',10000000)
                self.spectrum.set_property('threshold',-50)

                player = shell.get_player().props.player
                player.add_filter(self.spectrum)

                bus = player.props.bus

                if bus is None:
                        self.bus_id = player.connect('notify::bus', self.bus_notify)
                else:
                        self.bus_id = player.props.bus.connect('message', self.on_message)

                self.ser = serial.Serial('/dev/ttyS0', 115200, timeout=1)

        def deactivate(self, shell):
                player = shell.get_player().props.player

                player.remove_filter(self.spectrum)
                player.props.bus.disconnect(self.bus_id)
                self.bus_id = 0

        def bus_notify(self, obj, pspec):
                obj.disconnect(self.bus_id)
                self.bus_id = obj.props.bus.connect('message', self.on_message)

        def on_message(self, bus, message):
                clock = self.spectrum.get_clock()
                if message.src == self.spectrum and message.structure.has_key('magnitude') and clock:
                        magnitudes = message.structure['magnitude']
                        time = message.structure['running-time'] + message.structure['duration']
                       
                        clock_id = clock.new_single_shot_id(time + self.spectrum.get_base_time())

                        clock_id.wait_async() #NEED SOMETHING LIKE THIS
                        clock_id.unref()

                        self.ser.write("\x35")
                        for i in range(0, 27):
                                mag = (50 + int(round(magnitudes[i]))) * 1.4

                                red = (mag * mag / 25) + 1
                                green = ((50 - mag) * mag / 25) + 1

                                if red > 51:
                                        red = 51
                                if green > 51:
                                        green = 51

                                self.ser.write(chr(int(round(red))))
                                self.ser.write(chr(int(round(green))))
Thanks,
Justin
Reply | Threaded
Open this post in threaded view
|

Re: gst_clock_id_wait_async equivalent in Python

Edward Hervey
Administrator
Hi,

  The gst.ClockId objects are not wrapped properly yet in gst-python.

  There is a patch that needs deeper reviewing here :
http://bugzilla.gnome.org/show_bug.cgi?id=380495

    Edward

On Tue, 2009-05-05 at 15:58 -0700, EmbeddedMicro wrote:

> I need an equivalent to gst_clock_id_wait_async() for python. I need to
> reproduce these lines from
> gst-plugins-good/tests/examples/spectrum/demo-audiotest.c
>
> gst_clock_id_wait_async (clock_id, delayed_spectrum_update, (gpointer)
> spect);
> gst_clock_id_unref (clock_id);
>
> Here is what I have
> import rb
> > import gst
> > import serial
> >
> > class LEDcube(rb.Plugin):
> >
> > def activate(self, shell):
> > self.max = -60
> > self.spectrum = gst.element_factory_make("spectrum")
> > self.spectrum.set_property('bands',70)
> > self.spectrum.set_property('interval',10000000)
> > self.spectrum.set_property('threshold',-50)
> >
> > player = shell.get_player().props.player
> > player.add_filter(self.spectrum)
> >
> > bus = player.props.bus
> >
> > if bus is None:
> > self.bus_id = player.connect('notify::bus', self.bus_notify)
> > else:
> > self.bus_id = player.props.bus.connect('message', self.on_message)
> >
> > self.ser = serial.Serial('/dev/ttyS0', 115200, timeout=1)
> >
> > def deactivate(self, shell):
> > player = shell.get_player().props.player
> >
> > player.remove_filter(self.spectrum)
> > player.props.bus.disconnect(self.bus_id)
> > self.bus_id = 0
> >
> > def bus_notify(self, obj, pspec):
> > obj.disconnect(self.bus_id)
> > self.bus_id = obj.props.bus.connect('message', self.on_message)
> >
> > def on_message(self, bus, message):
> > clock = self.spectrum.get_clock()
> > if message.src == self.spectrum and
> > message.structure.has_key('magnitude') and clock:
> > magnitudes = message.structure['magnitude']
> > time = message.structure['running-time'] +
> > message.structure['duration']
> >
> > clock_id = clock.new_single_shot_id(time +
> > self.spectrum.get_base_time())
> >
> > clock_id.wait_async() #NEED SOMETHING LIKE THIS
> > clock_id.unref()
> >
> > self.ser.write("\x35")
> > for i in range(0, 27):
> > mag = (50 + int(round(magnitudes[i]))) * 1.4
> >
> > red = (mag * mag / 25) + 1
> > green = ((50 - mag) * mag / 25) + 1
> >
> > if red > 51:
> > red = 51
> > if green > 51:
> > green = 51
> >
> > self.ser.write(chr(int(round(red))))
> > self.ser.write(chr(int(round(green))))
>
> Thanks,
> Justin


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Simple example of RTSP

cammille
In reply to this post by EmbeddedMicro
Hi,

I would like to do an application which can emit/receive the flows from a
webcam and a micro. But I have problems with the caps. I have to
copy/paste the caps to decode the flows and I don't want to do that.

Does RTSP permit to send data and read it without copying/pasting the caps ?
If, it permits to do that can you give me a simple example to do that
please ?

I'm a newbie, and I have some difficulties.

Thank you for your help.


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Simple example of BUFFER

Guilherme Raymo Longo
hey mates...

Any ideia how can I use GstBuffer property?
I could not find any example of GstBuffer implemented.

Tks!

-------------------

Guilherme Longo
Dept. Eng. da Computação
Unaerp

Linux User - #484927

*Before Asking
http://www.istf.com.br/?page=perguntas

!- I'd rather die on my feet than live on my knees -!




------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Simple example of BUFFER

Stefan Sauer
Guilherme schrieb:
> hey mates...
>
> Any ideia how can I use GstBuffer property?
> I could not find any example of GstBuffer implemented.
>
> Tks!
>  
Could you please consider starting new threads and not hijack existing
threads by replying to random emails and changing the topic.
thanks

Stefan

> -------------------
>
> Guilherme Longo
> Dept. Eng. da Computação
> Unaerp
>
> Linux User - #484927
>
> *Before Asking
> http://www.istf.com.br/?page=perguntas
>
> !- I'd rather die on my feet than live on my knees -!
>
>
>
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>  


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gst_clock_id_wait_async equivalent in Python

EmbeddedMicro
In reply to this post by Edward Hervey
It's been awhile since I checked, have the clockid objects been wrapped?
Thanks,
Justin
Reply | Threaded
Open this post in threaded view
|

Re: gst_clock_id_wait_async equivalent in Python

Tim-Philipp Müller-2
On Sat, 2009-07-04 at 10:50 -0700, EmbeddedMicro wrote:

> It's been awhile since I checked, have the clockid objects been wrapped?

This bug looks relevant:
http://bugzilla.gnome.org/show_bug.cgi?id=380495

Cheers
 -Tim



------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel