[Xfce4-commits] [apps/xfburn] 02/06: BD burn speed support

noreply at xfce.org noreply at xfce.org
Tue Mar 18 19:24:06 CET 2014


This is an automated email from the git hooks/post-receive script.

squisher pushed a commit to branch master
in repository apps/xfburn.

commit 0902df21be4689f6f37883e1a7932b0b9f70e11b
Author: David Mohr <david at mcbf.net>
Date:   Tue Mar 18 11:26:04 2014 -0600

    BD burn speed support
---
 xfburn/xfburn-device-box.c   |   15 +++++++++------
 xfburn/xfburn-device-list.h  |    1 +
 xfburn/xfburn-global.h       |    1 +
 xfburn/xfburn-perform-burn.c |    7 +------
 xfburn/xfburn-utils.c        |   17 +++++++++++++++++
 xfburn/xfburn-utils.h        |    1 +
 6 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/xfburn/xfburn-device-box.c b/xfburn/xfburn-device-box.c
index e4fe6e3..0e31d17 100644
--- a/xfburn/xfburn-device-box.c
+++ b/xfburn/xfburn-device-box.c
@@ -456,12 +456,7 @@ fill_combo_speed (XfburnDeviceBox *box, XfburnDevice *device)
 
   /* check profile, so we can convert from 'kb/s' into 'x' rating */
   if (profile_no != 0) {
-    /* this will fail if newer disk types get supported */
-    if (profile_no <= 0x0a)
-      factor = CDR_1X_SPEED;
-    else
-      /* assume DVD for now */
-      factor = DVD_1X_SPEED;
+    factor = xfburn_media_profile_to_kb (profile_no);
   } else {
     factor = 1;
   }
@@ -580,7 +575,15 @@ check_disc_validity (XfburnDeviceBoxPrivate *priv)
         if (!priv->accept_only_cd)
           g_object_get (G_OBJECT (device), "dvdr", &priv->valid_disc, NULL);
         break;
+      case XFBURN_PROFILE_BD_R:
+      case XFBURN_PROFILE_BD_RE:
+        if (!priv->accept_only_cd)
+          g_object_get (G_OBJECT (device), "dvdr", &priv->valid_disc, NULL);
+        break;
       default:
+
+        /* >>> should recognize 0x08 = CD-ROM, 0x10 = DVD-ROM, 0x40 BD-ROM */
+
         g_warning ("Unknown disc profile 0x%x!", profile_no);
         priv->valid_disc = TRUE;
         break;
diff --git a/xfburn/xfburn-device-list.h b/xfburn/xfburn-device-list.h
index 9ce22bf..a747f9f 100644
--- a/xfburn/xfburn-device-list.h
+++ b/xfburn/xfburn-device-list.h
@@ -83,6 +83,7 @@ enum XfburnDiscProfiles {
   XFBURN_PROFILE_DVD_PLUS_RW = 0x1a,
   XFBURN_PROFILE_DVD_PLUS_R = 0x1b,
   XFBURN_PROFILE_DVD_PLUS_R_DL = 0x2b,
+  XFBURN_PROFILE_BD_R = 0x41,
   XFBURN_PROFILE_BD_RE = 0x43,
 };
 
diff --git a/xfburn/xfburn-global.h b/xfburn/xfburn-global.h
index da8b47a..0b33097 100644
--- a/xfburn/xfburn-global.h
+++ b/xfburn/xfburn-global.h
@@ -38,6 +38,7 @@
 /* in reality CDR_1X_SPEED is 176.4 (see libburn.h:1577), but that shouldn't matter */
 #define CDR_1X_SPEED 176
 #define DVD_1X_SPEED 1385
+#define BD_1X_SPEED  4496
 
 #define DATA_COMPOSITION_DEFAULT_NAME N_("Data composition")
 
diff --git a/xfburn/xfburn-perform-burn.c b/xfburn/xfburn-perform-burn.c
index c79b13a..e1a84ae 100644
--- a/xfburn/xfburn-perform-burn.c
+++ b/xfburn/xfburn-perform-burn.c
@@ -140,12 +140,7 @@ xfburn_perform_burn_write (GtkWidget *dialog_progress,
  
   /* retrieve media type, so we can convert from 'kb/s' into 'x' rating */
   if (burn_disc_get_profile(drive, &media_no, media_name) == 1) {
-    /* this will fail if newer disk types get supported */
-    if (media_no <= 0x0a)
-      factor = CDR_1X_SPEED;
-    else
-      /* assume DVD for now */
-      factor = DVD_1X_SPEED;
+    factor = xfburn_media_profile_to_kb (media_no);
   } else {
     g_warning ("no profile could be retrieved to calculate current burn speed");
     factor = 1;
diff --git a/xfburn/xfburn-utils.c b/xfburn/xfburn-utils.c
index 17689f2..36aa709 100644
--- a/xfburn/xfburn-utils.c
+++ b/xfburn/xfburn-utils.c
@@ -211,6 +211,23 @@ xfburn_console_libburn_messages (void)
  
 }
 
+int
+xfburn_media_profile_to_kb (int media_no)
+{
+  int factor = 1;
+  if (media_no <= XFBURN_PROFILE_CDR)
+    factor = CDR_1X_SPEED;
+  else if (media_no >= XFBURN_PROFILE_DVD_MINUS_R && media_no <= XFBURN_PROFILE_DVD_PLUS_R_DL)
+    factor = DVD_1X_SPEED;
+  else if (media_no >= XFBURN_PROFILE_BD_R && media_no <= XFBURN_PROFILE_BD_RE)
+    factor = BD_1X_SPEED;
+  else {
+    g_warning ("unknown profile, assuming BD");
+    factor = BD_1X_SPEED;
+  }
+  return factor;
+}
+
 
 GSList *
 xfburn_make_abosulet_file_list (gint count, gchar *filenames[])
diff --git a/xfburn/xfburn-utils.h b/xfburn/xfburn-utils.h
index dde32db..32069fb 100644
--- a/xfburn/xfburn-utils.h
+++ b/xfburn/xfburn-utils.h
@@ -45,5 +45,6 @@ gboolean xfburn_ask_yes_no (GtkMessageType type, const gchar *primary_text, cons
 
 void xfburn_capture_libburn_messages (void);
 void xfburn_console_libburn_messages (void);
+int xfburn_media_profile_to_kb (int media_no);
 
 #endif

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list