mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
gst/: We now have debugging in gst-python ;) gst.[log|debug|info|warning|error]()
Original commit message from CVS: * gst/gst.defs: * gst/gst.override: * gst/gstmodule.c: We now have debugging in gst-python ;) gst.[log|debug|info|warning|error]()
This commit is contained in:
parent
0f04024f5c
commit
139163d89e
4 changed files with 114 additions and 0 deletions
|
@ -1,3 +1,11 @@
|
|||
2005-08-04 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* gst/gst.defs:
|
||||
* gst/gst.override:
|
||||
* gst/gstmodule.c:
|
||||
We now have debugging in gst-python ;)
|
||||
gst.[log|debug|info|warning|error]()
|
||||
|
||||
2005-08-03 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* configure.ac:
|
||||
|
|
41
gst/gst.defs
41
gst/gst.defs
|
@ -2273,7 +2273,48 @@
|
|||
)
|
||||
)
|
||||
|
||||
;; DEBUGGING FUNCTIONS FROM PYTHON
|
||||
;; The c functions don't actually exist
|
||||
|
||||
(define-function log
|
||||
(c-name "gst_log")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("gchar *" "msg")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function debug
|
||||
(c-name "gst_debug")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("gchar *" "msg")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function info
|
||||
(c-name "gst_info")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("gchar *" "msg")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function warning
|
||||
(c-name "gst_warning")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("gchar *" "msg")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function error
|
||||
(c-name "gst_error")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("gchar *" "msg")
|
||||
)
|
||||
)
|
||||
|
||||
;; From ../gstreamer/gst/gstinterface.h
|
||||
|
||||
|
|
|
@ -53,6 +53,9 @@ headers
|
|||
|
||||
PyObject *PyGstExc_LinkError = NULL;
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_python);
|
||||
#define GST_CAT_DEFAULT gst_python
|
||||
|
||||
GSList *mainloops = NULL;
|
||||
void
|
||||
_pygst_main_quit(void)
|
||||
|
@ -217,6 +220,30 @@ _pygst_element_init (gpointer gclass, PyTypeObject *pyclass)
|
|||
}
|
||||
#endif
|
||||
|
||||
static PyObject *
|
||||
pygst_debug_log (PyObject *whatever, PyObject *string, GstDebugLevel level)
|
||||
{
|
||||
gchar *str;
|
||||
gchar *function;
|
||||
gchar *filename;
|
||||
gchar lineno;
|
||||
PyFrameObject *frame;
|
||||
|
||||
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);
|
||||
filename = PyString_AsString(frame->f_code->co_filename);
|
||||
lineno = frame->f_code->co_firstlineno;
|
||||
/* gst_debug_log : category, level, file, function, line, object, format, va_list */
|
||||
gst_debug_log (GST_CAT_DEFAULT, level, filename, function, lineno, NULL, str);
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
%%
|
||||
include
|
||||
gstbin.override
|
||||
|
@ -959,3 +986,38 @@ _wrap_gst_flow_get_name(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
%%
|
||||
override gst_log args
|
||||
static PyObject *
|
||||
_wrap_gst_log (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_LOG);
|
||||
}
|
||||
%%
|
||||
override gst_debug args
|
||||
static PyObject *
|
||||
_wrap_gst_debug (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_DEBUG);
|
||||
}
|
||||
%%
|
||||
override gst_info args
|
||||
static PyObject *
|
||||
_wrap_gst_info (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_INFO);
|
||||
}
|
||||
%%
|
||||
override gst_warning
|
||||
static PyObject *
|
||||
_wrap_gst_warning (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_WARNING);
|
||||
}
|
||||
%%
|
||||
override gst_error
|
||||
static PyObject *
|
||||
_wrap_gst_error (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_ERROR);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ extern GSList *mainloops;
|
|||
extern void _pygst_main_quit(void);
|
||||
extern PyObject *PyGstExc_LinkError;
|
||||
|
||||
GST_DEBUG_CATEGORY (gst_python);
|
||||
|
||||
/* This is a timeout that gets added to the mainloop to handle SIGINT (Ctrl-C)
|
||||
* Other signals get handled at some other point where transition from
|
||||
|
@ -168,6 +169,8 @@ init_gst (void)
|
|||
pygst_register_classes (d);
|
||||
pygst_add_constants (m, "GST_");
|
||||
|
||||
/* Initialize debugging category */
|
||||
GST_DEBUG_CATEGORY_INIT (gst_python, "gst-python", 0, "GStreamer python bindings");
|
||||
|
||||
g_timeout_add_full (0, 100, python_do_pending_calls, NULL, NULL);
|
||||
|
||||
|
|
Loading…
Reference in a new issue