brasero r2201 - in trunk: . libbrasero-burn libbrasero-burn/plugins/cdrkit libbrasero-burn/plugins/cdrtools libbrasero-burn/plugins/local-track libbrasero-burn/plugins/transcode src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r2201 - in trunk: . libbrasero-burn libbrasero-burn/plugins/cdrkit libbrasero-burn/plugins/cdrtools libbrasero-burn/plugins/local-track libbrasero-burn/plugins/transcode src
- Date: Thu, 2 Apr 2009 20:14:21 +0000 (UTC)
Author: philippr
Date: Thu Apr 2 20:14:21 2009
New Revision: 2201
URL: http://svn.gnome.org/viewvc/brasero?rev=2201&view=rev
Log:
2009-04-02 Philippe Rouquier <bonfire-app wanadoo fr>
Move BraseroStreamInfo from library to application
Now add additional information like title, composer, ... through tags
which are more easily copied and extensible
* libbrasero-burn/brasero-cover.c
(brasero_jacket_edit_set_audio_tracks_back):
* libbrasero-burn/brasero-tags.h:
* libbrasero-burn/brasero-track-stream.c
(brasero_track_stream_finalize):
* libbrasero-burn/brasero-track-stream.h:
* libbrasero-burn/brasero-track.c (brasero_track_tag_add_int),
(brasero_track_tag_add_string), (brasero_track_tag_lookup_int),
(brasero_track_tag_lookup_string),
(brasero_track_tag_copy_missing):
* libbrasero-burn/brasero-track.h:
* libbrasero-burn/plugins/cdrkit/burn-wodim.c
(brasero_wodim_write_inf):
* libbrasero-burn/plugins/cdrtools/burn-cdrecord.c
(brasero_cdrecord_write_inf):
* libbrasero-burn/plugins/local-track/burn-local-image.c
(brasero_local_track_update_track):
* libbrasero-burn/plugins/local-track/burn-uri.c
(brasero_burn_uri_thread):
* libbrasero-burn/plugins/transcode/burn-transcode.c
(brasero_transcode_create_sibling_size),
(brasero_transcode_create_sibling_image),
(brasero_transcode_push_track), (foreach_tag):
* src/brasero-audio-disc.c
(brasero_audio_disc_set_session_contents):
* src/brasero-project-parse.c (brasero_stream_info_free),
(brasero_stream_info_copy):
* src/brasero-project-parse.h:
* src/brasero-video-disc.c (brasero_video_disc_get_track):
* src/brasero-video-project.c (brasero_video_project_get_contents):
Modified:
trunk/ChangeLog
trunk/libbrasero-burn/brasero-cover.c
trunk/libbrasero-burn/brasero-tags.h
trunk/libbrasero-burn/brasero-track-stream.c
trunk/libbrasero-burn/brasero-track-stream.h
trunk/libbrasero-burn/brasero-track.c
trunk/libbrasero-burn/brasero-track.h
trunk/libbrasero-burn/plugins/cdrkit/burn-wodim.c
trunk/libbrasero-burn/plugins/cdrtools/burn-cdrecord.c
trunk/libbrasero-burn/plugins/local-track/burn-local-image.c
trunk/libbrasero-burn/plugins/local-track/burn-uri.c
trunk/libbrasero-burn/plugins/transcode/burn-transcode.c
trunk/src/brasero-audio-disc.c
trunk/src/brasero-project-parse.c
trunk/src/brasero-project-parse.h
trunk/src/brasero-video-disc.c
trunk/src/brasero-video-project.c
Modified: trunk/libbrasero-burn/brasero-cover.c
==============================================================================
--- trunk/libbrasero-burn/brasero-cover.c (original)
+++ trunk/libbrasero-burn/brasero-cover.c Thu Apr 2 20:14:21 2009
@@ -99,8 +99,8 @@
for (iter = tracks; iter; iter = iter->next) {
gchar *num;
gchar *time;
+ const gchar *info;
BraseroTrack *track;
- BraseroStreamInfo *info;
track = iter->data;
if (brasero_track_get_track_type (track, NULL) != BRASERO_TRACK_TYPE_STREAM)
@@ -110,47 +110,50 @@
BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, num, "Subtitle", &start);
g_free (num);
- info = brasero_track_stream_get_info (BRASERO_TRACK_STREAM (track));
-
+ info = brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_TITLE_TAG);
if (info) {
- if (info->title) {
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, info->title, "Subtitle", &start);
- }
- else {
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, _("Unknown song"), "Subtitle", &start);
- }
-
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, "\t\t", "Subtitle", &start);
-
- time = brasero_units_get_time_string (brasero_track_stream_get_end (BRASERO_TRACK_STREAM (track)) -
- brasero_track_stream_get_start (BRASERO_TRACK_STREAM (track)),
- TRUE,
- FALSE);
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, time, "Subtitle", &start);
- g_free (time);
-
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, "\n", "Subtitle", &start);
-
- if (info->artist) {
- /* Reminder: if this string happens to be used
- * somewhere else in brasero we'll need a
- * context with C_() macro */
- /* Translators: "by" is followed by the name of an artist.
- * This text is the one written on the cover of a disc.
- * Before it there is the name of the song.
- * I had to break it because it is in a GtkTextBuffer
- * and every word has a different tag. */
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, _("by"), "Artist", &start);
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, " ", "Artist", &start);
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, info->artist, "Artist", &start);
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, " ", "Artist", &start);
- }
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, info, "Subtitle", &start);
+ }
+ else {
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, _("Unknown song"), "Subtitle", &start);
+ }
+
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, "\t\t", "Subtitle", &start);
+
+ time = brasero_units_get_time_string (brasero_track_stream_get_end (BRASERO_TRACK_STREAM (track)) -
+ brasero_track_stream_get_start (BRASERO_TRACK_STREAM (track)),
+ TRUE,
+ FALSE);
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, time, "Subtitle", &start);
+ g_free (time);
- if (info->composer)
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, info->composer, "Subtitle", &start);
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, "\n", "Subtitle", &start);
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, "\n\n", "Subtitle", &start);
+ info = brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_ARTIST_TAG);
+ if (info) {
+ /* Reminder: if this string happens to be used
+ * somewhere else in brasero we'll need a
+ * context with C_() macro */
+ /* Translators: "by" is followed by the name of an artist.
+ * This text is the one written on the cover of a disc.
+ * Before it there is the name of the song.
+ * I had to break it because it is in a GtkTextBuffer
+ * and every word has a different tag. */
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, _("by"), "Artist", &start);
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, " ", "Artist", &start);
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, info, "Artist", &start);
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, " ", "Artist", &start);
}
+
+ info = brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_COMPOSER_TAG);
+
+ if (info)
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, info, "Subtitle", &start);
+
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, "\n\n", "Subtitle", &start);
}
/* side */
Modified: trunk/libbrasero-burn/brasero-tags.h
==============================================================================
--- trunk/libbrasero-burn/brasero-tags.h (original)
+++ trunk/libbrasero-burn/brasero-tags.h Thu Apr 2 20:14:21 2009
@@ -49,6 +49,20 @@
#define BRASERO_TRACK_MEDIUM_WRONG_CHECKSUM_TAG "track::medium::error::checksum::list"
/**
+ * Strings
+ */
+
+#define BRASERO_TRACK_STREAM_TITLE_TAG "track::stream::info::title"
+#define BRASERO_TRACK_STREAM_COMPOSER_TAG "track::stream::info::composer"
+#define BRASERO_TRACK_STREAM_ARTIST_TAG "track::stream::info::artist"
+
+/**
+ * Int
+ */
+
+#define BRASERO_TRACK_STREAM_ISRC_TAG "track::stream::info::isrc"
+
+/**
* Some defined and usable tags for a session
*/
Modified: trunk/libbrasero-burn/brasero-track-stream.c
==============================================================================
--- trunk/libbrasero-burn/brasero-track-stream.c (original)
+++ trunk/libbrasero-burn/brasero-track-stream.c Thu Apr 2 20:14:21 2009
@@ -49,44 +49,12 @@
guint64 gap;
guint64 start;
guint64 end;
-
- BraseroStreamInfo *info;
};
#define BRASERO_TRACK_STREAM_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_TRACK_STREAM, BraseroTrackStreamPrivate))
G_DEFINE_TYPE (BraseroTrackStream, brasero_track_stream, G_TYPE_OBJECT);
-void
-brasero_stream_info_free (BraseroStreamInfo *info)
-{
- if (!info)
- return;
-
- g_free (info->title);
- g_free (info->artist);
- g_free (info->composer);
- g_free (info);
-}
-
-BraseroStreamInfo *
-brasero_stream_info_copy (BraseroStreamInfo *info)
-{
- BraseroStreamInfo *copy;
-
- if (!info)
- return NULL;
-
- copy = g_new0 (BraseroStreamInfo, 1);
-
- copy->title = g_strdup (info->title);
- copy->artist = g_strdup (info->artist);
- copy->composer = g_strdup (info->composer);
- copy->isrc = info->isrc;
-
- return copy;
-}
-
BraseroBurnResult
brasero_track_stream_set_source (BraseroTrackStream *track,
const gchar *uri)
@@ -126,25 +94,6 @@
}
BraseroBurnResult
-brasero_track_stream_set_info (BraseroTrackStream *track,
- BraseroStreamInfo *info)
-{
- BraseroTrackStreamPrivate *priv;
-
- g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), BRASERO_BURN_ERR);
-
- priv = BRASERO_TRACK_STREAM_PRIVATE (track);
-
- if (priv->info)
- brasero_stream_info_free (priv->info);
-
- priv->info = info;
- brasero_track_changed (BRASERO_TRACK (track));
-
- return BRASERO_BURN_OK;
-}
-
-BraseroBurnResult
brasero_track_stream_set_boundaries (BraseroTrackStream *track,
gint64 start,
gint64 end,
@@ -218,18 +167,6 @@
return priv->end;
}
-/* FIXME: This is bad */
-BraseroStreamInfo *
-brasero_track_stream_get_info (BraseroTrackStream *track)
-{
- BraseroTrackStreamPrivate *priv;
-
- g_return_val_if_fail (BRASERO_IS_TRACK_STREAM (track), 0);
-
- priv = BRASERO_TRACK_STREAM_PRIVATE (track);
- return priv->info;
-}
-
BraseroBurnResult
brasero_track_stream_get_length (BraseroTrackStream *track,
guint64 *length)
@@ -302,11 +239,6 @@
priv->uri = NULL;
}
- if (priv->info) {
- brasero_stream_info_free (priv->info);
- priv->info = NULL;
- }
-
G_OBJECT_CLASS (brasero_track_stream_parent_class)->finalize (object);
}
Modified: trunk/libbrasero-burn/brasero-track-stream.h
==============================================================================
--- trunk/libbrasero-burn/brasero-track-stream.h (original)
+++ trunk/libbrasero-burn/brasero-track-stream.h Thu Apr 2 20:14:21 2009
@@ -52,21 +52,6 @@
BRASERO_VIDEO_FORMAT_VCD| \
BRASERO_VIDEO_FORMAT_VIDEO_DVD)))
-struct _BraseroStreamInfo {
- gchar *title;
- gchar *artist;
- gchar *composer;
- gint isrc;
-};
-
-typedef struct _BraseroStreamInfo BraseroStreamInfo;
-
-void
-brasero_stream_info_free (BraseroStreamInfo *info);
-
-BraseroStreamInfo *
-brasero_stream_info_copy (BraseroStreamInfo *info);
-
#define BRASERO_TYPE_TRACK_STREAM (brasero_track_stream_get_type ())
#define BRASERO_TRACK_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_TRACK_STREAM, BraseroTrackStream))
@@ -102,10 +87,6 @@
BraseroStreamFormat format);
BraseroBurnResult
-brasero_track_stream_set_info (BraseroTrackStream *track,
- BraseroStreamInfo *info);
-
-BraseroBurnResult
brasero_track_stream_set_boundaries (BraseroTrackStream *track,
gint64 start,
gint64 end,
@@ -119,9 +100,6 @@
brasero_track_stream_get_length (BraseroTrackStream *track,
guint64 *length);
-BraseroStreamInfo *
-brasero_track_stream_get_info (BraseroTrackStream *track);
-
guint64
brasero_track_stream_get_start (BraseroTrackStream *track);
Modified: trunk/libbrasero-burn/brasero-track.c
==============================================================================
--- trunk/libbrasero-burn/brasero-track.c (original)
+++ trunk/libbrasero-burn/brasero-track.c Thu Apr 2 20:14:21 2009
@@ -277,6 +277,34 @@
}
BraseroBurnResult
+brasero_track_tag_add_int (BraseroTrack *track,
+ const gchar *tag,
+ int value_int)
+{
+ GValue *value;
+
+ value = g_new0 (GValue, 1);
+ g_value_init (value, G_TYPE_INT);
+ g_value_set_int (value, value_int);
+
+ return brasero_track_tag_add (track, tag, value);
+}
+
+BraseroBurnResult
+brasero_track_tag_add_string (BraseroTrack *track,
+ const gchar *tag,
+ const gchar *string)
+{
+ GValue *value;
+
+ value = g_new0 (GValue, 1);
+ g_value_init (value, G_TYPE_STRING);
+ g_value_set_string (value, string);
+
+ return brasero_track_tag_add (track, tag, value);
+}
+
+BraseroBurnResult
brasero_track_tag_lookup (BraseroTrack *track,
const gchar *tag,
GValue **value)
@@ -301,9 +329,49 @@
return BRASERO_BURN_OK;
}
+int
+brasero_track_tag_lookup_int (BraseroTrack *track,
+ const gchar *tag)
+{
+ GValue *value = NULL;
+ BraseroBurnResult res;
+
+ res = brasero_track_tag_lookup (track, tag, &value);
+ if (res != BRASERO_BURN_OK)
+ return 0;
+
+ if (!value)
+ return 0;
+
+ if (!G_VALUE_HOLDS_INT (value))
+ return 0;
+
+ return g_value_get_int (value);
+}
+
+const gchar *
+brasero_track_tag_lookup_string (BraseroTrack *track,
+ const gchar *tag)
+{
+ GValue *value = NULL;
+ BraseroBurnResult res;
+
+ res = brasero_track_tag_lookup (track, tag, &value);
+ if (res != BRASERO_BURN_OK)
+ return NULL;
+
+ if (!value)
+ return NULL;
+
+ if (!G_VALUE_HOLDS_STRING (value))
+ return NULL;
+
+ return g_value_get_string (value);
+}
+
void
-brasero_track_tag_copy (BraseroTrack *dest,
- BraseroTrack *src)
+brasero_track_tag_copy_missing (BraseroTrack *dest,
+ BraseroTrack *src)
{
BraseroTrackPrivate *priv;
GHashTableIter iter;
@@ -324,6 +392,9 @@
priv = BRASERO_TRACK_PRIVATE (dest);
while (g_hash_table_iter_next (&iter, &key, &value)) {
+ if (g_hash_table_lookup (priv->tags, key))
+ continue;
+
new_value = g_new0 (GValue, 1);
g_value_init (new_value, g_value_get_gtype (value));
Modified: trunk/libbrasero-burn/brasero-track.h
==============================================================================
--- trunk/libbrasero-burn/brasero-track.h (original)
+++ trunk/libbrasero-burn/brasero-track.h Thu Apr 2 20:14:21 2009
@@ -159,8 +159,30 @@
GValue **value);
void
-brasero_track_tag_copy (BraseroTrack *dest,
- BraseroTrack *src);
+brasero_track_tag_copy_missing (BraseroTrack *dest,
+ BraseroTrack *src);
+
+/**
+ * Convenience functions for tags
+ */
+
+BraseroBurnResult
+brasero_track_tag_add_string (BraseroTrack *track,
+ const gchar *tag,
+ const gchar *string);
+
+const gchar *
+brasero_track_tag_lookup_string (BraseroTrack *track,
+ const gchar *tag);
+
+BraseroBurnResult
+brasero_track_tag_add_int (BraseroTrack *track,
+ const gchar *tag,
+ int value);
+
+int
+brasero_track_tag_lookup_int (BraseroTrack *track,
+ const gchar *tag);
G_END_DECLS
Modified: trunk/libbrasero-burn/plugins/cdrkit/burn-wodim.c
==============================================================================
--- trunk/libbrasero-burn/plugins/cdrkit/burn-wodim.c (original)
+++ trunk/libbrasero-burn/plugins/cdrkit/burn-wodim.c Thu Apr 2 20:14:21 2009
@@ -52,6 +52,7 @@
#include "burn-cdrkit.h"
#include "burn-wodim.h"
+#include "brasero-tags.h"
#include "brasero-track-image.h"
#include "brasero-track-stream.h"
@@ -379,16 +380,17 @@
GError **error)
{
gint fd;
+ int isrc;
gint size;
+ int errsv;
gchar *path;
guint64 length;
gchar *string;
gint b_written;
gint64 sectors;
gchar buffer [128];
- BraseroStreamInfo *info;
+ const gchar *info;
BraseroWodimPrivate *priv;
- int errsv;
priv = BRASERO_WODIM_PRIVATE (wodim);
@@ -441,8 +443,6 @@
* It might be good in the end to write and pack CD-TEXT pack data
* ourselves so we can set a different charset from English like
* Chinese for example. */
- info = brasero_track_stream_get_info (BRASERO_TRACK_STREAM (track));
-
strcpy (buffer, "# created by brasero\n");
size = strlen (buffer);
b_written = write (fd, buffer, size);
@@ -455,8 +455,10 @@
if (b_written != size)
goto error;
- if (info->isrc > 0)
- string = g_strdup_printf ("ISRC=\t%i\n", info->isrc);
+ /* ISRC */
+ isrc = brasero_track_tag_lookup_int (BRASERO_TRACK (track), BRASERO_TRACK_STREAM_ISRC_TAG);
+ if (isrc > 0)
+ string = g_strdup_printf ("ISRC=\t%i\n", isrc);
else
string = g_strdup ("ISRC=\t\n");
size = strlen (string);
@@ -493,10 +495,13 @@
if (b_written != size)
goto error;
- if (info->artist) {
+ /* ARTIST */
+ info = brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_ARTIST_TAG);
+ if (info) {
gchar *encoded;
- encoded = g_convert_with_fallback (info->artist,
+ encoded = g_convert_with_fallback (info,
-1,
"ISO-8859-1",
"UTF-8",
@@ -515,10 +520,13 @@
if (b_written != size)
goto error;
- if (info->composer) {
+ /* COMPOSER */
+ info = brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_COMPOSER_TAG);
+ if (info) {
gchar *encoded;
- encoded = g_convert_with_fallback (info->composer,
+ encoded = g_convert_with_fallback (info,
-1,
"ISO-8859-1",
"UTF-8",
@@ -537,10 +545,13 @@
if (b_written != size)
goto error;
- if (info->title) {
+ /* TITLE */
+ info = brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_TITLE_TAG);
+ if (info) {
gchar *encoded;
- encoded = g_convert_with_fallback (info->title,
+ encoded = g_convert_with_fallback (info,
-1,
"ISO-8859-1",
"UTF-8",
Modified: trunk/libbrasero-burn/plugins/cdrtools/burn-cdrecord.c
==============================================================================
--- trunk/libbrasero-burn/plugins/cdrtools/burn-cdrecord.c (original)
+++ trunk/libbrasero-burn/plugins/cdrtools/burn-cdrecord.c Thu Apr 2 20:14:21 2009
@@ -52,6 +52,7 @@
#include "burn-cdrtools.h"
#include "burn-cdrecord.h"
+#include "brasero-tags.h"
#include "brasero-track-image.h"
#include "brasero-track-stream.h"
@@ -363,16 +364,17 @@
GError **error)
{
gint fd;
+ int isrc;
+ int errsv;
gint size;
gchar *path;
guint64 length;
gchar *string;
gint b_written;
gint64 sectors;
+ const gchar *info;
gchar buffer [128];
- BraseroStreamInfo *info;
BraseroCDRecordPrivate *priv;
- int errsv;
priv = BRASERO_CD_RECORD_PRIVATE (cdrecord);
@@ -428,8 +430,6 @@
* It might be good in the end to write and pack CD-TEXT pack data
* ourselves so we can set a different charset from English like
* Chinese for example. */
- info = brasero_track_stream_get_info (BRASERO_TRACK_STREAM (track));
-
strcpy (buffer, "# created by brasero\n");
size = strlen (buffer);
b_written = write (fd, buffer, size);
@@ -442,8 +442,10 @@
if (b_written != size)
goto error;
- if (info->isrc > 0)
- string = g_strdup_printf ("ISRC=\t%i\n", info->isrc);
+ /* ISRC */
+ isrc = brasero_track_tag_lookup_int (BRASERO_TRACK (track), BRASERO_TRACK_STREAM_ISRC_TAG);
+ if (isrc > 0)
+ string = g_strdup_printf ("ISRC=\t%i\n", isrc);
else
string = g_strdup ("ISRC=\t\n");
size = strlen (string);
@@ -480,10 +482,13 @@
if (b_written != size)
goto error;
- if (info->artist) {
+ /* ARTIST */
+ info = brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_ARTIST_TAG);
+ if (info) {
gchar *encoded;
- encoded = g_convert_with_fallback (info->artist,
+ encoded = g_convert_with_fallback (info,
-1,
"ISO-8859-1",
"UTF-8",
@@ -502,10 +507,13 @@
if (b_written != size)
goto error;
- if (info->composer) {
+ /* COMPOSER */
+ info = brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_COMPOSER_TAG);
+ if (info) {
gchar *encoded;
- encoded = g_convert_with_fallback (info->composer,
+ encoded = g_convert_with_fallback (info,
-1,
"ISO-8859-1",
"UTF-8",
@@ -524,10 +532,13 @@
if (b_written != size)
goto error;
- if (info->title) {
+ /* TITLE */
+ info = brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_TITLE_TAG);
+ if (info) {
gchar *encoded;
- encoded = g_convert_with_fallback (info->title,
+ encoded = g_convert_with_fallback (info,
-1,
"ISO-8859-1",
"UTF-8",
Modified: trunk/libbrasero-burn/plugins/local-track/burn-local-image.c
==============================================================================
--- trunk/libbrasero-burn/plugins/local-track/burn-local-image.c (original)
+++ trunk/libbrasero-burn/plugins/local-track/burn-local-image.c Thu Apr 2 20:14:21 2009
@@ -604,7 +604,7 @@
guint64 file_num = 0;
track = BRASERO_TRACK (brasero_track_data_new ());
- brasero_track_tag_copy (BRASERO_TRACK (track), current);
+ brasero_track_tag_copy_missing (BRASERO_TRACK (track), current);
brasero_track_data_add_fs (BRASERO_TRACK_DATA (track), input.subtype.fs_type);
brasero_track_data_get_file_num (BRASERO_TRACK_DATA (current), &file_num);
@@ -652,15 +652,13 @@
newuri = brasero_local_track_translate_uri (self, uri);
track = BRASERO_TRACK (brasero_track_stream_new ());
- brasero_track_tag_copy (BRASERO_TRACK (track), current);
+ brasero_track_tag_copy_missing (BRASERO_TRACK (track), current);
brasero_track_stream_set_source (BRASERO_TRACK_STREAM (track), newuri);
brasero_track_stream_set_format (BRASERO_TRACK_STREAM (track), input.subtype.audio_format);
brasero_track_stream_set_boundaries (BRASERO_TRACK_STREAM (track),
brasero_track_stream_get_start (BRASERO_TRACK_STREAM (current)),
brasero_track_stream_get_end (BRASERO_TRACK_STREAM (current)),
brasero_track_stream_get_gap (BRASERO_TRACK_STREAM (current)));
- brasero_track_stream_set_info (BRASERO_TRACK_STREAM (track),
- brasero_stream_info_copy (brasero_track_stream_get_info (BRASERO_TRACK_STREAM (current))));
g_free (uri);
}
break;
@@ -682,7 +680,7 @@
brasero_track_get_size (current, &blocks, NULL);
track = BRASERO_TRACK (brasero_track_image_new ());
- brasero_track_tag_copy (BRASERO_TRACK (track), current);
+ brasero_track_tag_copy_missing (BRASERO_TRACK (track), current);
brasero_track_image_set_source (BRASERO_TRACK_IMAGE (track),
newimage,
newtoc,
Modified: trunk/libbrasero-burn/plugins/local-track/burn-uri.c
==============================================================================
--- trunk/libbrasero-burn/plugins/local-track/burn-uri.c (original)
+++ trunk/libbrasero-burn/plugins/local-track/burn-uri.c Thu Apr 2 20:14:21 2009
@@ -344,7 +344,7 @@
brasero_track_get_size (current, &blocks, NULL);
image = brasero_track_image_new ();
- brasero_track_tag_copy (BRASERO_TRACK (image), current);
+ brasero_track_tag_copy_missing (BRASERO_TRACK (image), current);
brasero_track_image_set_source (image,
path_image,
path_toc,
@@ -485,7 +485,7 @@
excluded = g_slist_reverse (excluded);
track = brasero_track_data_new ();
- brasero_track_tag_copy (BRASERO_TRACK (track), current);
+ brasero_track_tag_copy_missing (BRASERO_TRACK (track), current);
brasero_track_data_add_fs (track, type.subtype.fs_type);
Modified: trunk/libbrasero-burn/plugins/transcode/burn-transcode.c
==============================================================================
--- trunk/libbrasero-burn/plugins/transcode/burn-transcode.c (original)
+++ trunk/libbrasero-burn/plugins/transcode/burn-transcode.c Thu Apr 2 20:14:21 2009
@@ -42,6 +42,7 @@
#include "burn-basics.h"
#include "brasero-medium.h"
+#include "brasero-tags.h"
#include "burn-job.h"
#include "burn-plugin.h"
#include "burn-transcode.h"
@@ -607,7 +608,6 @@
BraseroTrack *src,
GError **error)
{
- BraseroStreamInfo *src_info, *dest_info;
BraseroTrack *dest;
guint64 duration;
@@ -622,16 +622,8 @@
BRASERO_DURATION_TO_BYTES (duration));
/* copy the info we are missing */
- src_info = brasero_track_stream_get_info (BRASERO_TRACK_STREAM (src));
brasero_job_get_current_track (BRASERO_JOB (transcode), &dest);
- dest_info = brasero_track_stream_get_info (BRASERO_TRACK_STREAM (dest));
-
- if (!dest_info->artist)
- dest_info->artist = g_strdup (src_info->artist);
- if (!dest_info->composer)
- dest_info->composer = g_strdup (src_info->composer);
- if (!dest_info->title)
- dest_info->title = g_strdup (src_info->title);
+ brasero_track_tag_copy_missing (dest, src);
return BRASERO_BURN_OK;
}
@@ -642,7 +634,6 @@
GError **error)
{
BraseroTrackStream *dest;
- BraseroStreamInfo *info;
BraseroTrack *track;
guint64 length = 0;
gchar *path_dest;
@@ -679,10 +670,7 @@
/* copy all infos but from the current track */
brasero_job_get_current_track (BRASERO_JOB (transcode), &track);
- info = brasero_track_stream_get_info (BRASERO_TRACK_STREAM (track));
- info = brasero_stream_info_copy (info);
- brasero_track_stream_set_info (dest, info);
-
+ brasero_track_tag_copy_missing (BRASERO_TRACK (dest), track);
brasero_job_add_track (BRASERO_JOB (transcode), BRASERO_TRACK (dest));
/* It's good practice to unref the track afterwards as we don't need it
@@ -938,7 +926,6 @@
guint64 length = 0;
gchar *output = NULL;
BraseroTrackType type;
- BraseroStreamInfo *info;
BraseroTrack *src = NULL;
BraseroTrackStream *track;
@@ -947,9 +934,6 @@
brasero_track_stream_get_length (BRASERO_TRACK_STREAM (src), &length);
- info = brasero_track_stream_get_info (BRASERO_TRACK_STREAM (src));
- info = brasero_stream_info_copy (info);
-
brasero_job_get_output_type (BRASERO_JOB (transcode), &type);
track = brasero_track_stream_new ();
@@ -958,7 +942,7 @@
BRASERO_AUDIO_FORMAT_RAW|
BRASERO_AUDIO_FORMAT_44100);
brasero_track_stream_set_boundaries (track, 0, length, 0);
- brasero_track_stream_set_info (track, info);
+ brasero_track_tag_copy_missing (BRASERO_TRACK (track), src);
brasero_job_add_track (BRASERO_JOB (transcode), BRASERO_TRACK (track));
@@ -1250,28 +1234,54 @@
{
BraseroTrack *track;
BraseroJobAction action;
- BraseroStreamInfo *info;
brasero_job_get_action (BRASERO_JOB (transcode), &action);
brasero_job_get_current_track (BRASERO_JOB (transcode), &track);
- info = brasero_track_stream_get_info (BRASERO_TRACK_STREAM (track));
BRASERO_JOB_LOG (transcode, "Retrieving tags");
- if (info && !strcmp (tag, GST_TAG_TITLE)) {
- if (!info->title)
- gst_tag_list_get_string (list, tag, &(info->title));
- }
- else if (info && !strcmp (tag, GST_TAG_ARTIST)) {
- if (!info->artist)
- gst_tag_list_get_string (list, tag, &(info->artist));
- }
- else if (info && !strcmp (tag, GST_TAG_ISRC)) {
- gst_tag_list_get_int (list, tag, &(info->isrc));
- }
- else if (info && !strcmp (tag, GST_TAG_PERFORMER)) {
- if (!info->artist)
- gst_tag_list_get_string (list, tag, &(info->artist));
+ if (!strcmp (tag, GST_TAG_TITLE)) {
+ if (!brasero_track_tag_lookup_string (track, BRASERO_TRACK_STREAM_TITLE_TAG)) {
+ gchar *title = NULL;
+
+ gst_tag_list_get_string (list, tag, &title);
+ brasero_track_tag_add_string (track,
+ BRASERO_TRACK_STREAM_TITLE_TAG,
+ title);
+ g_free (title);
+ }
+ }
+ else if (!strcmp (tag, GST_TAG_ARTIST)) {
+ if (!brasero_track_tag_lookup_string (track, BRASERO_TRACK_STREAM_ARTIST_TAG)) {
+ gchar *artist = NULL;
+
+ gst_tag_list_get_string (list, tag, &artist);
+ brasero_track_tag_add_string (track,
+ BRASERO_TRACK_STREAM_ARTIST_TAG,
+ artist);
+ g_free (artist);
+ }
+ }
+ else if (!strcmp (tag, GST_TAG_ISRC)) {
+ if (!brasero_track_tag_lookup_int (track, BRASERO_TRACK_STREAM_ISRC_TAG)) {
+ gint isrc = 0;
+
+ gst_tag_list_get_int (list, tag, &isrc);
+ brasero_track_tag_add_int (track,
+ BRASERO_TRACK_STREAM_ARTIST_TAG,
+ isrc);
+ }
+ }
+ else if (!strcmp (tag, GST_TAG_PERFORMER)) {
+ if (!brasero_track_tag_lookup_string (track, BRASERO_TRACK_STREAM_ARTIST_TAG)) {
+ gchar *artist = NULL;
+
+ gst_tag_list_get_string (list, tag, &artist);
+ brasero_track_tag_add_string (track,
+ BRASERO_TRACK_STREAM_ARTIST_TAG,
+ artist);
+ g_free (artist);
+ }
}
else if (action == BRASERO_JOB_ACTION_SIZE
&& !strcmp (tag, GST_TAG_DURATION)) {
Modified: trunk/src/brasero-audio-disc.c
==============================================================================
--- trunk/src/brasero-audio-disc.c (original)
+++ trunk/src/brasero-audio-disc.c Thu Apr 2 20:14:21 2009
@@ -53,6 +53,8 @@
#include "brasero-session-cfg.h"
#include "eggtreemultidnd.h"
+#include "brasero-tags.h"
+
#ifdef BUILD_INOTIFY
#include "sys/inotify.h"
@@ -2057,7 +2059,6 @@
gint64 end;
gint64 start;
gint64 length;
- BraseroStreamInfo *info;
gtk_tree_model_get (model, &iter,
URI_COL, &uri,
@@ -2079,13 +2080,6 @@
continue;
}
- info = g_new0 (BraseroStreamInfo, 1);
-
- info->title = title;
- info->artist = artist;
- info->composer = composer;
- info->isrc = isrc;
-
track = brasero_track_stream_new ();
brasero_track_stream_set_source (track, uri);
brasero_track_stream_set_format (track,
@@ -2093,7 +2087,24 @@
BRASERO_METADATA_INFO);
brasero_track_stream_set_boundaries (track, start, end, -1);
- brasero_track_stream_set_info (track, info);
+
+ if (title)
+ brasero_track_tag_add_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_TITLE_TAG,
+ title);
+ if (artist)
+ brasero_track_tag_add_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_ARTIST_TAG,
+ artist);
+ if (composer)
+ brasero_track_tag_add_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_COMPOSER_TAG,
+ composer);
+ if (isrc)
+ brasero_track_tag_add_int (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_ISRC_TAG,
+ isrc);
+
brasero_burn_session_add_track (session, BRASERO_TRACK (track));
/* It's good practice to unref the track afterwards as we don't
Modified: trunk/src/brasero-project-parse.c
==============================================================================
--- trunk/src/brasero-project-parse.c (original)
+++ trunk/src/brasero-project-parse.c Thu Apr 2 20:14:21 2009
@@ -48,6 +48,36 @@
#include "brasero-track-stream.h"
#include "brasero-track-data.h"
+void
+brasero_stream_info_free (BraseroStreamInfo *info)
+{
+ if (!info)
+ return;
+
+ g_free (info->title);
+ g_free (info->artist);
+ g_free (info->composer);
+ g_free (info);
+}
+
+BraseroStreamInfo *
+brasero_stream_info_copy (BraseroStreamInfo *info)
+{
+ BraseroStreamInfo *copy;
+
+ if (!info)
+ return NULL;
+
+ copy = g_new0 (BraseroStreamInfo, 1);
+
+ copy->title = g_strdup (info->title);
+ copy->artist = g_strdup (info->artist);
+ copy->composer = g_strdup (info->composer);
+ copy->isrc = info->isrc;
+
+ return copy;
+}
+
static void
brasero_track_clear_song (gpointer data)
{
Modified: trunk/src/brasero-project-parse.h
==============================================================================
--- trunk/src/brasero-project-parse.h (original)
+++ trunk/src/brasero-project-parse.h Thu Apr 2 20:14:21 2009
@@ -43,6 +43,21 @@
BRASERO_PROJECT_TYPE_VIDEO
} BraseroProjectType;
+struct _BraseroStreamInfo {
+ gchar *title;
+ gchar *artist;
+ gchar *composer;
+ gint isrc;
+};
+
+typedef struct _BraseroStreamInfo BraseroStreamInfo;
+
+void
+brasero_stream_info_free (BraseroStreamInfo *info);
+
+BraseroStreamInfo *
+brasero_stream_info_copy (BraseroStreamInfo *info);
+
struct _BraseroDiscSong {
gchar *uri;
gint64 gap;
Modified: trunk/src/brasero-video-disc.c
==============================================================================
--- trunk/src/brasero-video-disc.c (original)
+++ trunk/src/brasero-video-disc.c Thu Apr 2 20:14:21 2009
@@ -32,6 +32,8 @@
#include "eggtreemultidnd.h"
+#include "brasero-tags.h"
+
#include "burn-debug.h"
#include "brasero-app.h"
#include "brasero-disc.h"
@@ -1376,7 +1378,16 @@
song->uri = brasero_track_stream_get_source (BRASERO_TRACK_STREAM (track), TRUE);
song->start = brasero_track_stream_get_start (BRASERO_TRACK_STREAM (track));
song->end = brasero_track_stream_get_end (BRASERO_TRACK_STREAM (track));
- song->info = brasero_stream_info_copy (brasero_track_stream_get_info (BRASERO_TRACK_STREAM (track)));
+
+ song->info = g_new0 (BraseroStreamInfo, 1);
+ song->info->artist = g_strdup (brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_ARTIST_TAG));
+ song->info->title = g_strdup (brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_TITLE_TAG));
+ song->info->composer = g_strdup (brasero_track_tag_lookup_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_COMPOSER_TAG));
+ song->info->isrc = brasero_track_tag_lookup_int (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_ISRC_TAG);
disc_track->contents.tracks = g_slist_append (disc_track->contents.tracks, song);
}
Modified: trunk/src/brasero-video-project.c
==============================================================================
--- trunk/src/brasero-video-project.c (original)
+++ trunk/src/brasero-video-project.c Thu Apr 2 20:14:21 2009
@@ -24,6 +24,8 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
+#include "brasero-tags.h"
+
#include "brasero-video-project.h"
#include "brasero-file-monitor.h"
#include "brasero-io.h"
@@ -982,32 +984,8 @@
return NULL;
for (file = priv->first; file; file = file->next) {
- BraseroStreamInfo *info = NULL;
BraseroTrackStream *track;
- if (file->info) {
- info = brasero_stream_info_copy (file->info);
-
- if (values_set) {
- if (!file->title_set) {
- g_free (info->title);
- info->title = NULL;
- }
- if (!file->artist_set) {
- g_free (info->artist);
- info->artist = NULL;
- }
- if (!file->composer_set) {
- g_free (info->composer);
- info->composer = NULL;
- }
- if (!file->isrc_set)
- info->isrc = 0;
- }
- }
- else
- info = NULL;
-
track = brasero_track_stream_new ();
brasero_track_stream_set_source (track, file->uri);
brasero_track_stream_set_format (track,
@@ -1025,7 +1003,27 @@
0,
-1);
- brasero_track_stream_set_info (track, info);
+ if (file->info && values_set) {
+ if (!file->title_set)
+ brasero_track_tag_add_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_TITLE_TAG,
+ file->info->title);
+
+ if (!file->artist_set)
+ brasero_track_tag_add_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_ARTIST_TAG,
+ file->info->artist);
+
+ if (!file->composer_set)
+ brasero_track_tag_add_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_COMPOSER_TAG,
+ file->info->composer);
+ if (!file->isrc_set)
+ brasero_track_tag_add_int (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_ISRC_TAG,
+ file->info->isrc);
+ }
+
tracks = g_slist_prepend (tracks, BRASERO_TRACK (track));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]