4 space indents

Original commit message from CVS:
4 space indents
This commit is contained in:
David I. Lehn 2003-10-10 03:48:18 +00:00
parent 1ec10b9d91
commit 26c22b53d6
3 changed files with 110 additions and 108 deletions

View file

@ -5,6 +5,8 @@
* gstreamer/Makefile.am: fix libtool 1.5 build by fixing export * gstreamer/Makefile.am: fix libtool 1.5 build by fixing export
symbol typo s/initgstreamer/init_gstreamer/ symbol typo s/initgstreamer/init_gstreamer/
* gstreamer/examples/ilat.py: 4 space indents
2003-10-05 Thomas Vander Stichele <thomas at apestaart dot org> 2003-10-05 Thomas Vander Stichele <thomas at apestaart dot org>
* examples/gstreamer/*.py: use Element over gst_element_factory_make * examples/gstreamer/*.py: use Element over gst_element_factory_make

View file

@ -28,81 +28,81 @@ import time
from identity import Identity from identity import Identity
def update(sender, *args): def update(sender, *args):
print sender.get_name(), args print sender.get_name(), 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 = Pipeline('pipeline')
src = Element('fakesrc', 'source'); src = 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 = 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 # add objects to the main pipeline
for e in elements: for e in elements:
bin.add(e) bin.add(e)
# link the elements # link the elements
previous = None previous = None
for e in elements: for e in elements:
if previous: if previous:
previous.link(e) previous.link(e)
previous = e previous = e
return bin return bin
def filter(bin): def filter(bin):
bin.set_state(STATE_PLAYING); bin.set_state(STATE_PLAYING);
while bin.iterate(): pass while bin.iterate(): pass
bin.set_state(STATE_NULL) bin.set_state(STATE_NULL)
ccnt = 0 ccnt = 0
def c(): def c():
global ccnt global ccnt
id = Element ('identity', 'c identity %d' % ccnt); id = 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
return id return id
pcnt = 0 pcnt = 0
def py(): def py():
id = Identity() id = Identity()
assert id assert id
global pcnt global pcnt
id.set_name('py identity %d' % pcnt) id.set_name('py identity %d' % pcnt)
pcnt += 1 pcnt += 1
return id return id
def check(f, n, b): def check(f, n, b):
fs = [] fs = []
for i in range(n): for i in range(n):
fs.append(f()) fs.append(f())
pipe = build(fs, b) pipe = build(fs, b)
start = time.time() start = time.time()
ret = filter(pipe) ret = filter(pipe)
end = time.time() end = time.time()
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():
"Identity timer and latency check" "Identity timer and latency check"
gst_debug_set_categories(0L) gst_debug_set_categories(0L)
if len(sys.argv) < 3: if len(sys.argv) < 3:
print 'usage: %s identites buffers' % (sys.argv[0],) print 'usage: %s identites buffers' % (sys.argv[0],)
return -1 return -1
n = int(sys.argv[1]) n = int(sys.argv[1])
b = int(sys.argv[2]) b = int(sys.argv[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() ret = main()
sys.exit (ret) sys.exit (ret)

View file

@ -28,81 +28,81 @@ import time
from identity import Identity from identity import Identity
def update(sender, *args): def update(sender, *args):
print sender.get_name(), args print sender.get_name(), 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 = Pipeline('pipeline')
src = Element('fakesrc', 'source'); src = 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 = 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 # add objects to the main pipeline
for e in elements: for e in elements:
bin.add(e) bin.add(e)
# link the elements # link the elements
previous = None previous = None
for e in elements: for e in elements:
if previous: if previous:
previous.link(e) previous.link(e)
previous = e previous = e
return bin return bin
def filter(bin): def filter(bin):
bin.set_state(STATE_PLAYING); bin.set_state(STATE_PLAYING);
while bin.iterate(): pass while bin.iterate(): pass
bin.set_state(STATE_NULL) bin.set_state(STATE_NULL)
ccnt = 0 ccnt = 0
def c(): def c():
global ccnt global ccnt
id = Element ('identity', 'c identity %d' % ccnt); id = 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
return id return id
pcnt = 0 pcnt = 0
def py(): def py():
id = Identity() id = Identity()
assert id assert id
global pcnt global pcnt
id.set_name('py identity %d' % pcnt) id.set_name('py identity %d' % pcnt)
pcnt += 1 pcnt += 1
return id return id
def check(f, n, b): def check(f, n, b):
fs = [] fs = []
for i in range(n): for i in range(n):
fs.append(f()) fs.append(f())
pipe = build(fs, b) pipe = build(fs, b)
start = time.time() start = time.time()
ret = filter(pipe) ret = filter(pipe)
end = time.time() end = time.time()
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():
"Identity timer and latency check" "Identity timer and latency check"
gst_debug_set_categories(0L) gst_debug_set_categories(0L)
if len(sys.argv) < 3: if len(sys.argv) < 3:
print 'usage: %s identites buffers' % (sys.argv[0],) print 'usage: %s identites buffers' % (sys.argv[0],)
return -1 return -1
n = int(sys.argv[1]) n = int(sys.argv[1])
b = int(sys.argv[2]) b = int(sys.argv[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() ret = main()
sys.exit (ret) sys.exit (ret)