mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 05:56:31 +00:00
examples/vumeter.py: update for property name change
Original commit message from CVS: * examples/vumeter.py: update for property name change * gst/gst.override: * testsuite/test_element.py: actually log on objects, yay
This commit is contained in:
parent
58dbe77515
commit
a74cc80a77
4 changed files with 36 additions and 14 deletions
|
@ -1,3 +1,11 @@
|
|||
2005-09-12 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* examples/vumeter.py:
|
||||
update for property name change
|
||||
* gst/gst.override:
|
||||
* testsuite/test_element.py:
|
||||
actually log on objects, yay
|
||||
|
||||
2005-09-12 Andy Wingo <wingo@pobox.com>
|
||||
|
||||
* testsuite/test_element.py (ElementName.testElementStateGetName):
|
||||
|
|
|
@ -83,7 +83,7 @@ class Window(gtk.Dialog):
|
|||
def run(self):
|
||||
try:
|
||||
self.set_sensitive(False)
|
||||
s = 'alsasrc ! level signal=true ! fakesink'
|
||||
s = 'alsasrc ! level message=true ! fakesink'
|
||||
pipeline = gst.parse_launch(s)
|
||||
self.set_sensitive(True)
|
||||
watch_id = pipeline.get_bus().add_watch(self.on_message)
|
||||
|
|
|
@ -220,13 +220,15 @@ _pygst_element_init (gpointer gclass, PyTypeObject *pyclass)
|
|||
#endif
|
||||
|
||||
static PyObject *
|
||||
pygst_debug_log (PyObject *whatever, PyObject *string, GstDebugLevel level)
|
||||
pygst_debug_log (PyObject *pyobject, PyObject *string, GstDebugLevel level,
|
||||
gboolean isgstobject)
|
||||
{
|
||||
gchar *str;
|
||||
gchar *function;
|
||||
gchar *filename;
|
||||
int lineno;
|
||||
PyFrameObject *frame;
|
||||
GObject *object = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(string, "s:gst.debug_log", &str)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Need a string!");
|
||||
|
@ -238,7 +240,9 @@ pygst_debug_log (PyObject *whatever, PyObject *string, GstDebugLevel level)
|
|||
filename = g_path_get_basename(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, "%s", str);
|
||||
if (isgstobject)
|
||||
object = G_OBJECT (pygobject_get (pyobject));
|
||||
gst_debug_log (GST_CAT_DEFAULT, level, filename, function, lineno, object, "%s", str);
|
||||
if (filename)
|
||||
g_free(filename);
|
||||
Py_INCREF (Py_None);
|
||||
|
@ -968,35 +972,35 @@ override gst_log args
|
|||
static PyObject *
|
||||
_wrap_gst_log (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_LOG);
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_LOG, FALSE);
|
||||
}
|
||||
%%
|
||||
override gst_debug args
|
||||
static PyObject *
|
||||
_wrap_gst_debug (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_DEBUG);
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_DEBUG, FALSE);
|
||||
}
|
||||
%%
|
||||
override gst_info args
|
||||
static PyObject *
|
||||
_wrap_gst_info (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_INFO);
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_INFO, FALSE);
|
||||
}
|
||||
%%
|
||||
override gst_warning args
|
||||
static PyObject *
|
||||
_wrap_gst_warning (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_WARNING);
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_WARNING, FALSE);
|
||||
}
|
||||
%%
|
||||
override gst_error args
|
||||
static PyObject *
|
||||
_wrap_gst_error (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_ERROR);
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_ERROR, FALSE);
|
||||
}
|
||||
|
||||
%%
|
||||
|
@ -1004,33 +1008,33 @@ override gst_object_log args
|
|||
static PyObject *
|
||||
_wrap_gst_object_log (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_LOG);
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_LOG, TRUE);
|
||||
}
|
||||
%%
|
||||
override gst_object_debug args
|
||||
static PyObject *
|
||||
_wrap_gst_object_debug (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_DEBUG);
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_DEBUG, TRUE);
|
||||
}
|
||||
%%
|
||||
override gst_object_info args
|
||||
static PyObject *
|
||||
_wrap_gst_object_info (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_INFO);
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_INFO, TRUE);
|
||||
}
|
||||
%%
|
||||
override gst_object_warning args
|
||||
static PyObject *
|
||||
_wrap_gst_object_warning (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_WARNING);
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_WARNING, TRUE);
|
||||
}
|
||||
%%
|
||||
override gst_object_error args
|
||||
static PyObject *
|
||||
_wrap_gst_object_error (PyObject *whatever, PyObject *string)
|
||||
{
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_ERROR);
|
||||
return pygst_debug_log (whatever, string, GST_LEVEL_ERROR, TRUE);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
|
||||
from common import gst, unittest
|
||||
|
||||
# since I can't subclass gst.Element for some reason, I use a bin here
|
||||
# it don't matter to Jesus
|
||||
class TestElement(gst.Bin):
|
||||
def break_it_down(self):
|
||||
self.debug('Hammer Time')
|
||||
|
||||
class ElementTest(unittest.TestCase):
|
||||
name = 'fakesink'
|
||||
alias = 'sink'
|
||||
|
@ -184,7 +190,11 @@ class DebugTest(unittest.TestCase):
|
|||
e.debug('I am a debug string')
|
||||
e.log('I am a log string')
|
||||
e.debug('I am a formatted %s %s' % ('log', 'string'))
|
||||
|
||||
|
||||
def testElementDebug(self):
|
||||
e = TestElement("testelement")
|
||||
e.set_property("name", "testelement")
|
||||
e.break_it_down()
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in a new issue