[Goodies-commits] r4978 - xfburn/trunk/xfburn
David Mohr
squisher at xfce.org
Sat Jun 21 04:11:53 CEST 2008
Author: squisher
Date: 2008-06-21 02:11:53 +0000 (Sat, 21 Jun 2008)
New Revision: 4978
Modified:
xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c
xfburn/trunk/xfburn/xfburn-burn-image-dialog.c
xfburn/trunk/xfburn/xfburn-global.h
xfburn/trunk/xfburn/xfburn-perform-burn.c
xfburn/trunk/xfburn/xfburn-perform-burn.h
xfburn/trunk/xfburn/xfburn-preferences-dialog.c
xfburn/trunk/xfburn/xfburn-progress-dialog.c
xfburn/trunk/xfburn/xfburn-progress-dialog.h
Log:
Adding fifo buffering
Modified: xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c 2008-06-20 20:33:51 UTC (rev 4977)
+++ xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c 2008-06-21 02:11:53 UTC (rev 4978)
@@ -35,6 +35,7 @@
#include "xfburn-utils.h"
#include "xfburn-settings.h"
#include "xfburn-stock.h"
+#include "xfburn-settings.h"
#include "xfburn-device-box.h"
#include "xfburn-burn-data-composition-base-dialog.h"
@@ -415,6 +416,7 @@
GtkWidget *dialog_progress;
XfburnDevice *device;
struct burn_source *src;
+ gboolean is_fifo;
gint speed;
XfburnWriteMode write_mode;
gboolean eject;
@@ -474,7 +476,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);
+ xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, disc, (params->is_fifo ? params->src : NULL));
burn_write_opts_free (burn_options);
}
@@ -566,16 +568,22 @@
XfburnDevice *device;
gint speed;
XfburnWriteMode write_mode;
+ struct burn_source * src_fifo = NULL;
device = xfburn_device_box_get_selected_device (XFBURN_DEVICE_BOX (priv->device_box));
speed = xfburn_device_box_get_speed (XFBURN_DEVICE_BOX (priv->device_box));
write_mode = xfburn_device_box_get_mode (XFBURN_DEVICE_BOX (priv->device_box));
+ /* FIXME: how much buffer space do we need? Probably should put this into settings */
+ src_fifo = burn_fifo_source_new (src, 2048, xfburn_settings_get_int ("fifo-size", XFBURN_FIFO_DEFAULT_SIZE) / 2, 0);
+ burn_source_free (src);
+
/* burn composition */
params = g_new0 (ThreadBurnCompositionParams, 1);
params->dialog_progress = dialog_progress;
params->device = device;
- params->src = src;
+ params->src = src_fifo;
+ params->is_fifo = TRUE;
params->speed = speed;
params->write_mode = write_mode;
params->eject = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_eject));
Modified: xfburn/trunk/xfburn/xfburn-burn-image-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-image-dialog.c 2008-06-20 20:33:51 UTC (rev 4977)
+++ xfburn/trunk/xfburn/xfburn-burn-image-dialog.c 2008-06-21 02:11:53 UTC (rev 4978)
@@ -34,6 +34,7 @@
#include "xfburn-progress-dialog.h"
#include "xfburn-device-box.h"
#include "xfburn-stock.h"
+#include "xfburn-settings.h"
#include "xfburn-burn-image-dialog.h"
#include "xfburn-perform-burn.h"
@@ -270,6 +271,7 @@
struct stat stbuf;
off_t fixed_size = 0;
struct burn_source *data_src;
+ struct burn_source *fifo_src;
struct burn_drive *drive;
struct burn_drive_info *drive_info = NULL;
@@ -313,13 +315,16 @@
xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("Cannot open image"));
goto end;
}
- if (burn_track_set_source (track, data_src) != BURN_SOURCE_OK) {
+
+ fifo_src = burn_fifo_source_new (data_src, 2048, xfburn_settings_get_int ("fifo-size", XFBURN_FIFO_DEFAULT_SIZE) / 2, 0);
+ burn_source_free (data_src);
+
+ if (burn_track_set_source (track, fifo_src) != BURN_SOURCE_OK) {
xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("Cannot attach source object to track object"));
goto end;
}
burn_session_add_track (session, track, BURN_POS_END);
- burn_source_free (data_src);
if (!xfburn_device_grab (params->device, &drive_info)) {
xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("Unable to grab drive"));
@@ -339,7 +344,8 @@
burn_drive_set_speed (drive, 0, 0);
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);
+ xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, disc, fifo_src);
+ burn_source_free (fifo_src);
burn_write_opts_free (burn_options);
cleanup:
Modified: xfburn/trunk/xfburn/xfburn-global.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-global.h 2008-06-20 20:33:51 UTC (rev 4977)
+++ xfburn/trunk/xfburn/xfburn-global.h 2008-06-21 02:11:53 UTC (rev 4978)
@@ -41,4 +41,7 @@
#define DVD_1X_SPEED 1385
#define DATA_COMPOSITION_DEFAULT_NAME "Data composition"
+
+#define XFBURN_FIFO_DEFAULT_SIZE 4096 /* in kb/s */
+
#endif
Modified: xfburn/trunk/xfburn/xfburn-perform-burn.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-perform-burn.c 2008-06-20 20:33:51 UTC (rev 4977)
+++ xfburn/trunk/xfburn/xfburn-perform-burn.c 2008-06-21 02:11:53 UTC (rev 4978)
@@ -45,7 +45,9 @@
*/
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)
+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)
{
enum burn_disc_status disc_state;
enum burn_drive_status status;
@@ -117,6 +119,8 @@
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;
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);
@@ -128,6 +132,40 @@
//DBG ("(%f / %f) / %f = %f\n", (gdouble) ((gdouble)(glong)progress.sector * 2048L), (gdouble) (time_now - time_start), ((gdouble) (factor * 1000.0)), cur_speed);
xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG (dialog_progress),
cur_speed);
+
+ if (fifo != NULL) {
+ fifo_status = burn_fifo_inquire_status (fifo, &fifo_size, &fifo_free, &fifo_text);
+ switch (fifo_status) {
+ case 0:
+ xfburn_progress_dialog_set_fifo_bar_text (XFBURN_PROGRESS_DIALOG (dialog_progress), _("standby"));
+ break;
+ case 1:
+ percent = (gdouble) (fifo_size - fifo_free) / (gdouble) fifo_size;
+ xfburn_progress_dialog_set_fifo_bar_fraction (XFBURN_PROGRESS_DIALOG (dialog_progress), percent);
+ break;
+ case 2:
+ xfburn_progress_dialog_set_fifo_bar_text (XFBURN_PROGRESS_DIALOG (dialog_progress), _("active"));
+ break;
+ case 3:
+ xfburn_progress_dialog_set_fifo_bar_text (XFBURN_PROGRESS_DIALOG (dialog_progress), _("ending"));
+ break;
+ case 4:
+ xfburn_progress_dialog_set_fifo_bar_text (XFBURN_PROGRESS_DIALOG (dialog_progress), _("failing"));
+ break;
+ case 5:
+ xfburn_progress_dialog_set_fifo_bar_text (XFBURN_PROGRESS_DIALOG (dialog_progress), _("unused"));
+ break;
+ case 6:
+ xfburn_progress_dialog_set_fifo_bar_text (XFBURN_PROGRESS_DIALOG (dialog_progress), _("abandoned"));
+ break;
+ case 7:
+ xfburn_progress_dialog_set_fifo_bar_text (XFBURN_PROGRESS_DIALOG (dialog_progress), _("ended"));
+ break;
+ default:
+ xfburn_progress_dialog_set_fifo_bar_text (XFBURN_PROGRESS_DIALOG (dialog_progress), _("aborted"));
+ break;
+ }
+ }
}
break;
case BURN_DRIVE_WRITING_LEADIN:
Modified: xfburn/trunk/xfburn/xfburn-perform-burn.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-perform-burn.h 2008-06-20 20:33:51 UTC (rev 4977)
+++ xfburn/trunk/xfburn/xfburn-perform-burn.h 2008-06-21 02:11:53 UTC (rev 4978)
@@ -32,6 +32,6 @@
#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);
+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);
#endif /* __XFBURN_PERFORM_BURN_H__ */
Modified: xfburn/trunk/xfburn/xfburn-preferences-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-preferences-dialog.c 2008-06-20 20:33:51 UTC (rev 4977)
+++ xfburn/trunk/xfburn/xfburn-preferences-dialog.c 2008-06-21 02:11:53 UTC (rev 4978)
@@ -44,6 +44,7 @@
GtkWidget *treeview_devices;
GtkWidget *button_scan;
GtkWidget *check_empty_speed_list;
+ GtkWidget *scale_fifo;
} XfburnPreferencesDialogPrivate;
/* prototypes */
@@ -121,7 +122,7 @@
GtkBox *box = GTK_BOX (GTK_DIALOG (obj)->vbox);
XfburnPreferencesDialogPrivate *priv = XFBURN_PREFERENCES_DIALOG_GET_PRIVATE (obj);
- GtkWidget *vbox, *vbox2, *hbox;
+ GtkWidget *vbox, *vbox2, *vbox3, *hbox;
GtkWidget *label;
GtkWidget *frame;
GtkWidget *scrolled_window;
@@ -316,6 +317,20 @@
gtk_box_pack_start (GTK_BOX (vbox2), priv->check_empty_speed_list, FALSE, FALSE, BORDER);
gtk_widget_show (priv->check_empty_speed_list);
+ /* fifo */
+ vbox3 = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (vbox3);
+
+ frame = xfce_create_framebox_with_content (_("FIFO buffer size (in kb)"), vbox3);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, BORDER);
+ gtk_widget_show (frame);
+
+ priv->scale_fifo = gtk_hscale_new_with_range (0.0, 8192.0, 32.0);
+ gtk_scale_set_value_pos (GTK_SCALE (priv->scale_fifo), GTK_POS_LEFT);
+ gtk_range_set_value (GTK_RANGE (priv->scale_fifo), 0);
+ gtk_box_pack_start (GTK_BOX (vbox3), priv->scale_fifo, FALSE, FALSE, BORDER/2);
+ gtk_widget_show (priv->scale_fifo);
+
/* action buttons */
button_close = gtk_button_new_from_stock ("gtk-close");
@@ -352,6 +367,8 @@
xfburn_settings_get_boolean ("human-readable-units", TRUE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->check_empty_speed_list),
xfburn_settings_get_boolean ("show-empty-speed-list-notice", TRUE));
+ gtk_range_set_value (GTK_RANGE (priv->scale_fifo),
+ (double) xfburn_settings_get_int ("fifo-size", XFBURN_FIFO_DEFAULT_SIZE));
}
static void
@@ -372,6 +389,8 @@
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_show_human_readable)));
xfburn_settings_set_boolean ("show-empty-speed-list-notice",
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_empty_speed_list)));
+ xfburn_settings_set_int ("fifo-size",
+ ((((int) gtk_range_get_value (GTK_RANGE (priv->scale_fifo)) / 32) * 32))); /* this should round to multiples of 1024 */
}
static void
Modified: xfburn/trunk/xfburn/xfburn-progress-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-progress-dialog.c 2008-06-20 20:33:51 UTC (rev 4977)
+++ xfburn/trunk/xfburn/xfburn-progress-dialog.c 2008-06-21 02:11:53 UTC (rev 4978)
@@ -457,6 +457,17 @@
}
void
+xfburn_progress_dialog_set_fifo_bar_text (XfburnProgressDialog * dialog, const gchar *text)
+{
+ XfburnProgressDialogPrivate *priv = XFBURN_PROGRESS_DIALOG_GET_PRIVATE (dialog);
+
+ gdk_threads_enter ();
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->fifo_bar), 0.0);
+ gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->fifo_bar), text);
+ gdk_threads_leave ();
+}
+
+void
xfburn_progress_dialog_set_progress_bar_fraction (XfburnProgressDialog * dialog, gdouble fraction)
{
XfburnProgressDialogPrivate *priv = XFBURN_PROGRESS_DIALOG_GET_PRIVATE (dialog);
Modified: xfburn/trunk/xfburn/xfburn-progress-dialog.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-progress-dialog.h 2008-06-20 20:33:51 UTC (rev 4977)
+++ xfburn/trunk/xfburn/xfburn-progress-dialog.h 2008-06-21 02:11:53 UTC (rev 4978)
@@ -71,6 +71,7 @@
void xfburn_progress_dialog_set_progress_bar_fraction (XfburnProgressDialog * dialog, gdouble fraction);
void xfburn_progress_dialog_set_fifo_bar_fraction (XfburnProgressDialog * dialog, gdouble fraction);
+void xfburn_progress_dialog_set_fifo_bar_text (XfburnProgressDialog * dialog, const gchar *text);
void xfburn_progress_dialog_set_buffer_bar_fraction (XfburnProgressDialog * dialog, gdouble fraction);
void xfburn_progress_dialog_set_buffer_bar_min_fill (XfburnProgressDialog * dialog, gdouble fraction);
void xfburn_progress_dialog_set_writing_speed (XfburnProgressDialog * dialog, gfloat speed);
More information about the Goodies-commits
mailing list