brasero r881 - in branches/video: . src src/plugins/gstreamer



Author: philippr
Date: Wed Jun 11 13:16:06 2008
New Revision: 881
URL: http://svn.gnome.org/viewvc/brasero?rev=881&view=rev

Log:
	Added support for options (reorganized visually) MP2, AC3, aspect ratio
	There\'s still a problem with framerate (video format)

	* src/brasero-disc-option-dialog.c
	(brasero_disc_option_dialog_AC3), (brasero_disc_option_dialog_MP2),
	(brasero_disc_option_dialog_set_tag),
	(brasero_disc_option_dialog_NTSC),
	(brasero_disc_option_dialog_PAL_SECAM),
	(brasero_disc_option_dialog_native_framerate),
	(brasero_disc_option_dialog_16_9),
	(brasero_disc_option_dialog_4_3),
	(brasero_disc_option_dialog_native_aspect),
	(brasero_disc_option_dialog_add_video_options):
	* src/burn-basics.h:
	* src/burn-session.c (brasero_burn_session_tag_remove):
	* src/burn-session.h:
	* src/plugins/gstreamer/burn-vob.c (brasero_vob_build_video_bin):


Modified:
   branches/video/ChangeLog
   branches/video/src/Makefile.am
   branches/video/src/brasero-disc-option-dialog.c
   branches/video/src/burn-basics.h
   branches/video/src/burn-session.c
   branches/video/src/burn-session.h
   branches/video/src/plugins/gstreamer/burn-vob.c

Modified: branches/video/src/Makefile.am
==============================================================================
--- branches/video/src/Makefile.am	(original)
+++ branches/video/src/Makefile.am	Wed Jun 11 13:16:06 2008
@@ -262,7 +262,7 @@
 	burn-volume-source.c         \
 	burn-volume-source.h         \
 	brasero-video-disc.c         \
-	brasero-video-disc.h
+	brasero-video-disc.h         
 
 if BUILD_INOTIFY
 brasero_SOURCES += brasero-file-monitor.c brasero-file-monitor.h

Modified: branches/video/src/brasero-disc-option-dialog.c
==============================================================================
--- branches/video/src/brasero-disc-option-dialog.c	(original)
+++ branches/video/src/brasero-disc-option-dialog.c	Wed Jun 11 13:16:06 2008
@@ -770,12 +770,172 @@
 }
 
 static void
+brasero_disc_option_dialog_AC3 (GtkToggleButton *button,
+				BraseroDiscOptionDialog *dialog)
+{
+	BraseroDiscOptionDialogPrivate *priv;
+	BraseroAudioFormat format;
+	GValue *value = NULL;
+
+	priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+
+	brasero_burn_session_tag_lookup (priv->session,
+					 BRASERO_AUDIO_VIDEO_OUTPUT_FORMAT,
+					 &value);
+
+	if (value)
+		format = g_value_get_int (value);
+	else
+		format = BRASERO_AUDIO_FORMAT_NONE;
+
+	if (gtk_toggle_button_get_active (button))
+		format |= BRASERO_AUDIO_FORMAT_AC3;
+	else
+		format &= ~BRASERO_AUDIO_FORMAT_AC3;
+
+	value = g_new0 (GValue, 1);
+	g_value_init (value, G_TYPE_INT);
+	g_value_set_int (value, format);
+	brasero_burn_session_tag_add (priv->session,
+				      BRASERO_AUDIO_VIDEO_OUTPUT_FORMAT,
+				      value);
+}
+
+static void
+brasero_disc_option_dialog_MP2 (GtkToggleButton *button,
+				BraseroDiscOptionDialog *dialog)
+{
+	BraseroDiscOptionDialogPrivate *priv;
+	BraseroAudioFormat format;
+	GValue *value = NULL;
+
+	priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+
+	brasero_burn_session_tag_lookup (priv->session,
+					 BRASERO_AUDIO_VIDEO_OUTPUT_FORMAT,
+					 &value);
+
+	if (value)
+		format = g_value_get_int (value);
+	else
+		format = BRASERO_AUDIO_FORMAT_NONE;
+
+	if (gtk_toggle_button_get_active (button))
+		format |= BRASERO_AUDIO_FORMAT_MP2;
+	else
+		format &= ~BRASERO_AUDIO_FORMAT_MP2;
+
+	value = g_new0 (GValue, 1);
+	g_value_init (value, G_TYPE_INT);
+	g_value_set_int (value, format);
+	brasero_burn_session_tag_add (priv->session,
+				      BRASERO_AUDIO_VIDEO_OUTPUT_FORMAT,
+				      value);
+}
+
+static void
+brasero_disc_option_dialog_set_tag (BraseroDiscOptionDialog *dialog,
+				    const gchar *tag,
+				    gint contents)
+{
+	BraseroDiscOptionDialogPrivate *priv;
+	GValue *value;
+
+	priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+
+	value = g_new0 (GValue, 1);
+	g_value_init (value, G_TYPE_INT);
+	g_value_set_int (value, contents);
+	brasero_burn_session_tag_add (priv->session,
+				      tag,
+				      value);
+}
+
+static void
+brasero_disc_option_dialog_NTSC (GtkToggleButton *button,
+				 BraseroDiscOptionDialog *dialog)
+{
+	if (!gtk_toggle_button_get_active (button))
+		return;
+
+	brasero_disc_option_dialog_set_tag (dialog,
+					    BRASERO_VIDEO_OUTPUT_FRAMERATE,
+					    BRASERO_VIDEO_FRAMERATE_NTSC);
+}
+
+static void
+brasero_disc_option_dialog_PAL_SECAM (GtkToggleButton *button,
+				      BraseroDiscOptionDialog *dialog)
+{
+	if (!gtk_toggle_button_get_active (button))
+		return;
+
+	brasero_disc_option_dialog_set_tag (dialog,
+					    BRASERO_VIDEO_OUTPUT_FRAMERATE,
+					    BRASERO_VIDEO_FRAMERATE_PAL_SECAM);
+}
+
+static void
+brasero_disc_option_dialog_native_framerate (GtkToggleButton *button,
+					     BraseroDiscOptionDialog *dialog)
+{
+	BraseroDiscOptionDialogPrivate *priv;
+
+	if (!gtk_toggle_button_get_active (button))
+		return;
+
+	priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+	brasero_burn_session_tag_remove (priv->session,
+					 BRASERO_VIDEO_OUTPUT_FRAMERATE);
+}
+
+static void
+brasero_disc_option_dialog_16_9 (GtkToggleButton *button,
+				 BraseroDiscOptionDialog *dialog)
+{
+	if (!gtk_toggle_button_get_active (button))
+		return;
+
+	brasero_disc_option_dialog_set_tag (dialog,
+					    BRASERO_VIDEO_OUTPUT_ASPECT,
+					    BRASERO_VIDEO_ASPECT_16_9);
+}
+
+static void
+brasero_disc_option_dialog_4_3 (GtkToggleButton *button,
+				BraseroDiscOptionDialog *dialog)
+{
+	if (!gtk_toggle_button_get_active (button))
+		return;
+
+	brasero_disc_option_dialog_set_tag (dialog,
+					    BRASERO_VIDEO_OUTPUT_ASPECT,
+					    BRASERO_VIDEO_ASPECT_4_3);
+}
+
+static void
+brasero_disc_option_dialog_native_aspect (GtkToggleButton *button,
+					     BraseroDiscOptionDialog *dialog)
+{
+	BraseroDiscOptionDialogPrivate *priv;
+
+	if (!gtk_toggle_button_get_active (button))
+		return;
+
+	priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+	brasero_burn_session_tag_remove (priv->session,
+					 BRASERO_VIDEO_OUTPUT_ASPECT);
+}
+
+static void
 brasero_disc_option_dialog_add_video_options (BraseroDiscOptionDialog *dialog)
 {
+	GtkWidget *label;
+	GtkWidget *table;
+	GtkWidget *widget;
 	GtkWidget *button1;
 	GtkWidget *button2;
 	GtkWidget *button3;
-	GtkWidget *widget;
 	GtkWidget *options;
 	BraseroDiscOptionDialogPrivate *priv;
 
@@ -788,34 +948,138 @@
 			  FALSE,
 			  6);
 
-	button1 = gtk_radio_button_new_with_mnemonic (NULL, _("_NTSC"));
+
+	table = gtk_table_new (2, 4, FALSE);
+	gtk_widget_show (table);
+
+	label = gtk_label_new (_("Video format:"));
+	gtk_widget_show (label);
+	gtk_table_attach (GTK_TABLE (table),
+			  label,
+			  0, 1,
+			  0, 1,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+
+	button1 = gtk_radio_button_new_with_mnemonic (NULL,
+						      _("_NTSC"));
 	gtk_widget_set_tooltip_text (button1, _("Format used mostly on the North American Continent"));
-	button2 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1), _("_PAL/SECAM"));
+	g_signal_connect (button1,
+			  "toggled",
+			  G_CALLBACK (brasero_disc_option_dialog_NTSC),
+			  dialog);
+	gtk_table_attach (GTK_TABLE (table),
+			  button1,
+			  3, 4,
+			  0, 1,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+
+	button2 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1),
+								  _("_PAL/SECAM"));
 	gtk_widget_set_tooltip_text (button2, _("Format used mostly in Europe"));
-	button3 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1), _("Native _format"));
-	options = brasero_utils_pack_properties (_("<b>Video format</b>"),
-						 button1,
-						 button2,
-						 button3,
-						 NULL);
-	gtk_box_pack_start (GTK_BOX (widget), options, FALSE, FALSE, 0);
+	g_signal_connect (button2,
+			  "toggled",
+			  G_CALLBACK (brasero_disc_option_dialog_PAL_SECAM),
+			  dialog);
+	gtk_table_attach (GTK_TABLE (table),
+			  button2,
+			  2, 3,
+			  0, 1,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+
+	button3 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1),
+								  _("Native _format"));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button3), TRUE);
+	g_signal_connect (button3,
+			  "toggled",
+			  G_CALLBACK (brasero_disc_option_dialog_native_framerate),
+			  dialog);
+	gtk_table_attach (GTK_TABLE (table),
+			  button3,
+			  1, 2,
+			  0, 1,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+
+	label = gtk_label_new (_("Aspect ratio:"));
+	gtk_widget_show (label);
+	gtk_table_attach (GTK_TABLE (table),
+			  label,
+			  0, 1,
+			  1, 2,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+
+	button1 = gtk_radio_button_new_with_mnemonic (NULL,
+						      _("_4:3"));
+	g_signal_connect (button1,
+			  "toggled",
+			  G_CALLBACK (brasero_disc_option_dialog_4_3),
+			  dialog);
+	gtk_table_attach (GTK_TABLE (table),
+			  button1,
+			  3, 4,
+			  1, 2,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+
+	button2 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1),
+								  _("_16:9"));
+	g_signal_connect (button2,
+			  "toggled",
+			  G_CALLBACK (brasero_disc_option_dialog_16_9),
+			  dialog);
+	gtk_table_attach (GTK_TABLE (table),
+			  button2,
+			  2, 3,
+			  1, 2,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+
+	button3 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1),
+								  _("Native aspect _ratio"));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button3), TRUE);
+	g_signal_connect (button3,
+			  "toggled",
+			  G_CALLBACK (brasero_disc_option_dialog_native_aspect),
+			  dialog);
+	gtk_table_attach (GTK_TABLE (table),
+			  button3,
+			  1, 2,
+			  1, 2,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
 
-	button1 = gtk_radio_button_new_with_mnemonic (NULL, _("_4:3"));
-	button2 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1), _("_16:9"));
-	button3 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1), _("Native aspect _ratio"));
-	options = brasero_utils_pack_properties (_("<b>Aspect ratio</b>"),
-						 button1,
-						 button2,
-						 button3,
+	options = brasero_utils_pack_properties (_("<b>Video Options</b>"),
+						 table,
 						 NULL);
 	gtk_box_pack_start (GTK_BOX (widget), options, FALSE, FALSE, 0);
 
-	button1 = gtk_check_button_new_with_mnemonic (_("_AC3"));
-	button2 = gtk_check_button_new_with_mnemonic (_("_MP2"));
-	options = brasero_utils_pack_properties (_("<b>Audio formats</b>"),
+	button1 = gtk_check_button_new_with_mnemonic (_("Add _AC3 audio stream"));
+	button2 = gtk_check_button_new_with_mnemonic (_("Add _MP2 audio stream"));
+	options = brasero_utils_pack_properties (_("<b>Audio Options</b>"),
 						 button1,
 						 button2,
 						 NULL);
+	g_signal_connect (button1,
+			  "clicked",
+			  G_CALLBACK (brasero_disc_option_dialog_AC3),
+			  dialog);
+	g_signal_connect (button2,
+			  "clicked",
+			  G_CALLBACK (brasero_disc_option_dialog_MP2),
+			  dialog);
+
 	gtk_box_pack_start (GTK_BOX (widget), options, FALSE, FALSE, 0);
 
 	gtk_widget_show_all (widget);

Modified: branches/video/src/burn-basics.h
==============================================================================
--- branches/video/src/burn-basics.h	(original)
+++ branches/video/src/burn-basics.h	Wed Jun 11 13:16:06 2008
@@ -185,6 +185,20 @@
  */
 
 #define BRASERO_AUDIO_VIDEO_OUTPUT_FORMAT	"audio-video-format"
+#define BRASERO_VIDEO_OUTPUT_FRAMERATE		"video-framerate"
+#define BRASERO_VIDEO_OUTPUT_ASPECT		"video-aspect"
+
+enum {
+	BRASERO_VIDEO_FRAMERATE_NATIVE,
+	BRASERO_VIDEO_FRAMERATE_NTSC,
+	BRASERO_VIDEO_FRAMERATE_PAL_SECAM
+};
+
+enum {
+	BRASERO_VIDEO_ASPECT_NATIVE,
+	BRASERO_VIDEO_ASPECT_4_3,
+	BRASERO_VIDEO_ASPECT_16_9
+};
 
 G_END_DECLS
 

Modified: branches/video/src/burn-session.c
==============================================================================
--- branches/video/src/burn-session.c	(original)
+++ branches/video/src/burn-session.c	Wed Jun 11 13:16:06 2008
@@ -1095,6 +1095,22 @@
 }
 
 BraseroBurnResult
+brasero_burn_session_tag_remove (BraseroBurnSession *self,
+				 const gchar *tag)
+{
+	BraseroBurnSessionPrivate *priv;
+
+	g_return_val_if_fail (BRASERO_IS_BURN_SESSION (self), BRASERO_BURN_ERR);
+
+	priv = BRASERO_BURN_SESSION_PRIVATE (self);
+	if (!priv->tags)
+		return BRASERO_BURN_ERR;
+
+	g_hash_table_remove (priv->tags, tag);
+	return BRASERO_BURN_OK;
+}
+
+BraseroBurnResult
 brasero_burn_session_tag_add (BraseroBurnSession *self,
 			      const gchar *tag,
 			      GValue *value)

Modified: branches/video/src/burn-session.h
==============================================================================
--- branches/video/src/burn-session.h	(original)
+++ branches/video/src/burn-session.h	Wed Jun 11 13:16:06 2008
@@ -104,6 +104,11 @@
 brasero_burn_session_tag_add (BraseroBurnSession *session,
 			      const gchar *tag,
 			      GValue *value);
+
+BraseroBurnResult
+brasero_burn_session_tag_remove (BraseroBurnSession *session,
+				 const gchar *tag);
+
 /**
  * 
  */

Modified: branches/video/src/plugins/gstreamer/burn-vob.c
==============================================================================
--- branches/video/src/plugins/gstreamer/burn-vob.c	(original)
+++ branches/video/src/plugins/gstreamer/burn-vob.c	Wed Jun 11 13:16:06 2008
@@ -486,13 +486,17 @@
 			     GstElement *muxer,
 			     GError **error)
 {
+	GValue *value;
 	GstPad *srcpad;
 	GstPad *sinkpad;
 	GstElement *queue;
+	GstElement *filter;
 	GstElement *encode;
 	GstPadLinkReturn res;
+	GstElement *framerate;
 	GstElement *colorspace;
 	BraseroVobPrivate *priv;
+	BraseroBurnResult result;
 
 	priv = BRASERO_VOB_PRIVATE (vob);
 
@@ -511,6 +515,60 @@
 		      "max-size-time", (gint64) 0,
 		      NULL);
 
+	framerate = gst_element_factory_make ("videorate", NULL);
+	if (framerate == NULL) {
+		g_set_error (error,
+			     BRASERO_BURN_ERROR,
+			     BRASERO_BURN_ERROR_GENERAL,
+			     _("framerate can't be created"));
+		goto error;
+	}
+	gst_bin_add (GST_BIN (priv->pipeline), framerate);
+	g_object_set (framerate,
+		      "silent", TRUE,
+		      NULL);
+
+	/* create a filter */
+	filter = gst_element_factory_make ("capsfilter", NULL);
+	if (filter == NULL) {
+		g_set_error (error,
+			     BRASERO_BURN_ERROR,
+			     BRASERO_BURN_ERROR_GENERAL,
+			     _("filter can't be created"));
+		goto error;
+	}
+	gst_bin_add (GST_BIN (priv->pipeline), filter);
+
+	value = NULL;
+	result = brasero_job_tag_lookup (BRASERO_JOB (vob),
+					 BRASERO_VIDEO_OUTPUT_FRAMERATE,
+					 &value);
+
+/*	if (result == BRASERO_BURN_OK && value) {
+		gint rate;
+		GstCaps *filtercaps;
+		GValue fraction = { 0 };
+
+		rate = g_value_get_int (value);
+		g_value_init (&fraction, GST_TYPE_FRACTION);
+
+		if (rate == BRASERO_VIDEO_FRAMERATE_NTSC)
+			gst_value_set_fraction (&fraction, 30, 1.001);
+		else if (rate == BRASERO_VIDEO_FRAMERATE_PAL_SECAM)
+			gst_value_set_fraction (&fraction, 25, 1);
+
+		filtercaps = gst_caps_new_full (gst_structure_new ("video/x-raw-yuv",
+								   "framerate", G_TYPE_VALUE, &fraction,
+								   NULL),
+						gst_structure_new ("video/x-raw-rgb",
+								   "framerate", G_TYPE_VALUE, &fraction,
+								   NULL),
+						NULL);
+		g_object_set (GST_OBJECT (filter), "caps", filtercaps, NULL);
+		gst_caps_unref (filtercaps);
+	}
+*/
+
 	colorspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
 	if (colorspace == NULL) {
 		g_set_error (error,
@@ -521,17 +579,37 @@
 	}
 	gst_bin_add (GST_BIN (priv->pipeline), colorspace);
 
-	encode = gst_element_factory_make ("ffenc_mpeg2video", NULL);
+	encode = gst_element_factory_make ("mpeg2enc", NULL);
 	if (encode == NULL) {
 		g_set_error (error,
 			     BRASERO_BURN_ERROR,
 			     BRASERO_BURN_ERROR_GENERAL,
-			     _("ffenc_mpeg2video can't be created"));
+			     _("mpeg2enc can't be created"));
 		goto error;
 	}
 	gst_bin_add (GST_BIN (priv->pipeline), encode);
 
-	gst_element_link_many (queue, colorspace, encode, NULL);
+	value = NULL;
+	result = brasero_job_tag_lookup (BRASERO_JOB (vob),
+					 BRASERO_VIDEO_OUTPUT_ASPECT,
+					 &value);
+	if (result == BRASERO_BURN_OK && value) {
+		gint aspect;
+
+		aspect = g_value_get_int (value);
+		if (aspect == BRASERO_VIDEO_ASPECT_4_3) {
+			g_object_set (encode,
+				      "aspect", 2,
+				      NULL);
+		}
+		else if (aspect == BRASERO_VIDEO_ASPECT_16_9) {
+			g_object_set (encode,
+				      "aspect", 3,
+				      NULL);	
+		}
+	}
+
+	gst_element_link_many (queue, framerate, colorspace, filter, encode, NULL);
 
 	srcpad = gst_element_get_static_pad (encode, "src");
 	sinkpad = gst_element_get_request_pad (muxer, "video_%d");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]