mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 23:48:53 +00:00
update to new GstPad/GstElement link API and remove old hacks to call GObject connect method
Original commit message from CVS: update to new GstPad/GstElement link API and remove old hacks to call GObject connect method
This commit is contained in:
parent
f85f7a3952
commit
0a5f74f873
17 changed files with 122 additions and 114 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2003-01-09 David I. Lehn <dlehn@users.sourceforge.net>
|
||||||
|
|
||||||
|
* examples/gstreamer/*, gstreamer/gstreamer.override: update to new
|
||||||
|
GstPad/GstElement link API and remove old hacks to call GObject
|
||||||
|
connect method
|
||||||
|
|
||||||
|
* gstreamer/Makefile.am: ignore gstcompat.h
|
||||||
|
|
||||||
2003-01-04 David I. Lehn <dlehn@users.sourceforge.net>
|
2003-01-04 David I. Lehn <dlehn@users.sourceforge.net>
|
||||||
|
|
||||||
* gstreamer/gstreamer.override, gstreamer/gstreamer-extra.defs: add
|
* gstreamer/gstreamer.override, gstreamer/gstreamer-extra.defs: add
|
||||||
|
|
|
@ -55,11 +55,11 @@ def filter(filters):
|
||||||
for e in elements:
|
for e in elements:
|
||||||
bin.add(e)
|
bin.add(e)
|
||||||
|
|
||||||
# connect the elements
|
# link the elements
|
||||||
previous = None
|
previous = None
|
||||||
for e in elements:
|
for e in elements:
|
||||||
if previous:
|
if previous:
|
||||||
previous.connect(e)
|
previous.link(e)
|
||||||
previous = e
|
previous = e
|
||||||
|
|
||||||
# start playing
|
# start playing
|
||||||
|
@ -84,7 +84,7 @@ def main():
|
||||||
stats.set_property('silent', 0)
|
stats.set_property('silent', 0)
|
||||||
stats.set_property('buffer_update_freq', 1)
|
stats.set_property('buffer_update_freq', 1)
|
||||||
stats.set_property('update_on_eos', 1)
|
stats.set_property('update_on_eos', 1)
|
||||||
#GObject.connect(stats, 'update', update)
|
#stats.connect('update', update)
|
||||||
|
|
||||||
return filter([stats])
|
return filter([stats])
|
||||||
|
|
||||||
|
|
|
@ -46,13 +46,13 @@ class DVDPlayer(object):
|
||||||
#gtk.threads_enter()
|
#gtk.threads_enter()
|
||||||
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.connect(self.v_queue.get_pad('sink'))
|
pad.link(self.v_queue.get_pad('sink'))
|
||||||
self.pipeline.set_state(STATE_PAUSED)
|
self.pipeline.set_state(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(STATE_PLAYING)
|
||||||
self.pipeline.set_state(STATE_PLAYING)
|
self.pipeline.set_state(STATE_PLAYING)
|
||||||
elif pad.get_name() == 'private_stream_1.0':
|
elif pad.get_name() == 'private_stream_1.0':
|
||||||
pad.connect(self.a_queue.get_pad('sink'))
|
pad.link(self.a_queue.get_pad('sink'))
|
||||||
self.pipeline.set_state(STATE_PAUSED)
|
self.pipeline.set_state(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(STATE_PLAYING);
|
||||||
|
@ -146,14 +146,14 @@ class DVDPlayer(object):
|
||||||
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):
|
||||||
self.v_thread.add(e)
|
self.v_thread.add(e)
|
||||||
if last:
|
if last:
|
||||||
last.connect(e)
|
last.link(e)
|
||||||
last = e
|
last = e
|
||||||
|
|
||||||
#self.v_queue.connect(self.v_decode)
|
#self.v_queue.link(self.v_decode)
|
||||||
#self.v_decode.connect(self.color)
|
#self.v_decode.link(self.color)
|
||||||
#self.color.connect(self.efx)
|
#self.color.link(self.efx)
|
||||||
#self.efx.connect(self.color2)
|
#self.efx.link(self.color2)
|
||||||
#self.color2.connect(self.show)
|
#self.color2.link(self.show)
|
||||||
|
|
||||||
def build_audio_thread(self):
|
def build_audio_thread(self):
|
||||||
# ***** pre-construct the audio thread *****
|
# ***** pre-construct the audio thread *****
|
||||||
|
@ -175,8 +175,8 @@ class DVDPlayer(object):
|
||||||
for e in (self.a_queue, self.a_decode, self.osssink):
|
for e in (self.a_queue, self.a_decode, self.osssink):
|
||||||
self.a_thread.add(e)
|
self.a_thread.add(e)
|
||||||
|
|
||||||
self.a_queue.connect(self.a_decode)
|
self.a_queue.link(self.a_decode)
|
||||||
self.a_decode.connect(self.osssink)
|
self.a_decode.link(self.osssink)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
# ***** construct the main pipeline *****
|
# ***** construct the main pipeline *****
|
||||||
|
@ -186,7 +186,7 @@ class DVDPlayer(object):
|
||||||
self.src = gst_element_factory_make('dvdreadsrc','src');
|
self.src = gst_element_factory_make('dvdreadsrc','src');
|
||||||
assert self.src
|
assert self.src
|
||||||
|
|
||||||
GObject.connect(self.src,'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)
|
||||||
self.src.set_property('title', self.title)
|
self.src.set_property('title', self.title)
|
||||||
self.src.set_property('chapter', self.chapter)
|
self.src.set_property('chapter', self.chapter)
|
||||||
|
@ -199,7 +199,7 @@ class DVDPlayer(object):
|
||||||
self.pipeline.add(self.src)
|
self.pipeline.add(self.src)
|
||||||
self.pipeline.add(self.parse)
|
self.pipeline.add(self.parse)
|
||||||
|
|
||||||
self.src.connect(self.parse)
|
self.src.link(self.parse)
|
||||||
|
|
||||||
# pre-construct the audio/video threads
|
# pre-construct the audio/video threads
|
||||||
self.build_video_thread()
|
self.build_video_thread()
|
||||||
|
@ -218,12 +218,12 @@ class DVDPlayer(object):
|
||||||
#gtk_socket_steal (GTK_SOCKET (gtk_socket),
|
#gtk_socket_steal (GTK_SOCKET (gtk_socket),
|
||||||
#gst_util_get_int_arg (GTK_OBJECT(show), 'xid'));
|
#gst_util_get_int_arg (GTK_OBJECT(show), 'xid'));
|
||||||
|
|
||||||
GObject.connect(self.parse,'new_pad',self.mpegparse_newpad, self.pipeline)
|
self.parse.connect('new_pad',self.mpegparse_newpad, self.pipeline)
|
||||||
GObject.connect(self.src,'eos',self.eof)
|
self.src.connect('eos',self.eof)
|
||||||
#GObject.connect(show,'have_size',self.mpegparse_have_size, self.pipeline)
|
#show.connect('have_size',self.mpegparse_have_size, self.pipeline)
|
||||||
|
|
||||||
#GObject.connect(self.pipeline,'error',self.pipeline_error)
|
#self.pipeline.connect('error',self.pipeline_error)
|
||||||
#GObject.connect(self.pipeline,'deep_notify',self.dnprint)
|
#self.pipeline.connect('deep_notify',self.dnprint)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
@ -35,21 +35,21 @@ def main():
|
||||||
|
|
||||||
src = gst_element_factory_make('fakesrc', 'src')
|
src = gst_element_factory_make('fakesrc', 'src')
|
||||||
assert src
|
assert src
|
||||||
GObject.connect(src, '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 = gst_element_factory_make('fakesink', 'sink')
|
sink = gst_element_factory_make('fakesink', 'sink')
|
||||||
assert sink
|
assert sink
|
||||||
GObject.connect(sink, 'handoff', handoff)
|
sink.connect('handoff', handoff)
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
|
|
||||||
# add objects to the main pipeline
|
# add objects to the main pipeline
|
||||||
for e in (src, sink):
|
for e in (src, sink):
|
||||||
bin.add(e)
|
bin.add(e)
|
||||||
|
|
||||||
# connect the elements
|
# link the elements
|
||||||
res = src.connect(sink)
|
res = src.link(sink)
|
||||||
assert res
|
assert res
|
||||||
|
|
||||||
# start playing
|
# start playing
|
||||||
|
|
|
@ -32,19 +32,19 @@ class Identity(Element):
|
||||||
self.sinkpad = Pad('sink', PAD_SINK)
|
self.sinkpad = Pad('sink', 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_connect_function(self.pad_connect)
|
self.sinkpad.set_link_function(self.pad_link)
|
||||||
|
|
||||||
self.srcpad = Pad('src', PAD_SRC)
|
self.srcpad = Pad('src', PAD_SRC)
|
||||||
self.add_pad(self.srcpad)
|
self.add_pad(self.srcpad)
|
||||||
self.srcpad.set_connect_function(self.pad_connect)
|
self.srcpad.set_link_function(self.pad_link)
|
||||||
|
|
||||||
def get_bufferpool(self, pad):
|
def get_bufferpool(self, pad):
|
||||||
print 'get_bufferpool:', self, pad
|
print 'get_bufferpool:', self, pad
|
||||||
return self.srcpad.get_bufferpool()
|
return self.srcpad.get_bufferpool()
|
||||||
|
|
||||||
def pad_connect(self, pad, caps):
|
def pad_link(self, pad, caps):
|
||||||
print 'pad_connect:', self, pad, caps
|
print 'pad_link:', self, pad, caps
|
||||||
return PAD_CONNECT_OK
|
return PAD_LINK_OK
|
||||||
|
|
||||||
def chain(self, pad, buf):
|
def chain(self, pad, buf):
|
||||||
self.srcpad.push(buf)
|
self.srcpad.push(buf)
|
||||||
|
|
|
@ -48,11 +48,11 @@ def build(filters, b):
|
||||||
for e in elements:
|
for e in elements:
|
||||||
bin.add(e)
|
bin.add(e)
|
||||||
|
|
||||||
# connect the elements
|
# link the elements
|
||||||
previous = None
|
previous = None
|
||||||
for e in elements:
|
for e in elements:
|
||||||
if previous:
|
if previous:
|
||||||
previous.connect(e)
|
previous.link(e)
|
||||||
previous = e
|
previous = e
|
||||||
|
|
||||||
return bin
|
return bin
|
||||||
|
|
|
@ -67,7 +67,7 @@ def identity_add(pipeline, first, count):
|
||||||
assert ident
|
assert ident
|
||||||
ident.set_property('silent', 1)
|
ident.set_property('silent', 1)
|
||||||
pipeline.add(ident)
|
pipeline.add(ident)
|
||||||
last.get_pad('src').connect(ident.get_pad('sink'))
|
last.get_pad('src').link(ident.get_pad('sink'))
|
||||||
last = ident
|
last = ident
|
||||||
|
|
||||||
return last
|
return last
|
||||||
|
@ -77,14 +77,14 @@ def fakesrc():
|
||||||
assert src
|
assert src
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
src.set_property('num_buffers', iterations)
|
src.set_property('num_buffers', iterations)
|
||||||
GObject.connect(src, 'handoff', handoff_src)
|
src.connect('handoff', handoff_src)
|
||||||
return src
|
return src
|
||||||
|
|
||||||
def fakesink():
|
def fakesink():
|
||||||
sink = gst_element_factory_make('fakesink','fakesink')
|
sink = gst_element_factory_make('fakesink','fakesink')
|
||||||
assert sink
|
assert sink
|
||||||
sink.set_property('silent', 1)
|
sink.set_property('silent', 1)
|
||||||
GObject.connect(sink, 'handoff', handoff_sink)
|
sink.connect('handoff', handoff_sink)
|
||||||
return sink
|
return sink
|
||||||
|
|
||||||
def simple(argv):
|
def simple(argv):
|
||||||
|
@ -103,7 +103,7 @@ def simple(argv):
|
||||||
last = identity_add(pipeline, src, idents)
|
last = identity_add(pipeline, src, idents)
|
||||||
sink = fakesink()
|
sink = fakesink()
|
||||||
pipeline.add(sink)
|
pipeline.add(sink)
|
||||||
last.get_pad('src').connect(sink.get_pad('sink'))
|
last.get_pad('src').link(sink.get_pad('sink'))
|
||||||
|
|
||||||
return pipeline
|
return pipeline
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ def queue(argv):
|
||||||
src_q = gst_element_factory_make('queue','src_q')
|
src_q = gst_element_factory_make('queue','src_q')
|
||||||
assert src_q
|
assert src_q
|
||||||
src_thr.add(src_q)
|
src_thr.add(src_q)
|
||||||
src.get_pad('src').connect(src_q.get_pad('sink'))
|
src.get_pad('src').link(src_q.get_pad('sink'))
|
||||||
|
|
||||||
pipeline.add(src_thr)
|
pipeline.add(src_thr)
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ def queue(argv):
|
||||||
sink_q = gst_element_factory_make('queue','sink_q')
|
sink_q = gst_element_factory_make('queue','sink_q')
|
||||||
assert sink_q
|
assert sink_q
|
||||||
pipeline.add(sink_q)
|
pipeline.add(sink_q)
|
||||||
last.get_pad('src').connect(sink_q.get_pad('sink'))
|
last.get_pad('src').link(sink_q.get_pad('sink'))
|
||||||
|
|
||||||
sink_thr = Thread('sink_thread')
|
sink_thr = Thread('sink_thread')
|
||||||
assert sink_thr
|
assert sink_thr
|
||||||
|
@ -150,7 +150,7 @@ def queue(argv):
|
||||||
|
|
||||||
pipeline.add(sink_thr)
|
pipeline.add(sink_thr)
|
||||||
|
|
||||||
sink_q.get_pad('src').connect(sink.get_pad('sink'))
|
sink_q.get_pad('src').link(sink.get_pad('sink'))
|
||||||
|
|
||||||
return pipeline
|
return pipeline
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,11 @@ def main():
|
||||||
for e in (filesrc, decoder, osssink):
|
for e in (filesrc, decoder, osssink):
|
||||||
bin.add(e)
|
bin.add(e)
|
||||||
|
|
||||||
# connect the elements
|
# link the elements
|
||||||
previous = None
|
previous = None
|
||||||
for e in (filesrc, decoder, osssink):
|
for e in (filesrc, decoder, osssink):
|
||||||
if previous:
|
if previous:
|
||||||
previous.connect(e)
|
previous.link(e)
|
||||||
previous = e
|
previous = e
|
||||||
|
|
||||||
# start playing
|
# start playing
|
||||||
|
|
|
@ -55,11 +55,11 @@ def filter(filters):
|
||||||
for e in elements:
|
for e in elements:
|
||||||
bin.add(e)
|
bin.add(e)
|
||||||
|
|
||||||
# connect the elements
|
# link the elements
|
||||||
previous = None
|
previous = None
|
||||||
for e in elements:
|
for e in elements:
|
||||||
if previous:
|
if previous:
|
||||||
previous.connect(e)
|
previous.link(e)
|
||||||
previous = e
|
previous = e
|
||||||
|
|
||||||
# start playing
|
# start playing
|
||||||
|
@ -84,7 +84,7 @@ def main():
|
||||||
stats.set_property('silent', 0)
|
stats.set_property('silent', 0)
|
||||||
stats.set_property('buffer_update_freq', 1)
|
stats.set_property('buffer_update_freq', 1)
|
||||||
stats.set_property('update_on_eos', 1)
|
stats.set_property('update_on_eos', 1)
|
||||||
#GObject.connect(stats, 'update', update)
|
#stats.connect('update', update)
|
||||||
|
|
||||||
return filter([stats])
|
return filter([stats])
|
||||||
|
|
||||||
|
|
|
@ -46,13 +46,13 @@ class DVDPlayer(object):
|
||||||
#gtk.threads_enter()
|
#gtk.threads_enter()
|
||||||
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.connect(self.v_queue.get_pad('sink'))
|
pad.link(self.v_queue.get_pad('sink'))
|
||||||
self.pipeline.set_state(STATE_PAUSED)
|
self.pipeline.set_state(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(STATE_PLAYING)
|
||||||
self.pipeline.set_state(STATE_PLAYING)
|
self.pipeline.set_state(STATE_PLAYING)
|
||||||
elif pad.get_name() == 'private_stream_1.0':
|
elif pad.get_name() == 'private_stream_1.0':
|
||||||
pad.connect(self.a_queue.get_pad('sink'))
|
pad.link(self.a_queue.get_pad('sink'))
|
||||||
self.pipeline.set_state(STATE_PAUSED)
|
self.pipeline.set_state(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(STATE_PLAYING);
|
||||||
|
@ -146,14 +146,14 @@ class DVDPlayer(object):
|
||||||
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):
|
||||||
self.v_thread.add(e)
|
self.v_thread.add(e)
|
||||||
if last:
|
if last:
|
||||||
last.connect(e)
|
last.link(e)
|
||||||
last = e
|
last = e
|
||||||
|
|
||||||
#self.v_queue.connect(self.v_decode)
|
#self.v_queue.link(self.v_decode)
|
||||||
#self.v_decode.connect(self.color)
|
#self.v_decode.link(self.color)
|
||||||
#self.color.connect(self.efx)
|
#self.color.link(self.efx)
|
||||||
#self.efx.connect(self.color2)
|
#self.efx.link(self.color2)
|
||||||
#self.color2.connect(self.show)
|
#self.color2.link(self.show)
|
||||||
|
|
||||||
def build_audio_thread(self):
|
def build_audio_thread(self):
|
||||||
# ***** pre-construct the audio thread *****
|
# ***** pre-construct the audio thread *****
|
||||||
|
@ -175,8 +175,8 @@ class DVDPlayer(object):
|
||||||
for e in (self.a_queue, self.a_decode, self.osssink):
|
for e in (self.a_queue, self.a_decode, self.osssink):
|
||||||
self.a_thread.add(e)
|
self.a_thread.add(e)
|
||||||
|
|
||||||
self.a_queue.connect(self.a_decode)
|
self.a_queue.link(self.a_decode)
|
||||||
self.a_decode.connect(self.osssink)
|
self.a_decode.link(self.osssink)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
# ***** construct the main pipeline *****
|
# ***** construct the main pipeline *****
|
||||||
|
@ -186,7 +186,7 @@ class DVDPlayer(object):
|
||||||
self.src = gst_element_factory_make('dvdreadsrc','src');
|
self.src = gst_element_factory_make('dvdreadsrc','src');
|
||||||
assert self.src
|
assert self.src
|
||||||
|
|
||||||
GObject.connect(self.src,'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)
|
||||||
self.src.set_property('title', self.title)
|
self.src.set_property('title', self.title)
|
||||||
self.src.set_property('chapter', self.chapter)
|
self.src.set_property('chapter', self.chapter)
|
||||||
|
@ -199,7 +199,7 @@ class DVDPlayer(object):
|
||||||
self.pipeline.add(self.src)
|
self.pipeline.add(self.src)
|
||||||
self.pipeline.add(self.parse)
|
self.pipeline.add(self.parse)
|
||||||
|
|
||||||
self.src.connect(self.parse)
|
self.src.link(self.parse)
|
||||||
|
|
||||||
# pre-construct the audio/video threads
|
# pre-construct the audio/video threads
|
||||||
self.build_video_thread()
|
self.build_video_thread()
|
||||||
|
@ -218,12 +218,12 @@ class DVDPlayer(object):
|
||||||
#gtk_socket_steal (GTK_SOCKET (gtk_socket),
|
#gtk_socket_steal (GTK_SOCKET (gtk_socket),
|
||||||
#gst_util_get_int_arg (GTK_OBJECT(show), 'xid'));
|
#gst_util_get_int_arg (GTK_OBJECT(show), 'xid'));
|
||||||
|
|
||||||
GObject.connect(self.parse,'new_pad',self.mpegparse_newpad, self.pipeline)
|
self.parse.connect('new_pad',self.mpegparse_newpad, self.pipeline)
|
||||||
GObject.connect(self.src,'eos',self.eof)
|
self.src.connect('eos',self.eof)
|
||||||
#GObject.connect(show,'have_size',self.mpegparse_have_size, self.pipeline)
|
#show.connect('have_size',self.mpegparse_have_size, self.pipeline)
|
||||||
|
|
||||||
#GObject.connect(self.pipeline,'error',self.pipeline_error)
|
#self.pipeline.connect('error',self.pipeline_error)
|
||||||
#GObject.connect(self.pipeline,'deep_notify',self.dnprint)
|
#self.pipeline.connect('deep_notify',self.dnprint)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
@ -35,21 +35,21 @@ def main():
|
||||||
|
|
||||||
src = gst_element_factory_make('fakesrc', 'src')
|
src = gst_element_factory_make('fakesrc', 'src')
|
||||||
assert src
|
assert src
|
||||||
GObject.connect(src, '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 = gst_element_factory_make('fakesink', 'sink')
|
sink = gst_element_factory_make('fakesink', 'sink')
|
||||||
assert sink
|
assert sink
|
||||||
GObject.connect(sink, 'handoff', handoff)
|
sink.connect('handoff', handoff)
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
|
|
||||||
# add objects to the main pipeline
|
# add objects to the main pipeline
|
||||||
for e in (src, sink):
|
for e in (src, sink):
|
||||||
bin.add(e)
|
bin.add(e)
|
||||||
|
|
||||||
# connect the elements
|
# link the elements
|
||||||
res = src.connect(sink)
|
res = src.link(sink)
|
||||||
assert res
|
assert res
|
||||||
|
|
||||||
# start playing
|
# start playing
|
||||||
|
|
|
@ -32,19 +32,19 @@ class Identity(Element):
|
||||||
self.sinkpad = Pad('sink', PAD_SINK)
|
self.sinkpad = Pad('sink', 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_connect_function(self.pad_connect)
|
self.sinkpad.set_link_function(self.pad_link)
|
||||||
|
|
||||||
self.srcpad = Pad('src', PAD_SRC)
|
self.srcpad = Pad('src', PAD_SRC)
|
||||||
self.add_pad(self.srcpad)
|
self.add_pad(self.srcpad)
|
||||||
self.srcpad.set_connect_function(self.pad_connect)
|
self.srcpad.set_link_function(self.pad_link)
|
||||||
|
|
||||||
def get_bufferpool(self, pad):
|
def get_bufferpool(self, pad):
|
||||||
print 'get_bufferpool:', self, pad
|
print 'get_bufferpool:', self, pad
|
||||||
return self.srcpad.get_bufferpool()
|
return self.srcpad.get_bufferpool()
|
||||||
|
|
||||||
def pad_connect(self, pad, caps):
|
def pad_link(self, pad, caps):
|
||||||
print 'pad_connect:', self, pad, caps
|
print 'pad_link:', self, pad, caps
|
||||||
return PAD_CONNECT_OK
|
return PAD_LINK_OK
|
||||||
|
|
||||||
def chain(self, pad, buf):
|
def chain(self, pad, buf):
|
||||||
self.srcpad.push(buf)
|
self.srcpad.push(buf)
|
||||||
|
|
|
@ -48,11 +48,11 @@ def build(filters, b):
|
||||||
for e in elements:
|
for e in elements:
|
||||||
bin.add(e)
|
bin.add(e)
|
||||||
|
|
||||||
# connect the elements
|
# link the elements
|
||||||
previous = None
|
previous = None
|
||||||
for e in elements:
|
for e in elements:
|
||||||
if previous:
|
if previous:
|
||||||
previous.connect(e)
|
previous.link(e)
|
||||||
previous = e
|
previous = e
|
||||||
|
|
||||||
return bin
|
return bin
|
||||||
|
|
|
@ -67,7 +67,7 @@ def identity_add(pipeline, first, count):
|
||||||
assert ident
|
assert ident
|
||||||
ident.set_property('silent', 1)
|
ident.set_property('silent', 1)
|
||||||
pipeline.add(ident)
|
pipeline.add(ident)
|
||||||
last.get_pad('src').connect(ident.get_pad('sink'))
|
last.get_pad('src').link(ident.get_pad('sink'))
|
||||||
last = ident
|
last = ident
|
||||||
|
|
||||||
return last
|
return last
|
||||||
|
@ -77,14 +77,14 @@ def fakesrc():
|
||||||
assert src
|
assert src
|
||||||
src.set_property('silent', 1)
|
src.set_property('silent', 1)
|
||||||
src.set_property('num_buffers', iterations)
|
src.set_property('num_buffers', iterations)
|
||||||
GObject.connect(src, 'handoff', handoff_src)
|
src.connect('handoff', handoff_src)
|
||||||
return src
|
return src
|
||||||
|
|
||||||
def fakesink():
|
def fakesink():
|
||||||
sink = gst_element_factory_make('fakesink','fakesink')
|
sink = gst_element_factory_make('fakesink','fakesink')
|
||||||
assert sink
|
assert sink
|
||||||
sink.set_property('silent', 1)
|
sink.set_property('silent', 1)
|
||||||
GObject.connect(sink, 'handoff', handoff_sink)
|
sink.connect('handoff', handoff_sink)
|
||||||
return sink
|
return sink
|
||||||
|
|
||||||
def simple(argv):
|
def simple(argv):
|
||||||
|
@ -103,7 +103,7 @@ def simple(argv):
|
||||||
last = identity_add(pipeline, src, idents)
|
last = identity_add(pipeline, src, idents)
|
||||||
sink = fakesink()
|
sink = fakesink()
|
||||||
pipeline.add(sink)
|
pipeline.add(sink)
|
||||||
last.get_pad('src').connect(sink.get_pad('sink'))
|
last.get_pad('src').link(sink.get_pad('sink'))
|
||||||
|
|
||||||
return pipeline
|
return pipeline
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ def queue(argv):
|
||||||
src_q = gst_element_factory_make('queue','src_q')
|
src_q = gst_element_factory_make('queue','src_q')
|
||||||
assert src_q
|
assert src_q
|
||||||
src_thr.add(src_q)
|
src_thr.add(src_q)
|
||||||
src.get_pad('src').connect(src_q.get_pad('sink'))
|
src.get_pad('src').link(src_q.get_pad('sink'))
|
||||||
|
|
||||||
pipeline.add(src_thr)
|
pipeline.add(src_thr)
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ def queue(argv):
|
||||||
sink_q = gst_element_factory_make('queue','sink_q')
|
sink_q = gst_element_factory_make('queue','sink_q')
|
||||||
assert sink_q
|
assert sink_q
|
||||||
pipeline.add(sink_q)
|
pipeline.add(sink_q)
|
||||||
last.get_pad('src').connect(sink_q.get_pad('sink'))
|
last.get_pad('src').link(sink_q.get_pad('sink'))
|
||||||
|
|
||||||
sink_thr = Thread('sink_thread')
|
sink_thr = Thread('sink_thread')
|
||||||
assert sink_thr
|
assert sink_thr
|
||||||
|
@ -150,7 +150,7 @@ def queue(argv):
|
||||||
|
|
||||||
pipeline.add(sink_thr)
|
pipeline.add(sink_thr)
|
||||||
|
|
||||||
sink_q.get_pad('src').connect(sink.get_pad('sink'))
|
sink_q.get_pad('src').link(sink.get_pad('sink'))
|
||||||
|
|
||||||
return pipeline
|
return pipeline
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,11 @@ def main():
|
||||||
for e in (filesrc, decoder, osssink):
|
for e in (filesrc, decoder, osssink):
|
||||||
bin.add(e)
|
bin.add(e)
|
||||||
|
|
||||||
# connect the elements
|
# link the elements
|
||||||
previous = None
|
previous = None
|
||||||
for e in (filesrc, decoder, osssink):
|
for e in (filesrc, decoder, osssink):
|
||||||
if previous:
|
if previous:
|
||||||
previous.connect(e)
|
previous.link(e)
|
||||||
previous = e
|
previous = e
|
||||||
|
|
||||||
# start playing
|
# start playing
|
||||||
|
|
|
@ -30,7 +30,7 @@ headers
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyGObject *pad;
|
PyGObject *pad;
|
||||||
PyObject *connect_function;
|
PyObject *link_function;
|
||||||
PyObject *chain_function;
|
PyObject *chain_function;
|
||||||
} PyGstPadPrivate;
|
} PyGstPadPrivate;
|
||||||
|
|
||||||
|
@ -68,16 +68,16 @@ ignore-glob
|
||||||
gstreamer_*init
|
gstreamer_*init
|
||||||
*_get_type
|
*_get_type
|
||||||
%%
|
%%
|
||||||
override gst_pad_set_connect_function kwargs
|
override gst_pad_set_link_function kwargs
|
||||||
|
|
||||||
static GstPadConnectReturn
|
static GstPadLinkReturn
|
||||||
call_connect_function (GstPad *pad, GstCaps *caps)
|
call_link_function (GstPad *pad, GstCaps *caps)
|
||||||
{
|
{
|
||||||
PyObject *function;
|
PyObject *function;
|
||||||
PyObject *retval;
|
PyObject *retval;
|
||||||
GstPadConnectReturn ret;
|
GstPadLinkReturn ret;
|
||||||
|
|
||||||
function = pad_private(pad)->connect_function;
|
function = pad_private(pad)->link_function;
|
||||||
|
|
||||||
pyg_block_threads();
|
pyg_block_threads();
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ call_connect_function (GstPad *pad, GstCaps *caps)
|
||||||
if (PyErr_Occurred ()) {
|
if (PyErr_Occurred ()) {
|
||||||
PyErr_Print ();
|
PyErr_Print ();
|
||||||
pyg_unblock_threads();
|
pyg_unblock_threads();
|
||||||
return GST_PAD_CONNECT_REFUSED;
|
return GST_PAD_LINK_REFUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = PyInt_AsLong(retval);
|
ret = PyInt_AsLong(retval);
|
||||||
|
@ -100,30 +100,30 @@ call_connect_function (GstPad *pad, GstCaps *caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
_wrap_gst_pad_set_connect_function (PyGObject *self,
|
_wrap_gst_pad_set_link_function (PyGObject *self,
|
||||||
PyObject *args,
|
PyObject *args,
|
||||||
PyObject *kwargs)
|
PyObject *kwargs)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = { "connect_function", NULL };
|
static char *kwlist[] = { "link_function", NULL };
|
||||||
PyObject *connect_function;
|
PyObject *link_function;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||||
"O:GstPad.set_connect_funcion",
|
"O:GstPad.set_link_funcion",
|
||||||
kwlist,
|
kwlist,
|
||||||
&connect_function)) {
|
&link_function)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PyCallable_Check(connect_function)) {
|
if (!PyCallable_Check(link_function)) {
|
||||||
PyErr_SetString(PyExc_TypeError, "connect_function not callable");
|
PyErr_SetString(PyExc_TypeError, "link_function not callable");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(connect_function);
|
Py_INCREF(link_function);
|
||||||
py_pad_private(self)->connect_function = connect_function;
|
py_pad_private(self)->link_function = link_function;
|
||||||
pad = (GstPad*)pygobject_get(self);
|
pad = (GstPad*)pygobject_get(self);
|
||||||
gst_pad_set_connect_function(pad, call_connect_function);
|
gst_pad_set_link_function(pad, call_link_function);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
|
|
|
@ -30,7 +30,7 @@ headers
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyGObject *pad;
|
PyGObject *pad;
|
||||||
PyObject *connect_function;
|
PyObject *link_function;
|
||||||
PyObject *chain_function;
|
PyObject *chain_function;
|
||||||
} PyGstPadPrivate;
|
} PyGstPadPrivate;
|
||||||
|
|
||||||
|
@ -68,16 +68,16 @@ ignore-glob
|
||||||
gstreamer_*init
|
gstreamer_*init
|
||||||
*_get_type
|
*_get_type
|
||||||
%%
|
%%
|
||||||
override gst_pad_set_connect_function kwargs
|
override gst_pad_set_link_function kwargs
|
||||||
|
|
||||||
static GstPadConnectReturn
|
static GstPadLinkReturn
|
||||||
call_connect_function (GstPad *pad, GstCaps *caps)
|
call_link_function (GstPad *pad, GstCaps *caps)
|
||||||
{
|
{
|
||||||
PyObject *function;
|
PyObject *function;
|
||||||
PyObject *retval;
|
PyObject *retval;
|
||||||
GstPadConnectReturn ret;
|
GstPadLinkReturn ret;
|
||||||
|
|
||||||
function = pad_private(pad)->connect_function;
|
function = pad_private(pad)->link_function;
|
||||||
|
|
||||||
pyg_block_threads();
|
pyg_block_threads();
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ call_connect_function (GstPad *pad, GstCaps *caps)
|
||||||
if (PyErr_Occurred ()) {
|
if (PyErr_Occurred ()) {
|
||||||
PyErr_Print ();
|
PyErr_Print ();
|
||||||
pyg_unblock_threads();
|
pyg_unblock_threads();
|
||||||
return GST_PAD_CONNECT_REFUSED;
|
return GST_PAD_LINK_REFUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = PyInt_AsLong(retval);
|
ret = PyInt_AsLong(retval);
|
||||||
|
@ -100,30 +100,30 @@ call_connect_function (GstPad *pad, GstCaps *caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
_wrap_gst_pad_set_connect_function (PyGObject *self,
|
_wrap_gst_pad_set_link_function (PyGObject *self,
|
||||||
PyObject *args,
|
PyObject *args,
|
||||||
PyObject *kwargs)
|
PyObject *kwargs)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = { "connect_function", NULL };
|
static char *kwlist[] = { "link_function", NULL };
|
||||||
PyObject *connect_function;
|
PyObject *link_function;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||||
"O:GstPad.set_connect_funcion",
|
"O:GstPad.set_link_funcion",
|
||||||
kwlist,
|
kwlist,
|
||||||
&connect_function)) {
|
&link_function)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PyCallable_Check(connect_function)) {
|
if (!PyCallable_Check(link_function)) {
|
||||||
PyErr_SetString(PyExc_TypeError, "connect_function not callable");
|
PyErr_SetString(PyExc_TypeError, "link_function not callable");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(connect_function);
|
Py_INCREF(link_function);
|
||||||
py_pad_private(self)->connect_function = connect_function;
|
py_pad_private(self)->link_function = link_function;
|
||||||
pad = (GstPad*)pygobject_get(self);
|
pad = (GstPad*)pygobject_get(self);
|
||||||
gst_pad_set_connect_function(pad, call_connect_function);
|
gst_pad_set_link_function(pad, call_link_function);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
|
|
Loading…
Reference in a new issue