resindvdsrc: improve error messages on read erros

Provide i18n-ed error messages when a read error happens,
and point out that the error could be happening because the
DVD is scrambled.

https://bugzilla.gnome.org/show_bug.cgi?id=613633
This commit is contained in:
Tim-Philipp Müller 2010-09-26 20:41:25 +01:00
parent 0bef0f92c8
commit 887fc8e6e7

View file

@ -857,6 +857,25 @@ update_title_info (resinDvdSrc * src)
} }
} }
/* we don't cache the result on purpose */
static gboolean
rsn_descrambler_available (void)
{
GModule *module;
gpointer sym;
gsize res;
module = g_module_open ("libdvdcss", 0);
if (module != NULL) {
res = g_module_symbol (module, "dvdcss_open", &sym);
g_module_close (module);
} else {
res = FALSE;
}
return res;
}
static GstFlowReturn static GstFlowReturn
rsn_dvdsrc_step (resinDvdSrc * src, gboolean have_dvd_lock) rsn_dvdsrc_step (resinDvdSrc * src, gboolean have_dvd_lock)
{ {
@ -1092,19 +1111,35 @@ rsn_dvdsrc_step (resinDvdSrc * src, gboolean have_dvd_lock)
} }
return ret; return ret;
/* ERRORS */
read_error: read_error:
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), {
("Failed to read next DVD block. Error: %s", if (!rsn_descrambler_available ()) {
dvdnav_err_to_string (src->dvdnav))); GST_ELEMENT_ERROR (src, RESOURCE, READ,
return GST_FLOW_ERROR; (_("Could not read DVD. This may be because the DVD is encrypted "
"and a DVD decryption library is not installed.")),
("Failed to read next DVD block. Error: %s",
dvdnav_err_to_string (src->dvdnav)));
} else {
GST_ELEMENT_ERROR (src, RESOURCE, READ, (_("Could not read DVD.")),
("Failed to read next DVD block. Error: %s",
dvdnav_err_to_string (src->dvdnav)));
}
return GST_FLOW_ERROR;
}
internal_error: internal_error:
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), {
("Internal error processing DVD commands. Error: %s", GST_ELEMENT_ERROR (src, RESOURCE, READ, (_("Could not read DVD.")),
dvdnav_err_to_string (src->dvdnav))); ("Internal error processing DVD commands. Error: %s",
return GST_FLOW_ERROR; dvdnav_err_to_string (src->dvdnav)));
return GST_FLOW_ERROR;
}
branching: branching:
g_mutex_unlock (src->branch_lock); {
return GST_FLOW_WRONG_STATE; g_mutex_unlock (src->branch_lock);
return GST_FLOW_WRONG_STATE;
}
} }
/* Send app a bus message that the available commands have changed */ /* Send app a bus message that the available commands have changed */
@ -2334,7 +2369,7 @@ rsn_dvdsrc_src_event (GstBaseSrc * basesrc, GstEvent * event)
GST_LOG_OBJECT (src, "handling seek event"); GST_LOG_OBJECT (src, "handling seek event");
gst_event_parse_seek (event, NULL, NULL, &flags, NULL, NULL, NULL, NULL); gst_event_parse_seek (event, NULL, NULL, &flags, NULL, NULL, NULL, NULL);
src->flushing_seek = !!(flags & GST_SEEK_FLAG_FLUSH); src->flushing_seek = ! !(flags & GST_SEEK_FLAG_FLUSH);
GST_DEBUG_OBJECT (src, "%s seek event", GST_DEBUG_OBJECT (src, "%s seek event",
src->flushing_seek ? "flushing" : "non-flushing"); src->flushing_seek ? "flushing" : "non-flushing");