2004-08-03 17:07:38 +00:00
|
|
|
/* -*- Mode: C; c-basic-offset: 4 -*- */
|
2004-08-30 10:42:36 +00:00
|
|
|
/* gst-python
|
2004-02-27 18:32:20 +00:00
|
|
|
* Copyright (C) 2002 David I. Lehn
|
|
|
|
* 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: David I. Lehn <dlehn@users.sourceforge.net>
|
|
|
|
*/
|
|
|
|
%%
|
|
|
|
headers
|
2005-06-17 10:59:47 +00:00
|
|
|
/* define this for all source files that don't run init_pygobject()
|
|
|
|
* before including pygobject.h */
|
|
|
|
#define NO_IMPORT_PYGOBJECT
|
|
|
|
|
2004-03-08 13:51:02 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2004-05-03 09:10:26 +00:00
|
|
|
#include "common.h"
|
|
|
|
|
2004-02-27 18:32:20 +00:00
|
|
|
#include <gst/gst.h>
|
2004-03-09 14:54:57 +00:00
|
|
|
#include <gst/gsterror.h>
|
2004-02-27 18:32:20 +00:00
|
|
|
#include <gst/gsttypefind.h>
|
2005-09-09 16:39:59 +00:00
|
|
|
#include <gst/gsttagsetter.h>
|
2004-02-27 18:32:20 +00:00
|
|
|
|
2005-09-09 16:39:59 +00:00
|
|
|
#include <gst/controller/gstcontroller.h>
|
2005-08-03 16:54:57 +00:00
|
|
|
#include <gst/dataprotocol/dataprotocol.h>
|
|
|
|
#include <gst/base/gstadapter.h>
|
2006-01-01 21:18:28 +00:00
|
|
|
#include <gst/base/gstbasesrc.h>
|
|
|
|
#include <gst/base/gstpushsrc.h>
|
|
|
|
#include <gst/base/gstbasesink.h>
|
|
|
|
#include <gst/base/gstbasetransform.h>
|
|
|
|
#include <gst/base/gstcollectpads.h>
|
|
|
|
#include <gst/base/gsttypefindhelper.h>
|
2005-08-03 16:54:57 +00:00
|
|
|
|
2005-11-18 16:26:05 +00:00
|
|
|
#include <gst/net/gstnet.h>
|
|
|
|
|
2005-06-17 10:59:47 +00:00
|
|
|
#include "pygstvalue.h"
|
2005-06-26 12:35:07 +00:00
|
|
|
#include "pygstminiobject.h"
|
2005-10-13 10:41:06 +00:00
|
|
|
#include "pygstexception.h"
|
2005-06-17 10:59:47 +00:00
|
|
|
|
|
|
|
/* These headers have been included directly to get around multiple
|
|
|
|
* GetAttrString calls */
|
|
|
|
#include <compile.h>
|
|
|
|
#include <frameobject.h>
|
|
|
|
|
2005-10-06 09:10:14 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (python_debug);
|
2005-10-06 09:05:15 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (pygst_debug);
|
|
|
|
#define GST_CAT_DEFAULT pygst_debug
|
2005-08-04 10:44:16 +00:00
|
|
|
|
2004-08-03 17:07:38 +00:00
|
|
|
GSList *mainloops = NULL;
|
|
|
|
void
|
|
|
|
_pygst_main_quit(void)
|
|
|
|
{
|
|
|
|
if (!mainloops)
|
2004-10-11 09:01:23 +00:00
|
|
|
g_error ("Quit more loops than there are");
|
2004-08-03 17:07:38 +00:00
|
|
|
else {
|
2004-10-11 09:01:23 +00:00
|
|
|
GMainLoop *loop = mainloops->data;
|
2004-08-03 17:07:38 +00:00
|
|
|
|
2004-10-11 09:01:23 +00:00
|
|
|
mainloops = g_slist_delete_link (mainloops, mainloops);
|
|
|
|
g_main_loop_quit (loop);
|
|
|
|
g_main_loop_unref (loop);
|
2004-08-03 17:07:38 +00:00
|
|
|
}
|
2004-10-11 09:01:23 +00:00
|
|
|
}
|
2004-08-03 17:07:38 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_pygst_main(void)
|
|
|
|
{
|
|
|
|
GMainLoop *loop;
|
|
|
|
|
|
|
|
loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
mainloops = g_slist_prepend (mainloops, loop);
|
|
|
|
|
|
|
|
g_main_loop_run (loop);
|
|
|
|
}
|
|
|
|
|
2005-06-17 10:59:47 +00:00
|
|
|
/* This function checks if a former Python code threw an exception and if
|
|
|
|
* so, transforms this exception into an error on the given GstElement.
|
|
|
|
* This allows code run on the element to just raise an exception instead of
|
|
|
|
* returning GStreamer specific return values.
|
|
|
|
* The exception is cleared afterwards.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
_pygst_element_check_error (GstElement *element)
|
|
|
|
{
|
|
|
|
PyObject *type, *value, *traceback, *lineno, *msg, *typemsg;
|
|
|
|
PyFrameObject *frame;
|
|
|
|
|
|
|
|
if (!PyErr_Occurred())
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
PyErr_Fetch (&type, &value, &traceback);
|
|
|
|
if (traceback) {
|
|
|
|
frame = (PyFrameObject *) PyObject_GetAttrString (traceback, "tb_frame");
|
|
|
|
lineno = PyObject_GetAttrString (traceback, "tb_lineno");
|
|
|
|
} else {
|
|
|
|
frame = NULL;
|
|
|
|
lineno = NULL;
|
|
|
|
}
|
|
|
|
msg = PyObject_Str (value);
|
|
|
|
typemsg = PyObject_Str (type);
|
|
|
|
if (msg && PyString_Check (msg)) {
|
2005-06-20 21:39:34 +00:00
|
|
|
gst_element_message_full (element, GST_MESSAGE_ERROR,
|
|
|
|
GST_LIBRARY_ERROR,
|
2005-06-17 10:59:47 +00:00
|
|
|
GST_LIBRARY_ERROR_FAILED,
|
|
|
|
g_strdup (PyString_AsString (msg)),
|
|
|
|
typemsg ? g_strconcat (PyString_AsString (typemsg),
|
|
|
|
": ", PyString_AsString (msg), NULL)
|
|
|
|
: g_strdup (PyString_AsString (msg)),
|
|
|
|
frame ? PyString_AsString(frame->f_code->co_filename) : "???",
|
|
|
|
frame ? PyString_AsString(frame->f_code->co_name) : "???",
|
|
|
|
lineno ? PyInt_AsLong (lineno) : 0);
|
|
|
|
} else {
|
2005-06-20 21:39:34 +00:00
|
|
|
gst_element_message_full (element, GST_MESSAGE_ERROR,
|
|
|
|
GST_LIBRARY_ERROR,
|
2005-06-17 10:59:47 +00:00
|
|
|
GST_LIBRARY_ERROR_TOO_LAZY,
|
|
|
|
NULL, NULL,
|
|
|
|
frame ? PyString_AsString(frame->f_code->co_filename) : "???",
|
|
|
|
frame ? PyString_AsString(frame->f_code->co_name) : "???",
|
|
|
|
lineno ? PyInt_AsLong (lineno) : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
PyErr_Clear ();
|
|
|
|
Py_XDECREF (frame);
|
|
|
|
Py_XDECREF (lineno);
|
|
|
|
Py_DECREF (msg);
|
|
|
|
Py_DECREF (typemsg);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef pyg_register_class_init
|
|
|
|
PyTypeObject PyGstPadTemplate_Type;
|
|
|
|
static int
|
|
|
|
add_templates (gpointer gclass, PyObject *templates)
|
|
|
|
{
|
|
|
|
gint i, len;
|
|
|
|
PyGObject *templ;
|
|
|
|
|
|
|
|
if (pygobject_check(templates, &PyGstPadTemplate_Type)) {
|
|
|
|
gst_element_class_add_pad_template (gclass, GST_PAD_TEMPLATE (pygobject_get (templates)));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!PyTuple_Check(templates)) {
|
|
|
|
PyErr_SetString(PyExc_TypeError, "__gsttemplates__ attribute neither a tuple nor a GstPadTemplate!");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
len = PyTuple_Size(templates);
|
|
|
|
if (len == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
templ = (PyGObject*) PyTuple_GetItem(templates, i);
|
|
|
|
if (!pygobject_check(templ, &PyGstPadTemplate_Type)) {
|
|
|
|
PyErr_SetString(PyExc_TypeError, "entries for __gsttemplates__ must be of type GstPadTemplate");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
templ = (PyGObject*) PyTuple_GetItem(templates, i);
|
|
|
|
gst_element_class_add_pad_template (gclass, GST_PAD_TEMPLATE (templ->obj));
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_pygst_element_set_details (gpointer gclass, PyObject *details)
|
|
|
|
{
|
|
|
|
GstElementDetails gstdetails = { 0, };
|
|
|
|
|
|
|
|
if (!PyTuple_Check (details)) {
|
|
|
|
PyErr_SetString(PyExc_TypeError, "__gstdetails__ must be a tuple");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (PyTuple_Size (details) != 4) {
|
|
|
|
PyErr_SetString(PyExc_TypeError, "__gstdetails__ must be contain 4 elements");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (!PyArg_ParseTuple (details, "ssss", &gstdetails.longname, &gstdetails.klass,
|
|
|
|
&gstdetails.description, &gstdetails.author)) {
|
|
|
|
PyErr_SetString (PyExc_TypeError, "__gstdetails__ must be contain 4 strings");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
gst_element_class_set_details (gclass, &gstdetails);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_pygst_element_init (gpointer gclass, PyTypeObject *pyclass)
|
|
|
|
{
|
|
|
|
PyObject *templates, *details;
|
|
|
|
|
|
|
|
templates = PyDict_GetItemString(pyclass->tp_dict, "__gsttemplates__");
|
|
|
|
if (templates) {
|
|
|
|
if (add_templates(gclass, templates) != 0)
|
|
|
|
return -1;
|
|
|
|
} else {
|
|
|
|
PyErr_Clear();
|
|
|
|
}
|
|
|
|
details = PyDict_GetItemString(pyclass->tp_dict, "__gstdetails__");
|
|
|
|
if (details) {
|
|
|
|
if (_pygst_element_set_details (gclass, details) != 0)
|
|
|
|
return -1;
|
|
|
|
PyDict_DelItemString(pyclass->tp_dict, "__gstdetails__");
|
|
|
|
} else {
|
|
|
|
PyErr_Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-08-04 10:44:16 +00:00
|
|
|
static PyObject *
|
2005-09-12 17:06:09 +00:00
|
|
|
pygst_debug_log (PyObject *pyobject, PyObject *string, GstDebugLevel level,
|
|
|
|
gboolean isgstobject)
|
2005-08-04 10:44:16 +00:00
|
|
|
{
|
|
|
|
gchar *str;
|
|
|
|
gchar *function;
|
|
|
|
gchar *filename;
|
2005-08-10 15:24:12 +00:00
|
|
|
int lineno;
|
2005-08-04 10:44:16 +00:00
|
|
|
PyFrameObject *frame;
|
2005-09-12 17:06:09 +00:00
|
|
|
GObject *object = NULL;
|
2005-08-04 10:44:16 +00:00
|
|
|
|
|
|
|
if (!PyArg_ParseTuple(string, "s:gst.debug_log", &str)) {
|
|
|
|
PyErr_SetString(PyExc_TypeError, "Need a string!");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
frame = PyEval_GetFrame();
|
|
|
|
function = PyString_AsString(frame->f_code->co_name);
|
2005-08-11 13:23:20 +00:00
|
|
|
filename = g_path_get_basename(PyString_AsString(frame->f_code->co_filename));
|
2005-10-05 22:33:50 +00:00
|
|
|
lineno = PyCode_Addr2Line(frame->f_code, frame->f_lasti);
|
2005-08-04 10:44:16 +00:00
|
|
|
/* gst_debug_log : category, level, file, function, line, object, format, va_list */
|
2005-09-12 17:06:09 +00:00
|
|
|
if (isgstobject)
|
|
|
|
object = G_OBJECT (pygobject_get (pyobject));
|
2005-10-06 09:10:14 +00:00
|
|
|
gst_debug_log (python_debug, level, filename, function, lineno, object, "%s", str);
|
2005-08-11 13:23:20 +00:00
|
|
|
if (filename)
|
|
|
|
g_free(filename);
|
2005-08-04 10:44:16 +00:00
|
|
|
Py_INCREF (Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
|
|
|
|
2004-02-27 18:32:20 +00:00
|
|
|
%%
|
|
|
|
include
|
2004-05-24 10:30:05 +00:00
|
|
|
gstbin.override
|
2004-05-04 14:20:28 +00:00
|
|
|
gstbuffer.override
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
gstbus.override
|
2005-09-28 14:34:52 +00:00
|
|
|
gstcaps.override
|
2005-01-01 15:23:42 +00:00
|
|
|
gstelement.override
|
2005-10-13 10:41:06 +00:00
|
|
|
gstelementfactory.override
|
2005-09-28 14:34:52 +00:00
|
|
|
gstevent.override
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
gstmessage.override
|
2005-09-28 14:34:52 +00:00
|
|
|
gstobject.override
|
2005-01-01 15:23:42 +00:00
|
|
|
gstpad.override
|
2005-09-28 14:34:52 +00:00
|
|
|
gstquery.override
|
2005-01-01 15:23:42 +00:00
|
|
|
gststructure.override
|
2005-09-28 14:34:52 +00:00
|
|
|
gsttaglist.override
|
2005-08-03 16:54:57 +00:00
|
|
|
gstlibs.override
|
2004-02-27 18:32:20 +00:00
|
|
|
%%
|
2004-04-16 16:53:29 +00:00
|
|
|
init
|
2005-06-17 10:59:47 +00:00
|
|
|
{
|
|
|
|
/* FIXME: new in pygtk-2.6 */
|
|
|
|
#ifdef pyg_register_class_init
|
|
|
|
pyg_register_class_init (GST_TYPE_ELEMENT, _pygst_element_init);
|
|
|
|
#endif
|
|
|
|
if (!pygst_value_init())
|
|
|
|
return;
|
2005-09-29 15:42:31 +00:00
|
|
|
gst_controller_init(NULL, NULL);
|
2005-06-17 10:59:47 +00:00
|
|
|
}
|
2004-04-16 16:53:29 +00:00
|
|
|
%%
|
2004-02-27 18:32:20 +00:00
|
|
|
modulename gst
|
|
|
|
%%
|
|
|
|
import gobject.GObject as PyGObject_Type
|
|
|
|
%%
|
|
|
|
ignore-glob
|
2004-03-08 13:51:02 +00:00
|
|
|
_*
|
|
|
|
*_copy
|
2004-03-16 17:57:18 +00:00
|
|
|
*_error_quark
|
2004-03-08 13:51:02 +00:00
|
|
|
*_free
|
2004-03-16 17:57:18 +00:00
|
|
|
*_get_type
|
2004-03-08 13:51:02 +00:00
|
|
|
*_private
|
2004-03-16 17:57:18 +00:00
|
|
|
*_thyself
|
|
|
|
*_valist
|
2005-09-28 10:58:50 +00:00
|
|
|
*_ref
|
|
|
|
*_unref
|
2005-09-29 09:58:25 +00:00
|
|
|
*_init
|
2005-10-22 17:12:15 +00:00
|
|
|
*_deinit
|
2005-11-24 11:47:15 +00:00
|
|
|
*_full
|
2004-03-16 17:57:18 +00:00
|
|
|
gst_class_*
|
|
|
|
gst_init*
|
|
|
|
gst_interface_*
|
|
|
|
gst_value_*
|
2005-09-29 09:58:25 +00:00
|
|
|
gst_param_spec_*
|
2004-03-16 17:57:18 +00:00
|
|
|
%%
|
|
|
|
ignore
|
|
|
|
gst_alloc_trace_list
|
|
|
|
gst_alloc_trace_get
|
|
|
|
gst_error_get_message
|
|
|
|
gst_parse_launchv
|
|
|
|
gst_trace_read_tsc
|
2005-09-28 17:08:11 +00:00
|
|
|
gst_debug_log
|
|
|
|
gst_debug_log_default
|
2005-09-29 09:58:25 +00:00
|
|
|
gst_iterator_new_list
|
2005-10-11 12:42:53 +00:00
|
|
|
gst_task_set_lock
|
|
|
|
gst_clock_id_compare_func
|
|
|
|
gst_print_pad_caps
|
|
|
|
gst_util_set_value_from_string
|
|
|
|
gst_print_element_args
|
|
|
|
gst_atomic_int_set
|
2005-12-18 17:20:12 +00:00
|
|
|
gst_caps_replace
|
|
|
|
gst_mini_object_replace
|
|
|
|
gst_filter_run
|
|
|
|
gst_flow_to_quark
|
|
|
|
gst_implements_interface_cast
|
|
|
|
gst_implements_interface_check
|
2005-12-18 18:15:57 +00:00
|
|
|
gst_plugin_get_module
|
2005-12-19 16:05:34 +00:00
|
|
|
gst_object_sink
|
2005-06-17 10:59:47 +00:00
|
|
|
%%
|
|
|
|
override-slot GstPluginFeature.tp_repr
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_plugin_feature_tp_repr(PyObject *self)
|
|
|
|
{
|
|
|
|
gchar *repr;
|
|
|
|
PyObject *ret;
|
|
|
|
GstPluginFeature *feature = GST_PLUGIN_FEATURE (pygobject_get (self));
|
|
|
|
|
|
|
|
repr = g_strdup_printf ("<%s %s @ 0x%lx>",
|
|
|
|
self->ob_type->tp_name, gst_plugin_feature_get_name (feature),
|
|
|
|
(long) self);
|
|
|
|
ret = PyString_FromString(repr);
|
|
|
|
g_free (repr);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
%%
|
|
|
|
override-slot GstPluginFeature.tp_str
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_plugin_feature_tp_str(PyObject *self)
|
|
|
|
{
|
|
|
|
gchar *repr;
|
|
|
|
PyObject *ret;
|
|
|
|
GstPluginFeature *feature = GST_PLUGIN_FEATURE (pygobject_get (self));
|
|
|
|
|
|
|
|
repr = g_strdup_printf ("<%s %s (%d)>",
|
|
|
|
self->ob_type->tp_name, gst_plugin_feature_get_name (feature),
|
|
|
|
gst_plugin_feature_get_rank (feature));
|
|
|
|
ret = PyString_FromString(repr);
|
|
|
|
g_free (repr);
|
|
|
|
return ret;
|
2004-02-27 18:32:20 +00:00
|
|
|
}
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
|
|
|
|
%%
|
2004-05-03 09:10:26 +00:00
|
|
|
override gst_type_find_factory_get_caps noargs
|
2004-03-08 13:51:02 +00:00
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_type_find_factory_get_caps(PyGObject *self)
|
|
|
|
{
|
|
|
|
GstCaps *ret = (GstCaps*)gst_type_find_factory_get_caps(GST_TYPE_FIND_FACTORY(self->obj));
|
|
|
|
return pyg_boxed_new(GST_TYPE_CAPS, ret, TRUE, TRUE);
|
|
|
|
}
|
|
|
|
%%
|
|
|
|
override gst_type_find_factory_get_caps noargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_type_find_factory_get_caps(PyGObject *self)
|
|
|
|
{
|
|
|
|
GstCaps *ret = (GstCaps*)gst_type_find_factory_get_caps(GST_TYPE_FIND_FACTORY(self->obj));
|
|
|
|
return pyg_boxed_new(GST_TYPE_CAPS, ret, TRUE, TRUE);
|
|
|
|
}
|
2004-03-09 14:54:57 +00:00
|
|
|
%%
|
|
|
|
override-attr GError.domain
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_g_error__get_domain(PyGObject *self, void *closure)
|
|
|
|
{
|
|
|
|
return PyString_FromString(g_quark_to_string(((GError*)self->obj)->domain));
|
|
|
|
}
|
|
|
|
%%
|
|
|
|
override-slot GError.tp_str
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_g_error_tp_str(PyGObject *self)
|
|
|
|
{
|
|
|
|
GError *error = (GError*)self->obj;
|
|
|
|
return PyString_FromString(gst_error_get_message (error->domain,
|
|
|
|
error->code));
|
|
|
|
}
|
2005-09-18 11:54:34 +00:00
|
|
|
%%
|
2005-10-14 17:13:08 +00:00
|
|
|
override-attr GstDate.day
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_date__get_day(PyGObject *self, void *closure)
|
|
|
|
{
|
|
|
|
return PyInt_FromLong(g_date_get_day((GDate*)self->obj));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_wrap_gst_date__set_day(PyGObject *self, PyObject *value, void *closure)
|
|
|
|
{
|
|
|
|
GDate *date = (GDate *) self->obj;
|
|
|
|
|
|
|
|
if (!(PyInt_Check(value)))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
g_date_set_day(date, (int) PyInt_AsLong(value));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
%%
|
|
|
|
override-attr GstDate.month
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_date__get_month(PyGObject *self, void *closure)
|
|
|
|
{
|
|
|
|
return PyInt_FromLong(g_date_get_month((GDate*)self->obj));
|
|
|
|
}
|
|
|
|
static int
|
|
|
|
_wrap_gst_date__set_month(PyGObject *self, PyObject *value, void *closure)
|
|
|
|
{
|
|
|
|
GDate *date = (GDate *) self->obj;
|
|
|
|
|
|
|
|
if (!(PyInt_Check(value)))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
g_date_set_month(date, (int) PyInt_AsLong(value));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
%%
|
|
|
|
override-attr GstDate.year
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_date__get_year(PyGObject *self, void *closure)
|
|
|
|
{
|
|
|
|
return PyInt_FromLong(g_date_get_year((GDate*)self->obj));
|
|
|
|
}
|
|
|
|
static int
|
|
|
|
_wrap_gst_date__set_year(PyGObject *self, PyObject *value, void *closure)
|
|
|
|
{
|
|
|
|
GDate *date = (GDate *) self->obj;
|
|
|
|
|
|
|
|
if (!(PyInt_Check(value)))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
g_date_set_year(date, (int) PyInt_AsLong(value));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
%%
|
|
|
|
override-slot GstDate.tp_repr
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_date_tp_repr(PyGObject *self)
|
|
|
|
{
|
|
|
|
GDate *date = (GDate *) self->obj;
|
|
|
|
|
|
|
|
return PyString_FromFormat ("<GstDate: %2d/%2d/%4d>",
|
|
|
|
g_date_get_day(date),
|
|
|
|
g_date_get_month(date),
|
|
|
|
g_date_get_year(date));
|
|
|
|
}
|
|
|
|
%%
|
2005-09-18 11:54:34 +00:00
|
|
|
override gst_registry_get_path_list
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_registry_get_path_list (PyGObject *self)
|
|
|
|
{
|
2005-10-14 16:26:17 +00:00
|
|
|
GstRegistry *registry;
|
|
|
|
GList *l, *paths;
|
|
|
|
PyObject *list;
|
2005-10-13 10:58:16 +00:00
|
|
|
gint i;
|
2005-10-14 16:26:17 +00:00
|
|
|
|
|
|
|
registry = GST_REGISTRY (self->obj);
|
|
|
|
|
|
|
|
paths = gst_registry_get_path_list (registry);
|
|
|
|
|
|
|
|
list = PyList_New (g_list_length(paths));
|
|
|
|
for (l = paths, i = 0; l; l = l->next, ++i) {
|
|
|
|
gchar *path = (gchar *) l->data;
|
|
|
|
PyList_SetItem (list, i, PyString_FromString(path));
|
|
|
|
}
|
|
|
|
g_list_free (paths);
|
|
|
|
|
|
|
|
return list;
|
2005-09-18 11:54:34 +00:00
|
|
|
}
|
|
|
|
|
2004-07-15 10:15:18 +00:00
|
|
|
%%
|
2005-09-18 11:06:42 +00:00
|
|
|
override gst_registry_get_plugin_list
|
2004-07-15 10:15:18 +00:00
|
|
|
static PyObject *
|
2005-09-18 11:06:42 +00:00
|
|
|
_wrap_gst_registry_get_plugin_list (PyGObject *self)
|
2004-07-15 10:15:18 +00:00
|
|
|
{
|
2005-09-18 11:06:42 +00:00
|
|
|
GstRegistry *registry;
|
2004-07-15 10:15:18 +00:00
|
|
|
GList *l, *plugins;
|
|
|
|
PyObject *list;
|
2005-10-13 10:58:16 +00:00
|
|
|
gint i;
|
|
|
|
|
2005-09-18 11:06:42 +00:00
|
|
|
registry = GST_REGISTRY (self->obj);
|
|
|
|
|
|
|
|
plugins = gst_registry_get_plugin_list (registry);
|
2004-07-15 10:15:18 +00:00
|
|
|
|
2005-10-13 10:58:16 +00:00
|
|
|
list = PyList_New (g_list_length(plugins));
|
|
|
|
for (l = plugins, i = 0; l; l = l->next, ++i) {
|
2005-09-18 11:06:42 +00:00
|
|
|
GstPlugin *plugin = (GstPlugin *) l->data;
|
2005-10-14 16:26:17 +00:00
|
|
|
PyObject *object = pygstobject_new (G_OBJECT (plugin));
|
|
|
|
gst_object_unref (plugin);
|
|
|
|
|
|
|
|
PyList_SetItem (list, i, object);
|
2004-07-15 10:15:18 +00:00
|
|
|
}
|
2005-09-18 11:06:42 +00:00
|
|
|
g_list_free (plugins);
|
2005-10-14 16:26:17 +00:00
|
|
|
|
2004-07-15 10:15:18 +00:00
|
|
|
return list;
|
|
|
|
}
|
2005-09-18 11:06:42 +00:00
|
|
|
|
2005-09-18 11:54:34 +00:00
|
|
|
%%
|
|
|
|
override gst_registry_get_feature_list kwargs
|
2004-07-15 10:15:18 +00:00
|
|
|
static PyObject *
|
2005-09-18 11:54:34 +00:00
|
|
|
_wrap_gst_registry_get_feature_list (PyGObject *self, PyObject *args, PyObject *kwargs)
|
2004-07-15 10:15:18 +00:00
|
|
|
{
|
2005-09-18 11:54:34 +00:00
|
|
|
static char *kwlist[] = { "type", NULL };
|
|
|
|
PyObject *py_type = NULL;
|
|
|
|
GType type;
|
|
|
|
|
|
|
|
GstRegistry *registry;
|
|
|
|
GList *l, *features;
|
|
|
|
PyObject *list;
|
2005-10-13 10:58:16 +00:00
|
|
|
gint i;
|
2004-07-15 10:15:18 +00:00
|
|
|
|
|
|
|
|
2005-09-18 11:54:34 +00:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
|
|
|
"O:GstRegistry.get_feature_list", kwlist, &py_type))
|
|
|
|
return NULL;
|
|
|
|
if ((type = pyg_type_from_object(py_type)) == 0)
|
|
|
|
return NULL;
|
2004-07-15 10:15:18 +00:00
|
|
|
|
2005-09-18 11:54:34 +00:00
|
|
|
registry = GST_REGISTRY (self->obj);
|
|
|
|
|
|
|
|
features = gst_registry_get_feature_list (registry, type);
|
|
|
|
|
2005-10-13 10:58:16 +00:00
|
|
|
list = PyList_New (g_list_length(features));
|
|
|
|
for (l = features, i = 0; l; l = l->next, ++i) {
|
2005-09-18 11:54:34 +00:00
|
|
|
GstPluginFeature *feature = (GstPluginFeature *) l->data;
|
2005-10-13 10:58:16 +00:00
|
|
|
PyList_SetItem (list, i, pygobject_new (G_OBJECT (feature)));
|
2005-10-14 16:26:17 +00:00
|
|
|
gst_object_unref (feature);
|
2005-09-18 11:54:34 +00:00
|
|
|
}
|
|
|
|
g_list_free (features);
|
2005-09-18 11:06:42 +00:00
|
|
|
|
2005-09-18 11:54:34 +00:00
|
|
|
return list;
|
2004-07-15 10:15:18 +00:00
|
|
|
}
|
2005-09-18 11:06:42 +00:00
|
|
|
|
2005-09-23 15:37:40 +00:00
|
|
|
%%
|
|
|
|
override gst_registry_get_feature_list_by_plugin kwargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_registry_get_feature_list_by_plugin (PyGObject *self, PyObject *args, PyObject *kwargs)
|
|
|
|
{
|
|
|
|
static char *kwlist[] = { "name", NULL };
|
|
|
|
gchar * name = NULL;
|
|
|
|
|
|
|
|
GstRegistry *registry;
|
|
|
|
GList *l, *features;
|
|
|
|
PyObject *list;
|
2005-10-13 10:58:16 +00:00
|
|
|
gint i;
|
2005-09-23 15:37:40 +00:00
|
|
|
|
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
|
|
|
"s:GstRegistry.get_feature_list_by_plugin", kwlist, &name))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
registry = GST_REGISTRY (self->obj);
|
|
|
|
|
|
|
|
features = gst_registry_get_feature_list_by_plugin (registry, name);
|
|
|
|
|
2005-10-13 10:58:16 +00:00
|
|
|
list = PyList_New (g_list_length(features));
|
|
|
|
for (l = features, i = 0; l; l = l->next, ++i) {
|
2005-09-23 15:37:40 +00:00
|
|
|
GstPluginFeature *feature = (GstPluginFeature *) l->data;
|
2005-10-13 10:58:16 +00:00
|
|
|
PyList_SetItem (list, i, pygobject_new (G_OBJECT (feature)));
|
2005-09-23 15:37:40 +00:00
|
|
|
}
|
|
|
|
g_list_free (features);
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2004-10-11 09:24:15 +00:00
|
|
|
%%
|
|
|
|
override gst_xml_new noargs
|
|
|
|
|
2004-10-11 13:43:26 +00:00
|
|
|
extern PyObject * libxml_xmlDocPtrWrap(xmlDocPtr doc);
|
|
|
|
extern PyObject * libxml_xmlNodePtrWrap(xmlNodePtr node);
|
|
|
|
|
2004-10-11 09:24:15 +00:00
|
|
|
/* libxml2 available check */
|
|
|
|
static PyObject *
|
|
|
|
_gst_get_libxml2_module(void)
|
|
|
|
{
|
|
|
|
PyObject *xml = NULL;
|
|
|
|
|
|
|
|
xml = PyImport_ImportModule("libxml2");
|
|
|
|
if (!xml) {
|
|
|
|
PyErr_Clear();
|
|
|
|
PyErr_SetString(PyExc_RuntimeError,"libxml2 bindings required");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return xml;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_wrap_gst_xml_new(PyGObject *self)
|
|
|
|
{
|
|
|
|
PyObject *xml = _gst_get_libxml2_module();
|
|
|
|
|
|
|
|
if(!xml)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
self->obj = (GObject *)gst_xml_new();
|
|
|
|
|
|
|
|
if (!self->obj) {
|
|
|
|
PyErr_SetString(PyExc_RuntimeError, "could not create GstXML object");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
pygobject_register_wrapper((PyObject *)self);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
%%
|
|
|
|
override gst_xml_get_topelements noargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_xml_get_topelements(PyGObject *self)
|
|
|
|
{
|
|
|
|
GList *l, *xml_elements;
|
|
|
|
PyObject *py_list;
|
2005-10-13 10:58:16 +00:00
|
|
|
gint i;
|
2004-10-11 09:24:15 +00:00
|
|
|
|
|
|
|
xml_elements = gst_xml_get_topelements(GST_XML(self->obj));
|
2005-10-13 10:58:16 +00:00
|
|
|
py_list = PyList_New(g_list_length(xml_elements));
|
|
|
|
for (l = xml_elements, i = 0; l; l = l->next, ++i) {
|
|
|
|
GstElement *element = (GstElement*)l->data;
|
|
|
|
PyList_SetItem(py_list, i, pygstobject_new(G_OBJECT(element)));
|
|
|
|
gst_object_unref (element);
|
2004-10-11 09:24:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return py_list;
|
|
|
|
}
|
|
|
|
%%
|
|
|
|
override gst_xml_parse_memory kwargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_xml_parse_memory(PyGObject *self, PyObject *args, PyObject *kwargs)
|
|
|
|
{
|
|
|
|
static char *kwlist[] = { "buffer", "root", NULL };
|
|
|
|
int buffer_len, ret;
|
|
|
|
char *root = NULL;
|
|
|
|
guchar *buffer;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
|
|
|
"s#|s:GstXML.parse_memory",
|
|
|
|
kwlist, &buffer, &buffer_len, &root))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
ret = gst_xml_parse_memory(GST_XML(self->obj),
|
|
|
|
buffer, buffer_len, root);
|
|
|
|
|
|
|
|
return PyBool_FromLong(ret);
|
|
|
|
}
|
2004-11-15 12:13:57 +00:00
|
|
|
%%
|
2005-11-22 14:15:03 +00:00
|
|
|
override gst_tag_setter_get_tag_list noargs
|
2004-11-15 12:13:57 +00:00
|
|
|
static PyObject *
|
2005-11-22 14:15:03 +00:00
|
|
|
_wrap_gst_tag_setter_get_tag_list(PyGObject *self)
|
2004-11-15 12:13:57 +00:00
|
|
|
{
|
|
|
|
GstTagList *ret;
|
|
|
|
|
2005-11-22 14:15:03 +00:00
|
|
|
ret = (GstTagList*)gst_tag_setter_get_tag_list(GST_TAG_SETTER(self->obj));
|
2004-11-15 12:13:57 +00:00
|
|
|
/* pyg_boxed_new handles NULL checking */
|
|
|
|
return pyg_boxed_new(GST_TYPE_TAG_LIST, ret, TRUE, TRUE);
|
|
|
|
}
|
2005-09-03 10:01:47 +00:00
|
|
|
|
2005-06-17 10:59:47 +00:00
|
|
|
%%
|
|
|
|
override gst_element_register kwargs
|
|
|
|
|
|
|
|
static GstPlugin *
|
|
|
|
_pygst_get_plugin(void)
|
|
|
|
{
|
|
|
|
PyObject *dict = NULL, *module = NULL, *pyplugin = NULL;
|
|
|
|
GstPlugin *ret;
|
|
|
|
|
|
|
|
if (!(module = PyImport_ImportModule ("gst")))
|
|
|
|
goto err;
|
|
|
|
if (!(dict = PyModule_GetDict (module)))
|
|
|
|
goto err;
|
|
|
|
if (!(pyplugin = PyDict_GetItemString (dict, "__plugin__")))
|
|
|
|
goto err;
|
|
|
|
ret = pyg_boxed_get (pyplugin, GstPlugin);
|
|
|
|
|
|
|
|
Py_DECREF (module);
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
err:
|
|
|
|
Py_XDECREF (module);
|
|
|
|
PyErr_Clear ();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_element_register(PyObject *self, PyObject *args, PyObject *kwargs)
|
|
|
|
{
|
|
|
|
static char *kwlist[] = { "type", "elementname", "rank", NULL };
|
|
|
|
PyObject *py_type = NULL;
|
|
|
|
guint rank = GST_RANK_NONE;
|
|
|
|
char *elementname = NULL;
|
|
|
|
int ret;
|
|
|
|
GType type;
|
|
|
|
|
|
|
|
/* FIXME: can we make the name optional, too? Anyone know a good default? */
|
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os|I:element_register", kwlist,
|
|
|
|
&py_type, &elementname, &rank))
|
|
|
|
return NULL;
|
|
|
|
if ((type = pyg_type_from_object(py_type)) == 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
ret = gst_element_register(_pygst_get_plugin(), elementname, rank, type);
|
|
|
|
return PyBool_FromLong(ret);
|
|
|
|
}
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
%%
|
|
|
|
override-attr GError.domain
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_g_error__get_domain(PyGObject *self, void *closure)
|
|
|
|
{
|
|
|
|
return PyString_FromString(g_quark_to_string(((GError*)self->obj)->domain));
|
|
|
|
}
|
|
|
|
%%
|
|
|
|
override-slot GError.tp_str
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_g_error_tp_str(PyGObject *self)
|
|
|
|
{
|
|
|
|
GError *error = (GError*)self->obj;
|
|
|
|
return PyString_FromString(gst_error_get_message (error->domain,
|
|
|
|
error->code));
|
|
|
|
}
|
|
|
|
%%
|
|
|
|
override gst_uri_handler_get_protocols noargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_uri_handler_get_protocols (PyGObject *self)
|
|
|
|
{
|
|
|
|
gchar **tab;
|
|
|
|
int i, len;
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
tab = gst_uri_handler_get_protocols (GST_URI_HANDLER (self->obj));
|
|
|
|
if (!tab) {
|
|
|
|
Py_INCREF (Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
2005-10-13 10:58:16 +00:00
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
len = g_strv_length (tab);
|
2005-10-13 10:58:16 +00:00
|
|
|
ret = PyList_New(len);
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
for (i = 0; i < len; i++) {
|
2005-10-13 10:58:16 +00:00
|
|
|
PyList_SetItem(ret, i, PyString_FromString(tab[i]));
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
%%
|
2005-08-01 09:59:55 +00:00
|
|
|
override gst_flow_get_name kwargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_flow_get_name(PyObject *self, PyObject *args, PyObject *kwargs)
|
|
|
|
{
|
|
|
|
static char *kwlist[] = { "ret", NULL };
|
|
|
|
PyObject *py_ret = NULL;
|
|
|
|
const gchar *ret;
|
|
|
|
gchar *nret;
|
|
|
|
GstFlowReturn flow;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:gst_flow_get_name", kwlist, &py_ret))
|
|
|
|
return NULL;
|
|
|
|
if (pyg_enum_get_value(GST_TYPE_FLOW_RETURN, py_ret, (gint *)&flow))
|
|
|
|
return NULL;
|
|
|
|
ret = gst_flow_get_name(flow);
|
|
|
|
if (ret) {
|
|
|
|
nret = g_strdup(ret);
|
|
|
|
return PyString_FromString(nret);
|
|
|
|
}
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
2005-09-08 14:08:32 +00:00
|
|
|
|
2005-08-04 10:44:16 +00:00
|
|
|
%%
|
|
|
|
override gst_log args
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_log (PyObject *whatever, PyObject *string)
|
|
|
|
{
|
2005-09-12 17:06:09 +00:00
|
|
|
return pygst_debug_log (whatever, string, GST_LEVEL_LOG, FALSE);
|
2005-08-04 10:44:16 +00:00
|
|
|
}
|
|
|
|
%%
|
|
|
|
override gst_debug args
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_debug (PyObject *whatever, PyObject *string)
|
|
|
|
{
|
2005-09-12 17:06:09 +00:00
|
|
|
return pygst_debug_log (whatever, string, GST_LEVEL_DEBUG, FALSE);
|
2005-08-04 10:44:16 +00:00
|
|
|
}
|
|
|
|
%%
|
|
|
|
override gst_info args
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_info (PyObject *whatever, PyObject *string)
|
|
|
|
{
|
2005-09-12 17:06:09 +00:00
|
|
|
return pygst_debug_log (whatever, string, GST_LEVEL_INFO, FALSE);
|
2005-08-04 10:44:16 +00:00
|
|
|
}
|
|
|
|
%%
|
2005-09-08 14:08:32 +00:00
|
|
|
override gst_warning args
|
2005-08-04 10:44:16 +00:00
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_warning (PyObject *whatever, PyObject *string)
|
|
|
|
{
|
2005-09-12 17:06:09 +00:00
|
|
|
return pygst_debug_log (whatever, string, GST_LEVEL_WARNING, FALSE);
|
2005-08-04 10:44:16 +00:00
|
|
|
}
|
|
|
|
%%
|
2005-09-08 14:08:32 +00:00
|
|
|
override gst_error args
|
2005-08-04 10:44:16 +00:00
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_error (PyObject *whatever, PyObject *string)
|
|
|
|
{
|
2005-09-12 17:06:09 +00:00
|
|
|
return pygst_debug_log (whatever, string, GST_LEVEL_ERROR, FALSE);
|
2005-08-04 10:44:16 +00:00
|
|
|
}
|
2005-09-08 14:08:32 +00:00
|
|
|
|
|
|
|
%%
|
|
|
|
override gst_object_log args
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_object_log (PyObject *whatever, PyObject *string)
|
|
|
|
{
|
2005-09-12 17:06:09 +00:00
|
|
|
return pygst_debug_log (whatever, string, GST_LEVEL_LOG, TRUE);
|
2005-09-08 14:08:32 +00:00
|
|
|
}
|
|
|
|
%%
|
|
|
|
override gst_object_debug args
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_object_debug (PyObject *whatever, PyObject *string)
|
|
|
|
{
|
2005-09-12 17:06:09 +00:00
|
|
|
return pygst_debug_log (whatever, string, GST_LEVEL_DEBUG, TRUE);
|
2005-09-08 14:08:32 +00:00
|
|
|
}
|
|
|
|
%%
|
|
|
|
override gst_object_info args
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_object_info (PyObject *whatever, PyObject *string)
|
|
|
|
{
|
2005-09-12 17:06:09 +00:00
|
|
|
return pygst_debug_log (whatever, string, GST_LEVEL_INFO, TRUE);
|
2005-09-08 14:08:32 +00:00
|
|
|
}
|
|
|
|
%%
|
|
|
|
override gst_object_warning args
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_object_warning (PyObject *whatever, PyObject *string)
|
|
|
|
{
|
2005-09-12 17:06:09 +00:00
|
|
|
return pygst_debug_log (whatever, string, GST_LEVEL_WARNING, TRUE);
|
2005-09-08 14:08:32 +00:00
|
|
|
}
|
|
|
|
%%
|
|
|
|
override gst_object_error args
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_object_error (PyObject *whatever, PyObject *string)
|
|
|
|
{
|
2005-09-12 17:06:09 +00:00
|
|
|
return pygst_debug_log (whatever, string, GST_LEVEL_ERROR, TRUE);
|
2005-09-08 14:08:32 +00:00
|
|
|
}
|
2005-11-08 17:22:54 +00:00
|
|
|
%%
|
|
|
|
override GST_TIME_ARGS kwargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_GST_TIME_ARGS(PyObject *self, PyObject *args, PyObject *kwargs)
|
|
|
|
{
|
|
|
|
static char *kwlist[] = { "time", NULL };
|
|
|
|
PyObject *py_time = NULL;
|
|
|
|
PyObject *string;
|
|
|
|
gchar *ret;
|
|
|
|
guint64 time;
|
|
|
|
|
2005-11-21 18:58:50 +00:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:time_to_string", kwlist, &py_time))
|
2005-11-08 17:22:54 +00:00
|
|
|
return NULL;
|
2005-11-21 18:58:50 +00:00
|
|
|
time = PyInt_AsUnsignedLongLongMask(py_time);
|
2006-02-02 16:30:01 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (time))
|
|
|
|
ret = g_strdup_printf("%"GST_TIME_FORMAT, GST_TIME_ARGS(time));
|
|
|
|
else
|
|
|
|
ret = g_strdup ("CLOCK_TIME_NONE");
|
2005-11-08 17:22:54 +00:00
|
|
|
|
|
|
|
if (!ret) {
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(string = PyString_FromString(ret))) {
|
|
|
|
g_free(ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
g_free(ret);
|
|
|
|
return string;
|
|
|
|
}
|
2005-12-18 17:20:12 +00:00
|
|
|
%%
|
|
|
|
override gst_type_find_factory_get_list noargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_type_find_factory_get_list (PyObject *self)
|
|
|
|
{
|
|
|
|
GList *l, *list;
|
|
|
|
PyObject *py_list;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
list = gst_type_find_factory_get_list ();
|
|
|
|
|
|
|
|
py_list = PyList_New(g_list_length(list));
|
|
|
|
for (l = list; l ; l = g_list_next(l), i++) {
|
|
|
|
GstTypeFindFactory *fact = (GstTypeFindFactory*) l->data;
|
|
|
|
|
|
|
|
PyList_SetItem(py_list, i,
|
|
|
|
pygstobject_new (G_OBJECT (fact)));
|
|
|
|
}
|
|
|
|
g_list_free (list);
|
|
|
|
|
|
|
|
return py_list;
|
|
|
|
}
|
|
|
|
%%
|
|
|
|
override gst_version noargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_version (PyObject *self)
|
|
|
|
{
|
|
|
|
guint major, minor, micro, nano;
|
|
|
|
PyObject *py_tuple;
|
|
|
|
|
|
|
|
gst_version (&major, &minor, µ, &nano);
|
|
|
|
py_tuple = PyTuple_New(4);
|
|
|
|
PyTuple_SetItem(py_tuple, 0, PyInt_FromLong(major));
|
|
|
|
PyTuple_SetItem(py_tuple, 1, PyInt_FromLong(minor));
|
|
|
|
PyTuple_SetItem(py_tuple, 2, PyInt_FromLong(micro));
|
|
|
|
PyTuple_SetItem(py_tuple, 3, PyInt_FromLong(nano));
|
|
|
|
|
|
|
|
return py_tuple;
|
|
|
|
}
|
2005-12-18 18:15:57 +00:00
|
|
|
%%
|
|
|
|
override gst_clock_get_calibration noargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_gst_clock_get_calibration (PyGObject * self)
|
|
|
|
{
|
|
|
|
PyObject *ret;
|
|
|
|
GstClockTime internal;
|
|
|
|
GstClockTime external;
|
|
|
|
GstClockTime rate_num;
|
|
|
|
GstClockTime rate_denom;
|
|
|
|
|
|
|
|
gst_clock_get_calibration (GST_CLOCK (self->obj),
|
|
|
|
&internal,
|
|
|
|
&external,
|
|
|
|
&rate_num,
|
|
|
|
&rate_denom);
|
|
|
|
|
|
|
|
ret = PyTuple_New(4);
|
|
|
|
PyTuple_SetItem(ret, 0, PyLong_FromUnsignedLongLong(internal));
|
|
|
|
PyTuple_SetItem(ret, 1, PyLong_FromUnsignedLongLong(external));
|
|
|
|
PyTuple_SetItem(ret, 2, PyLong_FromUnsignedLongLong(rate_num));
|
|
|
|
PyTuple_SetItem(ret, 3, PyLong_FromUnsignedLongLong(rate_denom));
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|