[brasero] Fix #607752 - audio track start and end points are overwritten after being read from a project file
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Fix #607752 - audio track start and end points are overwritten after being read from a project file
- Date: Tue, 26 Jan 2010 08:58:37 +0000 (UTC)
commit a3811d2262cef64d3c11852ae36cafb2dd4dfddc
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Tue Jan 26 09:54:43 2010 +0100
Fix #607752 - audio track start and end points are overwritten after being read from a project file
The automatic fetching of song/video length overwrote the set start and end point
Thanks to Jonathan Matthew for pointing this out
libbrasero-burn/brasero-track-stream-cfg.c | 36 +++++++++++++++++++++++----
libbrasero-burn/brasero-track-stream.c | 9 ++++++-
src/brasero-project-parse.c | 20 ++++++++-------
3 files changed, 49 insertions(+), 16 deletions(-)
---
diff --git a/libbrasero-burn/brasero-track-stream-cfg.c b/libbrasero-burn/brasero-track-stream-cfg.c
index 28230ad..9d53dd6 100644
--- a/libbrasero-burn/brasero-track-stream-cfg.c
+++ b/libbrasero-burn/brasero-track-stream-cfg.c
@@ -204,12 +204,36 @@ brasero_track_stream_cfg_results_cb (GObject *obj,
BRASERO_AUDIO_FORMAT_UNDEFINED:BRASERO_AUDIO_FORMAT_NONE)|
BRASERO_METADATA_INFO);
- /* Size/length. Do forget to respect the gap size/len with -1 */
- if (BRASERO_TRACK_STREAM_CLASS (brasero_track_stream_cfg_parent_class)->set_boundaries)
- BRASERO_TRACK_STREAM_CLASS (brasero_track_stream_cfg_parent_class)->set_boundaries (BRASERO_TRACK_STREAM (obj),
- 0,
- len,
- -1);
+ /* Size/length. Only set when end value has not been already set.
+ * Fix #607752 - audio track start and end points are overwritten after
+ * being read from a project file.
+ * We don't want to set a new len if one has been set already. Nevertheless
+ * if the length we detected is smaller than the one that was set we go
+ * for the new one. */
+ if (BRASERO_TRACK_STREAM_CLASS (brasero_track_stream_cfg_parent_class)->set_boundaries) {
+ gint64 min_start;
+
+ /* Make sure that the start value is coherent */
+ min_start = (len - BRASERO_MIN_STREAM_LENGTH) >= 0? (len - BRASERO_MIN_STREAM_LENGTH):0;
+ if (min_start && brasero_track_stream_get_start (BRASERO_TRACK_STREAM (obj)) > min_start) {
+ BRASERO_TRACK_STREAM_CLASS (brasero_track_stream_cfg_parent_class)->set_boundaries (BRASERO_TRACK_STREAM (obj),
+ min_start,
+ -1,
+ -1);
+ }
+
+ if (brasero_track_stream_get_end (BRASERO_TRACK_STREAM (obj)) > len
+ || brasero_track_stream_get_end (BRASERO_TRACK_STREAM (obj)) <= 0) {
+ /* Don't set either gap or start to make sure we don't remove
+ * values set by project parser or values set from the beginning
+ * Fix #607752 - audio track start and end points are overwritten
+ * after being read from a project file */
+ BRASERO_TRACK_STREAM_CLASS (brasero_track_stream_cfg_parent_class)->set_boundaries (BRASERO_TRACK_STREAM (obj),
+ -1,
+ len,
+ -1);
+ }
+ }
snapshot = g_file_info_get_attribute_object (info, BRASERO_IO_THUMBNAIL);
if (snapshot) {
diff --git a/libbrasero-burn/brasero-track-stream.c b/libbrasero-burn/brasero-track-stream.c
index 9ab6385..f041676 100644
--- a/libbrasero-burn/brasero-track-stream.c
+++ b/libbrasero-burn/brasero-track-stream.c
@@ -69,6 +69,10 @@ brasero_track_stream_set_source_real (BraseroTrackStream *track,
g_free (priv->uri);
priv->uri = g_strdup (uri);
+
+ /* Since that's a new URI chances are, the end point is different */
+ priv->end = 0;
+
return BRASERO_BURN_OK;
}
@@ -77,7 +81,10 @@ brasero_track_stream_set_source_real (BraseroTrackStream *track,
* @track: a #BraseroTrackStream
* @uri: a #gchar
*
- * Sets the stream (song or video) uri.
+ * Sets the stream (song or video) uri.
+ *
+ * Note: it resets the end point of the track to 0 but keeps start point and gap
+ * unchanged.
*
* Return value: a #BraseroBurnResult. BRASERO_BURN_OK if it is successful.
**/
diff --git a/src/brasero-project-parse.c b/src/brasero-project-parse.c
index 5eebaeb..bcb8fd6 100644
--- a/src/brasero-project-parse.c
+++ b/src/brasero-project-parse.c
@@ -214,6 +214,8 @@ _read_audio_track (xmlDocPtr project,
unescaped_uri = g_uri_unescape_string ((char *) uri, NULL);
g_free (uri);
+ /* Note: this must come before brasero_track_stream_set_boundaries ()
+ * or we will reset the end point to 0 */
brasero_track_stream_set_source (BRASERO_TRACK_STREAM (track), unescaped_uri);
/* For the moment pretend it is a video file. Since it is BraseroTrackStreamCfg, that
@@ -238,9 +240,9 @@ _read_audio_track (xmlDocPtr project,
goto error;
brasero_track_stream_set_boundaries (BRASERO_TRACK_STREAM (track),
- -1,
- -1,
- g_ascii_strtoull (silence, NULL, 10));
+ -1,
+ -1,
+ g_ascii_strtoull (silence, NULL, 10));
g_free (silence);
}
else if (!xmlStrcmp (uris->name, (const xmlChar *) "start")) {
@@ -253,9 +255,9 @@ _read_audio_track (xmlDocPtr project,
goto error;
brasero_track_stream_set_boundaries (BRASERO_TRACK_STREAM (track),
- g_ascii_strtoull (start, NULL, 10),
- -1,
- -1);
+ g_ascii_strtoull (start, NULL, 10),
+ -1,
+ -1);
g_free (start);
}
else if (!xmlStrcmp (uris->name, (const xmlChar *) "end")) {
@@ -268,9 +270,9 @@ _read_audio_track (xmlDocPtr project,
goto error;
brasero_track_stream_set_boundaries (BRASERO_TRACK_STREAM (track),
- -1,
- g_ascii_strtoull (end, NULL, 10),
- -1);
+ -1,
+ g_ascii_strtoull (end, NULL, 10),
+ -1);
g_free (end);
}
else if (!xmlStrcmp (uris->name, (const xmlChar *) "title")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]