[brasero] Improve previous patch by adding a new function to BraseroTrackImage method to determine if byte swa
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Improve previous patch by adding a new function to BraseroTrackImage method to determine if byte swa
- Date: Sun, 22 Nov 2009 21:17:31 +0000 (UTC)
commit f001b3384319eea82a14594cd7c6ddb503bb08b4
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Sun Nov 22 08:46:17 2009 +0100
Improve previous patch by adding a new function to BraseroTrackImage method to determine if byte swapping is required
libbrasero-burn/brasero-track-image.c | 31 +++++++++++++++++++++++++++++++
libbrasero-burn/brasero-track-image.h | 3 +++
libbrasero-burn/burn-image-format.c | 6 ------
plugins/cdrdao/burn-cdrdao.c | 13 ++++---------
plugins/cdrkit/burn-wodim.c | 7 +------
plugins/cdrtools/burn-cdrecord.c | 7 +------
6 files changed, 40 insertions(+), 27 deletions(-)
---
diff --git a/libbrasero-burn/brasero-track-image.c b/libbrasero-burn/brasero-track-image.c
index 4fbd69f..15549bf 100644
--- a/libbrasero-burn/brasero-track-image.c
+++ b/libbrasero-burn/brasero-track-image.c
@@ -273,6 +273,37 @@ brasero_track_image_get_format (BraseroTrackImage *track)
return priv->format;
}
+/**
+ * brasero_track_image_need_byte_swap:
+ * @track: a #BraseroTrackImage
+ *
+ * This function returns whether the data bytes need swapping. Some .bin files
+ * associated with .cue files are little endian for audio whereas they should
+ * be big endian.
+ *
+ * Return value: a #gboolean
+ **/
+
+gboolean
+brasero_track_image_need_byte_swap (BraseroTrackImage *track)
+{
+ BraseroTrackImagePrivate *priv;
+ gchar *cueuri;
+ gboolean res;
+
+ g_return_val_if_fail (BRASERO_IS_TRACK_IMAGE (track), BRASERO_IMAGE_FORMAT_NONE);
+
+ priv = BRASERO_TRACK_IMAGE_PRIVATE (track);
+ if (priv->format != BRASERO_IMAGE_FORMAT_CUE)
+ return FALSE;
+
+ cueuri = brasero_string_get_uri (priv->toc);
+ res = brasero_image_format_cue_bin_byte_swap (cueuri, NULL, NULL);
+ g_free (cueuri);
+
+ return res;
+}
+
static BraseroTrackDataType
brasero_track_image_get_track_type (BraseroTrack *track,
BraseroTrackType *type)
diff --git a/libbrasero-burn/brasero-track-image.h b/libbrasero-burn/brasero-track-image.h
index b24bc27..91f626b 100644
--- a/libbrasero-burn/brasero-track-image.h
+++ b/libbrasero-burn/brasero-track-image.h
@@ -92,6 +92,9 @@ brasero_track_image_get_toc_source (BraseroTrackImage *track,
BraseroImageFormat
brasero_track_image_get_format (BraseroTrackImage *track);
+gboolean
+brasero_track_image_need_byte_swap (BraseroTrackImage *track);
+
G_END_DECLS
#endif /* _BURN_TRACK_IMAGE_H_ */
diff --git a/libbrasero-burn/burn-image-format.c b/libbrasero-burn/burn-image-format.c
index 63eb4d7..a1ac79b 100644
--- a/libbrasero-burn/burn-image-format.c
+++ b/libbrasero-burn/burn-image-format.c
@@ -543,16 +543,10 @@ brasero_image_format_cue_bin_byte_swap (gchar *uri,
if ((ptr = strstr (line, "FILE"))) {
if (strstr (ptr, "BINARY"))
is_binary = TRUE;
-
- g_free (line);
- break;
}
else if ((ptr = strstr (line, "TRACK"))) {
if (strstr (ptr, "AUDIO"))
is_audio = TRUE;
-
- g_free (line);
- break;
}
g_free (line);
}
diff --git a/plugins/cdrdao/burn-cdrdao.c b/plugins/cdrdao/burn-cdrdao.c
index 79e62de..60d626a 100644
--- a/plugins/cdrdao/burn-cdrdao.c
+++ b/plugins/cdrdao/burn-cdrdao.c
@@ -55,8 +55,6 @@
#include "brasero-drive.h"
#include "brasero-medium.h"
-#include "burn-image-format.h"
-
#define BRASERO_TYPE_CDRDAO (brasero_cdrdao_get_type ())
#define BRASERO_CDRDAO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), BRASERO_TYPE_CDRDAO, BraseroCdrdao))
@@ -363,11 +361,12 @@ brasero_cdrdao_set_argv_record (BraseroCdrdao *cdrdao,
gchar *cuepath;
BraseroTrack *track;
+ g_ptr_array_add (argv, g_strdup ("write"));
+
brasero_job_get_current_track (BRASERO_JOB (cdrdao), &track);
if (brasero_track_type_get_image_format (type) == BRASERO_IMAGE_FORMAT_CUE) {
gchar *parent;
- gchar *cueuri;
cuepath = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (track), FALSE);
parent = g_path_get_dirname (cuepath);
@@ -375,10 +374,8 @@ brasero_cdrdao_set_argv_record (BraseroCdrdao *cdrdao,
g_free (parent);
/* we need to check endianness */
- cueuri = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (track), TRUE);
- if (brasero_image_format_cue_bin_byte_swap (cueuri, NULL, NULL))
- g_ptr_array_add (argv, g_strdup ("-swap"));
- g_free (cueuri);
+ if (brasero_track_image_need_byte_swap (BRASERO_TRACK_IMAGE (track)))
+ g_ptr_array_add (argv, g_strdup ("--swap"));
}
else if (brasero_track_type_get_image_format (type) == BRASERO_IMAGE_FORMAT_CDRDAO) {
/* CDRDAO files are always BIG ENDIAN */
@@ -394,8 +391,6 @@ brasero_cdrdao_set_argv_record (BraseroCdrdao *cdrdao,
BRASERO_JOB_NOT_READY (cdrdao);
}
- g_ptr_array_add (argv, g_strdup ("write"));
-
brasero_cdrdao_set_argv_device (cdrdao, argv);
brasero_cdrdao_set_argv_common (cdrdao, argv);
brasero_cdrdao_set_argv_common_rec (cdrdao, argv);
diff --git a/plugins/cdrkit/burn-wodim.c b/plugins/cdrkit/burn-wodim.c
index b96bea7..0e6c1ff 100644
--- a/plugins/cdrkit/burn-wodim.c
+++ b/plugins/cdrkit/burn-wodim.c
@@ -60,8 +60,6 @@
#include "brasero-track-image.h"
#include "brasero-track-stream.h"
-#include "burn-image-format.h"
-
#define BRASERO_TYPE_WODIM (brasero_wodim_get_type ())
#define BRASERO_WODIM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), BRASERO_TYPE_WODIM, BraseroWodim))
@@ -970,7 +968,6 @@ brasero_wodim_set_argv_record (BraseroWodim *wodim,
else if (format == BRASERO_IMAGE_FORMAT_CUE) {
gchar *cue_str;
gchar *cuepath;
- gchar *cueuri;
cuepath = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (track), FALSE);
if (!cuepath) {
@@ -979,10 +976,8 @@ brasero_wodim_set_argv_record (BraseroWodim *wodim,
}
/* we need to check endianness */
- cueuri = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (track), TRUE);
- if (brasero_image_format_cue_bin_byte_swap (cueuri, NULL, NULL))
+ if (brasero_track_image_need_byte_swap (BRASERO_TRACK_IMAGE (track)))
g_ptr_array_add (argv, g_strdup ("-swab"));
- g_free (cueuri);
g_ptr_array_add (argv, g_strdup ("fs=16m"));
diff --git a/plugins/cdrtools/burn-cdrecord.c b/plugins/cdrtools/burn-cdrecord.c
index 9dff304..f18e4e2 100644
--- a/plugins/cdrtools/burn-cdrecord.c
+++ b/plugins/cdrtools/burn-cdrecord.c
@@ -60,8 +60,6 @@
#include "brasero-track-image.h"
#include "brasero-track-stream.h"
-#include "burn-image-format.h"
-
#define BRASERO_TYPE_CD_RECORD (brasero_cdrecord_get_type ())
#define BRASERO_CD_RECORD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), BRASERO_TYPE_CD_RECORD, BraseroCDRecord))
@@ -966,7 +964,6 @@ brasero_cdrecord_set_argv_record (BraseroCDRecord *cdrecord,
else if (format == BRASERO_IMAGE_FORMAT_CUE) {
gchar *cue_str;
gchar *cuepath;
- gchar *cueuri;
cuepath = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (track), FALSE);
if (!cuepath) {
@@ -975,10 +972,8 @@ brasero_cdrecord_set_argv_record (BraseroCDRecord *cdrecord,
}
/* we need to check endianness */
- cueuri = brasero_track_image_get_toc_source (BRASERO_TRACK_IMAGE (track), TRUE);
- if (brasero_image_format_cue_bin_byte_swap (cueuri, NULL, NULL))
+ if (brasero_track_image_need_byte_swap (BRASERO_TRACK_IMAGE (track)))
g_ptr_array_add (argv, g_strdup ("-swab"));
- g_free (cueuri);
g_ptr_array_add (argv, g_strdup ("fs=16m"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]