[brasero] Added new methods to BraseroSessionSpan and BraseroTrackDataCfg to determine what the maximum size o
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Added new methods to BraseroSessionSpan and BraseroTrackDataCfg to determine what the maximum size o
- Date: Fri, 14 Aug 2009 14:42:48 +0000 (UTC)
commit 7a647b69ee1a0335cabdd313418cd658c9f49082
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Thu Aug 13 16:36:14 2009 +0200
Added new methods to BraseroSessionSpan and BraseroTrackDataCfg to determine what the maximum size of batches is (when spanning)
libbrasero-burn/brasero-data-project.c | 33 +++++++++++++++++
libbrasero-burn/brasero-data-project.h | 3 ++
libbrasero-burn/brasero-session-span.c | 58 ++++++++++++++++++++++++++++++
libbrasero-burn/brasero-session-span.h | 3 ++
libbrasero-burn/brasero-track-data-cfg.c | 23 ++++++++++++
libbrasero-burn/brasero-track-data-cfg.h | 3 ++
6 files changed, 123 insertions(+), 0 deletions(-)
---
diff --git a/libbrasero-burn/brasero-data-project.c b/libbrasero-burn/brasero-data-project.c
index ebf7dd7..af55798 100644
--- a/libbrasero-burn/brasero-data-project.c
+++ b/libbrasero-burn/brasero-data-project.c
@@ -2849,6 +2849,39 @@ brasero_data_project_improve_image_size_accuracy (goffset sectors,
return sectors;
}
+goffset
+brasero_data_project_get_max_space (BraseroDataProject *self)
+{
+ BraseroDataProjectPrivate *priv;
+ BraseroFileNode *children;
+ goffset max_sectors = 0;
+
+ priv = BRASERO_DATA_PROJECT_PRIVATE (self);
+
+ /* When empty this is an error */
+ if (!g_hash_table_size (priv->grafts))
+ return 0;
+
+ children = BRASERO_FILE_NODE_CHILDREN (priv->root);
+ while (children) {
+ goffset child_sectors;
+
+ if (g_slist_find (priv->spanned, children)) {
+ children = children->next;
+ continue;
+ }
+
+ if (children->is_file)
+ child_sectors = BRASERO_FILE_NODE_SECTORS (children);
+ else
+ child_sectors = brasero_data_project_get_folder_sectors (self, children);
+
+ max_sectors = MAX (max_sectors, BRASERO_FILE_NODE_SECTORS (children));
+ }
+
+ return max_sectors;
+}
+
BraseroBurnResult
brasero_data_project_span (BraseroDataProject *self,
goffset max_sectors,
diff --git a/libbrasero-burn/brasero-data-project.h b/libbrasero-burn/brasero-data-project.h
index 1137917..b53b938 100644
--- a/libbrasero-burn/brasero-data-project.h
+++ b/libbrasero-burn/brasero-data-project.h
@@ -261,6 +261,9 @@ brasero_data_project_span_again (BraseroDataProject *project);
BraseroBurnResult
brasero_data_project_span_possible (BraseroDataProject *project,
goffset max_sectors);
+goffset
+brasero_data_project_get_max_space (BraseroDataProject *self);
+
void
brasero_data_project_span_stop (BraseroDataProject *project);
diff --git a/libbrasero-burn/brasero-session-span.c b/libbrasero-burn/brasero-session-span.c
index 976e101..ca5e002 100644
--- a/libbrasero-burn/brasero-session-span.c
+++ b/libbrasero-burn/brasero-session-span.c
@@ -53,6 +53,64 @@ struct _BraseroSessionSpanPrivate
G_DEFINE_TYPE (BraseroSessionSpan, brasero_session_span, BRASERO_TYPE_BURN_SESSION);
+/**
+ * brasero_session_span_get_max_space:
+ * @session: a #BraseroSessionSpan
+ *
+ * Returns the maximum required space (in sectors)
+ * among all the possible spanned batches.
+ * This means that when burningto a media
+ * it will also be the minimum required
+ * space to burn all the contents in several
+ * batches.
+ *
+ * Return value: a #goffset.
+ **/
+
+goffset
+brasero_session_span_get_max_space (BraseroSessionSpan *session)
+{
+ GSList *tracks;
+ goffset max_sectors = 0;
+ BraseroSessionSpanPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_SESSION_SPAN (session), 0);
+
+ priv = BRASERO_SESSION_SPAN_PRIVATE (session);
+
+ g_return_val_if_fail (priv->track_list != NULL, 0);
+
+ if (priv->last_track) {
+ tracks = g_slist_find (priv->track_list, priv->last_track);
+
+ if (!tracks->next)
+ return 0;
+
+ tracks = tracks->next;
+ }
+ else
+ tracks = priv->track_list;
+
+ for (; tracks; tracks = tracks->next) {
+ BraseroTrack *track;
+ goffset track_blocks = 0;
+
+ track = tracks->data;
+
+ if (BRASERO_IS_TRACK_DATA_CFG (track))
+ return brasero_track_data_cfg_span_max_space (BRASERO_TRACK_DATA_CFG (track));
+
+ /* This is the common case */
+ brasero_track_get_size (BRASERO_TRACK (track),
+ &track_blocks,
+ NULL);
+
+ max_sectors = MAX (max_sectors, track_blocks);
+ }
+
+ return max_sectors;
+}
+
static goffset
brasero_session_span_get_available_medium_space (BraseroSessionSpan *session)
{
diff --git a/libbrasero-burn/brasero-session-span.h b/libbrasero-burn/brasero-session-span.h
index db34ea8..afd01ae 100644
--- a/libbrasero-burn/brasero-session-span.h
+++ b/libbrasero-burn/brasero-session-span.h
@@ -74,6 +74,9 @@ brasero_session_span_start (BraseroSessionSpan *session);
BraseroBurnResult
brasero_session_span_next (BraseroSessionSpan *session);
+goffset
+brasero_session_span_get_max_space (BraseroSessionSpan *session);
+
void
brasero_session_span_stop (BraseroSessionSpan *session);
diff --git a/libbrasero-burn/brasero-track-data-cfg.c b/libbrasero-burn/brasero-track-data-cfg.c
index 26769f5..8601b34 100644
--- a/libbrasero-burn/brasero-track-data-cfg.c
+++ b/libbrasero-burn/brasero-track-data-cfg.c
@@ -3018,6 +3018,29 @@ brasero_track_data_cfg_span_stop (BraseroTrackDataCfg *track)
}
/**
+ * brasero_track_data_cfg_span_max_space:
+ * @track: a #BraseroTrackDataCfg
+ *
+ * Returns the maximum required space (in sectors)
+ * among all the possible spanned batches.
+ * This means that when burningto a media
+ * it will also be the minimum required
+ * space to burn all the contents in several
+ * batches.
+ *
+ * Return value: a #goffset.
+ **/
+
+goffset
+brasero_track_data_cfg_span_max_space (BraseroTrackDataCfg *track)
+{
+ BraseroTrackDataCfgPrivate *priv;
+
+ priv = BRASERO_TRACK_DATA_CFG_PRIVATE (track);
+ return brasero_data_project_get_max_space (BRASERO_DATA_PROJECT (priv->tree));
+}
+
+/**
* This is to handle the icon for the image
*/
diff --git a/libbrasero-burn/brasero-track-data-cfg.h b/libbrasero-burn/brasero-track-data-cfg.h
index bafa7d1..674c067 100644
--- a/libbrasero-burn/brasero-track-data-cfg.h
+++ b/libbrasero-burn/brasero-track-data-cfg.h
@@ -164,6 +164,9 @@ BraseroBurnResult
brasero_track_data_cfg_span_possible (BraseroTrackDataCfg *track,
goffset sectors);
+goffset
+brasero_track_data_cfg_span_max_space (BraseroTrackDataCfg *track);
+
void
brasero_track_data_cfg_span_stop (BraseroTrackDataCfg *track);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]