[Goodies-commits] r5345 - xfburn/trunk/xfburn
David Mohr
squisher at xfce.org
Wed Sep 3 04:32:58 CEST 2008
Author: squisher
Date: 2008-09-03 02:32:57 +0000 (Wed, 03 Sep 2008)
New Revision: 5345
Modified:
xfburn/trunk/xfburn/xfburn-burn-audio-cd-composition-dialog.c
xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c
xfburn/trunk/xfburn/xfburn-burn-image-dialog.c
xfburn/trunk/xfburn/xfburn-perform-burn.c
xfburn/trunk/xfburn/xfburn-perform-burn.h
Log:
Add support for multiple tracks to the burn progress dialog
Modified: xfburn/trunk/xfburn/xfburn-burn-audio-cd-composition-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-audio-cd-composition-dialog.c 2008-09-02 18:40:29 UTC (rev 5344)
+++ xfburn/trunk/xfburn/xfburn-burn-audio-cd-composition-dialog.c 2008-09-03 02:32:57 UTC (rev 5345)
@@ -445,6 +445,7 @@
struct burn_write_opts * burn_options;
gint ret,i;
+ int track_sectors[n_tracks];
ret = burn_disc_add_session (disc, session, BURN_POS_END);
if (ret == 0) {
@@ -454,6 +455,8 @@
for (i=0; i<n_tracks; i++) {
burn_session_add_track (session, tracks[i], BURN_POS_END);
+ //FIXME: not reliable for variable length, so needs to get replaced for gstreamer
+ track_sectors[i] = burn_track_get_sectors (tracks[i]);
}
burn_options = burn_write_opts_new (drive);
@@ -486,7 +489,7 @@
burn_drive_set_speed (drive, 0, params->speed);
burn_write_opts_set_underrun_proof (burn_options, params->burnfree ? 1 : 0);
- xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, disc, NULL);
+ xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, disc, NULL, track_sectors);
burn_write_opts_free (burn_options);
}
Modified: xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c 2008-09-02 18:40:29 UTC (rev 5344)
+++ xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c 2008-09-03 02:32:57 UTC (rev 5345)
@@ -528,6 +528,7 @@
struct burn_write_opts * burn_options;
gint ret;
+ int sectors[1];
ret = burn_disc_add_session (disc, session, BURN_POS_END);
if (ret == 0) {
@@ -572,8 +573,10 @@
burn_drive_set_speed (drive, 0, params->speed);
burn_write_opts_set_underrun_proof (burn_options, params->burnfree ? 1 : 0);
- xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, disc, (params->is_fifo ? params->src : NULL));
+ sectors[0] = burn_disc_get_sectors (disc);
+ xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, disc, (params->is_fifo ? params->src : NULL), sectors);
+
burn_write_opts_free (burn_options);
}
Modified: xfburn/trunk/xfburn/xfburn-burn-image-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-image-dialog.c 2008-09-02 18:40:29 UTC (rev 5344)
+++ xfburn/trunk/xfburn/xfburn-burn-image-dialog.c 2008-09-03 02:32:57 UTC (rev 5345)
@@ -273,6 +273,7 @@
off_t fixed_size = 0;
struct burn_source *data_src;
struct burn_source *fifo_src;
+ int sectors[1];
struct burn_drive *drive;
struct burn_drive_info *drive_info = NULL;
@@ -344,8 +345,11 @@
DBG ("Set speed to %d kb/s", params->speed);
burn_drive_set_speed (drive, 0, params->speed);
+ // this assumes that an iso image can only have one track
+ sectors[0] = burn_disc_get_sectors (disc);
+
xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Burning image..."));
- xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, disc, fifo_src);
+ xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, disc, fifo_src, sectors);
burn_source_free (fifo_src);
burn_write_opts_free (burn_options);
Modified: xfburn/trunk/xfburn/xfburn-perform-burn.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-perform-burn.c 2008-09-02 18:40:29 UTC (rev 5344)
+++ xfburn/trunk/xfburn/xfburn-perform-burn.c 2008-09-03 02:32:57 UTC (rev 5345)
@@ -47,7 +47,7 @@
void
xfburn_perform_burn_write (GtkWidget *dialog_progress,
struct burn_drive *drive, XfburnWriteMode write_mode, struct burn_write_opts *burn_options, struct burn_disc *disc,
- struct burn_source *fifo)
+ struct burn_source *fifo, int *track_sectors)
{
enum burn_disc_status disc_state;
enum burn_drive_status status;
@@ -68,6 +68,7 @@
const char *final_message;
gdouble percent = 0.0;
int dbg_no;
+ int total_sectors, burned_sectors;
while (burn_drive_get_status (drive, NULL) != BURN_DRIVE_IDLE)
usleep(100001);
@@ -109,6 +110,8 @@
if (ret <= 0)
g_warning ("Failed to set libburn message severities, burn errors might not get detected!");
+ total_sectors = burn_disc_get_sectors (disc);
+
burn_disc_write (burn_options, disc);
while (burn_drive_get_status (drive, NULL) == BURN_DRIVE_SPAWNING)
@@ -116,24 +119,44 @@
time_start = time (NULL);
dbg_no = 0;
+ burned_sectors = 0;
while ((status = burn_drive_get_status (drive, &progress)) != BURN_DRIVE_IDLE) {
time_t time_now = time (NULL);
dbg_no++;
switch (status) {
case BURN_DRIVE_WRITING:
- xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Burning composition..."));
if (progress.sectors > 0 && progress.sector >= 0) {
gdouble cur_speed = 0.0;
int fifo_status, fifo_size, fifo_free;
char *fifo_text;
- if ((dbg_no % 16) == 0)
- DBG ("track = %d\tsector %d/%d", progress.track, progress.sector, progress.sectors);
+ if (progress.tracks > 1) {
+ gchar *str;
+
+ str = g_strdup_printf (_("Burning track %2d/%d..."), progress.track+1, progress.tracks);
+ xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, str);
+ g_free (str);
+ } else {
+ xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Burning composition..."));
+ }
percent = (gdouble) (progress.buffer_capacity - progress.buffer_available) / (gdouble) progress.buffer_capacity;
xfburn_progress_dialog_set_buffer_bar_fraction (XFBURN_PROGRESS_DIALOG (dialog_progress), percent);
- percent = 1.0 + ((gdouble) progress.sector+1.0) / ((gdouble) progress.sectors) * 98.0;
+ /* accumulate the sectors that have been burned in the previous track */
+ if (progress.track > 0 && track_sectors[progress.track-1] > 0) {
+ burned_sectors += track_sectors[progress.track-1];
+ track_sectors[progress.track-1] = 0;
+ }
+
+ //percent = 1.0 + ((gdouble) progress.sector+1.0) / ((gdouble) progress.sectors) * 98.0;
+ percent = 1.0 + ((gdouble) progress.sector + burned_sectors + 1.0) / ((gdouble) total_sectors) * 98.0;
+ /*
+ if ((dbg_no % 16) == 0) {
+ DBG ("progress = %f", percent);
+ DBG ("track = %d\tsector %d/%d", progress.track, progress.sector, progress.sectors);
+ }
+ */
xfburn_progress_dialog_set_progress_bar_fraction (XFBURN_PROGRESS_DIALOG (dialog_progress), percent / 100.0);
cur_speed = ((gdouble) ((gdouble)(glong)progress.sector * 2048L) / (gdouble) (time_now - time_start)) / ((gdouble) (factor * 1000.0));
@@ -174,6 +197,8 @@
break;
}
}
+ } else {
+ xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Burning composition..."));
}
break;
case BURN_DRIVE_WRITING_LEADIN:
Modified: xfburn/trunk/xfburn/xfburn-perform-burn.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-perform-burn.h 2008-09-02 18:40:29 UTC (rev 5344)
+++ xfburn/trunk/xfburn/xfburn-perform-burn.h 2008-09-03 02:32:57 UTC (rev 5345)
@@ -32,6 +32,7 @@
#include "xfburn-device-box.h"
-void xfburn_perform_burn_write (GtkWidget *dialog_progress, struct burn_drive *drive, XfburnWriteMode write_mode, struct burn_write_opts *burn_options, struct burn_disc *disc, struct burn_source *fifo);
+void xfburn_perform_burn_write (GtkWidget *dialog_progress, struct burn_drive *drive, XfburnWriteMode write_mode, struct burn_write_opts *burn_options,
+ struct burn_disc *disc, struct burn_source *fifo, int *track_sectors);
#endif /* __XFBURN_PERFORM_BURN_H__ */
More information about the Goodies-commits
mailing list