make examples use Element

Original commit message from CVS:
make examples use Element
parent 0ffd6e38
2003-10-05 Thomas Vander Stichele <thomas at apestaart dot org>
* examples/gstreamer/*.py: use Element over gst_element_factory_make
2003-10-05 Thomas Vander Stichele <thomas at apestaart dot org>
* gstreamer/gstreamermodule.c: (init_gstreamer):
......
......@@ -45,15 +45,13 @@ class BPS(object):
gtk.main_quit()
def fakesrc(self, buffers):
src = gst_element_factory_make('fakesrc','src')
assert src
src = Element('fakesrc','src')
src.set_property('silent', 1)
src.set_property('num_buffers', buffers)
return src
def fakesink(self):
sink = gst_element_factory_make('fakesink','sink')
assert sink
sink = Element('fakesink','sink')
sink.set_property('silent', 1)
return sink
......
......@@ -38,16 +38,10 @@ def filter(filters):
# create a new bin to hold the elements
bin = Pipeline('pipeline')
filesrc = gst_element_factory_make('filesrc', 'source');
if not filesrc:
print 'could not find plugin \"filesrc\"'
return -1
filesrc = Element('filesrc', 'source');
filesrc.set_property('location', sys.argv[1])
filesink = gst_element_factory_make('filesink', 'sink')
if not filesink:
print 'could not find plugin \"filesink\"'
return -1
filesink = Element('filesink', 'sink')
filesink.set_property('location', sys.argv[2])
elements = [filesrc] + filters + [filesink]
......@@ -77,10 +71,7 @@ def main():
#gst_info_set_categories(-1)
#gst_debug_set_categories(-1)
stats = gst_element_factory_make ('statistics', 'stats');
if not stats:
print 'could not find plugin \"statistics\"'
return -1
stats = Element ('statistics', 'stats');
stats.set_property('silent', 0)
stats.set_property('buffer_update_freq', 1)
stats.set_property('update_on_eos', 1)
......
......@@ -108,39 +108,32 @@ class DVDPlayer(object):
self.v_thread = Thread('v_thread')
assert self.v_thread
self.v_queue = gst_element_factory_make('queue','v_queue')
assert self.v_queue
self.v_queue = Element('queue','v_queue')
self.v_decode = gst_element_factory_make('mpeg2dec','decode_video')
assert self.v_decode
self.v_decode = Element('mpeg2dec','decode_video')
self.color = gst_element_factory_make('colorspace','color')
assert self.color
self.color = Element('colorspace','color')
self.efx = gst_element_factory_make('identity','identity')
#self.efx = gst_element_factory_make('edgeTV','EdgeTV')
#self.efx = gst_element_factory_make('agingTV','AgingTV')
self.efx = Element('identity','identity')
#self.efx = Element('edgeTV','EdgeTV')
#self.efx = Element('agingTV','AgingTV')
#effectv: diceTV: DiceTV
#effectv: warpTV: WarpTV
#effectv: shagadelicTV: ShagadelicTV
#effectv: vertigoTV: VertigoTV
#self.efx = gst_element_factory_make('revTV','RevTV')
#self.efx = gst_element_factory_make('quarkTV','QuarkTV')
assert self.efx
#self.efx = Element('revTV','RevTV')
#self.efx = Element('quarkTV','QuarkTV')
self.color2 = gst_element_factory_make('colorspace','color2')
assert self.color2
self.color2 = Element('colorspace','color2')
self.show = gst_element_factory_make('xvideosink','show')
#self.show = gst_element_factory_make('sdlvideosink','show')
#self.show = gst_element_factory_make('fakesink','fakesinkv')
assert self.show
self.show = Element('xvideosink','show')
#self.show = Element('sdlvideosink','show')
#self.show = Element('fakesink','fakesinkv')
#self.show.set_property('silent', 0)
#self.show.set_property('sync', 1)
#self.deinterlace = gst_element_factory_make('deinterlace','deinterlace')
self.deinterlace = gst_element_factory_make('identity','deinterlace')
assert self.deinterlace
#self.deinterlace = Element('deinterlace','deinterlace')
self.deinterlace = Element('identity','deinterlace')
last = None
for e in (self.v_queue, self.v_decode, self.color, self.efx, self.color2, self.deinterlace, self.show):
......@@ -160,15 +153,12 @@ class DVDPlayer(object):
self.a_thread = Thread('a_thread')
assert self.a_thread
self.a_queue = gst_element_factory_make('queue','a_queue')
assert self.a_queue
self.a_queue = Element('queue','a_queue')
self.a_decode = gst_element_factory_make('a52dec','decode_audio')
assert self.a_decode
self.a_decode = Element('a52dec','decode_audio')
self.osssink = gst_element_factory_make('osssink','osssink')
#self.osssink = gst_element_factory_make('fakesink','fakesinka')
assert self.osssink
self.osssink = Element('osssink','osssink')
#self.osssink = Element('fakesink','fakesinka')
#self.osssink.set_property('silent', 0)
#self.osssink.set_property('sync', 0)
......@@ -183,8 +173,7 @@ class DVDPlayer(object):
self.pipeline = Pipeline('pipeline')
assert self.pipeline
self.src = gst_element_factory_make('dvdreadsrc','src');
assert self.src
self.src = Element('dvdreadsrc','src');
self.src.connect('deep_notify',self.dnprint)
self.src.set_property('location', self.location)
......@@ -192,8 +181,7 @@ class DVDPlayer(object):
self.src.set_property('chapter', self.chapter)
self.src.set_property('angle', self.angle)
self.parse = gst_element_factory_make('mpegdemux','parse')
assert self.parse
self.parse = Element('mpegdemux','parse')
self.parse.set_property('sync', 0)
self.pipeline.add(self.src)
......
......@@ -33,14 +33,12 @@ def main():
bin = Pipeline('pipeline')
assert bin
src = gst_element_factory_make('fakesrc', 'src')
assert src
src = Element('fakesrc', 'src')
src.connect('handoff', handoff)
src.set_property('silent', 1)
src.set_property('num_buffers', 10)
sink = gst_element_factory_make('fakesink', 'sink')
assert sink
sink = Element('fakesink', 'sink')
sink.connect('handoff', handoff)
src.set_property('silent', 1)
......
......@@ -34,13 +34,11 @@ def build(filters, b):
# create a new bin to hold the elements
bin = Pipeline('pipeline')
src = gst_element_factory_make('fakesrc', 'source');
assert src
src = Element('fakesrc', 'source');
src.set_property('silent', 1)
src.set_property('num_buffers', b)
sink = gst_element_factory_make('fakesink', 'sink')
assert sink
sink = Element('fakesink', 'sink')
sink.set_property('silent', 1)
elements = [src] + filters + [sink]
......@@ -65,8 +63,7 @@ def filter(bin):
ccnt = 0
def c():
global ccnt
id = gst_element_factory_make ('identity', 'c identity %d' % ccnt);
assert id
id = Element ('identity', 'c identity %d' % ccnt);
id.set_property('silent', 1)
id.set_property('loop_based', 0)
ccnt += 1
......
......@@ -63,8 +63,7 @@ def identity_add(pipeline, first, count):
for i in range(count):
name = 'identity_%03d' % i
ident = gst_element_factory_make('identity', name)
assert ident
ident = Element('identity', name)
ident.set_property('silent', 1)
pipeline.add(ident)
last.get_pad('src').link(ident.get_pad('sink'))
......@@ -73,16 +72,14 @@ def identity_add(pipeline, first, count):
return last
def fakesrc():
src = gst_element_factory_make('fakesrc','src')
assert src
src = Element('fakesrc','src')
src.set_property('silent', 1)
src.set_property('num_buffers', iterations)
src.connect('handoff', handoff_src)
return src
def fakesink():
sink = gst_element_factory_make('fakesink','fakesink')
assert sink
sink = Element('fakesink','fakesink')
sink.set_property('silent', 1)
sink.connect('handoff', handoff_sink)
return sink
......@@ -126,8 +123,7 @@ def queue(argv):
assert src
src_thr.add(src)
src_q = gst_element_factory_make('queue','src_q')
assert src_q
src_q = Element('queue','src_q')
src_thr.add(src_q)
src.get_pad('src').link(src_q.get_pad('sink'))
......@@ -135,8 +131,7 @@ def queue(argv):
last = identity_add(pipeline, src_q, idents)
sink_q = gst_element_factory_make('queue','sink_q')
assert sink_q
sink_q = Element('queue','sink_q')
pipeline.add(sink_q)
last.get_pad('src').link(sink_q.get_pad('sink'))
......
......@@ -109,24 +109,15 @@ def main():
bin = Pipeline('pipeline')
# create a disk reader
filesrc = gst_element_factory_make ('filesrc', 'disk_source');
if not filesrc:
print 'could not find plugin \"filesrc\"'
return -1
filesrc = Element ('filesrc', 'disk_source')
filesrc.set_property('location', sys.argv[1])
# now get the decoder
decoder = gst_element_factory_make ('vorbisfile', 'parse');
if not decoder:
print 'could not find plugin \"vorbisfile\"'
return -1
decoder = Element ('vorbisfile', 'parse')
decoder.connect('notify', decoder_notified)
# and an audio sink
osssink = gst_element_factory_make ('osssink', 'play_audio')
if not osssink:
print 'could not find plugin \"osssink\"'
return -1
osssink = Element ('osssink', 'play_audio')
# add objects to the main pipeline
for e in (filesrc, decoder, osssink):
......
......@@ -45,15 +45,13 @@ class BPS(object):
gtk.main_quit()
def fakesrc(self, buffers):
src = gst_element_factory_make('fakesrc','src')
assert src
src = Element('fakesrc','src')
src.set_property('silent', 1)
src.set_property('num_buffers', buffers)
return src
def fakesink(self):
sink = gst_element_factory_make('fakesink','sink')
assert sink
sink = Element('fakesink','sink')
sink.set_property('silent', 1)
return sink
......
......@@ -38,16 +38,10 @@ def filter(filters):
# create a new bin to hold the elements
bin = Pipeline('pipeline')
filesrc = gst_element_factory_make('filesrc', 'source');
if not filesrc:
print 'could not find plugin \"filesrc\"'
return -1
filesrc = Element('filesrc', 'source');
filesrc.set_property('location', sys.argv[1])
filesink = gst_element_factory_make('filesink', 'sink')
if not filesink:
print 'could not find plugin \"filesink\"'
return -1
filesink = Element('filesink', 'sink')
filesink.set_property('location', sys.argv[2])
elements = [filesrc] + filters + [filesink]
......@@ -77,10 +71,7 @@ def main():
#gst_info_set_categories(-1)
#gst_debug_set_categories(-1)
stats = gst_element_factory_make ('statistics', 'stats');
if not stats:
print 'could not find plugin \"statistics\"'
return -1
stats = Element ('statistics', 'stats');
stats.set_property('silent', 0)
stats.set_property('buffer_update_freq', 1)
stats.set_property('update_on_eos', 1)
......
......@@ -108,39 +108,32 @@ class DVDPlayer(object):
self.v_thread = Thread('v_thread')
assert self.v_thread
self.v_queue = gst_element_factory_make('queue','v_queue')
assert self.v_queue
self.v_queue = Element('queue','v_queue')
self.v_decode = gst_element_factory_make('mpeg2dec','decode_video')
assert self.v_decode
self.v_decode = Element('mpeg2dec','decode_video')
self.color = gst_element_factory_make('colorspace','color')
assert self.color
self.color = Element('colorspace','color')
self.efx = gst_element_factory_make('identity','identity')
#self.efx = gst_element_factory_make('edgeTV','EdgeTV')
#self.efx = gst_element_factory_make('agingTV','AgingTV')
self.efx = Element('identity','identity')
#self.efx = Element('edgeTV','EdgeTV')
#self.efx = Element('agingTV','AgingTV')
#effectv: diceTV: DiceTV
#effectv: warpTV: WarpTV
#effectv: shagadelicTV: ShagadelicTV
#effectv: vertigoTV: VertigoTV
#self.efx = gst_element_factory_make('revTV','RevTV')
#self.efx = gst_element_factory_make('quarkTV','QuarkTV')
assert self.efx
#self.efx = Element('revTV','RevTV')
#self.efx = Element('quarkTV','QuarkTV')
self.color2 = gst_element_factory_make('colorspace','color2')
assert self.color2
self.color2 = Element('colorspace','color2')
self.show = gst_element_factory_make('xvideosink','show')
#self.show = gst_element_factory_make('sdlvideosink','show')
#self.show = gst_element_factory_make('fakesink','fakesinkv')
assert self.show
self.show = Element('xvideosink','show')
#self.show = Element('sdlvideosink','show')
#self.show = Element('fakesink','fakesinkv')
#self.show.set_property('silent', 0)
#self.show.set_property('sync', 1)
#self.deinterlace = gst_element_factory_make('deinterlace','deinterlace')
self.deinterlace = gst_element_factory_make('identity','deinterlace')
assert self.deinterlace
#self.deinterlace = Element('deinterlace','deinterlace')
self.deinterlace = Element('identity','deinterlace')
last = None
for e in (self.v_queue, self.v_decode, self.color, self.efx, self.color2, self.deinterlace, self.show):
......@@ -160,15 +153,12 @@ class DVDPlayer(object):
self.a_thread = Thread('a_thread')
assert self.a_thread
self.a_queue = gst_element_factory_make('queue','a_queue')
assert self.a_queue
self.a_queue = Element('queue','a_queue')
self.a_decode = gst_element_factory_make('a52dec','decode_audio')
assert self.a_decode
self.a_decode = Element('a52dec','decode_audio')
self.osssink = gst_element_factory_make('osssink','osssink')
#self.osssink = gst_element_factory_make('fakesink','fakesinka')
assert self.osssink
self.osssink = Element('osssink','osssink')
#self.osssink = Element('fakesink','fakesinka')
#self.osssink.set_property('silent', 0)
#self.osssink.set_property('sync', 0)
......@@ -183,8 +173,7 @@ class DVDPlayer(object):
self.pipeline = Pipeline('pipeline')
assert self.pipeline
self.src = gst_element_factory_make('dvdreadsrc','src');
assert self.src
self.src = Element('dvdreadsrc','src');
self.src.connect('deep_notify',self.dnprint)
self.src.set_property('location', self.location)
......@@ -192,8 +181,7 @@ class DVDPlayer(object):
self.src.set_property('chapter', self.chapter)
self.src.set_property('angle', self.angle)
self.parse = gst_element_factory_make('mpegdemux','parse')
assert self.parse
self.parse = Element('mpegdemux','parse')
self.parse.set_property('sync', 0)
self.pipeline.add(self.src)
......
......@@ -33,14 +33,12 @@ def main():
bin = Pipeline('pipeline')
assert bin
src = gst_element_factory_make('fakesrc', 'src')
assert src
src = Element('fakesrc', 'src')
src.connect('handoff', handoff)
src.set_property('silent', 1)
src.set_property('num_buffers', 10)
sink = gst_element_factory_make('fakesink', 'sink')
assert sink
sink = Element('fakesink', 'sink')
sink.connect('handoff', handoff)
src.set_property('silent', 1)
......
......@@ -34,13 +34,11 @@ def build(filters, b):
# create a new bin to hold the elements
bin = Pipeline('pipeline')
src = gst_element_factory_make('fakesrc', 'source');
assert src
src = Element('fakesrc', 'source');
src.set_property('silent', 1)
src.set_property('num_buffers', b)
sink = gst_element_factory_make('fakesink', 'sink')
assert sink
sink = Element('fakesink', 'sink')
sink.set_property('silent', 1)
elements = [src] + filters + [sink]
......@@ -65,8 +63,7 @@ def filter(bin):
ccnt = 0
def c():
global ccnt
id = gst_element_factory_make ('identity', 'c identity %d' % ccnt);
assert id
id = Element ('identity', 'c identity %d' % ccnt);
id.set_property('silent', 1)
id.set_property('loop_based', 0)
ccnt += 1
......
......@@ -63,8 +63,7 @@ def identity_add(pipeline, first, count):
for i in range(count):
name = 'identity_%03d' % i
ident = gst_element_factory_make('identity', name)
assert ident
ident = Element('identity', name)
ident.set_property('silent', 1)
pipeline.add(ident)
last.get_pad('src').link(ident.get_pad('sink'))
......@@ -73,16 +72,14 @@ def identity_add(pipeline, first, count):
return last
def fakesrc():
src = gst_element_factory_make('fakesrc','src')
assert src
src = Element('fakesrc','src')
src.set_property('silent', 1)
src.set_property('num_buffers', iterations)
src.connect('handoff', handoff_src)
return src
def fakesink():
sink = gst_element_factory_make('fakesink','fakesink')
assert sink
sink = Element('fakesink','fakesink')
sink.set_property('silent', 1)
sink.connect('handoff', handoff_sink)
return sink
......@@ -126,8 +123,7 @@ def queue(argv):
assert src
src_thr.add(src)
src_q = gst_element_factory_make('queue','src_q')
assert src_q
src_q = Element('queue','src_q')
src_thr.add(src_q)
src.get_pad('src').link(src_q.get_pad('sink'))
......@@ -135,8 +131,7 @@ def queue(argv):
last = identity_add(pipeline, src_q, idents)
sink_q = gst_element_factory_make('queue','sink_q')
assert sink_q
sink_q = Element('queue','sink_q')
pipeline.add(sink_q)
last.get_pad('src').link(sink_q.get_pad('sink'))
......
......@@ -109,24 +109,15 @@ def main():
bin = Pipeline('pipeline')
# create a disk reader
filesrc = gst_element_factory_make ('filesrc', 'disk_source');
if not filesrc:
print 'could not find plugin \"filesrc\"'
return -1
filesrc = Element ('filesrc', 'disk_source')
filesrc.set_property('location', sys.argv[1])
# now get the decoder
decoder = gst_element_factory_make ('vorbisfile', 'parse');
if not decoder:
print 'could not find plugin \"vorbisfile\"'
return -1
decoder = Element ('vorbisfile', 'parse')
decoder.connect('notify', decoder_notified)
# and an audio sink
osssink = gst_element_factory_make ('osssink', 'play_audio')
if not osssink:
print 'could not find plugin \"osssink\"'
return -1
osssink = Element ('osssink', 'play_audio')
# add objects to the main pipeline
for e in (filesrc, decoder, osssink):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment