Commit b27c464e authored by Johan Dahlin's avatar Johan Dahlin

gstreamer/: Rename some more things to gst

Original commit message from CVS:
* gstreamer/gstreamer.override:
* gstreamer/gstreamermodule.c: Rename some more things to gst

* gstreamer/arg-types.py: Clean up and add GstData handling

* gstreamer/gstreamer.defs:
* gstreamer/gst-types.defs: Split out types to a separate defs

* gstreamer/gst-types.c: New file to handle custom GstData conversions.
parent 5b2f393d
2004-02-25 Johan Dahlin <johan@gnome.org>
* gstreamer/gstreamer.override:
* gstreamer/gstreamermodule.c: Rename some more things to gst
* gstreamer/arg-types.py: Clean up and add GstData handling
* gstreamer/gstreamer.defs:
* gstreamer/gst-types.defs: Split out types to a separate defs
* gstreamer/gst-types.c: New file to handle custom GstData conversions.
2004-02-24 David I. Lehn <dlehn@users.sourceforge.net>
* gstreamer/0.7.override:
......
......@@ -47,6 +47,7 @@ class Identity(gst.Element):
def chain(self, pad, buf):
self.srcpad.push(buf)
gobject.type_register(Identity)
def filter(element):
......
......@@ -47,6 +47,7 @@ class Identity(gst.Element):
def chain(self, pad, buf):
self.srcpad.push(buf)
gobject.type_register(Identity)
def filter(element):
......
......@@ -37,7 +37,9 @@ endif
pygstexec_LTLIBRARIES = _gstmodule.la
_gstmodule_la_SOURCES = \
gstreamermodule.c \
common.c common.h \
gst-types.c \
common.c \
common.h \
$(VERSOURCES)
_gstmodule_la_CFLAGS = $(GST_CFLAGS) -fno-strict-aliasing
_gstmodule_la_LIBADD = $(GST_LIBS)
......@@ -55,10 +57,8 @@ GST_INCLUDES=$(filter-out $(GST_EXCLUDE_INCLUDES),$(wildcard $(GST_INCLUDEDIR)/g
gstreamer.c: $(srcdir)/$(MODULE).defs $(srcdir)/arg-types.py $(srcdir)/$(MODULE).override
$(PYGTK_CODEGEN) \
--load-types $(srcdir)/arg-types.py \
--register $(srcdir)/gst-types.defs \
--override $(srcdir)/$(MODULE).override \
--prefix py$(MODULE) $(MODULE).defs > gen-$(MODULE).c \
--prefix pygst $(MODULE).defs > gen-$(MODULE).c \
&& cp gen-$(MODULE).c $(MODULE).c \
&& rm -f gen-$(MODULE).c
# --register $(PYGTK_DEFSDIR)/gtk-types.defs
# --register $(top_srcdir)/blah/blah-types.defs
#
# gst-python
# Copyright (C) 2002 David I. Lehn
# 2004 Johan Dahlin
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
......@@ -20,13 +21,38 @@
# Author: David I. Lehn <dlehn@users.sourceforge.net>
#
import argtypes
from argtypes import UInt64Arg, Int64Arg, PointerArg, ArgMatcher, ArgType, matcher
arg = argtypes.UInt64Arg()
argtypes.matcher.register('GstClockTime', arg)
class GstDataPtrArg(ArgType):
normal = (' if (!pygst_data_from_pyobject(py_%(name)s, &%(name)s))\n'
' return NULL;\n')
null = (' if (py_%(name)s == Py_None)\n'
' %(name)s = NULL;\n'
' else if (pyst_data_from_pyobject(py_%(name)s, &%(name)s_rect))\n'
' %(name)s = &%(name)s_rect;\n'
' else\n'
' return NULL;\n')
def write_param(self, ptype, pname, pdflt, pnull, info):
if pnull:
info.varlist.add('GstData', pname + '_data')
info.varlist.add('GstData', '*' + pname)
info.varlist.add('PyObject', '*py_' + pname + ' = Py_None')
info.add_parselist('O', ['&py_' + pname], [pname])
info.arglist.append(pname)
info.codebefore.append(self.null % {'name': pname})
else:
info.varlist.add('GstData', pname)
info.varlist.add('PyObject', '*py_' + pname)
info.add_parselist('O', ['&py_' + pname], [pname])
info.arglist.append('&' + pname)
info.codebefore.append(self.normal % {'name': pname})
arg = argtypes.Int64Arg()
argtypes.matcher.register('GstClockTimeDiff', arg)
arg = GstDataPtrArg()
matcher.register('GstData*', arg)
matcher.register('GstClockTime', UInt64Arg())
matcher.register('GstClockTimeDiff', Int64Arg())
arg = argtypes.PointerArg('gpointer', 'G_TYPE_POINTER')
argtypes.matcher.register('GstClockID', arg)
arg = PointerArg('gpointer', 'G_TYPE_POINTER')
matcher.register('GstClockID', arg)
del arg
/* gst-python
* Copyright (C) 2004 Johan Dahlin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Johan Dahlin <johan@gnome.org>
*/
#include <gst/gst.h>
#include <pygobject.h>
gboolean
pygst_data_from_pyobject(PyObject *object, GstData **data)
{
g_return_val_if_fail(*data != NULL, FALSE);
if (pyg_boxed_check(object, GST_TYPE_DATA)) {
*data = pyg_boxed_get(object, GstData);
return TRUE;
} else if (pyg_boxed_check(object, GST_TYPE_BUFFER)) {
*data = GST_DATA (pyg_boxed_get(object, GstBuffer));
return TRUE;
} else if (pyg_boxed_check(object, GST_TYPE_EVENT)) {
*data = GST_DATA (pyg_boxed_get(object, GstEvent));
return TRUE;
}
PyErr_Clear();
PyErr_SetString(PyExc_TypeError, "could not convert to GstData");
return FALSE;
}
static PyObject *
PyGstData_from_value(const GValue *value)
{
GstData *data = (GstData *)g_value_get_boxed(value);
return pyg_boxed_new(GST_TYPE_DATA, data, TRUE, TRUE);
}
static int
PyGstData_to_value(GValue *value, PyObject *object)
{
GstData* data;
if (!pygst_data_from_pyobject(object, &data))
return -1;
g_value_set_boxed(value, &data);
return 0;
}
/* We have to set ob_type here because stupid win32 does not allow you
* to use variables from another dll in a global variable initialisation.
*/
void
_pygst_register_boxed_types(PyObject *moddict)
{
pyg_register_boxed_custom(GST_TYPE_DATA,
PyGstData_from_value,
PyGstData_to_value);
}
This diff is collapsed.
This diff is collapsed.
......@@ -28,10 +28,10 @@
#include <pygobject.h>
#include <gst/gst.h>
void pygstreamer_register_classes (PyObject *d);
void pygstreamer_add_constants(PyObject *module, const gchar *strip_prefix);
void pygst_register_classes (PyObject *d);
void pygst_add_constants(PyObject *module, const gchar *strip_prefix);
extern PyMethodDef pygstreamer_functions[];
extern PyMethodDef pygst_functions[];
DL_EXPORT(void)
init_gst (void)
......@@ -61,7 +61,7 @@ init_gst (void)
g_free (argv[i]);
g_free (argv);
}
PyErr_SetString (PyExc_RuntimeError, "can't initialize module gstreamer");
PyErr_SetString (PyExc_RuntimeError, "can't initialize module gst");
}
if (argv != NULL) {
PySys_SetArgv (argc, argv);
......@@ -70,13 +70,13 @@ init_gst (void)
g_free (argv);
}
m = Py_InitModule ("gst._gst", pygstreamer_functions);
m = Py_InitModule ("gst._gst", pygst_functions);
d = PyModule_GetDict (m);
pygstreamer_register_classes (d);
pygstreamer_add_constants (m, "GST_");
pygst_register_classes (d);
pygst_add_constants (m, "GST_");
if (PyErr_Occurred ()) {
Py_FatalError ("can't initialize module gstreamer");
Py_FatalError ("can't initialize module gst");
}
}
This diff is collapsed.
......@@ -28,10 +28,10 @@
#include <pygobject.h>
#include <gst/gst.h>
void pygstreamer_register_classes (PyObject *d);
void pygstreamer_add_constants(PyObject *module, const gchar *strip_prefix);
void pygst_register_classes (PyObject *d);
void pygst_add_constants(PyObject *module, const gchar *strip_prefix);
extern PyMethodDef pygstreamer_functions[];
extern PyMethodDef pygst_functions[];
DL_EXPORT(void)
init_gst (void)
......@@ -61,7 +61,7 @@ init_gst (void)
g_free (argv[i]);
g_free (argv);
}
PyErr_SetString (PyExc_RuntimeError, "can't initialize module gstreamer");
PyErr_SetString (PyExc_RuntimeError, "can't initialize module gst");
}
if (argv != NULL) {
PySys_SetArgv (argc, argv);
......@@ -70,13 +70,13 @@ init_gst (void)
g_free (argv);
}
m = Py_InitModule ("gst._gst", pygstreamer_functions);
m = Py_InitModule ("gst._gst", pygst_functions);
d = PyModule_GetDict (m);
pygstreamer_register_classes (d);
pygstreamer_add_constants (m, "GST_");
pygst_register_classes (d);
pygst_add_constants (m, "GST_");
if (PyErr_Occurred ()) {
Py_FatalError ("can't initialize module gstreamer");
Py_FatalError ("can't initialize module gst");
}
}
......@@ -37,7 +37,9 @@ endif
pygstexec_LTLIBRARIES = _gstmodule.la
_gstmodule_la_SOURCES = \
gstreamermodule.c \
common.c common.h \
gst-types.c \
common.c \
common.h \
$(VERSOURCES)
_gstmodule_la_CFLAGS = $(GST_CFLAGS) -fno-strict-aliasing
_gstmodule_la_LIBADD = $(GST_LIBS)
......@@ -55,10 +57,8 @@ GST_INCLUDES=$(filter-out $(GST_EXCLUDE_INCLUDES),$(wildcard $(GST_INCLUDEDIR)/g
gstreamer.c: $(srcdir)/$(MODULE).defs $(srcdir)/arg-types.py $(srcdir)/$(MODULE).override
$(PYGTK_CODEGEN) \
--load-types $(srcdir)/arg-types.py \
--register $(srcdir)/gst-types.defs \
--override $(srcdir)/$(MODULE).override \
--prefix py$(MODULE) $(MODULE).defs > gen-$(MODULE).c \
--prefix pygst $(MODULE).defs > gen-$(MODULE).c \
&& cp gen-$(MODULE).c $(MODULE).c \
&& rm -f gen-$(MODULE).c
# --register $(PYGTK_DEFSDIR)/gtk-types.defs
# --register $(top_srcdir)/blah/blah-types.defs
#
# gst-python
# Copyright (C) 2002 David I. Lehn
# 2004 Johan Dahlin
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
......@@ -20,13 +21,38 @@
# Author: David I. Lehn <dlehn@users.sourceforge.net>
#
import argtypes
from argtypes import UInt64Arg, Int64Arg, PointerArg, ArgMatcher, ArgType, matcher
arg = argtypes.UInt64Arg()
argtypes.matcher.register('GstClockTime', arg)
class GstDataPtrArg(ArgType):
normal = (' if (!pygst_data_from_pyobject(py_%(name)s, &%(name)s))\n'
' return NULL;\n')
null = (' if (py_%(name)s == Py_None)\n'
' %(name)s = NULL;\n'
' else if (pyst_data_from_pyobject(py_%(name)s, &%(name)s_rect))\n'
' %(name)s = &%(name)s_rect;\n'
' else\n'
' return NULL;\n')
def write_param(self, ptype, pname, pdflt, pnull, info):
if pnull:
info.varlist.add('GstData', pname + '_data')
info.varlist.add('GstData', '*' + pname)
info.varlist.add('PyObject', '*py_' + pname + ' = Py_None')
info.add_parselist('O', ['&py_' + pname], [pname])
info.arglist.append(pname)
info.codebefore.append(self.null % {'name': pname})
else:
info.varlist.add('GstData', pname)
info.varlist.add('PyObject', '*py_' + pname)
info.add_parselist('O', ['&py_' + pname], [pname])
info.arglist.append('&' + pname)
info.codebefore.append(self.normal % {'name': pname})
arg = argtypes.Int64Arg()
argtypes.matcher.register('GstClockTimeDiff', arg)
arg = GstDataPtrArg()
matcher.register('GstData*', arg)
matcher.register('GstClockTime', UInt64Arg())
matcher.register('GstClockTimeDiff', Int64Arg())
arg = argtypes.PointerArg('gpointer', 'G_TYPE_POINTER')
argtypes.matcher.register('GstClockID', arg)
arg = PointerArg('gpointer', 'G_TYPE_POINTER')
matcher.register('GstClockID', arg)
del arg
/* gst-python
* Copyright (C) 2004 Johan Dahlin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Johan Dahlin <johan@gnome.org>
*/
#include <gst/gst.h>
#include <pygobject.h>
gboolean
pygst_data_from_pyobject(PyObject *object, GstData **data)
{
g_return_val_if_fail(*data != NULL, FALSE);
if (pyg_boxed_check(object, GST_TYPE_DATA)) {
*data = pyg_boxed_get(object, GstData);
return TRUE;
} else if (pyg_boxed_check(object, GST_TYPE_BUFFER)) {
*data = GST_DATA (pyg_boxed_get(object, GstBuffer));
return TRUE;
} else if (pyg_boxed_check(object, GST_TYPE_EVENT)) {
*data = GST_DATA (pyg_boxed_get(object, GstEvent));
return TRUE;
}
PyErr_Clear();
PyErr_SetString(PyExc_TypeError, "could not convert to GstData");
return FALSE;
}
static PyObject *
PyGstData_from_value(const GValue *value)
{
GstData *data = (GstData *)g_value_get_boxed(value);
return pyg_boxed_new(GST_TYPE_DATA, data, TRUE, TRUE);
}
static int
PyGstData_to_value(GValue *value, PyObject *object)
{
GstData* data;
if (!pygst_data_from_pyobject(object, &data))
return -1;
g_value_set_boxed(value, &data);
return 0;
}
/* We have to set ob_type here because stupid win32 does not allow you
* to use variables from another dll in a global variable initialisation.
*/
void
_pygst_register_boxed_types(PyObject *moddict)
{
pyg_register_boxed_custom(GST_TYPE_DATA,
PyGstData_from_value,
PyGstData_to_value);
}
This diff is collapsed.
This diff is collapsed.
......@@ -28,10 +28,10 @@
#include <pygobject.h>
#include <gst/gst.h>
void pygstreamer_register_classes (PyObject *d);
void pygstreamer_add_constants(PyObject *module, const gchar *strip_prefix);
void pygst_register_classes (PyObject *d);
void pygst_add_constants(PyObject *module, const gchar *strip_prefix);
extern PyMethodDef pygstreamer_functions[];
extern PyMethodDef pygst_functions[];
DL_EXPORT(void)
init_gst (void)
......@@ -61,7 +61,7 @@ init_gst (void)
g_free (argv[i]);
g_free (argv);
}
PyErr_SetString (PyExc_RuntimeError, "can't initialize module gstreamer");
PyErr_SetString (PyExc_RuntimeError, "can't initialize module gst");
}
if (argv != NULL) {
PySys_SetArgv (argc, argv);
......@@ -70,13 +70,13 @@ init_gst (void)
g_free (argv);
}
m = Py_InitModule ("gst._gst", pygstreamer_functions);
m = Py_InitModule ("gst._gst", pygst_functions);
d = PyModule_GetDict (m);
pygstreamer_register_classes (d);
pygstreamer_add_constants (m, "GST_");
pygst_register_classes (d);
pygst_add_constants (m, "GST_");
if (PyErr_Occurred ()) {
Py_FatalError ("can't initialize module gstreamer");
Py_FatalError ("can't initialize module gst");
}
}
This diff is collapsed.
......@@ -28,10 +28,10 @@
#include <pygobject.h>
#include <gst/gst.h>
void pygstreamer_register_classes (PyObject *d);
void pygstreamer_add_constants(PyObject *module, const gchar *strip_prefix);
void pygst_register_classes (PyObject *d);
void pygst_add_constants(PyObject *module, const gchar *strip_prefix);
extern PyMethodDef pygstreamer_functions[];
extern PyMethodDef pygst_functions[];
DL_EXPORT(void)
init_gst (void)
......@@ -61,7 +61,7 @@ init_gst (void)
g_free (argv[i]);
g_free (argv);
}
PyErr_SetString (PyExc_RuntimeError, "can't initialize module gstreamer");
PyErr_SetString (PyExc_RuntimeError, "can't initialize module gst");
}
if (argv != NULL) {
PySys_SetArgv (argc, argv);
......@@ -70,13 +70,13 @@ init_gst (void)
g_free (argv);
}
m = Py_InitModule ("gst._gst", pygstreamer_functions);
m = Py_InitModule ("gst._gst", pygst_functions);
d = PyModule_GetDict (m);
pygstreamer_register_classes (d);
pygstreamer_add_constants (m, "GST_");
pygst_register_classes (d);
pygst_add_constants (m, "GST_");
if (PyErr_Occurred ()) {
Py_FatalError ("can't initialize module gstreamer");
Py_FatalError ("can't initialize module gst");
}
}
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