[brasero] Have BraseroBurnSessionCfg configure tags
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Have BraseroBurnSessionCfg configure tags
- Date: Mon, 24 Aug 2009 13:45:51 +0000 (UTC)
commit a386405f088ff76d1ca845b6c1310c5fcf899d34
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Wed Aug 19 14:51:33 2009 +0200
Have BraseroBurnSessionCfg configure tags
libbrasero-burn/brasero-dest-selection.c | 40 +--------------
libbrasero-burn/brasero-image-properties.c | 18 -------
libbrasero-burn/brasero-session-cfg.c | 77 +++++++++++++++++++++++++++-
libbrasero-burn/brasero-session.c | 5 ++-
libbrasero-burn/brasero-video-options.c | 10 ----
src/brasero-project.c | 12 ----
6 files changed, 82 insertions(+), 80 deletions(-)
---
diff --git a/libbrasero-burn/brasero-dest-selection.c b/libbrasero-burn/brasero-dest-selection.c
index 38ccb1c..5f456c7 100644
--- a/libbrasero-burn/brasero-dest-selection.c
+++ b/libbrasero-burn/brasero-dest-selection.c
@@ -127,7 +127,6 @@ brasero_dest_selection_output_changed (BraseroSessionCfg *session,
BraseroDestSelection *self)
{
BraseroDestSelectionPrivate *priv;
- BraseroTrackType *type;
BraseroMedium *medium;
BraseroDrive *burner;
@@ -140,43 +139,8 @@ brasero_dest_selection_output_changed (BraseroSessionCfg *session,
brasero_medium_selection_set_active (BRASERO_MEDIUM_SELECTION (self),
brasero_drive_get_medium (burner));
- if (!medium)
- return;
-
- /* Case for video project */
- type = brasero_track_type_new ();
- brasero_burn_session_get_input_type (priv->session, type);
-
- if (brasero_track_type_get_has_stream (type)
- && BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (type))) {
- BraseroMedia media;
-
- media = brasero_medium_get_status (medium);
- if (media & BRASERO_MEDIUM_DVD)
- brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (priv->session),
- BRASERO_DVD_STREAM_FORMAT,
- BRASERO_AUDIO_FORMAT_AC3);
- else if (media & BRASERO_MEDIUM_CD)
- brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (priv->session),
- BRASERO_DVD_STREAM_FORMAT,
- BRASERO_AUDIO_FORMAT_MP2);
- else {
- BraseroImageFormat format;
-
- format = brasero_burn_session_get_output_format (priv->session);
- if (format == BRASERO_IMAGE_FORMAT_CUE)
- brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (priv->session),
- BRASERO_DVD_STREAM_FORMAT,
- BRASERO_AUDIO_FORMAT_MP2);
- else
- brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (priv->session),
- BRASERO_DVD_STREAM_FORMAT,
- BRASERO_AUDIO_FORMAT_AC3);
- }
- }
-
- brasero_track_type_free (type);
- g_object_unref (medium);
+ if (medium)
+ g_object_unref (medium);
}
static void
diff --git a/libbrasero-burn/brasero-image-properties.c b/libbrasero-burn/brasero-image-properties.c
index 27ce749..d0c16d2 100644
--- a/libbrasero-burn/brasero-image-properties.c
+++ b/libbrasero-burn/brasero-image-properties.c
@@ -181,16 +181,7 @@ brasero_image_properties_format_changed_cb (BraseroImageTypeChooser *chooser,
brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (priv->session),
BRASERO_VCD_TYPE,
BRASERO_VCD_V2);
-
- /* This is for a (S)VCD set to MP2 */
- brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (priv->session),
- BRASERO_DVD_STREAM_FORMAT,
- BRASERO_AUDIO_FORMAT_MP2);
}
- else
- brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (priv->session),
- BRASERO_DVD_STREAM_FORMAT,
- BRASERO_AUDIO_FORMAT_AC3);
}
}
@@ -355,16 +346,7 @@ brasero_image_properties_response (GtkFileChooser *chooser,
brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (priv->session),
BRASERO_VCD_TYPE,
BRASERO_VCD_V2);
-
- /* This is a (S)VCD set to MP2 */
- brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (priv->session),
- BRASERO_DVD_STREAM_FORMAT,
- BRASERO_AUDIO_FORMAT_MP2);
}
- else
- brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (priv->session),
- BRASERO_DVD_STREAM_FORMAT,
- BRASERO_AUDIO_FORMAT_AC3);
}
}
diff --git a/libbrasero-burn/brasero-session-cfg.c b/libbrasero-burn/brasero-session-cfg.c
index 276c855..2708a60 100644
--- a/libbrasero-burn/brasero-session-cfg.c
+++ b/libbrasero-burn/brasero-session-cfg.c
@@ -90,6 +90,26 @@ G_DEFINE_TYPE (BraseroSessionCfg, brasero_session_cfg, BRASERO_TYPE_SESSION_SPAN
#define BRASERO_DRIVE_PROPERTIES_KEY "/apps/brasero/drives"
/**
+ * This is to handle tags (and more particularly video ones)
+ */
+
+static void
+brasero_session_cfg_tag_changed (BraseroBurnSession *session,
+ const gchar *tag,
+ gpointer NULL_data)
+{
+ if (!strcmp (tag, BRASERO_VCD_TYPE)) {
+ int svcd_type;
+
+ svcd_type = brasero_burn_session_tag_lookup_int (session, BRASERO_VCD_TYPE);
+ if (svcd_type != BRASERO_SVCD)
+ brasero_burn_session_tag_add_int (session,
+ BRASERO_VIDEO_OUTPUT_ASPECT,
+ BRASERO_VIDEO_ASPECT_4_3);
+ }
+}
+
+/**
* brasero_session_cfg_has_default_output_path:
* @cfg: a #BraseroSessionCfg
*
@@ -991,8 +1011,8 @@ brasero_session_cfg_update (BraseroSessionCfg *self,
0);
return;
}
- /* it can be empty with an empty track */
+ /* it can be empty with just an empty track */
if (brasero_track_type_get_has_medium (source)
&& brasero_track_type_get_medium_type (source) == BRASERO_MEDIUM_NONE) {
brasero_track_type_free (source);
@@ -1130,6 +1150,16 @@ brasero_session_cfg_update (BraseroSessionCfg *self,
return;
}
+ /* Special case for video projects */
+ if (brasero_track_type_get_has_stream (source)
+ && BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (source))) {
+ /* Only set if it was not already set */
+ if (brasero_burn_session_tag_lookup (BRASERO_BURN_SESSION (self), BRASERO_VCD_TYPE, NULL) != BRASERO_BURN_OK)
+ brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (self),
+ BRASERO_VCD_TYPE,
+ BRASERO_SVCD);
+ }
+
brasero_track_type_free (source);
/* Configure flags */
@@ -1263,11 +1293,46 @@ brasero_session_cfg_output_changed (BraseroBurnSession *session,
BraseroMedium *former)
{
BraseroSessionCfgPrivate *priv;
+ BraseroTrackType *type;
priv = BRASERO_SESSION_CFG_PRIVATE (session);
if (priv->disabled)
return;
+ /* Case for video project */
+ type = brasero_track_type_new ();
+ brasero_burn_session_get_input_type (session, type);
+
+ if (brasero_track_type_get_has_stream (type)
+ && BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (type))) {
+ BraseroMedia media;
+
+ media = brasero_burn_session_get_dest_media (session);
+ if (media & BRASERO_MEDIUM_DVD)
+ brasero_burn_session_tag_add_int (session,
+ BRASERO_DVD_STREAM_FORMAT,
+ BRASERO_AUDIO_FORMAT_AC3);
+ else if (media & BRASERO_MEDIUM_CD)
+ brasero_burn_session_tag_add_int (session,
+ BRASERO_DVD_STREAM_FORMAT,
+ BRASERO_AUDIO_FORMAT_MP2);
+ else {
+ BraseroImageFormat format;
+
+ format = brasero_burn_session_get_output_format (session);
+ if (format == BRASERO_IMAGE_FORMAT_CUE)
+ brasero_burn_session_tag_add_int (session,
+ BRASERO_DVD_STREAM_FORMAT,
+ BRASERO_AUDIO_FORMAT_MP2);
+ else
+ brasero_burn_session_tag_add_int (session,
+ BRASERO_DVD_STREAM_FORMAT,
+ BRASERO_AUDIO_FORMAT_AC3);
+ }
+ }
+
+ brasero_track_type_free (type);
+
brasero_session_cfg_save_drive_properties (BRASERO_SESSION_CFG (session),
former);
@@ -1447,6 +1512,12 @@ brasero_session_cfg_init (BraseroSessionCfg *object)
"caps-changed",
G_CALLBACK (brasero_session_cfg_caps_changed),
object);
+
+ /* FIXME: to be changed in the future */
+ g_signal_connect (object,
+ "tag-changed",
+ G_CALLBACK (brasero_session_cfg_tag_changed),
+ NULL);
}
static void
@@ -1459,6 +1530,10 @@ brasero_session_cfg_finalize (GObject *object)
priv = BRASERO_SESSION_CFG_PRIVATE (object);
+ g_signal_handlers_disconnect_by_func (object,
+ brasero_session_cfg_tag_changed,
+ NULL);
+
drive = brasero_burn_session_get_burner (BRASERO_BURN_SESSION (object));
if (drive && brasero_drive_get_medium (drive))
brasero_session_cfg_save_drive_properties (BRASERO_SESSION_CFG (object),
diff --git a/libbrasero-burn/brasero-session.c b/libbrasero-burn/brasero-session.c
index 7a83e4e..c5ad95f 100644
--- a/libbrasero-burn/brasero-session.c
+++ b/libbrasero-burn/brasero-session.c
@@ -1687,7 +1687,10 @@ brasero_burn_session_tag_lookup (BraseroBurnSession *self,
if (!data)
return BRASERO_BURN_ERR;
- *value = data;
+ /* value can be NULL if the function was just called
+ * to check whether a tag was set. */
+ if (value)
+ *value = data;
return BRASERO_BURN_OK;
}
diff --git a/libbrasero-burn/brasero-video-options.c b/libbrasero-burn/brasero-video-options.c
index 4b9502b..47a5636 100644
--- a/libbrasero-burn/brasero-video-options.c
+++ b/libbrasero-burn/brasero-video-options.c
@@ -572,16 +572,6 @@ brasero_video_options_init (BraseroVideoOptions *object)
gtk_widget_show_all (widget);
gtk_container_add (GTK_CONTAINER (object), widget);
-
- if (priv->session) {
- /* Just to make sure our tags are correct in BraseroBurnSession */
- brasero_burn_session_tag_add_int (priv->session,
- BRASERO_VCD_TYPE,
- BRASERO_SVCD);
- brasero_burn_session_tag_add_int (priv->session,
- BRASERO_VIDEO_OUTPUT_ASPECT,
- BRASERO_VIDEO_ASPECT_4_3);
- }
}
static void
diff --git a/src/brasero-project.c b/src/brasero-project.c
index 7530593..4228566 100644
--- a/src/brasero-project.c
+++ b/src/brasero-project.c
@@ -1485,18 +1485,6 @@ brasero_project_burn (BraseroProject *project)
{
gboolean res = FALSE;
BraseroDisc *current_disc;
- BraseroTrackType *track_type;
-
- track_type = brasero_track_type_new ();
-
- brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (project->priv->session), track_type);
- if (brasero_track_type_get_has_stream (track_type)
- && BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (track_type)))
- brasero_burn_session_tag_add_int (BRASERO_BURN_SESSION (project->priv->session),
- BRASERO_VCD_TYPE,
- BRASERO_SVCD);
-
- brasero_track_type_free (track_type);
if (!brasero_burn_session_is_dest_file (BRASERO_BURN_SESSION (project->priv->session)))
res = brasero_project_drive_properties (project);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]