summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2009-12-27 21:32:58 (GMT)
committerStefan Kost <ensonic@users.sf.net>2009-12-27 21:32:58 (GMT)
commitbe0d7470cf3d59d4e46faa1bdeb9b0c2906e291e (patch)
treed23385172e8166662c88e675de9e0fafbbec5fb8
parentebc1d598365daa839d8f86c901a547f267a96ee1 (diff)
qtmux: move errors _new_pad to the end
-rw-r--r--gst/qtmux/gstqtmux.c34
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