validate: descriptor-writer: Print proper error message when discover fails

When discovering the files, there will be different kind of errors. If we print
the exact message, then it will be more helpful for user. Especially in the case
of missing plugins, displaying which plugin is missing as error message

https://bugzilla.gnome.org/show_bug.cgi?id=752758
This commit is contained in:
Vineeth TM 2015-07-23 15:08:55 +09:00 committed by Nicolas Dufresne
parent 185b3b2d7e
commit 97e630efba

View file

@ -525,13 +525,40 @@ gst_media_descriptor_writer_new_discover (GstValidateRunner * runner,
}
info = gst_discoverer_discover_uri (discoverer, uri, err);
if (info == NULL
|| gst_discoverer_info_get_result (info) != GST_DISCOVERER_OK) {
GST_ERROR ("Could not discover URI: %s (error: %s(", uri,
err && *err ? (*err)->message : "Unkown");
if (info == NULL && err && *err) {
GST_ERROR ("Could not discover URI: %s (error: %s)", uri, (*err)->message);
goto out;
} else {
GstDiscovererResult result = gst_discoverer_info_get_result (info);
switch (result) {
case GST_DISCOVERER_OK:
break;
case GST_DISCOVERER_URI_INVALID:
GST_ERROR ("URI is not valid");
goto out;
case GST_DISCOVERER_TIMEOUT:
GST_ERROR ("Analyzing URI timed out\n");
goto out;
case GST_DISCOVERER_BUSY:
GST_ERROR ("Discoverer was busy\n");
goto out;
case GST_DISCOVERER_MISSING_PLUGINS:
{
gint i = 0;
const gchar **installer_details =
gst_discoverer_info_get_missing_elements_installer_details (info);
GST_ERROR ("Missing plugins");
while (installer_details[i]) {
GST_ERROR ("(%s)", installer_details[i]);
i++;
}
goto out;
}
default:
break;
}
}
writer =