[pyar] Hola mundo

Lautaro Woites lauchapc87 en gmail.com
Dom Mayo 19 19:13:40 ART 2013


Hola gente,
                 los conocí en la pycon 2012. Demoré un poco pero al fin me
enlisté.
Les dejo mi Hello world, requiere de gstreamer-0.10, gst-plugins-good y su
binding para python:

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

#!/usr/bin/env python2

import sys, os, time, thread
import glib, gobject
import pygst
pygst.require("0.10")
import gst

def on_message(bus, message):
    t = message.type
    if t == gst.MESSAGE_ERROR:
        err, debug = message.parse_error()
        print "Error: %s" % err, debug
    if t == gst.MESSAGE_EOS or t == gst.MESSAGE_ERROR:
        player.set_state(gst.STATE_NULL)
        loop.quit()

def start():
    player.set_state(gst.STATE_PLAYING)
    time.sleep(1)


player = gst.parse_launch('videotestsrc pattern=1 ! video/x-raw-yuv,
width=720, height=576 ! textoverlay text="Hello World" halignment=1
valignment=4 font-desc=70 ! ffmpegcolorspace !xvimagesink')
bus = player.get_bus()
bus.add_signal_watch()
bus.connect("message", on_message)

thread.start_new_thread(start, ())
gobject.threads_init()
loop = glib.MainLoop()
loop.run()
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20130519/05bbad0d/attachment.html>


More information about the pyar mailing list