From: <en...@ke...> - 2009-12-27 21:57:26
|
Module: gst-plugins-bad Branch: master Commit: be0d7470cf3d59d4e46faa1bdeb9b0c2906e291e URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=be0d7470cf3d59d4e46faa1bdeb9b0c2906e291e Author: Stefan Kost <en...@us...> Date: Sun Dec 27 23:32:58 2009 +0200 qtmux: move errors _new_pad to the end --- gst/qtmux/gstqtmux.c | 34 +++++++++++++++++++++++++--------- 1 files changed, 25 insertions(+), 9 deletions(-) diff --git a/gst/qtmux/gstqtmux.c b/gst/qtmux/gstqtmux.c index a602e63..6f78718 100644 --- a/gst/qtmux/gstqtmux.c +++ b/gst/qtmux/gstqtmux.c @@ -2282,21 +2282,20 @@ gst_qt_mux_request_new_pad (GstElement * element, GstPad *newpad; gboolean audio; - GST_DEBUG_OBJECT (qtmux, "Requested pad: %s", GST_STR_NULL (name)); + if (templ->direction != GST_PAD_SINK) + goto wrong_direction; - if (qtmux->state != GST_QT_MUX_STATE_NONE) { - GST_WARNING_OBJECT (qtmux, "Not providing request pad after stream start."); - return NULL; - } + if (qtmux->state != GST_QT_MUX_STATE_NONE) + goto too_late; + + GST_DEBUG_OBJECT (qtmux, "Requested pad: %s", GST_STR_NULL (name)); if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) { audio = TRUE; } else if (templ == gst_element_class_get_pad_template (klass, "video_%d")) { audio = FALSE; - } else { - GST_WARNING_OBJECT (qtmux, "This is not our template!"); - return NULL; - } + } else + goto wrong_template; /* add pad to collections */ newpad = gst_pad_new_from_template (templ, name); @@ -2328,6 +2327,23 @@ gst_qt_mux_request_new_pad (GstElement * element, gst_element_add_pad (element, newpad); return newpad; + + /* ERRORS */ +wrong_direction: + { + GST_WARNING_OBJECT (qtmux, "Request pad that is not a SINK pad."); + return NULL; + } +too_late: + { + GST_WARNING_OBJECT (qtmux, "Not providing request pad after stream start."); + return NULL; + } +wrong_template: + { + GST_WARNING_OBJECT (qtmux, "This is not our template!"); + return NULL; + } } static void |