uridecodebin: use same message string for missing elements as in playbin

Use the same translated message string for missing core elements as
playbin uses, which is a bit nicer and also indicates that there is
something wrong with the user's GStreamer installation (which arguably
is the case if elements like typefind or queue2 are missing).
This commit is contained in:
Tim-Philipp Müller 2010-02-16 10:09:54 +00:00
parent 0230f7ed9e
commit 3be20d7a5e

View file

@ -1037,6 +1037,19 @@ done:
return res; return res;
} }
static void
post_missing_plugin_error (GstElement * dec, const gchar * element_name)
{
GstMessage *msg;
msg = gst_missing_element_message_new (dec, element_name);
gst_element_post_message (dec, msg);
GST_ELEMENT_ERROR (dec, CORE, MISSING_PLUGIN,
(_("Missing element '%s' - check your GStreamer installation."),
element_name), (NULL));
}
/** /**
* analyse_source: * analyse_source:
* @decoder: a #GstURIDecodeBin * @decoder: a #GstURIDecodeBin
@ -1163,14 +1176,7 @@ analyse_source (GstURIDecodeBin * decoder, gboolean * is_raw,
return res; return res;
no_queue2: no_queue2:
{ {
GstMessage *msg; post_missing_plugin_error (GST_ELEMENT_CAST (decoder), "queue2");
msg =
gst_missing_element_message_new (GST_ELEMENT_CAST (decoder), "queue2");
gst_element_post_message (GST_ELEMENT_CAST (decoder), msg);
GST_ELEMENT_ERROR (decoder, CORE, MISSING_PLUGIN,
(_("Could not create \"queue2\" element.")), (NULL));
gst_object_unref (pad); gst_object_unref (pad);
gst_iterator_free (pads_iter); gst_iterator_free (pads_iter);
@ -1392,15 +1398,7 @@ make_decoder (GstURIDecodeBin * decoder)
/* ERRORS */ /* ERRORS */
no_decodebin: no_decodebin:
{ {
GstMessage *msg; post_missing_plugin_error (GST_ELEMENT_CAST (decoder), "decodebin2");
msg =
gst_missing_element_message_new (GST_ELEMENT_CAST (decoder),
"decodebin2");
gst_element_post_message (GST_ELEMENT_CAST (decoder), msg);
GST_ELEMENT_ERROR (decoder, CORE, MISSING_PLUGIN,
(_("Could not create \"decodebin2\" element.")), (NULL));
return NULL; return NULL;
} }
} }
@ -1503,14 +1501,7 @@ could_not_link:
} }
no_queue2: no_queue2:
{ {
GstMessage *msg; post_missing_plugin_error (GST_ELEMENT_CAST (decoder), "queue2");
msg =
gst_missing_element_message_new (GST_ELEMENT_CAST (decoder), "queue2");
gst_element_post_message (GST_ELEMENT_CAST (decoder), msg);
GST_ELEMENT_ERROR (decoder, CORE, MISSING_PLUGIN,
(_("Could not create \"queue2\" element.")), (NULL));
return; return;
} }
} }
@ -1548,15 +1539,7 @@ setup_streaming (GstURIDecodeBin * decoder)
/* ERRORS */ /* ERRORS */
no_typefind: no_typefind:
{ {
GstMessage *msg; post_missing_plugin_error (GST_ELEMENT_CAST (decoder), "typefind");
msg =
gst_missing_element_message_new (GST_ELEMENT_CAST (decoder),
"typefind");
gst_element_post_message (GST_ELEMENT_CAST (decoder), msg);
GST_ELEMENT_ERROR (decoder, CORE, MISSING_PLUGIN,
(_("Could not create \"typefind\" element.")), (NULL));
return FALSE; return FALSE;
} }
could_not_link: could_not_link: