From da73b89200bdfbcae6fa75e9d2a41f9a9d2a6bbb Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 23 Aug 2016 13:27:20 -0300 Subject: [PATCH] element: Add API to more easily post messages about flowing issues In many parts of the code we raise streaming error when the flow goes wrong, and each time we create more or less similare error message. Also that message does not let the application know what has actually gone wrong. In the new API we add a "flow-return" detail field inside the GstMessage so that the application has all the information if it needs it. API: GST_ELEMENT_FLOW_ERROR https://bugzilla.gnome.org/show_bug.cgi?id=770158 --- docs/gst/gstreamer-sections.txt | 1 + gst/gstelement.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index cefddf4..9355155 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -815,6 +815,7 @@ GST_ELEMENT_PADS GST_ELEMENT_START_TIME GST_ELEMENT_ERROR GST_ELEMENT_ERROR_WITH_DETAILS +GST_ELEMENT_FLOW_ERROR GST_ELEMENT_WARNING GST_ELEMENT_WARNING_WITH_DETAILS GST_ELEMENT_INFO diff --git a/gst/gstelement.h b/gst/gstelement.h index 41af931..6dae510 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -403,6 +403,24 @@ GstStructure *gst_make_element_message_details (const char *name, ...); #define GST_ELEMENT_MESSAGE_MAKE_DETAILS(args) gst_make_element_message_details args /** + * GST_ELEMENT_FLOW_ERROR: + * @el: the element that generates the error + * @flow_return: the GstFlowReturn leading to that ERROR message + * + * Utility function that elements can use in case they encountered a fatal + * data processing error due to wrong flow processing. + * + * Since: 1.10 + */ +#define GST_ELEMENT_FLOW_ERROR(el,flow_return) \ +G_STMT_START { \ + GST_ELEMENT_ERROR_WITH_DETAILS (el, STREAM, FAILED, \ + ("Internal data stream error."), \ + ("streaming stopped, reason %s (%d)", gst_flow_get_name (flow_return), flow_return), \ + ("flow-return", G_TYPE_INT, flow_return, NULL));\ +} G_STMT_END + +/** * GST_ELEMENT_ERROR_WITH_DETAILS: * @el: the element that generates the error * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError) -- 2.7.4