qtmux: move errors _new_pad to the end

This commit is contained in:
Stefan Kost 2009-12-27 23:32:58 +02:00
parent ebc1d59836
commit be0d7470cf

View file

@ -2282,21 +2282,20 @@ gst_qt_mux_request_new_pad (GstElement * element,
GstPad *newpad; GstPad *newpad;
gboolean audio; 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) { if (qtmux->state != GST_QT_MUX_STATE_NONE)
GST_WARNING_OBJECT (qtmux, "Not providing request pad after stream start."); goto too_late;
return NULL;
} GST_DEBUG_OBJECT (qtmux, "Requested pad: %s", GST_STR_NULL (name));
if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) { if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) {
audio = TRUE; audio = TRUE;
} else if (templ == gst_element_class_get_pad_template (klass, "video_%d")) { } else if (templ == gst_element_class_get_pad_template (klass, "video_%d")) {
audio = FALSE; audio = FALSE;
} else { } else
GST_WARNING_OBJECT (qtmux, "This is not our template!"); goto wrong_template;
return NULL;
}
/* add pad to collections */ /* add pad to collections */
newpad = gst_pad_new_from_template (templ, name); 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); gst_element_add_pad (element, newpad);
return 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 static void