gstreamer/gstreamer.defs (element_link_many): This is function and not a method, despite popular belief

Original commit message from CVS:
* gstreamer/gstreamer.defs (element_link_many): This is function
and not a method, despite popular belief
(gst_element_factory_make): Make it the constructor of GstElement,
so we can avoid dirty hacks.

* gstreamer/gstreamer.override (_wrap_gst_element_link_many): Wrap
(_wrap_gst_element_link_many): Wrap

* gstreamer/common.defs:
* gstreamer/common.override:
* gstreamer/Makefile.am: Beginning of reorganization, to include
gstreamer.defs and override (eg, not auto generate them)

* examples/gstreamer/cp.py: Prettify and pythonify. Will do the
other examples later

* gstreamer/gstreamer.py: Backwards compatibility module

* gstreamer/gstreamermodule.c:
* gstreamer/Makefile.am: Rename the module to gst
This commit is contained in:
Johan Dahlin 2004-02-23 20:24:53 +00:00
parent ade405ce0f
commit d178fff215
13 changed files with 28042 additions and 158 deletions

View file

@ -1,5 +1,21 @@
2004-02-23 Johan Dahlin <johan@gnome.org>
* gstreamer/gstreamer.defs (element_link_many): This is function
and not a method, despite popular belief
(gst_element_factory_make): Make it the constructor of GstElement,
so we can avoid dirty hacks.
* gstreamer/gstreamer.override (_wrap_gst_element_link_many): Wrap
(_wrap_gst_element_link_many): Wrap
* gstreamer/common.defs:
* gstreamer/common.override:
* gstreamer/Makefile.am: Beginning of reorganization, to include
gstreamer.defs and override (eg, not auto generate them)
* examples/gstreamer/cp.py: Prettify and pythonify. Will do the
other examples later
* gstreamer/gstreamer.py: Backwards compatibility module
* gstreamer/gstreamermodule.c:

View file

@ -1,7 +1,8 @@
#!/usr/bin/env python
#
# gst-python
# Copyright (C) 2002 David I. Lehn
# Copyright (C) 2002 David I. Lehn <dlehn@users.sourceforge.net>
# 2004 Johan Dahlin <johan@gnome.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@ -22,63 +23,45 @@
#
import sys
from gstreamer import *
from gobject import GObject
import gst
def update(sender, *args):
print sender.get_name(), args
def filter(filters):
def filter(input, output):
"A GStreamer copy pipeline which can add arbitrary filters"
if len(sys.argv) != 3:
# create a new bin to hold the elements
bin = gst.Pipeline('pipeline')
filesrc = gst.Element('filesrc', 'source');
filesrc.set_property('location', input)
stats = gst.Element('statistics', 'stats');
stats.set_property('silent', False)
stats.set_property('buffer_update_freq', True)
stats.set_property('update_on_eos', True)
filesink = gst.Element('filesink', 'sink')
filesink.set_property('location', output)
bin.add_many(filesrc, stats, filesink)
gst.element_link_many(filesrc, stats, 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 based cp(1) with stats"
if len(args) != 3:
print 'usage: %s source dest' % (sys.argv[0])
return -1
# create a new bin to hold the elements
bin = Pipeline('pipeline')
filesrc = Element('filesrc', 'source');
filesrc.set_property('location', sys.argv[1])
filesink = Element('filesink', 'sink')
filesink.set_property('location', sys.argv[2])
elements = [filesrc] + filters + [filesink]
# add objects to the main pipeline
for e in elements:
bin.add(e)
# link the elements
previous = None
for e in elements:
if previous:
previous.link(e)
previous = e
# start playing
bin.set_state(STATE_PLAYING);
while bin.iterate(): pass
# stop the bin
bin.set_state(STATE_NULL)
return 0
def main():
"A GStreamer based cp(1) with stats"
#gst_info_set_categories(-1)
#gst_debug_set_categories(-1)
stats = Element ('statistics', 'stats');
stats.set_property('silent', 0)
stats.set_property('buffer_update_freq', 1)
stats.set_property('update_on_eos', 1)
#stats.connect('update', update)
return filter([stats])
return filter(args[1], args[2])
if __name__ == '__main__':
ret = main()
sys.exit (ret)
sys.exit(main(sys.argv))

View file

@ -1,7 +1,8 @@
#!/usr/bin/env python
#
# gst-python
# Copyright (C) 2002 David I. Lehn
# Copyright (C) 2002 David I. Lehn <dlehn@users.sourceforge.net>
# 2004 Johan Dahlin <johan@gnome.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@ -22,63 +23,45 @@
#
import sys
from gstreamer import *
from gobject import GObject
import gst
def update(sender, *args):
print sender.get_name(), args
def filter(filters):
def filter(input, output):
"A GStreamer copy pipeline which can add arbitrary filters"
if len(sys.argv) != 3:
# create a new bin to hold the elements
bin = gst.Pipeline('pipeline')
filesrc = gst.Element('filesrc', 'source');
filesrc.set_property('location', input)
stats = gst.Element('statistics', 'stats');
stats.set_property('silent', False)
stats.set_property('buffer_update_freq', True)
stats.set_property('update_on_eos', True)
filesink = gst.Element('filesink', 'sink')
filesink.set_property('location', output)
bin.add_many(filesrc, stats, filesink)
gst.element_link_many(filesrc, stats, 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 based cp(1) with stats"
if len(args) != 3:
print 'usage: %s source dest' % (sys.argv[0])
return -1
# create a new bin to hold the elements
bin = Pipeline('pipeline')
filesrc = Element('filesrc', 'source');
filesrc.set_property('location', sys.argv[1])
filesink = Element('filesink', 'sink')
filesink.set_property('location', sys.argv[2])
elements = [filesrc] + filters + [filesink]
# add objects to the main pipeline
for e in elements:
bin.add(e)
# link the elements
previous = None
for e in elements:
if previous:
previous.link(e)
previous = e
# start playing
bin.set_state(STATE_PLAYING);
while bin.iterate(): pass
# stop the bin
bin.set_state(STATE_NULL)
return 0
def main():
"A GStreamer based cp(1) with stats"
#gst_info_set_categories(-1)
#gst_debug_set_categories(-1)
stats = Element ('statistics', 'stats');
stats.set_property('silent', 0)
stats.set_property('buffer_update_freq', 1)
stats.set_property('update_on_eos', 1)
#stats.connect('update', update)
return filter([stats])
return filter(args[1], args[2])
if __name__ == '__main__':
ret = main()
sys.exit (ret)
sys.exit(main(sys.argv))

View file

@ -42,26 +42,17 @@ _gstmodule_la_SOURCES = \
_gstmodule_la_CFLAGS = $(GST_CFLAGS) -fno-strict-aliasing
_gstmodule_la_LIBADD = $(GST_LIBS)
_gstmodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex init_gst
nodist__gstmodule_la_SOURCES = gstreamer.c
nodist__gstmodule_la_SOURCES = $(MODULE).c
CLEANFILES = $(MODULE).c h2def.defs $(MODULE).defs $(MODULE).override
EXTRA_DIST = $(GST_OVERRIDES) $(GST_DEFS) $(GST_CODE) arg-types.py
CLEANFILES = $(MODULE).c
EXTRA_DIST = $(MODULE).defs $(GST_OVERRIDES) $(GST_DEFS) $(GST_CODE) arg-types.py
GST_EXCLUDE_INCLUDES=\
$(GST_INCLUDEDIR)/gst/gstatomic_impl.h \
$(GST_INCLUDEDIR)/gst/gstcompat.h
GST_INCLUDES=$(filter-out $(GST_EXCLUDE_INCLUDES),$(wildcard $(GST_INCLUDEDIR)/gst/*.h))
gstreamer.override: common.override $(GST_MAJORMINOR).override
cat $+ > $@
h2def.defs: $(GST_INCLUDES)
$(PYTHON) $(PYGTK_H2DEF) $(GST_INCLUDES) > $@
gstreamer.defs: h2def.defs common.defs $(GST_MAJORMINOR).defs
cat $+ > $@
gstreamer.c: $(MODULE).defs arg-types.py $(MODULE).override
gstreamer.c: $(srcdir)/$(MODULE).defs $(srcdir)/arg-types.py $(srcdir)/$(MODULE).override
$(PYGTK_CODEGEN) \
--load-types $(srcdir)/arg-types.py \
--override $(srcdir)/$(MODULE).override \

View file

@ -1,3 +1,4 @@
;; -*- scheme -*-
;;
;; Boxed types
;;
@ -67,17 +68,4 @@
)
)
;;
;; Element constructor override; uses a nonexistant make_element
;; which is defined in gstreamer.overrides
;;
(define-function gst_element_factory_make_element
(is-constructor-of "GstElement")
(c-name "gst_element_factory_make_element")
(return-type "GstElement*")
(parameters
'("const-gchar*" "elementname")
'("const-gchar*" "name")
)
)

View file

@ -369,3 +369,39 @@ _wrap_gst_version(void)
return Py_BuildValue("(iii)", major, minor, micro);
}
%%
override gst_bin_add_many args
static PyObject *
_wrap_gst_bin_add_many(PyGObject *self, PyObject *args, PyObject *kwargs)
{
PyGObject *element;
int i;
int len;
len = PyList_Size(args);
if (len == 0)
{
PyErr_SetString(PyExc_TypeError, "GstBin.add requires at least one argument");
return NULL;
}
for (i = 0; i < len; i++)
{
element = (PyGObject*)PyList_GetItem(args, i);
if (!pygobject_check(element, &PyGstElement_Type))
{
PyErr_SetString(PyExc_TypeError, "argument must be a GstElement");
return NULL;
}
}
for (i = 0; i < len; i++)
{
element = (PyGObject*)PyList_GetItem(args, i);
gst_bin_add(GST_BIN(self->obj), GST_ELEMENT(element->obj));
}
Py_INCREF(Py_None);
return Py_None;
}

6968
gst/gst.defs Normal file

File diff suppressed because it is too large Load diff

6968
gst/gstreamer.defs Normal file

File diff suppressed because it is too large Load diff

View file

@ -42,26 +42,17 @@ _gstmodule_la_SOURCES = \
_gstmodule_la_CFLAGS = $(GST_CFLAGS) -fno-strict-aliasing
_gstmodule_la_LIBADD = $(GST_LIBS)
_gstmodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex init_gst
nodist__gstmodule_la_SOURCES = gstreamer.c
nodist__gstmodule_la_SOURCES = $(MODULE).c
CLEANFILES = $(MODULE).c h2def.defs $(MODULE).defs $(MODULE).override
EXTRA_DIST = $(GST_OVERRIDES) $(GST_DEFS) $(GST_CODE) arg-types.py
CLEANFILES = $(MODULE).c
EXTRA_DIST = $(MODULE).defs $(GST_OVERRIDES) $(GST_DEFS) $(GST_CODE) arg-types.py
GST_EXCLUDE_INCLUDES=\
$(GST_INCLUDEDIR)/gst/gstatomic_impl.h \
$(GST_INCLUDEDIR)/gst/gstcompat.h
GST_INCLUDES=$(filter-out $(GST_EXCLUDE_INCLUDES),$(wildcard $(GST_INCLUDEDIR)/gst/*.h))
gstreamer.override: common.override $(GST_MAJORMINOR).override
cat $+ > $@
h2def.defs: $(GST_INCLUDES)
$(PYTHON) $(PYGTK_H2DEF) $(GST_INCLUDES) > $@
gstreamer.defs: h2def.defs common.defs $(GST_MAJORMINOR).defs
cat $+ > $@
gstreamer.c: $(MODULE).defs arg-types.py $(MODULE).override
gstreamer.c: $(srcdir)/$(MODULE).defs $(srcdir)/arg-types.py $(srcdir)/$(MODULE).override
$(PYGTK_CODEGEN) \
--load-types $(srcdir)/arg-types.py \
--override $(srcdir)/$(MODULE).override \

View file

@ -1,3 +1,4 @@
;; -*- scheme -*-
;;
;; Boxed types
;;
@ -67,17 +68,4 @@
)
)
;;
;; Element constructor override; uses a nonexistant make_element
;; which is defined in gstreamer.overrides
;;
(define-function gst_element_factory_make_element
(is-constructor-of "GstElement")
(c-name "gst_element_factory_make_element")
(return-type "GstElement*")
(parameters
'("const-gchar*" "elementname")
'("const-gchar*" "name")
)
)

View file

@ -369,3 +369,39 @@ _wrap_gst_version(void)
return Py_BuildValue("(iii)", major, minor, micro);
}
%%
override gst_bin_add_many args
static PyObject *
_wrap_gst_bin_add_many(PyGObject *self, PyObject *args, PyObject *kwargs)
{
PyGObject *element;
int i;
int len;
len = PyList_Size(args);
if (len == 0)
{
PyErr_SetString(PyExc_TypeError, "GstBin.add requires at least one argument");
return NULL;
}
for (i = 0; i < len; i++)
{
element = (PyGObject*)PyList_GetItem(args, i);
if (!pygobject_check(element, &PyGstElement_Type))
{
PyErr_SetString(PyExc_TypeError, "argument must be a GstElement");
return NULL;
}
}
for (i = 0; i < len; i++)
{
element = (PyGObject*)PyList_GetItem(args, i);
gst_bin_add(GST_BIN(self->obj), GST_ELEMENT(element->obj));
}
Py_INCREF(Py_None);
return Py_None;
}

6968
gstreamer/gst.defs Normal file

File diff suppressed because it is too large Load diff

6968
gstreamer/gstreamer.defs Normal file

File diff suppressed because it is too large Load diff