summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2010-09-26 20:41:25 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2010-09-26 20:43:43 +0100
commit887fc8e6e7bdd46d3f262fddec533594b6e7cb9c (patch)
treee8d78f1638a82909efe7799074a05c512307584f
parent0bef0f92c816a824d8f5859e8a76519efdc14052 (diff)
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
-rw-r--r--ext/resindvd/resindvdsrc.c57
1 files changed, 46 insertions, 11 deletions
diff --git a/ext/resindvd/resindvdsrc.c b/ext/resindvd/resindvdsrc.c
index 590fde630..0eda62a02 100644
--- a/ext/resindvd/resindvdsrc.c
+++ b/ext/resindvd/resindvdsrc.c
@@ -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
rsn_dvdsrc_step (resinDvdSrc * src, gboolean have_dvd_lock)
{
@@ -1092,19 +1111,35 @@ rsn_dvdsrc_step (resinDvdSrc * src, gboolean have_dvd_lock)
}
return ret;
+
+/* ERRORS */
read_error:
- GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
- ("Failed to read next DVD block. Error: %s",
- dvdnav_err_to_string (src->dvdnav)));
- return GST_FLOW_ERROR;
+ {
+ if (!rsn_descrambler_available ()) {
+ GST_ELEMENT_ERROR (src, RESOURCE, READ,
+ (_("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:
- GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
- ("Internal error processing DVD commands. Error: %s",
- dvdnav_err_to_string (src->dvdnav)));
- return GST_FLOW_ERROR;
+ {
+ GST_ELEMENT_ERROR (src, RESOURCE, READ, (_("Could not read DVD.")),
+ ("Internal error processing DVD commands. Error: %s",
+ dvdnav_err_to_string (src->dvdnav)));
+ return GST_FLOW_ERROR;
+ }
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 */
@@ -2334,7 +2369,7 @@ rsn_dvdsrc_src_event (GstBaseSrc * basesrc, GstEvent * event)
GST_LOG_OBJECT (src, "handling seek event");
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",
src->flushing_seek ? "flushing" : "non-flushing");