[Goodies-commits] r5781 - xfburn/trunk/xfburn

David Mohr squisher at xfce.org
Fri Oct 24 01:14:56 CEST 2008


Author: squisher
Date: 2008-10-23 23:14:56 +0000 (Thu, 23 Oct 2008)
New Revision: 5781

Modified:
   xfburn/trunk/xfburn/xfburn-main.c
   xfburn/trunk/xfburn/xfburn-transcoder-gst.c
Log:
Adding command line option to switch between transcoders

Modified: xfburn/trunk/xfburn/xfburn-main.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-main.c	2008-10-23 19:47:33 UTC (rev 5780)
+++ xfburn/trunk/xfburn/xfburn-main.c	2008-10-23 23:14:56 UTC (rev 5781)
@@ -65,6 +65,7 @@
 static gboolean add_data_composition = FALSE;
 static gboolean add_audio_composition = FALSE;
 static gboolean blank = FALSE;
+static gchar *transcoder_selection = NULL;
 
 static GOptionEntry optionentries[] = {
   { "burn-image", 'i', G_OPTION_FLAG_OPTIONAL_ARG /* || G_OPTION_FLAG_FILENAME */, G_OPTION_ARG_CALLBACK, &parse_option, 
@@ -75,6 +76,8 @@
     "Start a data composition. Optionally followed by files/directories to be added to the composition.", NULL },
   { "audio-composition", 'a', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, &parse_option, 
     "Start an audio composition. Optionally followed by files/directories to be added to the composition.", NULL },
+  { "transcoder", 't', 0, G_OPTION_ARG_STRING, &transcoder_selection, 
+    "Select the transcoder. Run with --transcoder=list to see the available ones.", NULL },
   { "version", 'V', G_OPTION_FLAG_NO_ARG , G_OPTION_ARG_NONE, &show_version, 
     "Display program version and exit", NULL },
   { "main", 'm', G_OPTION_FLAG_NO_ARG , G_OPTION_ARG_NONE, &show_main, 
@@ -135,6 +138,16 @@
 }
 
 
+void
+print_available_transcoders ()
+{
+  g_print ("Valid transcoders are:\n");
+  g_print ("\tbasic\tCan only burn uncompressed CD quality .wav files.\n");
+#ifdef HAVE_GST
+  g_print ("\tgst\tUses gstreamer, and can burn all formats supported by it.\n");
+#endif
+}
+
 /* entry point */
 int
 main (int argc, char **argv)
@@ -207,7 +220,12 @@
     exit (EXIT_SUCCESS);
   }
 
+  if (strcmp (transcoder_selection, "list") == 0) {
+    print_available_transcoders();
+    return EXIT_SUCCESS;
+  }
 
+
   xfburn_settings_init ();
   
 #ifdef HAVE_THUNAR_VFS
@@ -298,11 +316,27 @@
     gtk_widget_destroy (GTK_WIDGET (dialog));
   }
 
+  if (!transcoder_selection) {
+    /* select the best available */
 #ifdef HAVE_GST
-  transcoder = XFBURN_TRANSCODER (xfburn_transcoder_gst_new ());
+    transcoder = XFBURN_TRANSCODER (xfburn_transcoder_gst_new ());
 #else
-  transcoder = XFBURN_TRANSCODER (xfburn_transcoder_basic_new ());
+    transcoder = XFBURN_TRANSCODER (xfburn_transcoder_basic_new ());
 #endif
+#ifdef HAVE_GST
+  } else if (strcmp (transcoder_selection, "gst") == 0) {
+    transcoder = XFBURN_TRANSCODER (xfburn_transcoder_gst_new ());
+#endif
+  } else if (strcmp (transcoder_selection, "basic") == 0) {
+    transcoder = XFBURN_TRANSCODER (xfburn_transcoder_basic_new ());
+  } else {
+    g_print ("'%s' is an invalid transcoder selection.\n",
+             transcoder_selection);
+    g_print ("\n");
+    print_available_transcoders();
+    return EXIT_FAILURE;
+  }
+
   if (!xfburn_transcoder_is_initialized (transcoder, &error)) {
     g_warning ("Failed to initialize %s transcoder: %s\n\t(falling back to basic implementation)", xfburn_transcoder_get_name (transcoder), error->message);
     g_error_free (error);

Modified: xfburn/trunk/xfburn/xfburn-transcoder-gst.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-transcoder-gst.c	2008-10-23 19:47:33 UTC (rev 5780)
+++ xfburn/trunk/xfburn/xfburn-transcoder-gst.c	2008-10-23 23:14:56 UTC (rev 5781)
@@ -403,7 +403,7 @@
       }
 
       secs = priv->duration / 1000000000;
-      DBG ("Length is %lldns = %ds = %lld bytes\n", priv->duration, secs, priv->duration * 176400 /1000000000);
+      //DBG ("Length is %lldns = %ds = %lld bytes\n", priv->duration, secs, priv->duration * 176400 /1000000000);
       if (gst_element_set_state (priv->pipeline, GST_STATE_READY) == GST_STATE_CHANGE_FAILURE) {
         DBG ("Failed to set state!");
       }




More information about the Goodies-commits mailing list