mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:36:20 +00:00
gstreamer/gstreamer.defs: rename all functions, remove gst_ suffix.
Original commit message from CVS: * gstreamer/gstreamer.defs: rename all functions, remove gst_ suffix. * gstreamer/examples/gstreamer/*.py: Update to new API.
This commit is contained in:
parent
d178fff215
commit
ad4e6fd770
21 changed files with 1388 additions and 1374 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2004-02-24 Johan Dahlin <johan@gnome.org>
|
||||||
|
|
||||||
|
* gstreamer/gstreamer.defs: rename all functions, remove
|
||||||
|
gst_ suffix.
|
||||||
|
* gstreamer/examples/gstreamer/*.py: Update to new API.
|
||||||
|
|
||||||
2004-02-23 Johan Dahlin <johan@gnome.org>
|
2004-02-23 Johan Dahlin <johan@gnome.org>
|
||||||
|
|
||||||
* gstreamer/gstreamer.defs (element_link_many): This is function
|
* gstreamer/gstreamer.defs (element_link_many): This is function
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from gstreamer import *
|
import gobject
|
||||||
from gobject import GObject
|
import gst
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
class BPS(object):
|
class BPS(object):
|
||||||
|
@ -42,21 +42,21 @@ class BPS(object):
|
||||||
def eos(self, sink):
|
def eos(self, sink):
|
||||||
self.done()
|
self.done()
|
||||||
if self.method in ('gtk', 'c'):
|
if self.method in ('gtk', 'c'):
|
||||||
gtk.main_quit()
|
gst.main_quit()
|
||||||
|
|
||||||
def fakesrc(self, buffers):
|
def fakesrc(self, buffers):
|
||||||
src = Element('fakesrc','src')
|
src = gst.Element('fakesrc','src')
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
src.set_property('num_buffers', buffers)
|
src.set_property('num_buffers', buffers)
|
||||||
return src
|
return src
|
||||||
|
|
||||||
def fakesink(self):
|
def fakesink(self):
|
||||||
sink = Element('fakesink','sink')
|
sink = gst.Element('fakesink','sink')
|
||||||
sink.set_property('silent', 1)
|
sink.set_property('silent', 1)
|
||||||
return sink
|
return sink
|
||||||
|
|
||||||
def build_pipeline(self, buffers):
|
def build_pipeline(self, buffers):
|
||||||
pipeline = Pipeline('pipeline')
|
pipeline = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
src = self.fakesrc(buffers)
|
src = self.fakesrc(buffers)
|
||||||
pipeline.add(src)
|
pipeline.add(src)
|
||||||
|
@ -77,8 +77,9 @@ class BPS(object):
|
||||||
|
|
||||||
def test(self, method):
|
def test(self, method):
|
||||||
print '%s:' % (method,),
|
print '%s:' % (method,),
|
||||||
|
self.method = method
|
||||||
self.pipeline.set_state(STATE_PLAYING)
|
|
||||||
|
self.pipeline.set_state(gst.STATE_PLAYING)
|
||||||
|
|
||||||
if method == 'py':
|
if method == 'py':
|
||||||
self.start = time.time()
|
self.start = time.time()
|
||||||
|
@ -86,50 +87,50 @@ class BPS(object):
|
||||||
pass
|
pass
|
||||||
elif method == 'c':
|
elif method == 'c':
|
||||||
self.start = time.time()
|
self.start = time.time()
|
||||||
self.iter_id = add_iterate_bin(self.pipeline)
|
self.iter_id = gst.add_iterate_bin(self.pipeline)
|
||||||
gtk.main()
|
gst.main()
|
||||||
elif method == 'gtk':
|
#elif method == 'gst':
|
||||||
self.start = time.time()
|
# self.start = time.time()
|
||||||
gtk.idle_add(self.idle, self.pipeline)
|
# gtk.idle_add(self.idle, self.pipeline)
|
||||||
gtk.main()
|
# gtk.main()
|
||||||
elif method == 'all':
|
elif method == 'all':
|
||||||
self.start = time.time()
|
self.start = time.time()
|
||||||
iterate_bin_all(self.pipeline)
|
iterate_bin_all(self.pipeline)
|
||||||
|
|
||||||
self.pipeline.set_state(STATE_NULL)
|
self.pipeline.set_state(gst.STATE_NULL)
|
||||||
|
|
||||||
def __main__(self):
|
def run(self, buffers, methods):
|
||||||
"GStreamer Buffers-Per-Second tester"
|
self.buffers = buffers
|
||||||
gst_info_set_categories(0L)
|
|
||||||
gst_debug_set_categories(0L)
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
print 'usage: %s buffers [method method ...]' % sys.argv[0]
|
|
||||||
return 1
|
|
||||||
else:
|
|
||||||
self.buffers = int(sys.argv[1])
|
|
||||||
self.methods = sys.argv[2:]
|
|
||||||
if self.methods == []:
|
|
||||||
self.methods = ('gtk', 'c', 'py', 'all')
|
|
||||||
|
|
||||||
print '# Testing buffer processing rate for "fakesrc ! fakesink"'
|
print '# Testing buffer processing rate for "fakesrc ! fakesink"'
|
||||||
print '# gtk = gtk idle loop function in python'
|
#print '# gst = gtk idle loop function in python'
|
||||||
print '# c = gtk idle loop function in C'
|
print '# c = gtk idle loop function in C'
|
||||||
print '# py = full iterate loop in python'
|
print '# py = full iterate loop in python'
|
||||||
print '# all = full iterate loop in C'
|
print '# all = full iterate loop in C'
|
||||||
print '# bps = buffers per second'
|
print '# bps = buffers per second'
|
||||||
print '# spb = seconds per buffer'
|
print '# spb = seconds per buffer'
|
||||||
self.pipeline = self.build_pipeline(self.buffers)
|
|
||||||
|
self.pipeline = self.build_pipeline(buffers)
|
||||||
assert self.pipeline
|
assert self.pipeline
|
||||||
#self.pipeline.connect('deep-notify', self.notify)
|
#self.pipeline.connect('deep-notify', self.notify)
|
||||||
|
|
||||||
|
map(self.test, methods)
|
||||||
|
|
||||||
|
def main(args):
|
||||||
|
"GStreamer Buffers-Per-Second tester"
|
||||||
|
|
||||||
for m in self.methods:
|
if len(args) < 2:
|
||||||
self.method = m
|
print 'usage: %s buffers [method method ...]' % args[0]
|
||||||
self.test(m)
|
return 1
|
||||||
|
|
||||||
|
bps = BPS()
|
||||||
|
|
||||||
|
buffers = int(args[1])
|
||||||
|
methods = args[2:]
|
||||||
|
if not methods:
|
||||||
|
methods = ('gtk', 'c', 'py', 'all')
|
||||||
|
|
||||||
return 0;
|
bps.run(buffers, methods)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
bps = BPS()
|
sys.exit(main(sys.argv))
|
||||||
ret = bps.__main__()
|
|
||||||
sys.exit (ret)
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import gst
|
import gst
|
||||||
|
|
||||||
def filter(input, output):
|
def filter(input, output):
|
||||||
|
|
|
@ -22,16 +22,11 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
#from gnome import *
|
import gst
|
||||||
from gstreamer import *
|
|
||||||
from gobject import GObject
|
|
||||||
import gtk
|
import gtk
|
||||||
gtk.threads_init()
|
gtk.threads_init()
|
||||||
|
|
||||||
class DVDPlayer(object):
|
class DVDPlayer(object):
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def idle(self, pipeline):
|
def idle(self, pipeline):
|
||||||
#gtk.threads_enter()
|
#gtk.threads_enter()
|
||||||
pipeline.iterate()
|
pipeline.iterate()
|
||||||
|
@ -47,16 +42,16 @@ class DVDPlayer(object):
|
||||||
print '***** a new pad %s was created' % pad.get_name()
|
print '***** a new pad %s was created' % pad.get_name()
|
||||||
if pad.get_name()[:6] == 'video_':
|
if pad.get_name()[:6] == 'video_':
|
||||||
pad.link(self.v_queue.get_pad('sink'))
|
pad.link(self.v_queue.get_pad('sink'))
|
||||||
self.pipeline.set_state(STATE_PAUSED)
|
self.pipeline.set_state(gst.STATE_PAUSED)
|
||||||
self.pipeline.add(self.v_thread)
|
self.pipeline.add(self.v_thread)
|
||||||
#self.v_thread.set_state(STATE_PLAYING)
|
#self.v_thread.set_state(gst.STATE_PLAYING)
|
||||||
self.pipeline.set_state(STATE_PLAYING)
|
self.pipeline.set_state(gst.STATE_PLAYING)
|
||||||
elif pad.get_name() == 'private_stream_1.0':
|
elif pad.get_name() == 'private_stream_1.0':
|
||||||
pad.link(self.a_queue.get_pad('sink'))
|
pad.link(self.a_queue.get_pad('sink'))
|
||||||
self.pipeline.set_state(STATE_PAUSED)
|
self.pipeline.set_state(gst.STATE_PAUSED)
|
||||||
self.pipeline.add(self.a_thread)
|
self.pipeline.add(self.a_thread)
|
||||||
#self.a_thread.set_state(STATE_PLAYING);
|
#self.a_thread.set_state(gst.STATE_PLAYING);
|
||||||
self.pipeline.set_state(STATE_PLAYING)
|
self.pipeline.set_state(gst.STATE_PLAYING)
|
||||||
else:
|
else:
|
||||||
print 'unknown pad: %s' % pad.get_name()
|
print 'unknown pad: %s' % pad.get_name()
|
||||||
#gtk.threads_leave()
|
#gtk.threads_leave()
|
||||||
|
@ -67,16 +62,12 @@ class DVDPlayer(object):
|
||||||
self.appwindow.show_all()
|
self.appwindow.show_all()
|
||||||
gtk.threads_leave()
|
gtk.threads_leave()
|
||||||
|
|
||||||
def main(self):
|
def main(self, location, title, chapter, angle):
|
||||||
if len(sys.argv) < 5:
|
self.location = location
|
||||||
print 'usage: %s dvdlocation title chapter angle' % sys.argv[0]
|
self.title = title
|
||||||
return -1
|
self.chapter = chapter
|
||||||
|
self.angle = angle
|
||||||
self.location = sys.argv[1]
|
|
||||||
self.title = int(sys.argv[2])
|
|
||||||
self.chapter = int(sys.argv[3])
|
|
||||||
self.angle = int(sys.argv[4])
|
|
||||||
|
|
||||||
#gst_init(&argc,&argv);
|
#gst_init(&argc,&argv);
|
||||||
#gnome_init('MPEG2 Video player','0.0.1',argc,argv);
|
#gnome_init('MPEG2 Video player','0.0.1',argc,argv);
|
||||||
|
|
||||||
|
@ -91,13 +82,13 @@ class DVDPlayer(object):
|
||||||
|
|
||||||
gtk.threads_enter()
|
gtk.threads_enter()
|
||||||
|
|
||||||
self.pipeline.set_state(STATE_PLAYING)
|
self.pipeline.set_state(gst.STATE_PLAYING)
|
||||||
|
|
||||||
gtk.idle_add(self.idle,self.pipeline)
|
gtk.idle_add(self.idle,self.pipeline)
|
||||||
|
|
||||||
gtk.main()
|
gtk.main()
|
||||||
|
|
||||||
self.pipeline.set_state(STATE_NULL)
|
self.pipeline.set_state(gst.STATE_NULL)
|
||||||
|
|
||||||
gtk.threads_leave()
|
gtk.threads_leave()
|
||||||
|
|
||||||
|
@ -105,34 +96,34 @@ class DVDPlayer(object):
|
||||||
|
|
||||||
def build_video_thread(self):
|
def build_video_thread(self):
|
||||||
# ***** pre-construct the video thread *****
|
# ***** pre-construct the video thread *****
|
||||||
self.v_thread = Thread('v_thread')
|
self.v_thread = gst.Thread('v_thread')
|
||||||
|
|
||||||
self.v_queue = Element('queue','v_queue')
|
self.v_queue = gst.Element('queue','v_queue')
|
||||||
|
|
||||||
self.v_decode = Element('mpeg2dec','decode_video')
|
self.v_decode = gst.Element('mpeg2dec','decode_video')
|
||||||
|
|
||||||
self.color = Element('colorspace','color')
|
self.color = gst.Element('colorspace','color')
|
||||||
|
|
||||||
self.efx = Element('identity','identity')
|
self.efx = gst.Element('identity','identity')
|
||||||
#self.efx = Element('edgeTV','EdgeTV')
|
#self.efx = gst.Element('edgeTV','EdgeTV')
|
||||||
#self.efx = Element('agingTV','AgingTV')
|
#self.efx = gst.Element('agingTV','AgingTV')
|
||||||
#effectv: diceTV: DiceTV
|
#effectv: diceTV: DiceTV
|
||||||
#effectv: warpTV: WarpTV
|
#effectv: warpTV: WarpTV
|
||||||
#effectv: shagadelicTV: ShagadelicTV
|
#effectv: shagadelicTV: ShagadelicTV
|
||||||
#effectv: vertigoTV: VertigoTV
|
#effectv: vertigoTV: VertigoTV
|
||||||
#self.efx = Element('revTV','RevTV')
|
#self.efx = gst.Element('revTV','RevTV')
|
||||||
#self.efx = Element('quarkTV','QuarkTV')
|
#self.efx = gst.Element('quarkTV','QuarkTV')
|
||||||
|
|
||||||
self.color2 = Element('colorspace','color2')
|
self.color2 = gst.Element('colorspace','color2')
|
||||||
|
|
||||||
self.show = Element('xvideosink','show')
|
self.show = gst.Element('xvideosink','show')
|
||||||
#self.show = Element('sdlvideosink','show')
|
#self.show = Element('sdlvideosink','show')
|
||||||
#self.show = Element('fakesink','fakesinkv')
|
#self.show = Element('fakesink','fakesinkv')
|
||||||
#self.show.set_property('silent', 0)
|
#self.show.set_property('silent', 0)
|
||||||
#self.show.set_property('sync', 1)
|
#self.show.set_property('sync', 1)
|
||||||
|
|
||||||
#self.deinterlace = Element('deinterlace','deinterlace')
|
#self.deinterlace = gst.Element('deinterlace','deinterlace')
|
||||||
self.deinterlace = Element('identity','deinterlace')
|
self.deinterlace = gst.Element('identity','deinterlace')
|
||||||
|
|
||||||
last = None
|
last = None
|
||||||
for e in (self.v_queue, self.v_decode, self.color, self.efx, self.color2, self.deinterlace, self.show):
|
for e in (self.v_queue, self.v_decode, self.color, self.efx, self.color2, self.deinterlace, self.show):
|
||||||
|
@ -149,13 +140,13 @@ class DVDPlayer(object):
|
||||||
|
|
||||||
def build_audio_thread(self):
|
def build_audio_thread(self):
|
||||||
# ***** pre-construct the audio thread *****
|
# ***** pre-construct the audio thread *****
|
||||||
self.a_thread = Thread('a_thread')
|
self.a_thread = gst.Thread('a_thread')
|
||||||
|
|
||||||
self.a_queue = Element('queue','a_queue')
|
self.a_queue = gst.Element('queue','a_queue')
|
||||||
|
|
||||||
self.a_decode = Element('a52dec','decode_audio')
|
self.a_decode = gst.Element('a52dec','decode_audio')
|
||||||
|
|
||||||
self.osssink = Element('osssink','osssink')
|
self.osssink = gst.Element('osssink','osssink')
|
||||||
#self.osssink = Element('fakesink','fakesinka')
|
#self.osssink = Element('fakesink','fakesinka')
|
||||||
#self.osssink.set_property('silent', 0)
|
#self.osssink.set_property('silent', 0)
|
||||||
#self.osssink.set_property('sync', 0)
|
#self.osssink.set_property('sync', 0)
|
||||||
|
@ -168,9 +159,9 @@ class DVDPlayer(object):
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
# ***** construct the main pipeline *****
|
# ***** construct the main pipeline *****
|
||||||
self.pipeline = Pipeline('pipeline')
|
self.pipeline = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
self.src = Element('dvdreadsrc','src');
|
self.src = gst.Element('dvdreadsrc','src');
|
||||||
|
|
||||||
self.src.connect('deep_notify',self.dnprint)
|
self.src.connect('deep_notify',self.dnprint)
|
||||||
self.src.set_property('location', self.location)
|
self.src.set_property('location', self.location)
|
||||||
|
@ -178,7 +169,7 @@ class DVDPlayer(object):
|
||||||
self.src.set_property('chapter', self.chapter)
|
self.src.set_property('chapter', self.chapter)
|
||||||
self.src.set_property('angle', self.angle)
|
self.src.set_property('angle', self.angle)
|
||||||
|
|
||||||
self.parse = Element('mpegdemux','parse')
|
self.parse = gst.Element('mpegdemux','parse')
|
||||||
self.parse.set_property('sync', 0)
|
self.parse.set_property('sync', 0)
|
||||||
|
|
||||||
self.pipeline.add(self.src)
|
self.pipeline.add(self.src)
|
||||||
|
@ -219,9 +210,18 @@ class DVDPlayer(object):
|
||||||
str = obj.get_property(param.name)
|
str = obj.get_property(param.name)
|
||||||
print '%s: %s = %s' % (sender.get_name(), param.name, str)
|
print '%s: %s = %s' % (sender.get_name(), param.name, str)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def main(args):
|
||||||
#gst_debug_set_categories(0xFFFFFFFFL)
|
if len(sys.argv) < 5:
|
||||||
#gst_info_set_categories(0xFFFFFFFFL)
|
print 'usage: %s dvdlocation title chapter angle' % sys.argv[0]
|
||||||
|
return -1
|
||||||
|
|
||||||
|
location = sys.argv[1]
|
||||||
|
title = int(sys.argv[2])
|
||||||
|
chapter = int(sys.argv[3])
|
||||||
|
angle = int(sys.argv[4])
|
||||||
|
|
||||||
player = DVDPlayer()
|
player = DVDPlayer()
|
||||||
ret = player.main()
|
return player.main(location, title, chapter, angle)
|
||||||
sys.exit(ret)
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main(sys.argv))
|
||||||
|
|
|
@ -21,23 +21,24 @@
|
||||||
# Author: David I. Lehn <dlehn@users.sourceforge.net>
|
# Author: David I. Lehn <dlehn@users.sourceforge.net>
|
||||||
#
|
#
|
||||||
|
|
||||||
from gobject import GObject
|
import sys
|
||||||
from gstreamer import *
|
|
||||||
|
import gst
|
||||||
|
|
||||||
def handoff(sender, *args):
|
def handoff(sender, *args):
|
||||||
print sender.get_name(), args
|
print sender.get_name(), args
|
||||||
|
|
||||||
def main():
|
def main(args):
|
||||||
# create a new bin to hold the elements
|
# create a new bin to hold the elements
|
||||||
#gst_debug_set_categories(-1)
|
#gst_debug_set_categories(-1)
|
||||||
bin = Pipeline('pipeline')
|
bin = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
src = Element('fakesrc', 'src')
|
src = gst.Element('fakesrc', 'src')
|
||||||
src.connect('handoff', handoff)
|
src.connect('handoff', handoff)
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
src.set_property('num_buffers', 10)
|
src.set_property('num_buffers', 10)
|
||||||
|
|
||||||
sink = Element('fakesink', 'sink')
|
sink = gst.Element('fakesink', 'sink')
|
||||||
sink.connect('handoff', handoff)
|
sink.connect('handoff', handoff)
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
|
|
||||||
|
@ -50,14 +51,15 @@ def main():
|
||||||
assert res
|
assert res
|
||||||
|
|
||||||
# start playing
|
# start playing
|
||||||
res = bin.set_state(STATE_PLAYING);
|
res = bin.set_state(gst.STATE_PLAYING);
|
||||||
assert res
|
assert res
|
||||||
|
|
||||||
while bin.iterate(): pass
|
while bin.iterate():
|
||||||
|
pass
|
||||||
|
|
||||||
# stop the bin
|
# stop the bin
|
||||||
res = bin.set_state(STATE_NULL)
|
res = bin.set_state(gst.STATE_NULL)
|
||||||
assert res
|
assert res
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
sys.exit(main(sys.argv))
|
||||||
|
|
|
@ -22,19 +22,18 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from gstreamer import *
|
|
||||||
import gobject
|
import gobject
|
||||||
from cp import filter
|
import gst
|
||||||
|
|
||||||
class Identity(Element):
|
class Identity(gst.Element):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.__gobject_init__()
|
self.__gobject_init__()
|
||||||
self.sinkpad = Pad('sink', PAD_SINK)
|
self.sinkpad = gst.Pad('sink', gst.PAD_SINK)
|
||||||
self.add_pad(self.sinkpad)
|
self.add_pad(self.sinkpad)
|
||||||
self.sinkpad.set_chain_function(self.chain)
|
self.sinkpad.set_chain_function(self.chain)
|
||||||
self.sinkpad.set_link_function(self.pad_link)
|
self.sinkpad.set_link_function(self.pad_link)
|
||||||
|
|
||||||
self.srcpad = Pad('src', PAD_SRC)
|
self.srcpad = gst.Pad('src', gst.PAD_SRC)
|
||||||
self.add_pad(self.srcpad)
|
self.add_pad(self.srcpad)
|
||||||
self.srcpad.set_link_function(self.pad_link)
|
self.srcpad.set_link_function(self.pad_link)
|
||||||
|
|
||||||
|
@ -44,16 +43,33 @@ class Identity(Element):
|
||||||
|
|
||||||
def pad_link(self, pad, caps):
|
def pad_link(self, pad, caps):
|
||||||
print 'pad_link:', self, pad, caps
|
print 'pad_link:', self, pad, caps
|
||||||
return PAD_LINK_OK
|
return gst.PAD_LINK_OK
|
||||||
|
|
||||||
def chain(self, pad, buf):
|
def chain(self, pad, buf):
|
||||||
self.srcpad.push(buf)
|
self.srcpad.push(buf)
|
||||||
|
|
||||||
gobject.type_register(Identity)
|
gobject.type_register(Identity)
|
||||||
|
|
||||||
def main():
|
def filter(element):
|
||||||
|
# create a new bin to hold the elements
|
||||||
|
bin = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
|
filesrc = gst.Element('sinesrc', 'source');
|
||||||
|
filesink = gst.Element('fakesink', 'sink')
|
||||||
|
|
||||||
|
bin.add_many(filesrc, element, filesink)
|
||||||
|
gst.element_link_many(filesrc, element, filesink)
|
||||||
|
|
||||||
|
# start playing
|
||||||
|
bin.set_state(gst.STATE_PLAYING);
|
||||||
|
|
||||||
|
while bin.iterate():
|
||||||
|
pass
|
||||||
|
|
||||||
|
# stop the bin
|
||||||
|
bin.set_state(gst.STATE_NULL)
|
||||||
|
|
||||||
|
def main(args):
|
||||||
"A GStreamer Python subclassing example of an identity filter"
|
"A GStreamer Python subclassing example of an identity filter"
|
||||||
gst_debug_set_categories(0L)
|
|
||||||
|
|
||||||
identity = Identity()
|
identity = Identity()
|
||||||
identity.set_name('identity')
|
identity.set_name('identity')
|
||||||
|
@ -61,8 +77,8 @@ def main():
|
||||||
print 'could not create \"Identity\" element'
|
print 'could not create \"Identity\" element'
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
return filter([identity])
|
return filter(identity)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ret = main()
|
sys.exit(main(sys.argv))
|
||||||
sys.exit (ret)
|
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from gstreamer import *
|
import gst
|
||||||
from gobject import GObject
|
|
||||||
import time
|
import time
|
||||||
from identity import Identity
|
from identity import Identity
|
||||||
|
|
||||||
|
@ -32,38 +31,30 @@ def update(sender, *args):
|
||||||
|
|
||||||
def build(filters, b):
|
def build(filters, b):
|
||||||
# create a new bin to hold the elements
|
# create a new bin to hold the elements
|
||||||
bin = Pipeline('pipeline')
|
bin = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
src = Element('fakesrc', 'source');
|
src = gst.Element('fakesrc', 'source');
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
src.set_property('num_buffers', b)
|
src.set_property('num_buffers', b)
|
||||||
|
|
||||||
sink = Element('fakesink', 'sink')
|
sink = gst.Element('fakesink', 'sink')
|
||||||
sink.set_property('silent', 1)
|
sink.set_property('silent', 1)
|
||||||
|
|
||||||
elements = [src] + filters + [sink]
|
elements = [src] + filters + [sink]
|
||||||
# add objects to the main pipeline
|
bin.add_many(*elements)
|
||||||
for e in elements:
|
gst.element_link_many(*elements)
|
||||||
bin.add(e)
|
|
||||||
|
|
||||||
# link the elements
|
|
||||||
previous = None
|
|
||||||
for e in elements:
|
|
||||||
if previous:
|
|
||||||
previous.link(e)
|
|
||||||
previous = e
|
|
||||||
|
|
||||||
return bin
|
return bin
|
||||||
|
|
||||||
def filter(bin):
|
def filter(bin):
|
||||||
bin.set_state(STATE_PLAYING);
|
bin.set_state(gst.STATE_PLAYING);
|
||||||
while bin.iterate(): pass
|
while bin.iterate():
|
||||||
bin.set_state(STATE_NULL)
|
pass
|
||||||
|
bin.set_state(gst.STATE_NULL)
|
||||||
|
|
||||||
ccnt = 0
|
ccnt = 0
|
||||||
def c():
|
def c():
|
||||||
global ccnt
|
global ccnt
|
||||||
id = Element ('identity', 'c identity %d' % ccnt);
|
id = gst.Element('identity', 'c identity %d' % ccnt);
|
||||||
id.set_property('silent', 1)
|
id.set_property('silent', 1)
|
||||||
id.set_property('loop_based', 0)
|
id.set_property('loop_based', 0)
|
||||||
ccnt += 1
|
ccnt += 1
|
||||||
|
@ -91,19 +82,17 @@ def check(f, n, b):
|
||||||
print '%s b:%d i:%d t:%f' % (f, b, n, end - start)
|
print '%s b:%d i:%d t:%f' % (f, b, n, end - start)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def main():
|
def main(args):
|
||||||
"Identity timer and latency check"
|
"Identity timer and latency check"
|
||||||
if gst_version() < (0,7,0):
|
|
||||||
gst_debug_set_categories(0L)
|
|
||||||
|
|
||||||
if len(sys.argv) < 3:
|
if len(args) < 3:
|
||||||
print 'usage: %s identites buffers' % (sys.argv[0],)
|
print 'usage: %s identites buffers' % args[0]
|
||||||
return -1
|
return -1
|
||||||
n = int(sys.argv[1])
|
n = int(args[1])
|
||||||
b = int(sys.argv[2])
|
b = int(args[2])
|
||||||
|
|
||||||
for f in (c, py):
|
for f in (c, py):
|
||||||
check(f, n, b)
|
check(f, n, b)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ret = main()
|
sys.exit(main(sys.argv))
|
||||||
sys.exit (ret)
|
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from gstreamer import *
|
import gst
|
||||||
from gobject import GObject
|
|
||||||
|
|
||||||
def update(sender, *args):
|
def update(sender, *args):
|
||||||
print sender.get_name(), args
|
print sender.get_name(), args
|
||||||
|
@ -63,7 +62,7 @@ def identity_add(pipeline, first, count):
|
||||||
|
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
name = 'identity_%03d' % i
|
name = 'identity_%03d' % i
|
||||||
ident = Element('identity', name)
|
ident = gst.Element('identity', name)
|
||||||
ident.set_property('silent', 1)
|
ident.set_property('silent', 1)
|
||||||
pipeline.add(ident)
|
pipeline.add(ident)
|
||||||
last.get_pad('src').link(ident.get_pad('sink'))
|
last.get_pad('src').link(ident.get_pad('sink'))
|
||||||
|
@ -72,14 +71,14 @@ def identity_add(pipeline, first, count):
|
||||||
return last
|
return last
|
||||||
|
|
||||||
def fakesrc():
|
def fakesrc():
|
||||||
src = Element('fakesrc','src')
|
src = gst.Element('fakesrc','src')
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
src.set_property('num_buffers', iterations)
|
src.set_property('num_buffers', iterations)
|
||||||
src.connect('handoff', handoff_src)
|
src.connect('handoff', handoff_src)
|
||||||
return src
|
return src
|
||||||
|
|
||||||
def fakesink():
|
def fakesink():
|
||||||
sink = Element('fakesink','fakesink')
|
sink = gst.Element('fakesink','fakesink')
|
||||||
sink.set_property('silent', 1)
|
sink.set_property('silent', 1)
|
||||||
sink.connect('handoff', handoff_sink)
|
sink.connect('handoff', handoff_sink)
|
||||||
return sink
|
return sink
|
||||||
|
@ -89,10 +88,8 @@ def simple(argv):
|
||||||
print 'simple: bad params'
|
print 'simple: bad params'
|
||||||
return None
|
return None
|
||||||
idents = int(argv[0])
|
idents = int(argv[0])
|
||||||
if len(argv) == 2:
|
|
||||||
gst_schedulerfactory_set_default_name (argv[1])
|
|
||||||
|
|
||||||
pipeline = Pipeline('pipeline')
|
pipeline = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
src = fakesrc()
|
src = fakesrc()
|
||||||
pipeline.add(src)
|
pipeline.add(src)
|
||||||
|
@ -109,17 +106,14 @@ def queue(argv):
|
||||||
return None
|
return None
|
||||||
idents = int(argv[0])
|
idents = int(argv[0])
|
||||||
|
|
||||||
if len(arv) == 2:
|
pipeline = gst.Pipeline('pipeline')
|
||||||
gst_schedulerfactory_set_default_name (argv[1])
|
|
||||||
|
|
||||||
pipeline = Pipeline('pipeline')
|
src_thr = gst.Thread('src_thread')
|
||||||
|
|
||||||
src_thr = Thread('src_thread')
|
|
||||||
|
|
||||||
src = fakesrc()
|
src = fakesrc()
|
||||||
src_thr.add(src)
|
src_thr.add(src)
|
||||||
|
|
||||||
src_q = Element('queue','src_q')
|
src_q = gst.Element('queue','src_q')
|
||||||
src_thr.add(src_q)
|
src_thr.add(src_q)
|
||||||
src.get_pad('src').link(src_q.get_pad('sink'))
|
src.get_pad('src').link(src_q.get_pad('sink'))
|
||||||
|
|
||||||
|
@ -127,11 +121,11 @@ def queue(argv):
|
||||||
|
|
||||||
last = identity_add(pipeline, src_q, idents)
|
last = identity_add(pipeline, src_q, idents)
|
||||||
|
|
||||||
sink_q = Element('queue','sink_q')
|
sink_q = gst.Element('queue','sink_q')
|
||||||
pipeline.add(sink_q)
|
pipeline.add(sink_q)
|
||||||
last.get_pad('src').link(sink_q.get_pad('sink'))
|
last.get_pad('src').link(sink_q.get_pad('sink'))
|
||||||
|
|
||||||
sink_thr = Thread('sink_thread')
|
sink_thr = gst.Thread('sink_thread')
|
||||||
|
|
||||||
sink = fakesink()
|
sink = fakesink()
|
||||||
|
|
||||||
|
@ -169,12 +163,12 @@ def main():
|
||||||
|
|
||||||
#xmlSaveFile('lat.gst', gst_xml_write(pipeline))
|
#xmlSaveFile('lat.gst', gst_xml_write(pipeline))
|
||||||
|
|
||||||
pipeline.set_state(STATE_PLAYING)
|
pipeline.set_state(gst.STATE_PLAYING)
|
||||||
|
|
||||||
while count < iterations:
|
while count < iterations:
|
||||||
pipeline.iterate()
|
pipeline.iterate()
|
||||||
|
|
||||||
pipeline.set_state(STATE_NULL)
|
pipeline.set_state(gst.STATE_NULL)
|
||||||
|
|
||||||
print
|
print
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from gstreamer import *
|
import gst
|
||||||
import gobject
|
|
||||||
from identity import Identity
|
from identity import Identity
|
||||||
from cp import filter
|
from cp import filter
|
||||||
|
|
||||||
|
@ -41,15 +40,14 @@ class Rot13(Identity):
|
||||||
a = 'A'
|
a = 'A'
|
||||||
c = chr((((ord(c) - ord(a)) + 13) % 26) + ord(a))
|
c = chr((((ord(c) - ord(a)) + 13) % 26) + ord(a))
|
||||||
data2 = data2 + c
|
data2 = data2 + c
|
||||||
newbuf = Buffer()
|
newbuf = gst.Buffer()
|
||||||
newbuf.set_data(data2)
|
newbuf.set_data(data2)
|
||||||
self.srcpad.push(newbuf)
|
self.srcpad.push(newbuf)
|
||||||
|
|
||||||
gobject.type_register(Rot13)
|
gobject.type_register(Rot13)
|
||||||
|
|
||||||
def main():
|
def main(args):
|
||||||
"A GStreamer Python subclassing example of a rot13 filter"
|
"A GStreamer Python subclassing example of a rot13 filter"
|
||||||
gst_debug_set_categories(0L)
|
|
||||||
|
|
||||||
rot13 = Rot13()
|
rot13 = Rot13()
|
||||||
rot13.set_name('rot13')
|
rot13.set_name('rot13')
|
||||||
|
@ -60,5 +58,4 @@ def main():
|
||||||
return filter([rot13])
|
return filter([rot13])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ret = main()
|
sys.exit(main(sys.argv))
|
||||||
sys.exit (ret)
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from gstreamer import *
|
import gobject
|
||||||
from gobject import GObject
|
import gst
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
class BPS(object):
|
class BPS(object):
|
||||||
|
@ -42,21 +42,21 @@ class BPS(object):
|
||||||
def eos(self, sink):
|
def eos(self, sink):
|
||||||
self.done()
|
self.done()
|
||||||
if self.method in ('gtk', 'c'):
|
if self.method in ('gtk', 'c'):
|
||||||
gtk.main_quit()
|
gst.main_quit()
|
||||||
|
|
||||||
def fakesrc(self, buffers):
|
def fakesrc(self, buffers):
|
||||||
src = Element('fakesrc','src')
|
src = gst.Element('fakesrc','src')
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
src.set_property('num_buffers', buffers)
|
src.set_property('num_buffers', buffers)
|
||||||
return src
|
return src
|
||||||
|
|
||||||
def fakesink(self):
|
def fakesink(self):
|
||||||
sink = Element('fakesink','sink')
|
sink = gst.Element('fakesink','sink')
|
||||||
sink.set_property('silent', 1)
|
sink.set_property('silent', 1)
|
||||||
return sink
|
return sink
|
||||||
|
|
||||||
def build_pipeline(self, buffers):
|
def build_pipeline(self, buffers):
|
||||||
pipeline = Pipeline('pipeline')
|
pipeline = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
src = self.fakesrc(buffers)
|
src = self.fakesrc(buffers)
|
||||||
pipeline.add(src)
|
pipeline.add(src)
|
||||||
|
@ -77,8 +77,9 @@ class BPS(object):
|
||||||
|
|
||||||
def test(self, method):
|
def test(self, method):
|
||||||
print '%s:' % (method,),
|
print '%s:' % (method,),
|
||||||
|
self.method = method
|
||||||
self.pipeline.set_state(STATE_PLAYING)
|
|
||||||
|
self.pipeline.set_state(gst.STATE_PLAYING)
|
||||||
|
|
||||||
if method == 'py':
|
if method == 'py':
|
||||||
self.start = time.time()
|
self.start = time.time()
|
||||||
|
@ -86,50 +87,50 @@ class BPS(object):
|
||||||
pass
|
pass
|
||||||
elif method == 'c':
|
elif method == 'c':
|
||||||
self.start = time.time()
|
self.start = time.time()
|
||||||
self.iter_id = add_iterate_bin(self.pipeline)
|
self.iter_id = gst.add_iterate_bin(self.pipeline)
|
||||||
gtk.main()
|
gst.main()
|
||||||
elif method == 'gtk':
|
#elif method == 'gst':
|
||||||
self.start = time.time()
|
# self.start = time.time()
|
||||||
gtk.idle_add(self.idle, self.pipeline)
|
# gtk.idle_add(self.idle, self.pipeline)
|
||||||
gtk.main()
|
# gtk.main()
|
||||||
elif method == 'all':
|
elif method == 'all':
|
||||||
self.start = time.time()
|
self.start = time.time()
|
||||||
iterate_bin_all(self.pipeline)
|
iterate_bin_all(self.pipeline)
|
||||||
|
|
||||||
self.pipeline.set_state(STATE_NULL)
|
self.pipeline.set_state(gst.STATE_NULL)
|
||||||
|
|
||||||
def __main__(self):
|
def run(self, buffers, methods):
|
||||||
"GStreamer Buffers-Per-Second tester"
|
self.buffers = buffers
|
||||||
gst_info_set_categories(0L)
|
|
||||||
gst_debug_set_categories(0L)
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
print 'usage: %s buffers [method method ...]' % sys.argv[0]
|
|
||||||
return 1
|
|
||||||
else:
|
|
||||||
self.buffers = int(sys.argv[1])
|
|
||||||
self.methods = sys.argv[2:]
|
|
||||||
if self.methods == []:
|
|
||||||
self.methods = ('gtk', 'c', 'py', 'all')
|
|
||||||
|
|
||||||
print '# Testing buffer processing rate for "fakesrc ! fakesink"'
|
print '# Testing buffer processing rate for "fakesrc ! fakesink"'
|
||||||
print '# gtk = gtk idle loop function in python'
|
#print '# gst = gtk idle loop function in python'
|
||||||
print '# c = gtk idle loop function in C'
|
print '# c = gtk idle loop function in C'
|
||||||
print '# py = full iterate loop in python'
|
print '# py = full iterate loop in python'
|
||||||
print '# all = full iterate loop in C'
|
print '# all = full iterate loop in C'
|
||||||
print '# bps = buffers per second'
|
print '# bps = buffers per second'
|
||||||
print '# spb = seconds per buffer'
|
print '# spb = seconds per buffer'
|
||||||
self.pipeline = self.build_pipeline(self.buffers)
|
|
||||||
|
self.pipeline = self.build_pipeline(buffers)
|
||||||
assert self.pipeline
|
assert self.pipeline
|
||||||
#self.pipeline.connect('deep-notify', self.notify)
|
#self.pipeline.connect('deep-notify', self.notify)
|
||||||
|
|
||||||
|
map(self.test, methods)
|
||||||
|
|
||||||
|
def main(args):
|
||||||
|
"GStreamer Buffers-Per-Second tester"
|
||||||
|
|
||||||
for m in self.methods:
|
if len(args) < 2:
|
||||||
self.method = m
|
print 'usage: %s buffers [method method ...]' % args[0]
|
||||||
self.test(m)
|
return 1
|
||||||
|
|
||||||
|
bps = BPS()
|
||||||
|
|
||||||
|
buffers = int(args[1])
|
||||||
|
methods = args[2:]
|
||||||
|
if not methods:
|
||||||
|
methods = ('gtk', 'c', 'py', 'all')
|
||||||
|
|
||||||
return 0;
|
bps.run(buffers, methods)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
bps = BPS()
|
sys.exit(main(sys.argv))
|
||||||
ret = bps.__main__()
|
|
||||||
sys.exit (ret)
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import gst
|
import gst
|
||||||
|
|
||||||
def filter(input, output):
|
def filter(input, output):
|
||||||
|
|
|
@ -22,16 +22,11 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
#from gnome import *
|
import gst
|
||||||
from gstreamer import *
|
|
||||||
from gobject import GObject
|
|
||||||
import gtk
|
import gtk
|
||||||
gtk.threads_init()
|
gtk.threads_init()
|
||||||
|
|
||||||
class DVDPlayer(object):
|
class DVDPlayer(object):
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def idle(self, pipeline):
|
def idle(self, pipeline):
|
||||||
#gtk.threads_enter()
|
#gtk.threads_enter()
|
||||||
pipeline.iterate()
|
pipeline.iterate()
|
||||||
|
@ -47,16 +42,16 @@ class DVDPlayer(object):
|
||||||
print '***** a new pad %s was created' % pad.get_name()
|
print '***** a new pad %s was created' % pad.get_name()
|
||||||
if pad.get_name()[:6] == 'video_':
|
if pad.get_name()[:6] == 'video_':
|
||||||
pad.link(self.v_queue.get_pad('sink'))
|
pad.link(self.v_queue.get_pad('sink'))
|
||||||
self.pipeline.set_state(STATE_PAUSED)
|
self.pipeline.set_state(gst.STATE_PAUSED)
|
||||||
self.pipeline.add(self.v_thread)
|
self.pipeline.add(self.v_thread)
|
||||||
#self.v_thread.set_state(STATE_PLAYING)
|
#self.v_thread.set_state(gst.STATE_PLAYING)
|
||||||
self.pipeline.set_state(STATE_PLAYING)
|
self.pipeline.set_state(gst.STATE_PLAYING)
|
||||||
elif pad.get_name() == 'private_stream_1.0':
|
elif pad.get_name() == 'private_stream_1.0':
|
||||||
pad.link(self.a_queue.get_pad('sink'))
|
pad.link(self.a_queue.get_pad('sink'))
|
||||||
self.pipeline.set_state(STATE_PAUSED)
|
self.pipeline.set_state(gst.STATE_PAUSED)
|
||||||
self.pipeline.add(self.a_thread)
|
self.pipeline.add(self.a_thread)
|
||||||
#self.a_thread.set_state(STATE_PLAYING);
|
#self.a_thread.set_state(gst.STATE_PLAYING);
|
||||||
self.pipeline.set_state(STATE_PLAYING)
|
self.pipeline.set_state(gst.STATE_PLAYING)
|
||||||
else:
|
else:
|
||||||
print 'unknown pad: %s' % pad.get_name()
|
print 'unknown pad: %s' % pad.get_name()
|
||||||
#gtk.threads_leave()
|
#gtk.threads_leave()
|
||||||
|
@ -67,16 +62,12 @@ class DVDPlayer(object):
|
||||||
self.appwindow.show_all()
|
self.appwindow.show_all()
|
||||||
gtk.threads_leave()
|
gtk.threads_leave()
|
||||||
|
|
||||||
def main(self):
|
def main(self, location, title, chapter, angle):
|
||||||
if len(sys.argv) < 5:
|
self.location = location
|
||||||
print 'usage: %s dvdlocation title chapter angle' % sys.argv[0]
|
self.title = title
|
||||||
return -1
|
self.chapter = chapter
|
||||||
|
self.angle = angle
|
||||||
self.location = sys.argv[1]
|
|
||||||
self.title = int(sys.argv[2])
|
|
||||||
self.chapter = int(sys.argv[3])
|
|
||||||
self.angle = int(sys.argv[4])
|
|
||||||
|
|
||||||
#gst_init(&argc,&argv);
|
#gst_init(&argc,&argv);
|
||||||
#gnome_init('MPEG2 Video player','0.0.1',argc,argv);
|
#gnome_init('MPEG2 Video player','0.0.1',argc,argv);
|
||||||
|
|
||||||
|
@ -91,13 +82,13 @@ class DVDPlayer(object):
|
||||||
|
|
||||||
gtk.threads_enter()
|
gtk.threads_enter()
|
||||||
|
|
||||||
self.pipeline.set_state(STATE_PLAYING)
|
self.pipeline.set_state(gst.STATE_PLAYING)
|
||||||
|
|
||||||
gtk.idle_add(self.idle,self.pipeline)
|
gtk.idle_add(self.idle,self.pipeline)
|
||||||
|
|
||||||
gtk.main()
|
gtk.main()
|
||||||
|
|
||||||
self.pipeline.set_state(STATE_NULL)
|
self.pipeline.set_state(gst.STATE_NULL)
|
||||||
|
|
||||||
gtk.threads_leave()
|
gtk.threads_leave()
|
||||||
|
|
||||||
|
@ -105,34 +96,34 @@ class DVDPlayer(object):
|
||||||
|
|
||||||
def build_video_thread(self):
|
def build_video_thread(self):
|
||||||
# ***** pre-construct the video thread *****
|
# ***** pre-construct the video thread *****
|
||||||
self.v_thread = Thread('v_thread')
|
self.v_thread = gst.Thread('v_thread')
|
||||||
|
|
||||||
self.v_queue = Element('queue','v_queue')
|
self.v_queue = gst.Element('queue','v_queue')
|
||||||
|
|
||||||
self.v_decode = Element('mpeg2dec','decode_video')
|
self.v_decode = gst.Element('mpeg2dec','decode_video')
|
||||||
|
|
||||||
self.color = Element('colorspace','color')
|
self.color = gst.Element('colorspace','color')
|
||||||
|
|
||||||
self.efx = Element('identity','identity')
|
self.efx = gst.Element('identity','identity')
|
||||||
#self.efx = Element('edgeTV','EdgeTV')
|
#self.efx = gst.Element('edgeTV','EdgeTV')
|
||||||
#self.efx = Element('agingTV','AgingTV')
|
#self.efx = gst.Element('agingTV','AgingTV')
|
||||||
#effectv: diceTV: DiceTV
|
#effectv: diceTV: DiceTV
|
||||||
#effectv: warpTV: WarpTV
|
#effectv: warpTV: WarpTV
|
||||||
#effectv: shagadelicTV: ShagadelicTV
|
#effectv: shagadelicTV: ShagadelicTV
|
||||||
#effectv: vertigoTV: VertigoTV
|
#effectv: vertigoTV: VertigoTV
|
||||||
#self.efx = Element('revTV','RevTV')
|
#self.efx = gst.Element('revTV','RevTV')
|
||||||
#self.efx = Element('quarkTV','QuarkTV')
|
#self.efx = gst.Element('quarkTV','QuarkTV')
|
||||||
|
|
||||||
self.color2 = Element('colorspace','color2')
|
self.color2 = gst.Element('colorspace','color2')
|
||||||
|
|
||||||
self.show = Element('xvideosink','show')
|
self.show = gst.Element('xvideosink','show')
|
||||||
#self.show = Element('sdlvideosink','show')
|
#self.show = Element('sdlvideosink','show')
|
||||||
#self.show = Element('fakesink','fakesinkv')
|
#self.show = Element('fakesink','fakesinkv')
|
||||||
#self.show.set_property('silent', 0)
|
#self.show.set_property('silent', 0)
|
||||||
#self.show.set_property('sync', 1)
|
#self.show.set_property('sync', 1)
|
||||||
|
|
||||||
#self.deinterlace = Element('deinterlace','deinterlace')
|
#self.deinterlace = gst.Element('deinterlace','deinterlace')
|
||||||
self.deinterlace = Element('identity','deinterlace')
|
self.deinterlace = gst.Element('identity','deinterlace')
|
||||||
|
|
||||||
last = None
|
last = None
|
||||||
for e in (self.v_queue, self.v_decode, self.color, self.efx, self.color2, self.deinterlace, self.show):
|
for e in (self.v_queue, self.v_decode, self.color, self.efx, self.color2, self.deinterlace, self.show):
|
||||||
|
@ -149,13 +140,13 @@ class DVDPlayer(object):
|
||||||
|
|
||||||
def build_audio_thread(self):
|
def build_audio_thread(self):
|
||||||
# ***** pre-construct the audio thread *****
|
# ***** pre-construct the audio thread *****
|
||||||
self.a_thread = Thread('a_thread')
|
self.a_thread = gst.Thread('a_thread')
|
||||||
|
|
||||||
self.a_queue = Element('queue','a_queue')
|
self.a_queue = gst.Element('queue','a_queue')
|
||||||
|
|
||||||
self.a_decode = Element('a52dec','decode_audio')
|
self.a_decode = gst.Element('a52dec','decode_audio')
|
||||||
|
|
||||||
self.osssink = Element('osssink','osssink')
|
self.osssink = gst.Element('osssink','osssink')
|
||||||
#self.osssink = Element('fakesink','fakesinka')
|
#self.osssink = Element('fakesink','fakesinka')
|
||||||
#self.osssink.set_property('silent', 0)
|
#self.osssink.set_property('silent', 0)
|
||||||
#self.osssink.set_property('sync', 0)
|
#self.osssink.set_property('sync', 0)
|
||||||
|
@ -168,9 +159,9 @@ class DVDPlayer(object):
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
# ***** construct the main pipeline *****
|
# ***** construct the main pipeline *****
|
||||||
self.pipeline = Pipeline('pipeline')
|
self.pipeline = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
self.src = Element('dvdreadsrc','src');
|
self.src = gst.Element('dvdreadsrc','src');
|
||||||
|
|
||||||
self.src.connect('deep_notify',self.dnprint)
|
self.src.connect('deep_notify',self.dnprint)
|
||||||
self.src.set_property('location', self.location)
|
self.src.set_property('location', self.location)
|
||||||
|
@ -178,7 +169,7 @@ class DVDPlayer(object):
|
||||||
self.src.set_property('chapter', self.chapter)
|
self.src.set_property('chapter', self.chapter)
|
||||||
self.src.set_property('angle', self.angle)
|
self.src.set_property('angle', self.angle)
|
||||||
|
|
||||||
self.parse = Element('mpegdemux','parse')
|
self.parse = gst.Element('mpegdemux','parse')
|
||||||
self.parse.set_property('sync', 0)
|
self.parse.set_property('sync', 0)
|
||||||
|
|
||||||
self.pipeline.add(self.src)
|
self.pipeline.add(self.src)
|
||||||
|
@ -219,9 +210,18 @@ class DVDPlayer(object):
|
||||||
str = obj.get_property(param.name)
|
str = obj.get_property(param.name)
|
||||||
print '%s: %s = %s' % (sender.get_name(), param.name, str)
|
print '%s: %s = %s' % (sender.get_name(), param.name, str)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def main(args):
|
||||||
#gst_debug_set_categories(0xFFFFFFFFL)
|
if len(sys.argv) < 5:
|
||||||
#gst_info_set_categories(0xFFFFFFFFL)
|
print 'usage: %s dvdlocation title chapter angle' % sys.argv[0]
|
||||||
|
return -1
|
||||||
|
|
||||||
|
location = sys.argv[1]
|
||||||
|
title = int(sys.argv[2])
|
||||||
|
chapter = int(sys.argv[3])
|
||||||
|
angle = int(sys.argv[4])
|
||||||
|
|
||||||
player = DVDPlayer()
|
player = DVDPlayer()
|
||||||
ret = player.main()
|
return player.main(location, title, chapter, angle)
|
||||||
sys.exit(ret)
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main(sys.argv))
|
||||||
|
|
|
@ -21,23 +21,24 @@
|
||||||
# Author: David I. Lehn <dlehn@users.sourceforge.net>
|
# Author: David I. Lehn <dlehn@users.sourceforge.net>
|
||||||
#
|
#
|
||||||
|
|
||||||
from gobject import GObject
|
import sys
|
||||||
from gstreamer import *
|
|
||||||
|
import gst
|
||||||
|
|
||||||
def handoff(sender, *args):
|
def handoff(sender, *args):
|
||||||
print sender.get_name(), args
|
print sender.get_name(), args
|
||||||
|
|
||||||
def main():
|
def main(args):
|
||||||
# create a new bin to hold the elements
|
# create a new bin to hold the elements
|
||||||
#gst_debug_set_categories(-1)
|
#gst_debug_set_categories(-1)
|
||||||
bin = Pipeline('pipeline')
|
bin = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
src = Element('fakesrc', 'src')
|
src = gst.Element('fakesrc', 'src')
|
||||||
src.connect('handoff', handoff)
|
src.connect('handoff', handoff)
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
src.set_property('num_buffers', 10)
|
src.set_property('num_buffers', 10)
|
||||||
|
|
||||||
sink = Element('fakesink', 'sink')
|
sink = gst.Element('fakesink', 'sink')
|
||||||
sink.connect('handoff', handoff)
|
sink.connect('handoff', handoff)
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
|
|
||||||
|
@ -50,14 +51,15 @@ def main():
|
||||||
assert res
|
assert res
|
||||||
|
|
||||||
# start playing
|
# start playing
|
||||||
res = bin.set_state(STATE_PLAYING);
|
res = bin.set_state(gst.STATE_PLAYING);
|
||||||
assert res
|
assert res
|
||||||
|
|
||||||
while bin.iterate(): pass
|
while bin.iterate():
|
||||||
|
pass
|
||||||
|
|
||||||
# stop the bin
|
# stop the bin
|
||||||
res = bin.set_state(STATE_NULL)
|
res = bin.set_state(gst.STATE_NULL)
|
||||||
assert res
|
assert res
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
sys.exit(main(sys.argv))
|
||||||
|
|
|
@ -22,19 +22,18 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from gstreamer import *
|
|
||||||
import gobject
|
import gobject
|
||||||
from cp import filter
|
import gst
|
||||||
|
|
||||||
class Identity(Element):
|
class Identity(gst.Element):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.__gobject_init__()
|
self.__gobject_init__()
|
||||||
self.sinkpad = Pad('sink', PAD_SINK)
|
self.sinkpad = gst.Pad('sink', gst.PAD_SINK)
|
||||||
self.add_pad(self.sinkpad)
|
self.add_pad(self.sinkpad)
|
||||||
self.sinkpad.set_chain_function(self.chain)
|
self.sinkpad.set_chain_function(self.chain)
|
||||||
self.sinkpad.set_link_function(self.pad_link)
|
self.sinkpad.set_link_function(self.pad_link)
|
||||||
|
|
||||||
self.srcpad = Pad('src', PAD_SRC)
|
self.srcpad = gst.Pad('src', gst.PAD_SRC)
|
||||||
self.add_pad(self.srcpad)
|
self.add_pad(self.srcpad)
|
||||||
self.srcpad.set_link_function(self.pad_link)
|
self.srcpad.set_link_function(self.pad_link)
|
||||||
|
|
||||||
|
@ -44,16 +43,33 @@ class Identity(Element):
|
||||||
|
|
||||||
def pad_link(self, pad, caps):
|
def pad_link(self, pad, caps):
|
||||||
print 'pad_link:', self, pad, caps
|
print 'pad_link:', self, pad, caps
|
||||||
return PAD_LINK_OK
|
return gst.PAD_LINK_OK
|
||||||
|
|
||||||
def chain(self, pad, buf):
|
def chain(self, pad, buf):
|
||||||
self.srcpad.push(buf)
|
self.srcpad.push(buf)
|
||||||
|
|
||||||
gobject.type_register(Identity)
|
gobject.type_register(Identity)
|
||||||
|
|
||||||
def main():
|
def filter(element):
|
||||||
|
# create a new bin to hold the elements
|
||||||
|
bin = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
|
filesrc = gst.Element('sinesrc', 'source');
|
||||||
|
filesink = gst.Element('fakesink', 'sink')
|
||||||
|
|
||||||
|
bin.add_many(filesrc, element, filesink)
|
||||||
|
gst.element_link_many(filesrc, element, filesink)
|
||||||
|
|
||||||
|
# start playing
|
||||||
|
bin.set_state(gst.STATE_PLAYING);
|
||||||
|
|
||||||
|
while bin.iterate():
|
||||||
|
pass
|
||||||
|
|
||||||
|
# stop the bin
|
||||||
|
bin.set_state(gst.STATE_NULL)
|
||||||
|
|
||||||
|
def main(args):
|
||||||
"A GStreamer Python subclassing example of an identity filter"
|
"A GStreamer Python subclassing example of an identity filter"
|
||||||
gst_debug_set_categories(0L)
|
|
||||||
|
|
||||||
identity = Identity()
|
identity = Identity()
|
||||||
identity.set_name('identity')
|
identity.set_name('identity')
|
||||||
|
@ -61,8 +77,8 @@ def main():
|
||||||
print 'could not create \"Identity\" element'
|
print 'could not create \"Identity\" element'
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
return filter([identity])
|
return filter(identity)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ret = main()
|
sys.exit(main(sys.argv))
|
||||||
sys.exit (ret)
|
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from gstreamer import *
|
import gst
|
||||||
from gobject import GObject
|
|
||||||
import time
|
import time
|
||||||
from identity import Identity
|
from identity import Identity
|
||||||
|
|
||||||
|
@ -32,38 +31,30 @@ def update(sender, *args):
|
||||||
|
|
||||||
def build(filters, b):
|
def build(filters, b):
|
||||||
# create a new bin to hold the elements
|
# create a new bin to hold the elements
|
||||||
bin = Pipeline('pipeline')
|
bin = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
src = Element('fakesrc', 'source');
|
src = gst.Element('fakesrc', 'source');
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
src.set_property('num_buffers', b)
|
src.set_property('num_buffers', b)
|
||||||
|
|
||||||
sink = Element('fakesink', 'sink')
|
sink = gst.Element('fakesink', 'sink')
|
||||||
sink.set_property('silent', 1)
|
sink.set_property('silent', 1)
|
||||||
|
|
||||||
elements = [src] + filters + [sink]
|
elements = [src] + filters + [sink]
|
||||||
# add objects to the main pipeline
|
bin.add_many(*elements)
|
||||||
for e in elements:
|
gst.element_link_many(*elements)
|
||||||
bin.add(e)
|
|
||||||
|
|
||||||
# link the elements
|
|
||||||
previous = None
|
|
||||||
for e in elements:
|
|
||||||
if previous:
|
|
||||||
previous.link(e)
|
|
||||||
previous = e
|
|
||||||
|
|
||||||
return bin
|
return bin
|
||||||
|
|
||||||
def filter(bin):
|
def filter(bin):
|
||||||
bin.set_state(STATE_PLAYING);
|
bin.set_state(gst.STATE_PLAYING);
|
||||||
while bin.iterate(): pass
|
while bin.iterate():
|
||||||
bin.set_state(STATE_NULL)
|
pass
|
||||||
|
bin.set_state(gst.STATE_NULL)
|
||||||
|
|
||||||
ccnt = 0
|
ccnt = 0
|
||||||
def c():
|
def c():
|
||||||
global ccnt
|
global ccnt
|
||||||
id = Element ('identity', 'c identity %d' % ccnt);
|
id = gst.Element('identity', 'c identity %d' % ccnt);
|
||||||
id.set_property('silent', 1)
|
id.set_property('silent', 1)
|
||||||
id.set_property('loop_based', 0)
|
id.set_property('loop_based', 0)
|
||||||
ccnt += 1
|
ccnt += 1
|
||||||
|
@ -91,19 +82,17 @@ def check(f, n, b):
|
||||||
print '%s b:%d i:%d t:%f' % (f, b, n, end - start)
|
print '%s b:%d i:%d t:%f' % (f, b, n, end - start)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def main():
|
def main(args):
|
||||||
"Identity timer and latency check"
|
"Identity timer and latency check"
|
||||||
if gst_version() < (0,7,0):
|
|
||||||
gst_debug_set_categories(0L)
|
|
||||||
|
|
||||||
if len(sys.argv) < 3:
|
if len(args) < 3:
|
||||||
print 'usage: %s identites buffers' % (sys.argv[0],)
|
print 'usage: %s identites buffers' % args[0]
|
||||||
return -1
|
return -1
|
||||||
n = int(sys.argv[1])
|
n = int(args[1])
|
||||||
b = int(sys.argv[2])
|
b = int(args[2])
|
||||||
|
|
||||||
for f in (c, py):
|
for f in (c, py):
|
||||||
check(f, n, b)
|
check(f, n, b)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ret = main()
|
sys.exit(main(sys.argv))
|
||||||
sys.exit (ret)
|
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from gstreamer import *
|
import gst
|
||||||
from gobject import GObject
|
|
||||||
|
|
||||||
def update(sender, *args):
|
def update(sender, *args):
|
||||||
print sender.get_name(), args
|
print sender.get_name(), args
|
||||||
|
@ -63,7 +62,7 @@ def identity_add(pipeline, first, count):
|
||||||
|
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
name = 'identity_%03d' % i
|
name = 'identity_%03d' % i
|
||||||
ident = Element('identity', name)
|
ident = gst.Element('identity', name)
|
||||||
ident.set_property('silent', 1)
|
ident.set_property('silent', 1)
|
||||||
pipeline.add(ident)
|
pipeline.add(ident)
|
||||||
last.get_pad('src').link(ident.get_pad('sink'))
|
last.get_pad('src').link(ident.get_pad('sink'))
|
||||||
|
@ -72,14 +71,14 @@ def identity_add(pipeline, first, count):
|
||||||
return last
|
return last
|
||||||
|
|
||||||
def fakesrc():
|
def fakesrc():
|
||||||
src = Element('fakesrc','src')
|
src = gst.Element('fakesrc','src')
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
src.set_property('num_buffers', iterations)
|
src.set_property('num_buffers', iterations)
|
||||||
src.connect('handoff', handoff_src)
|
src.connect('handoff', handoff_src)
|
||||||
return src
|
return src
|
||||||
|
|
||||||
def fakesink():
|
def fakesink():
|
||||||
sink = Element('fakesink','fakesink')
|
sink = gst.Element('fakesink','fakesink')
|
||||||
sink.set_property('silent', 1)
|
sink.set_property('silent', 1)
|
||||||
sink.connect('handoff', handoff_sink)
|
sink.connect('handoff', handoff_sink)
|
||||||
return sink
|
return sink
|
||||||
|
@ -89,10 +88,8 @@ def simple(argv):
|
||||||
print 'simple: bad params'
|
print 'simple: bad params'
|
||||||
return None
|
return None
|
||||||
idents = int(argv[0])
|
idents = int(argv[0])
|
||||||
if len(argv) == 2:
|
|
||||||
gst_schedulerfactory_set_default_name (argv[1])
|
|
||||||
|
|
||||||
pipeline = Pipeline('pipeline')
|
pipeline = gst.Pipeline('pipeline')
|
||||||
|
|
||||||
src = fakesrc()
|
src = fakesrc()
|
||||||
pipeline.add(src)
|
pipeline.add(src)
|
||||||
|
@ -109,17 +106,14 @@ def queue(argv):
|
||||||
return None
|
return None
|
||||||
idents = int(argv[0])
|
idents = int(argv[0])
|
||||||
|
|
||||||
if len(arv) == 2:
|
pipeline = gst.Pipeline('pipeline')
|
||||||
gst_schedulerfactory_set_default_name (argv[1])
|
|
||||||
|
|
||||||
pipeline = Pipeline('pipeline')
|
src_thr = gst.Thread('src_thread')
|
||||||
|
|
||||||
src_thr = Thread('src_thread')
|
|
||||||
|
|
||||||
src = fakesrc()
|
src = fakesrc()
|
||||||
src_thr.add(src)
|
src_thr.add(src)
|
||||||
|
|
||||||
src_q = Element('queue','src_q')
|
src_q = gst.Element('queue','src_q')
|
||||||
src_thr.add(src_q)
|
src_thr.add(src_q)
|
||||||
src.get_pad('src').link(src_q.get_pad('sink'))
|
src.get_pad('src').link(src_q.get_pad('sink'))
|
||||||
|
|
||||||
|
@ -127,11 +121,11 @@ def queue(argv):
|
||||||
|
|
||||||
last = identity_add(pipeline, src_q, idents)
|
last = identity_add(pipeline, src_q, idents)
|
||||||
|
|
||||||
sink_q = Element('queue','sink_q')
|
sink_q = gst.Element('queue','sink_q')
|
||||||
pipeline.add(sink_q)
|
pipeline.add(sink_q)
|
||||||
last.get_pad('src').link(sink_q.get_pad('sink'))
|
last.get_pad('src').link(sink_q.get_pad('sink'))
|
||||||
|
|
||||||
sink_thr = Thread('sink_thread')
|
sink_thr = gst.Thread('sink_thread')
|
||||||
|
|
||||||
sink = fakesink()
|
sink = fakesink()
|
||||||
|
|
||||||
|
@ -169,12 +163,12 @@ def main():
|
||||||
|
|
||||||
#xmlSaveFile('lat.gst', gst_xml_write(pipeline))
|
#xmlSaveFile('lat.gst', gst_xml_write(pipeline))
|
||||||
|
|
||||||
pipeline.set_state(STATE_PLAYING)
|
pipeline.set_state(gst.STATE_PLAYING)
|
||||||
|
|
||||||
while count < iterations:
|
while count < iterations:
|
||||||
pipeline.iterate()
|
pipeline.iterate()
|
||||||
|
|
||||||
pipeline.set_state(STATE_NULL)
|
pipeline.set_state(gst.STATE_NULL)
|
||||||
|
|
||||||
print
|
print
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from gstreamer import *
|
import gst
|
||||||
import gobject
|
|
||||||
from identity import Identity
|
from identity import Identity
|
||||||
from cp import filter
|
from cp import filter
|
||||||
|
|
||||||
|
@ -41,15 +40,14 @@ class Rot13(Identity):
|
||||||
a = 'A'
|
a = 'A'
|
||||||
c = chr((((ord(c) - ord(a)) + 13) % 26) + ord(a))
|
c = chr((((ord(c) - ord(a)) + 13) % 26) + ord(a))
|
||||||
data2 = data2 + c
|
data2 = data2 + c
|
||||||
newbuf = Buffer()
|
newbuf = gst.Buffer()
|
||||||
newbuf.set_data(data2)
|
newbuf.set_data(data2)
|
||||||
self.srcpad.push(newbuf)
|
self.srcpad.push(newbuf)
|
||||||
|
|
||||||
gobject.type_register(Rot13)
|
gobject.type_register(Rot13)
|
||||||
|
|
||||||
def main():
|
def main(args):
|
||||||
"A GStreamer Python subclassing example of a rot13 filter"
|
"A GStreamer Python subclassing example of a rot13 filter"
|
||||||
gst_debug_set_categories(0L)
|
|
||||||
|
|
||||||
rot13 = Rot13()
|
rot13 = Rot13()
|
||||||
rot13.set_name('rot13')
|
rot13.set_name('rot13')
|
||||||
|
@ -60,5 +58,4 @@ def main():
|
||||||
return filter([rot13])
|
return filter([rot13])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ret = main()
|
sys.exit(main(sys.argv))
|
||||||
sys.exit (ret)
|
|
||||||
|
|
526
gst/gst.defs
526
gst/gst.defs
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue