Commit 0a5f74f8 authored by David I. Lehn's avatar David I. Lehn

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
parent f85f7a39
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>
* gstreamer/gstreamer.override, gstreamer/gstreamer-extra.defs: add
......
......@@ -55,11 +55,11 @@ def filter(filters):
for e in elements:
bin.add(e)
# connect the elements
# link the elements
previous = None
for e in elements:
if previous:
previous.connect(e)
previous.link(e)
previous = e
# start playing
......@@ -84,7 +84,7 @@ def main():
stats.set_property('silent', 0)
stats.set_property('buffer_update_freq', 1)
stats.set_property('update_on_eos', 1)
#GObject.connect(stats, 'update', update)
#stats.connect('update', update)
return filter([stats])
......
......@@ -46,13 +46,13 @@ class DVDPlayer(object):
#gtk.threads_enter()
print '***** a new pad %s was created' % pad.get_name()
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.add(self.v_thread)
#self.v_thread.set_state(STATE_PLAYING)
self.pipeline.set_state(STATE_PLAYING)
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.add(self.a_thread)
#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):
self.v_thread.add(e)
if last:
last.connect(e)
last.link(e)
last = e
#self.v_queue.connect(self.v_decode)
#self.v_decode.connect(self.color)
#self.color.connect(self.efx)
#self.efx.connect(self.color2)
#self.color2.connect(self.show)
#self.v_queue.link(self.v_decode)
#self.v_decode.link(self.color)
#self.color.link(self.efx)
#self.efx.link(self.color2)
#self.color2.link(self.show)
def build_audio_thread(self):
# ***** pre-construct the audio thread *****
......@@ -175,8 +175,8 @@ class DVDPlayer(object):
for e in (self.a_queue, self.a_decode, self.osssink):
self.a_thread.add(e)
self.a_queue.connect(self.a_decode)
self.a_decode.connect(self.osssink)
self.a_queue.link(self.a_decode)
self.a_decode.link(self.osssink)
def build(self):
# ***** construct the main pipeline *****
......@@ -186,7 +186,7 @@ class DVDPlayer(object):
self.src = gst_element_factory_make('dvdreadsrc','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('title', self.title)
self.src.set_property('chapter', self.chapter)
......@@ -199,7 +199,7 @@ class DVDPlayer(object):
self.pipeline.add(self.src)
self.pipeline.add(self.parse)
self.src.connect(self.parse)
self.src.link(self.parse)
# pre-construct the audio/video threads
self.build_video_thread()
......@@ -218,12 +218,12 @@ class DVDPlayer(object):
#gtk_socket_steal (GTK_SOCKET (gtk_socket),
#gst_util_get_int_arg (GTK_OBJECT(show), 'xid'));
GObject.connect(self.parse,'new_pad',self.mpegparse_newpad, self.pipeline)
GObject.connect(self.src,'eos',self.eof)
#GObject.connect(show,'have_size',self.mpegparse_have_size, self.pipeline)
self.parse.connect('new_pad',self.mpegparse_newpad, self.pipeline)
self.src.connect('eos',self.eof)
#show.connect('have_size',self.mpegparse_have_size, self.pipeline)
#GObject.connect(self.pipeline,'error',self.pipeline_error)
#GObject.connect(self.pipeline,'deep_notify',self.dnprint)
#self.pipeline.connect('error',self.pipeline_error)
#self.pipeline.connect('deep_notify',self.dnprint)
return 0
......
......@@ -35,21 +35,21 @@ def main():
src = gst_element_factory_make('fakesrc', 'src')
assert src
GObject.connect(src, 'handoff', handoff)
src.connect('handoff', handoff)
src.set_property('silent', 1)
src.set_property('num_buffers', 10)
sink = gst_element_factory_make('fakesink', 'sink')
assert sink
GObject.connect(sink, 'handoff', handoff)
sink.connect('handoff', handoff)
src.set_property('silent', 1)
# add objects to the main pipeline
for e in (src, sink):
bin.add(e)
# connect the elements
res = src.connect(sink)
# link the elements
res = src.link(sink)
assert res
# start playing
......
......@@ -32,19 +32,19 @@ class Identity(Element):
self.sinkpad = Pad('sink', PAD_SINK)
self.add_pad(self.sinkpad)
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.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):
print 'get_bufferpool:', self, pad
return self.srcpad.get_bufferpool()
def pad_connect(self, pad, caps):
print 'pad_connect:', self, pad, caps
return PAD_CONNECT_OK
def pad_link(self, pad, caps):
print 'pad_link:', self, pad, caps
return PAD_LINK_OK
def chain(self, pad, buf):
self.srcpad.push(buf)
......
......@@ -48,11 +48,11 @@ def build(filters, b):
for e in elements:
bin.add(e)
# connect the elements
# link the elements
previous = None
for e in elements:
if previous:
previous.connect(e)
previous.link(e)
previous = e
return bin
......
......@@ -67,7 +67,7 @@ def identity_add(pipeline, first, count):
assert ident
ident.set_property('silent', 1)
pipeline.add(ident)
last.get_pad('src').connect(ident.get_pad('sink'))
last.get_pad('src').link(ident.get_pad('sink'))
last = ident
return last
......@@ -77,14 +77,14 @@ def fakesrc():
assert src
src.set_property('silent', 1)
src.set_property('num_buffers', iterations)
GObject.connect(src, 'handoff', handoff_src)
src.connect('handoff', handoff_src)
return src
def fakesink():
sink = gst_element_factory_make('fakesink','fakesink')
assert sink
sink.set_property('silent', 1)
GObject.connect(sink, 'handoff', handoff_sink)
sink.connect('handoff', handoff_sink)
return sink
def simple(argv):
......@@ -103,7 +103,7 @@ def simple(argv):
last = identity_add(pipeline, src, idents)
sink = fakesink()
pipeline.add(sink)
last.get_pad('src').connect(sink.get_pad('sink'))
last.get_pad('src').link(sink.get_pad('sink'))
return pipeline
......@@ -129,7 +129,7 @@ def queue(argv):
src_q = gst_element_factory_make('queue','src_q')
assert 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)
......@@ -138,7 +138,7 @@ def queue(argv):
sink_q = gst_element_factory_make('queue','sink_q')
assert 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')
assert sink_thr
......@@ -150,7 +150,7 @@ def queue(argv):
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
......
......@@ -58,11 +58,11 @@ def main():
for e in (filesrc, decoder, osssink):
bin.add(e)
# connect the elements
# link the elements
previous = None
for e in (filesrc, decoder, osssink):
if previous:
previous.connect(e)
previous.link(e)
previous = e
# start playing
......
......@@ -55,11 +55,11 @@ def filter(filters):
for e in elements:
bin.add(e)
# connect the elements
# link the elements
previous = None
for e in elements:
if previous:
previous.connect(e)
previous.link(e)
previous = e
# start playing
......@@ -84,7 +84,7 @@ def main():
stats.set_property('silent', 0)
stats.set_property('buffer_update_freq', 1)
stats.set_property('update_on_eos', 1)
#GObject.connect(stats, 'update', update)
#stats.connect('update', update)
return filter([stats])
......
......@@ -46,13 +46,13 @@ class DVDPlayer(object):
#gtk.threads_enter()
print '***** a new pad %s was created' % pad.get_name()
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.add(self.v_thread)
#self.v_thread.set_state(STATE_PLAYING)
self.pipeline.set_state(STATE_PLAYING)
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.add(self.a_thread)
#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):
self.v_thread.add(e)
if last:
last.connect(e)
last.link(e)
last = e
#self.v_queue.connect(self.v_decode)
#self.v_decode.connect(self.color)
#self.color.connect(self.efx)
#self.efx.connect(self.color2)
#self.color2.connect(self.show)
#self.v_queue.link(self.v_decode)
#self.v_decode.link(self.color)
#self.color.link(self.efx)
#self.efx.link(self.color2)
#self.color2.link(self.show)
def build_audio_thread(self):
# ***** pre-construct the audio thread *****
......@@ -175,8 +175,8 @@ class DVDPlayer(object):
for e in (self.a_queue, self.a_decode, self.osssink):
self.a_thread.add(e)
self.a_queue.connect(self.a_decode)
self.a_decode.connect(self.osssink)
self.a_queue.link(self.a_decode)
self.a_decode.link(self.osssink)
def build(self):
# ***** construct the main pipeline *****
......@@ -186,7 +186,7 @@ class DVDPlayer(object):
self.src = gst_element_factory_make('dvdreadsrc','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('title', self.title)
self.src.set_property('chapter', self.chapter)
......@@ -199,7 +199,7 @@ class DVDPlayer(object):
self.pipeline.add(self.src)
self.pipeline.add(self.parse)
self.src.connect(self.parse)
self.src.link(self.parse)
# pre-construct the audio/video threads
self.build_video_thread()
......@@ -218,12 +218,12 @@ class DVDPlayer(object):
#gtk_socket_steal (GTK_SOCKET (gtk_socket),
#gst_util_get_int_arg (GTK_OBJECT(show), 'xid'));
GObject.connect(self.parse,'new_pad',self.mpegparse_newpad, self.pipeline)
GObject.connect(self.src,'eos',self.eof)
#GObject.connect(show,'have_size',self.mpegparse_have_size, self.pipeline)
self.parse.connect('new_pad',self.mpegparse_newpad, self.pipeline)
self.src.connect('eos',self.eof)
#show.connect('have_size',self.mpegparse_have_size, self.pipeline)
#GObject.connect(self.pipeline,'error',self.pipeline_error)
#GObject.connect(self.pipeline,'deep_notify',self.dnprint)
#self.pipeline.connect('error',self.pipeline_error)
#self.pipeline.connect('deep_notify',self.dnprint)
return 0
......
......@@ -35,21 +35,21 @@ def main():
src = gst_element_factory_make('fakesrc', 'src')
assert src
GObject.connect(src, 'handoff', handoff)
src.connect('handoff', handoff)
src.set_property('silent', 1)
src.set_property('num_buffers', 10)
sink = gst_element_factory_make('fakesink', 'sink')
assert sink
GObject.connect(sink, 'handoff', handoff)
sink.connect('handoff', handoff)
src.set_property('silent', 1)
# add objects to the main pipeline
for e in (src, sink):
bin.add(e)
# connect the elements
res = src.connect(sink)
# link the elements
res = src.link(sink)
assert res
# start playing
......
......@@ -32,19 +32,19 @@ class Identity(Element):
self.sinkpad = Pad('sink', PAD_SINK)
self.add_pad(self.sinkpad)
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.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):
print 'get_bufferpool:', self, pad
return self.srcpad.get_bufferpool()
def pad_connect(self, pad, caps):
print 'pad_connect:', self, pad, caps
return PAD_CONNECT_OK
def pad_link(self, pad, caps):
print 'pad_link:', self, pad, caps
return PAD_LINK_OK
def chain(self, pad, buf):
self.srcpad.push(buf)
......
......@@ -48,11 +48,11 @@ def build(filters, b):
for e in elements:
bin.add(e)
# connect the elements
# link the elements
previous = None
for e in elements:
if previous:
previous.connect(e)
previous.link(e)
previous = e
return bin
......
......@@ -67,7 +67,7 @@ def identity_add(pipeline, first, count):
assert ident
ident.set_property('silent', 1)
pipeline.add(ident)
last.get_pad('src').connect(ident.get_pad('sink'))
last.get_pad('src').link(ident.get_pad('sink'))
last = ident
return last
......@@ -77,14 +77,14 @@ def fakesrc():
assert src
src.set_property('silent', 1)
src.set_property('num_buffers', iterations)
GObject.connect(src, 'handoff', handoff_src)
src.connect('handoff', handoff_src)
return src
def fakesink():
sink = gst_element_factory_make('fakesink','fakesink')
assert sink
sink.set_property('silent', 1)
GObject.connect(sink, 'handoff', handoff_sink)
sink.connect('handoff', handoff_sink)
return sink
def simple(argv):
......@@ -103,7 +103,7 @@ def simple(argv):
last = identity_add(pipeline, src, idents)
sink = fakesink()
pipeline.add(sink)
last.get_pad('src').connect(sink.get_pad('sink'))
last.get_pad('src').link(sink.get_pad('sink'))
return pipeline
......@@ -129,7 +129,7 @@ def queue(argv):
src_q = gst_element_factory_make('queue','src_q')
assert 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)
......@@ -138,7 +138,7 @@ def queue(argv):
sink_q = gst_element_factory_make('queue','sink_q')
assert 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')
assert sink_thr
......@@ -150,7 +150,7 @@ def queue(argv):
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
......
......@@ -58,11 +58,11 @@ def main():
for e in (filesrc, decoder, osssink):
bin.add(e)
# connect the elements
# link the elements
previous = None
for e in (filesrc, decoder, osssink):
if previous:
previous.connect(e)
previous.link(e)
previous = e
# start playing
......
......@@ -30,7 +30,7 @@ headers
typedef struct {
PyGObject *pad;
PyObject *connect_function;
PyObject *link_function;
PyObject *chain_function;
} PyGstPadPrivate;
......@@ -68,16 +68,16 @@ ignore-glob
gstreamer_*init
*_get_type
%%
override gst_pad_set_connect_function kwargs
override gst_pad_set_link_function kwargs
static GstPadConnectReturn
call_connect_function (GstPad *pad, GstCaps *caps)
static GstPadLinkReturn
call_link_function (GstPad *pad, GstCaps *caps)
{
PyObject *function;
PyObject *retval;
GstPadConnectReturn ret;
GstPadLinkReturn ret;
function = pad_private(pad)->connect_function;
function = pad_private(pad)->link_function;
pyg_block_threads();
......@@ -89,7 +89,7 @@ call_connect_function (GstPad *pad, GstCaps *caps)
if (PyErr_Occurred ()) {
PyErr_Print ();
pyg_unblock_threads();
return GST_PAD_CONNECT_REFUSED;
return GST_PAD_LINK_REFUSED;
}
ret = PyInt_AsLong(retval);
......@@ -100,30 +100,30 @@ call_connect_function (GstPad *pad, GstCaps *caps)
}
static PyObject*
_wrap_gst_pad_set_connect_function (PyGObject *self,
_wrap_gst_pad_set_link_function (PyGObject *self,
PyObject *args,
PyObject *kwargs)
{
static char *kwlist[] = { "connect_function", NULL };
PyObject *connect_function;
static char *kwlist[] = { "link_function", NULL };
PyObject *link_function;
GstPad *pad;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"O:GstPad.set_connect_funcion",
"O:GstPad.set_link_funcion",
kwlist,
&connect_function)) {
&link_function)) {
return NULL;
}
if (!PyCallable_Check(connect_function)) {
PyErr_SetString(PyExc_TypeError, "connect_function not callable");
if (!PyCallable_Check(link_function)) {
PyErr_SetString(PyExc_TypeError, "link_function not callable");
return NULL;
}
Py_INCREF(connect_function);
py_pad_private(self)->connect_function = connect_function;
Py_INCREF(link_function);
py_pad_private(self)->link_function = link_function;
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);
return Py_None;
......
......@@ -30,7 +30,7 @@ headers
typedef struct {
PyGObject *pad;
PyObject *connect_function;
PyObject *link_function;
PyObject *chain_function;
} PyGstPadPrivate;
......@@ -68,16 +68,16 @@ ignore-glob
gstreamer_*init
*_get_type
%%
override gst_pad_set_connect_function kwargs
override gst_pad_set_link_function kwargs
static GstPadConnectReturn
call_connect_function (GstPad *pad, GstCaps *caps)
static GstPadLinkReturn
call_link_function (GstPad *pad, GstCaps *caps)
{
PyObject *function;
PyObject *retval;
GstPadConnectReturn ret;
GstPadLinkReturn ret;
function = pad_private(pad)->connect_function;
function = pad_private(pad)->link_function;
pyg_block_threads();
......@@ -89,7 +89,7 @@ call_connect_function (GstPad *pad, GstCaps *caps)
if (PyErr_Occurred ()) {
PyErr_Print ();
pyg_unblock_threads();
return GST_PAD_CONNECT_REFUSED;
return GST_PAD_LINK_REFUSED;
}
ret = PyInt_AsLong(retval);
......@@ -100,30 +100,30 @@ call_connect_function (GstPad *pad, GstCaps *caps)
}
static PyObject*
_wrap_gst_pad_set_connect_function (PyGObject *self,
_wrap_gst_pad_set_link_function (PyGObject *self,
PyObject *args,
PyObject *kwargs)
{
static char *kwlist[] = { "connect_function", NULL };
PyObject *connect_function;
static char *kwlist[] = { "link_function", NULL };
PyObject *link_function;
GstPad *pad;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"O:GstPad.set_connect_funcion",
"O:GstPad.set_link_funcion",
kwlist,
&connect_function)) {
&link_function)) {
return NULL;
}
if (!PyCallable_Check(connect_function)) {
PyErr_SetString(PyExc_TypeError, "connect_function not callable");
if (!PyCallable_Check(link_function)) {
PyErr_SetString(PyExc_TypeError, "link_function not callable");
return NULL;
}
Py_INCREF(connect_function);
py_pad_private(self)->connect_function = connect_function;
Py_INCREF(link_function);
py_pad_private(self)->link_function = link_function;
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);
return Py_None;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment