brasero r1542 - in trunk: . src src/plugins/checksum
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1542 - in trunk: . src src/plugins/checksum
- Date: Mon, 17 Nov 2008 21:22:25 +0000 (UTC)
Author: philippr
Date: Mon Nov 17 21:22:25 2008
New Revision: 1542
URL: http://svn.gnome.org/viewvc/brasero?rev=1542&view=rev
Log:
Improve and fix previous patch where we didn\'t set the checksum type
Also improve checksuming for track < 300k
* src/burn.c (brasero_burn_action_changed),
(brasero_burn_run_tasks), (brasero_burn_record_session):
* src/plugins/checksum/burn-checksum-image.c
(brasero_checksum_image_create_checksum),
(brasero_checksum_get_checksum_type),
(brasero_checksum_image_image_and_checksum),
(brasero_checksum_image_end):
Modified:
trunk/ChangeLog
trunk/src/burn.c
trunk/src/plugins/checksum/burn-checksum-image.c
Modified: trunk/src/burn.c
==============================================================================
--- trunk/src/burn.c (original)
+++ trunk/src/burn.c Mon Nov 17 21:22:25 2008
@@ -1170,40 +1170,7 @@
BraseroBurnAction action,
BraseroBurn *burn)
{
- BraseroBurnPrivate *priv;
- BraseroMedia media;
-
brasero_burn_action_changed_real (burn, action);
-
- if (action != BRASERO_BURN_ACTION_START_RECORDING)
- return;
-
- priv = BRASERO_BURN_PRIVATE (burn);
-
- media = brasero_burn_session_get_dest_media (priv->session);
- if ((BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_PLUS)
- || BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_RESTRICTED))) {
- BraseroBurnFlag flags;
- BraseroMedium *medium;
- BraseroDrive *drive;
- gint64 len = 0;
-
- drive = brasero_burn_session_get_burner (priv->session);
- medium = brasero_drive_get_medium (drive);
- flags = brasero_burn_session_get_flags (priv->session);
-
- /* we need to save some parameters for later checksuming */
- brasero_task_ctx_get_session_output_size (BRASERO_TASK_CTX (priv->task),
- &len,
- NULL);
-
- if (flags & (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;
- }
}
void
@@ -1736,6 +1703,31 @@
if (result != BRASERO_BURN_OK)
break;
+ /* try to get the output size */
+ if (BRASERO_MEDIUM_RANDOM_WRITABLE (brasero_burn_session_get_dest_media (priv->session))) {
+ gint64 len = 0;
+ BraseroDrive *drive;
+ BraseroMedium *medium;
+
+ 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);
+
+ 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;
+
+ 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) {
if (brasero_burn_session_is_dest_file (priv->session))
@@ -2159,8 +2151,7 @@
* number for these drives. */
media = brasero_medium_get_status (medium);
- if (!BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_PLUS)
- && !BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_RESTRICTED)) {
+ if (!BRASERO_MEDIUM_RANDOM_WRITABLE (media)) {
guint track_num;
track_num = brasero_medium_get_track_num (medium);
Modified: trunk/src/plugins/checksum/burn-checksum-image.c
==============================================================================
--- trunk/src/plugins/checksum/burn-checksum-image.c (original)
+++ trunk/src/plugins/checksum/burn-checksum-image.c Mon Nov 17 21:22:25 2008
@@ -191,10 +191,10 @@
result = BRASERO_BURN_OK;
while (1) {
read_bytes = brasero_checksum_image_read (self,
- fd_in,
- buffer,
- sizeof (buffer),
- error);
+ fd_in,
+ buffer,
+ sizeof (buffer),
+ error);
if (read_bytes == -2)
return BRASERO_BURN_CANCEL;
@@ -208,9 +208,9 @@
* that we don't need to output the received data */
if (fd_out > 0) {
result = brasero_checksum_image_write (self,
- fd_out,
- buffer,
- read_bytes, error);
+ fd_out,
+ buffer,
+ read_bytes, error);
if (result != BRASERO_BURN_OK)
break;
}
@@ -318,9 +318,9 @@
GError **error)
{
BraseroBurnResult result;
- BraseroChecksumImagePrivate *priv;
BraseroTrack *track = NULL;
GChecksumType checksum_type;
+ BraseroChecksumImagePrivate *priv;
priv = BRASERO_CHECKSUM_IMAGE_PRIVATE (self);
@@ -384,16 +384,8 @@
checksum_type = gconf_client_get_int (client, GCONF_KEY_CHECKSUM_TYPE, NULL);
g_object_unref (client);
- if (checksum_type == BRASERO_CHECKSUM_NONE)
- checksum_type = G_CHECKSUM_MD5;
- else if (checksum_type & BRASERO_CHECKSUM_MD5)
- checksum_type = G_CHECKSUM_MD5;
- else if (checksum_type & BRASERO_CHECKSUM_SHA1)
- checksum_type = G_CHECKSUM_SHA1;
- else if (checksum_type & BRASERO_CHECKSUM_SHA256)
- checksum_type = G_CHECKSUM_SHA256;
- else
- checksum_type = G_CHECKSUM_MD5;
+ if (!checksum_type)
+ checksum_type = BRASERO_CHECKSUM_MD5;
return checksum_type;
}
@@ -403,10 +395,22 @@
GError **error)
{
BraseroBurnResult result;
+ GChecksumType checksum_type;
BraseroChecksumImagePrivate *priv;
priv = BRASERO_CHECKSUM_IMAGE_PRIVATE (self);
+
priv->checksum_type = brasero_checksum_get_checksum_type ();
+ if (priv->checksum_type == BRASERO_CHECKSUM_NONE)
+ checksum_type = G_CHECKSUM_MD5;
+ else if (priv->checksum_type & BRASERO_CHECKSUM_MD5)
+ checksum_type = G_CHECKSUM_MD5;
+ else if (priv->checksum_type & BRASERO_CHECKSUM_SHA1)
+ checksum_type = G_CHECKSUM_SHA1;
+ else if (priv->checksum_type & BRASERO_CHECKSUM_SHA256)
+ checksum_type = G_CHECKSUM_SHA256;
+ else
+ checksum_type = G_CHECKSUM_MD5;
brasero_job_set_current_action (BRASERO_JOB (self),
BRASERO_BURN_ACTION_CHECKSUM,
@@ -426,10 +430,14 @@
if (result != BRASERO_BURN_OK)
return result;
- result = brasero_checksum_image_checksum_file_input (self, priv->checksum_type, error);
+ result = brasero_checksum_image_checksum_file_input (self,
+ checksum_type,
+ error);
}
else
- result = brasero_checksum_image_checksum_fd_input (self, priv->checksum_type, error);
+ result = brasero_checksum_image_checksum_fd_input (self,
+ checksum_type,
+ error);
return result;
}
@@ -480,7 +488,7 @@
* potential previous one. */
checksum = g_checksum_get_string (priv->checksum);
BRASERO_JOB_LOG (self,
- "setting new checksum (type = %i) %s (%s before)",
+ "Setting new checksum (type = %i) %s (%s before)",
priv->checksum_type,
checksum,
brasero_track_get_checksum (track));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]