[totem/wip/hadess/error-messages: 3/3] backend: Add error message when libdvdcss is missing



commit c6ca450dd6332bd71d33c518d576edd655281691
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Feb 21 13:55:59 2019 +0100

    backend: Add error message when libdvdcss is missing
    
    If we get a read error from a DVD, check whether libdvdcss is available,
    and if not, make the error point to installing it as a possible solution.
    
    Closes: #24

 src/backend/bacon-video-widget.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 480e07b13..d185bd9b3 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -3858,7 +3858,6 @@ bvw_error_from_gst_error (BaconVideoWidget *bvw, GstMessage * err_msg)
 
   /* FIXME:
    * Unemitted errors:
-   * BVW_ERROR_DVD_ENCRYPTED
    * BVW_ERROR_BROKEN_FILE
    */
 
@@ -3876,6 +3875,23 @@ bvw_error_from_gst_error (BaconVideoWidget *bvw, GstMessage * err_msg)
     }
   }
 
+  /* Check for encrypted DVD */
+  if (is_error (e, RESOURCE, READ) &&
+      g_str_has_prefix (bvw->priv->mrl, "dvd:")) {
+    GModule *module;
+    gpointer sym;
+
+    module = g_module_open ("libdvdcss", 0);
+    if (module == NULL ||
+       g_module_symbol (module, "dvdcss_open", &sym)) {
+      g_clear_pointer (&module, g_module_close);
+      ret = g_error_new_literal (BVW_ERROR, BVW_ERROR_DVD_ENCRYPTED,
+                                _("The source seems encrypted and can't be read. Are you trying to play an 
encrypted DVD without libdvdcss?"));
+      goto done;
+    }
+    g_clear_pointer (&module, g_module_close);
+  }
+
   /* HTTP error codes */
   /* FIXME: bvw_get_http_error_code() calls gst_message_parse_error too */
   http_error_code = bvw_get_http_error_code (err_msg);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]