[brasero] Fix a problem with checksum always wrong after burning a sequential DVD
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Fix a problem with checksum always wrong after burning a sequential DVD
- Date: Mon, 24 Aug 2009 13:46:31 +0000 (UTC)
commit 83bdae06da9431e9655e2f1478a2e7954b562a4a
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Fri Aug 21 15:02:15 2009 +0200
Fix a problem with checksum always wrong after burning a sequential DVD
DVD are always aligned along a 16 sector boundary which means that the size of the track returned is different from the size of the actual data
libbrasero-burn/brasero-burn.c | 99 ++++++++++++++------------------
plugins/checksum/burn-checksum-image.c | 33 ++++++++++-
2 files changed, 74 insertions(+), 58 deletions(-)
---
diff --git a/libbrasero-burn/brasero-burn.c b/libbrasero-burn/brasero-burn.c
index 8a66d68..d6079d8 100644
--- a/libbrasero-burn/brasero-burn.c
+++ b/libbrasero-burn/brasero-burn.c
@@ -1754,6 +1754,9 @@ brasero_burn_run_tasks (BraseroBurn *burn,
/* run all imaging tasks first */
for (iter = tasks; iter; iter = next) {
+ goffset len = 0;
+ BraseroDrive *drive;
+ BraseroMedium *medium;
BraseroTaskAction action;
next = iter->next;
@@ -1813,29 +1816,23 @@ brasero_burn_run_tasks (BraseroBurn *burn,
break;
/* try to get the output size */
- if (BRASERO_MEDIUM_RANDOM_WRITABLE (brasero_burn_session_get_dest_media (priv->session))) {
- goffset len = 0;
- BraseroDrive *drive;
- BraseroMedium *medium;
+ brasero_task_ctx_get_session_output_size (BRASERO_TASK_CTX (priv->task),
+ &len,
+ NULL);
- brasero_task_ctx_get_session_output_size (BRASERO_TASK_CTX (priv->task),
- &len,
- NULL);
+ drive = brasero_burn_session_get_burner (priv->session);
+ medium = brasero_drive_get_medium (drive);
- drive = brasero_burn_session_get_burner (priv->session);
- medium = brasero_drive_get_medium (drive);
-
- if (brasero_burn_session_get_flags (priv->session) & (BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND))
- priv->session_start = brasero_medium_get_next_writable_address (medium);
- else
- priv->session_start = 0;
+ if (brasero_burn_session_get_flags (priv->session) & (BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND))
+ priv->session_start = brasero_medium_get_next_writable_address (medium);
+ else
+ priv->session_start = 0;
- priv->session_end = priv->session_start + len;
+ priv->session_end = priv->session_start + len;
- BRASERO_BURN_LOG ("Burning from %lld to %lld",
- priv->session_start,
- priv->session_end);
- }
+ BRASERO_BURN_LOG ("Burning from %lld to %lld",
+ priv->session_start,
+ priv->session_end);
/* see if we reached a recording task: it's the last task */
if (!next) {
@@ -2243,45 +2240,37 @@ brasero_burn_record_session (BraseroBurn *burn,
medium = brasero_drive_get_medium (priv->dest);
+ /* Why do we do this?
+ * Because for a lot of medium types the size
+ * of the track return is not the real size of the
+ * data that was written; examples
+ * - CD that was written in SAO mode
+ * - a DVD-R which usually aligns its track size
+ * to a 16 block boundary
+ */
if (type == BRASERO_CHECKSUM_MD5
|| type == BRASERO_CHECKSUM_SHA1
|| type == BRASERO_CHECKSUM_SHA256) {
- BraseroMedia media;
-
- /* get the last written track address in case of DVD+RW/DVD-RW
- * restricted overwrite since there is no such thing as track
- * number for these drives. */
- media = brasero_medium_get_status (medium);
-
- if (!BRASERO_MEDIUM_RANDOM_WRITABLE (media)) {
- guint track_num;
-
- track_num = brasero_medium_get_track_num (medium);
-
- BRASERO_BURN_LOG ("Last written track num == %i", track_num);
- brasero_track_disc_set_track_num (BRASERO_TRACK_DISC (track), track_num);
- }
- else {
- GValue *value;
-
- value = g_new0 (GValue, 1);
- g_value_init (value, G_TYPE_UINT64);
-
- BRASERO_BURN_LOG ("Start of last written track address == %lli", priv->session_start);
- g_value_set_uint64 (value, priv->session_start);
- brasero_track_tag_add (track,
- BRASERO_TRACK_MEDIUM_ADDRESS_START_TAG,
- value);
-
- value = g_new0 (GValue, 1);
- g_value_init (value, G_TYPE_UINT64);
-
- BRASERO_BURN_LOG ("End of last written track address == %lli", priv->session_end);
- g_value_set_uint64 (value, priv->session_end);
- brasero_track_tag_add (track,
- BRASERO_TRACK_MEDIUM_ADDRESS_END_TAG,
- value);
- }
+ GValue *value;
+
+ /* get the last written track address */
+ value = g_new0 (GValue, 1);
+ g_value_init (value, G_TYPE_UINT64);
+
+ BRASERO_BURN_LOG ("Start of last written track address == %lli", priv->session_start);
+ g_value_set_uint64 (value, priv->session_start);
+ brasero_track_tag_add (track,
+ BRASERO_TRACK_MEDIUM_ADDRESS_START_TAG,
+ value);
+
+ value = g_new0 (GValue, 1);
+ g_value_init (value, G_TYPE_UINT64);
+
+ BRASERO_BURN_LOG ("End of last written track address == %lli", priv->session_end);
+ g_value_set_uint64 (value, priv->session_end);
+ brasero_track_tag_add (track,
+ BRASERO_TRACK_MEDIUM_ADDRESS_END_TAG,
+ value);
}
result = brasero_burn_check_real (burn, track, error);
diff --git a/plugins/checksum/burn-checksum-image.c b/plugins/checksum/burn-checksum-image.c
index 82f9771..89cc663 100644
--- a/plugins/checksum/burn-checksum-image.c
+++ b/plugins/checksum/burn-checksum-image.c
@@ -56,6 +56,7 @@
#include "brasero-drive.h"
#include "brasero-track-disc.h"
#include "brasero-track-image.h"
+#include "brasero-tags.h"
BRASERO_PLUGIN_BOILERPLATE (BraseroChecksumImage, brasero_checksum_image, BRASERO_TYPE_JOB, BraseroJob);
@@ -354,18 +355,44 @@ brasero_checksum_image_create_checksum (BraseroChecksumImage *self,
brasero_job_start_progress (BRASERO_JOB (self), FALSE);
brasero_job_get_current_track (BRASERO_JOB (self), &track);
- /* see if another plugin is sending us data to checksum */
+ /* see if another plugin is sending us data to checksum
+ * or if we do it ourself (and then that must be from an
+ * image file only). */
if (brasero_job_get_fd_in (BRASERO_JOB (self), NULL) == BRASERO_BURN_OK) {
BraseroMedium *medium;
+ GValue *value = NULL;
BraseroDrive *drive;
+ guint64 start, end;
+ goffset sectors;
+ goffset bytes;
+
+ brasero_track_tag_lookup (track,
+ BRASERO_TRACK_MEDIUM_ADDRESS_START_TAG,
+ &value);
+
+ /* we were given an address to start */
+ start = g_value_get_uint64 (value);
+
+ /* get the length now */
+ value = NULL;
+ brasero_track_tag_lookup (track,
+ BRASERO_TRACK_MEDIUM_ADDRESS_END_TAG,
+ &value);
+
+ end = g_value_get_uint64 (value);
+
+ priv->total = end - start;
/* we're only able to checksum ISO format at the moment so that
* means we can only handle last session */
drive = brasero_track_disc_get_drive (BRASERO_TRACK_DISC (track));
medium = brasero_drive_get_medium (drive);
brasero_medium_get_last_data_track_space (medium,
- &priv->total,
- NULL);
+ &bytes,
+ §ors);
+
+ /* That's the only way to get the sector size */
+ priv->total *= bytes / sectors;
return brasero_checksum_image_checksum_fd_input (self, checksum_type, error);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]