[jokosher-devel] Ticket 7 : C->python



Hello!
I'm new in the Jokosher  mailing list and I want to help on Jokosher
development.
To get familiar to gstreamer and python bindings, I worked on ticket 7
(http://jokosher.python-hosting.com/ticket/7). I converted the C code
into python. You can find the result in attached file!

If you can tell me what I can do in the same order of difficulty (that
is basic things), I want to help!
-- 
Fabrice Silva <silva crans org>
#! /usr/bin/env python

import gst
from types import *

elt = gst.element_factory_make('alsasrc')
# must set proper device to get precise caps 
elt.set_property('device','hw:0')
elt.set_state(gst.STATE_READY)

# open device (so caps are probed)
pad = elt.get_pad("src")
caps = pad.get_caps()
val = caps[0]["rate"]

if True :
	if isinstance(val, IntType) :
		print 'Supported sample rate = %d' % (val)
	elif isinstance(val, gst.IntRange) :
		print 'Supported sample rate = %d - %d' % (val.low,val.high)
	elif isinstance(val, list) :
		for i in range(len(val)):
			print 'Supported sample rate %02u/%02u = %d' % (i,len(val),val[i])

# and get rid
elt.set_state(gst.STATE_NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]