gstreamer/gst/gst-types.c
Johan Dahlin a37dede09c examples/gstreamer/filesrc.py,player.py: New examples
Original commit message from CVS:
* examples/gstreamer/filesrc.py,player.py: New examples

* gstreamer/gstreamer.override: Add a dict like interface to GstTagList

* gstreamer/gstpad-handlers.override: New file, split out from gstreamer.override

* gstreamer/gst-types.defs: Don't use
gst_buffer_free/gst_data_free, use gst_data_unref instead.

* gstreamer/gst-types.c (PyGstData_to_value): Don't send address here.

* gstreamer/arg-types.py (GstDataPtrArg.write_param): Send the
address to stuff, since we really want to avoid segfaults :)

* gstreamer/0.6.[c,defs,h,override]: Remove, we're focusing on 0.7

* gstreamer/0.7.[c,defs,h,override]: Remove, merge with
gstreamer.*

* gstreamer/Makefile.am: Clean up, remove versioning support.
2004-02-27 18:01:52 +00:00

72 lines
2 KiB
C

/* 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;
}
void
_pygst_register_boxed_types(PyObject *moddict)
{
pyg_register_boxed_custom(GST_TYPE_DATA,
PyGstData_from_value,
PyGstData_to_value);
}