ges: Output otio formatter loading issues in debug logs

Instead of spamming the terminal with a python traceback

Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/issues/107

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/173>
This commit is contained in:
Thibault Saunier 2020-05-04 10:35:25 -04:00 committed by GStreamer Merge Bot
parent 5c05b4942e
commit 154816365f
2 changed files with 42 additions and 28 deletions

View file

@ -617,7 +617,26 @@ load_python_formatters (void)
Py_XDECREF (code);
Py_XDECREF (res);
if (PyErr_Occurred ()) {
PyErr_Print ();
PyObject *exception_backtrace;
PyObject *exception_type;
PyObject *exception_value, *exception_value_repr, *exception_value_str;
PyErr_Fetch (&exception_type, &exception_value, &exception_backtrace);
PyErr_NormalizeException (&exception_type, &exception_value,
&exception_backtrace);
exception_value_repr = PyObject_Repr (exception_value);
exception_value_str =
PyUnicode_AsEncodedString (exception_value_repr, "utf-8", "Error ~");
GST_INFO ("Could not load OpenTimelineIO formatter: %s",
PyBytes_AS_STRING (exception_value_str));
Py_XDECREF (exception_type);
Py_XDECREF (exception_value);
Py_XDECREF (exception_backtrace);
Py_XDECREF (exception_value_repr);
Py_XDECREF (exception_value_str);
PyErr_Clear ();
}

View file

@ -21,12 +21,8 @@ from gi.repository import GES
from gi.repository import GLib
from collections import OrderedDict
try:
import opentimelineio as otio
otio.adapters.from_name('xges')
except Exception as e:
Gst.info("Could not load OpenTimelineIO: %s" % e)
otio = None
class GESOtioFormatter(GES.Formatter):
def do_save_to_uri(self, timeline, uri, overwrite):
@ -81,7 +77,6 @@ class GESOtioFormatter(GES.Formatter):
timeline.get_asset().add_formatter(formatter)
return formatter.load_from_uri(timeline, "file://" + tmpxges.name)
if otio is not None:
GObject.type_register(GESOtioFormatter)
known_extensions_mimetype_map = [
("otio", "xml", "fcpxml"),