[gnac] Merged the audio part of gnac and gnac-video.



commit 1cbbf9fa04cb0ccf3807ac456434a3904d5ca275
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date:   Sun Sep 6 11:20:23 2009 +0200

    Merged the audio part of gnac and gnac-video.

 libgnac/libgnac-converter.c |   26 ++--
 libgnac/libgnac-gst.c       |  308 ++++++++++++++++++++++++++++++-------------
 libgnac/libgnac-gst.h       |   18 +++
 libgnac/libgnac-metadata.c  |   75 ++++++-----
 src/gnac-main.c             |   14 +-
 src/gnac-main.h             |    6 +-
 6 files changed, 296 insertions(+), 151 deletions(-)
---
diff --git a/libgnac/libgnac-converter.c b/libgnac/libgnac-converter.c
index c6aff01..92eef91 100644
--- a/libgnac/libgnac-converter.c
+++ b/libgnac/libgnac-converter.c
@@ -81,7 +81,7 @@ struct LibgnacConverterPrivate
   guint64               total_duration;
 
   gboolean              strip_special;
-  gchar                *pipeline_description;
+  gchar                *audio_description;
   gchar                *rename_pattern;
   gint                  folder_type;
   gchar                *folder_hierarchy;
@@ -122,7 +122,7 @@ libgnac_converter_init(LibgnacConverter *self)
   priv->total_duration = 0;
   priv->elapsed_duration = 0;
 
-  priv->pipeline_description = NULL;
+  priv->audio_description = NULL;
   priv->folder_path = NULL;
   priv->extension = NULL;
   priv->rename_pattern = NULL;
@@ -158,8 +158,8 @@ libgnac_converter_finalize(GObject *gobject)
 {
   LibgnacConverter *self = LIBGNAC_CONVERTER(gobject);
 
-  if (self->priv->pipeline_description) {
-    g_free(self->priv->pipeline_description);
+  if (self->priv->audio_description) {
+    g_free(self->priv->audio_description);
   }
 
   if (self->priv->extension) {
@@ -188,7 +188,7 @@ libgnac_converter_get_property(GObject    *object,
   switch (property_id) 
   {
     case PROP_PIPELINE_DESC:
-      g_value_set_string(value, self->priv->pipeline_description); 
+      g_value_set_string(value, self->priv->audio_description);
     break;
 
     case PROP_STRIP_SPECIAL:
@@ -238,9 +238,9 @@ libgnac_converter_set_property(GObject      *object,
   switch (property_id) 
   {
     case PROP_PIPELINE_DESC:
-      g_free(self->priv->pipeline_description);
-      self->priv->pipeline_description = NULL;
-      self->priv->pipeline_description = g_value_dup_string(value);
+      g_free(self->priv->audio_description);
+      self->priv->audio_description = NULL;
+      self->priv->audio_description = g_value_dup_string(value);
     break;
 
     case PROP_STRIP_SPECIAL:
@@ -309,9 +309,9 @@ libgnac_converter_class_init(LibgnacConverterClass *klass)
   gobject_class->get_property = libgnac_converter_get_property;
 
   /* Pipeline desc */
-  pspec = g_param_spec_string("pipeline-description",
-                              "Pipeline Description",
-                              "Pipeline output description",
+  pspec = g_param_spec_string("audio-description",
+                              "Audio pipeline description",
+                              "Audio pipeline description",
                               NULL,
                               G_PARAM_READWRITE);
 
@@ -978,7 +978,7 @@ libgnac_converter_error_cb(GstBus      *bus,
 
   gst_message_parse_error(message, &error, NULL);
 
-  if (g_str_equal("sink", name)) 
+  if (g_str_has_prefix(name, "giosink"))
   {
     if (g_error_matches(error, 
             GST_RESOURCE_ERROR, 
@@ -1040,7 +1040,7 @@ libgnac_converter_error_cb(GstBus      *bus,
                           _("Unable to access destination file"), error);
       }
     }
-  } else if (g_str_equal("source", name)) {
+  } else if (g_str_has_prefix(name, "giosrc")) {
     g_signal_emit(item->converter, signals[ERROR], 0, uri, 
                     _("Unable to read source file"), error);
   } else {
diff --git a/libgnac/libgnac-gst.c b/libgnac/libgnac-gst.c
index 314b6fe..3d6fe45 100644
--- a/libgnac/libgnac-gst.c
+++ b/libgnac/libgnac-gst.c
@@ -37,6 +37,9 @@
 #include "libgnac-gst.h"
 
 
+#define libgnac_gst_element_add_ghost_pad(element, pad, name) \
+    gst_element_add_pad(element, gst_ghost_pad_new(name, pad))
+
 void
 libgnac_gst_run(LibgnacConverterItem  *item, 
                 GError               **error)
@@ -69,28 +72,186 @@ libgnac_gst_stop(LibgnacConverterItem  *item,
 }
 
 
+GstElement *
+libgnac_gst_make_pipeline_element(GstElement   *bin,
+                                  const gchar  *element,
+                                  GError      **error)
+{
+  GstElement *elem;
+  elem = gst_element_factory_make(element, NULL);
+  if (!elem) {
+    libgnac_debug("Failed to create %s element", element);
+    g_set_error(error,
+        LIBGNAC_ERROR,
+        LIBGNAC_ERROR_MISSING_PLUGIN,
+        _("Failed to create %s element"),
+        element);
+    return NULL;
+  }
+
+  gst_bin_add(GST_BIN(bin), elem);
+  return elem;
+}
+
+
+GstElement *
+libgnac_gst_pipeline_new(GError **error)
+{
+  GstElement *pipeline;
+  pipeline = gst_pipeline_new("pipeline");
+  if (!pipeline) {
+    libgnac_debug("Pipeline creation failed");
+    g_set_error(error,
+        LIBGNAC_ERROR,
+        LIBGNAC_ERROR_PIPELINE_CREATION,
+        _("Unable to create pipeline"));
+    return NULL;
+  }
+
+  return pipeline;
+}
+
+
+gboolean
+libgnac_gst_element_link(GstElement  *src,
+                         GstElement  *dst,
+                         GError     **error)
+{
+  gboolean ret;
+  ret = gst_element_link(src, dst);
+  if (!ret) {
+    libgnac_debug("Failed to link element %s to %s",
+        gst_element_get_name(src), gst_element_get_name(dst));
+    g_set_error(error,
+        LIBGNAC_ERROR,
+        LIBGNAC_ERROR_PIPELINE_CREATION,
+        _("Unable to link element %s to %s"),
+        gst_element_get_name(src), gst_element_get_name(dst));
+  }
+
+  return ret;
+}
+
+
+GstPadLinkReturn
+libgnac_gst_pad_link(GstPad  *src,
+                     GstPad  *sink,
+                     GError **error)
+{
+  GstPadLinkReturn ret;
+  ret = gst_pad_link(src, sink);
+  if (ret != GST_PAD_LINK_OK) {
+    libgnac_debug("Failed to link pad %s to %s",
+        gst_pad_get_name(src), gst_pad_get_name(sink));
+    g_set_error(error,
+        LIBGNAC_ERROR,
+        LIBGNAC_ERROR_PIPELINE_CREATION,
+        _("Unable to link pad %s to %s"),
+        gst_pad_get_name(src), gst_pad_get_name(sink));
+  }
+
+  return ret;
+}
+
+
+static gboolean
+libgnac_gst_get_compatible_pad(GstElement   *element,
+                               GstPad       *pad,
+                               GstCaps      *caps,
+                               const gchar  *type)
+{
+  GstPad *sink_pad;
+  sink_pad = gst_element_get_compatible_pad(element, pad, caps);
+  if (!sink_pad) {
+    libgnac_debug("Unable to find a compatible %s pad "
+        "(sink_pad = %s, caps = %s\n)", type, gst_pad_get_name(pad),
+        gst_caps_to_string(caps));
+    gst_caps_unref(caps);
+    return FALSE;
+  }
+
+  libgnac_debug("%s: %s -> %s", type,
+      gst_pad_get_name(pad), gst_pad_get_name(sink_pad));
+
+  if (GST_PAD_IS_LINKED(sink_pad)) {
+    libgnac_debug("%s pad %s is already linked", type,
+        gst_pad_get_name(sink_pad));
+    g_object_unref(sink_pad);
+    gst_caps_unref(caps);
+    return FALSE;
+  }
+
+  g_return_val_if_fail(
+      libgnac_gst_pad_link(pad, sink_pad, NULL) == GST_PAD_LINK_OK,
+      FALSE);
+  g_object_unref(sink_pad);
+
+  return TRUE;
+}
+
+
+static GstElement *
+libgnac_gst_get_audio_bin(LibgnacConverterItem  *item,
+                          GError               **error)
+{
+  gchar      *descr;
+  GstElement *bin;
+  GstElement *conv;
+  GstElement *enc;
+  GstElement *rate;
+  GstElement *resample;
+  GstPad     *pad;
+
+  bin = gst_bin_new("audio_bin");
+
+  g_object_get(G_OBJECT(item->converter), "audio-description", &descr, NULL);
+
+  conv = libgnac_gst_make_pipeline_element(bin, "audioconvert", error);
+  g_return_val_if_fail(conv, NULL);
+
+  resample = libgnac_gst_make_pipeline_element(bin, "audioresample", error);
+  g_return_val_if_fail(resample, NULL);
+
+  rate = libgnac_gst_make_pipeline_element(bin, "audiorate", error);
+  g_return_val_if_fail(rate, NULL);
+
+  enc = gst_parse_bin_from_description(descr, TRUE, error);
+  g_free(descr);
+  g_return_val_if_fail(enc && gst_bin_add(GST_BIN(bin), enc), NULL);
+
+  g_return_val_if_fail(
+      gst_element_link_many(conv, resample, rate, enc, NULL),
+      NULL);
+
+  /* ghost pads */
+  pad = gst_element_get_static_pad(conv, "sink");
+  libgnac_gst_element_add_ghost_pad(bin, pad, "sink");
+  gst_object_unref(pad);
+
+  pad = gst_element_get_static_pad(enc, "src");
+  libgnac_gst_element_add_ghost_pad(bin, pad, "src");
+  gst_object_unref(pad);
+
+  return bin;
+}
+
+
 void
 libgnac_gst_build_pipeline(LibgnacConverterItem  *item, 
                            GError               **error)
 {
-  gchar      *description;
+  gboolean    linked;
   GError     *encoder_error = NULL; 
   GstElement *source = NULL;
   GstElement *decodebin;
   GstElement *sink = NULL;
-  GstElement *encoder;
+  GstElement *audio_bin;
 
   g_return_if_fail(!error || !*error);
 
-  item->pipeline = gst_pipeline_new("pipeline");
-  if (!item->pipeline) {
-    libgnac_debug("Pipeline creation failed");
-
-    g_set_error(error,  
-     LIBGNAC_ERROR, 
-     LIBGNAC_ERROR_PIPELINE_CREATION, 
-     _("Unable to create pipeline"));
-
+  item->pipeline = libgnac_gst_pipeline_new(&encoder_error);
+  if (encoder_error) {
+    g_propagate_error(error, encoder_error);
     return;
   }
 
@@ -104,73 +265,50 @@ libgnac_gst_build_pipeline(LibgnacConverterItem  *item,
   item->bus = gst_element_get_bus(GST_ELEMENT(item->pipeline));
   gst_bus_add_signal_watch(item->bus);
 
-  if (gst_element_factory_find("giosrc")) {
-    source = gst_element_factory_make("giosrc", "file-source");
-    g_object_set(G_OBJECT(source), "file", item->source, NULL);
-  } else {
-    libgnac_debug("Unable to find giosrc");
-
-    g_set_error(error,  
-     LIBGNAC_ERROR, 
-     LIBGNAC_ERROR_PIPELINE_CREATION, 
-     _("Unable to find %s"), "giosrc");
+  source = libgnac_gst_make_pipeline_element(item->pipeline, "giosrc",
+      &encoder_error);
+  if (encoder_error) {
+    g_propagate_error(error, encoder_error);
     return;
   }
-  if (!source) {
-    libgnac_debug("Source creation failed");
+  g_object_set(G_OBJECT(source), "file", item->source, NULL);
 
-    g_set_error(error,  
-     LIBGNAC_ERROR, 
-     LIBGNAC_ERROR_PIPELINE_CREATION, 
-     _("Unable to create source"));
+  decodebin = libgnac_gst_make_pipeline_element(item->pipeline, "decodebin",
+      &encoder_error);
+  if (encoder_error) {
+    g_propagate_error(error, encoder_error);
     return;
   }
 
-  decodebin = gst_element_factory_make("decodebin", "decodebin");
-  if (!decodebin) {
-    libgnac_debug("Decoder creation failed");
- 
-    g_set_error(error,  
-     LIBGNAC_ERROR, 
-     LIBGNAC_ERROR_PIPELINE_CREATION, 
-     _("Unable to create decoder"));
-
+  audio_bin = libgnac_gst_get_audio_bin(item, &encoder_error);
+  if (encoder_error) {
+    libgnac_debug("audio_bin creation failed");
+    g_propagate_error(error, encoder_error);
     return;
   }
 
-  g_object_get(G_OBJECT(item->converter), "pipeline-description", &description, NULL);
+  item->audio_encoder = audio_bin;
+  gst_bin_add(GST_BIN(item->pipeline), audio_bin);
 
-  description = g_strdup_printf("audioresample ! audioconvert ! %s", description);
-  encoder = gst_parse_bin_from_description(description, TRUE, &encoder_error);
-  g_free(description);
+  sink = libgnac_gst_make_pipeline_element(item->pipeline, "giosink",
+      &encoder_error);
   if (encoder_error) {
-    libgnac_debug("Encoder creation failed");
     g_propagate_error(error, encoder_error);
     return;
   }
+  g_object_set(G_OBJECT(sink), "file", item->destination, NULL);
 
-  item->audio_encoder = encoder;
-
-  if (gst_element_factory_find("giosink")) {
-    sink = gst_element_factory_make("giosink", "sink");
-    g_object_set(G_OBJECT(sink), "file", item->destination, NULL);
-  } else {
-    libgnac_debug("Unable to find giosink");
-
-    g_set_error(error,  
-     LIBGNAC_ERROR, 
-     LIBGNAC_ERROR_PIPELINE_CREATION, 
-     _("Unable to find %s"), "giosink");
+  linked = libgnac_gst_element_link(source, decodebin, &encoder_error);
+  if (encoder_error) {
+    libgnac_debug("link source->decodebin failed");
+    g_propagate_error(error, encoder_error);
     return;
   }
 
-  if (!sink) {
-    libgnac_debug("Sink creation failed");
-    g_set_error(error,  
-     LIBGNAC_ERROR, 
-     LIBGNAC_ERROR_PIPELINE_CREATION, 
-     _("Unable to create sink"));
-
+  linked = libgnac_gst_element_link(audio_bin, sink, &encoder_error);
+  if (encoder_error) {
+    libgnac_debug("link encoder->sink failed");
+    g_propagate_error(error, encoder_error);
     return;
   }
 
@@ -178,8 +316,6 @@ libgnac_gst_build_pipeline(LibgnacConverterItem  *item,
   
   g_signal_connect(G_OBJECT(item->bus), "message::element", 
       G_CALLBACK(libgnac_gst_element_cb), item);
-  /*g_signal_connect(G_OBJECT(bus), "message::tag", 
-      G_CALLBACK(libgnac_gst_tags_cb), item);*/
   g_signal_connect(G_OBJECT(item->bus), "message::eos", 
       G_CALLBACK(libgnac_gst_eos_cb), item);
   g_signal_connect(G_OBJECT(item->bus), "message::error", 
@@ -197,10 +333,6 @@ libgnac_gst_build_pipeline(LibgnacConverterItem  *item,
   g_signal_connect(G_OBJECT(item->bus), "message::eos", 
       G_CALLBACK(libgnac_converter_eos_cb), item);
 
-  gst_bin_add_many(GST_BIN(item->pipeline), source, decodebin, encoder, sink, NULL);
-  gst_element_link(source, decodebin);
-  gst_element_link(encoder, sink);
-
   gst_object_unref(item->bus);
 }
 
@@ -234,35 +366,25 @@ libgnac_gst_newpad_cb(GstElement *decodebin,
   item = (LibgnacConverterItem*)data;
 	caps = gst_pad_get_caps(pad);
 
-	/* we get "ANY" caps for text/plain files etc. */
 	if (gst_caps_is_empty(caps) || gst_caps_is_any(caps)) {
-    /* NON AUDIO FILE */
+    libgnac_debug("Got a bad caps: %s", gst_caps_to_string(caps));
+    gst_caps_unref(caps);
+    return;
+	}
+
+	structure = gst_caps_get_structure(caps, 0);
+	mimetype = gst_structure_get_name(structure);
+
+	if (g_str_has_prefix(mimetype, "audio/")) {
+	  if (!libgnac_gst_get_compatible_pad(item->audio_encoder, pad,
+        caps, "audio"))
+    {
+      return;
+    }
+	} else if (g_str_has_prefix(mimetype, "video/")) {
+    /* contains video data */
 	} else {
-		/* is this pad audio? */
-		structure = gst_caps_get_structure(caps, 0);
-		mimetype = gst_structure_get_name(structure);
-
-		if (g_str_has_prefix (mimetype, "audio/x-raw")) {
-      // contains audio data
-		  GstPad *sink_pad = NULL;
-		  sink_pad = gst_element_get_compatible_pad(item->audio_encoder, pad, caps);
-      if (GST_PAD_IS_LINKED(sink_pad)) {
-        g_object_unref(sink_pad);
-        return;
-      }
-
-      if (sink_pad) {
-		    gst_pad_link(pad, sink_pad);
-        g_object_unref(sink_pad);
-      } else {
-        libgnac_debug("Unable to find a compatible pad");
-      }
-
-		} else if (g_str_has_prefix(mimetype, "video/")) {
-      /* contains video data */
-		} else {
-      /* other, we have mimetype */
-		}
+    /* unhandled mimetype */
 	}
 
 	gst_caps_unref(caps);
diff --git a/libgnac/libgnac-gst.h b/libgnac/libgnac-gst.h
index 2d687e6..df99b03 100644
--- a/libgnac/libgnac-gst.h
+++ b/libgnac/libgnac-gst.h
@@ -58,6 +58,24 @@ libgnac_gst_build_pipeline(LibgnacConverterItem  *item,
 void
 libgnac_gst_clean_pipeline(LibgnacConverterItem *item);
 
+GstElement *
+libgnac_gst_make_pipeline_element(GstElement   *bin,
+                                  const gchar  *element,
+                                  GError      **error);
+
+GstPadLinkReturn
+libgnac_gst_pad_link(GstPad  *src,
+                     GstPad  *sink,
+                     GError **error);
+
+GstElement *
+libgnac_gst_pipeline_new(GError **error);
+
+gboolean
+libgnac_gst_element_link(GstElement  *src,
+                         GstElement  *dst,
+                         GError     **error);
+
 void
 libgnac_gst_newpad_cb(GstElement *decodebin,
                       GstPad     *pad,
diff --git a/libgnac/libgnac-metadata.c b/libgnac/libgnac-metadata.c
index b343eb5..cd5af07 100644
--- a/libgnac/libgnac-metadata.c
+++ b/libgnac/libgnac-metadata.c
@@ -37,6 +37,7 @@
 
 #include "libgnac-debug.h"
 #include "libgnac-error.h"
+#include "libgnac-gst.h"
 #include "libgnac-metadata.h"
 
 static LibgnacTags *dummy_tags;
@@ -430,7 +431,9 @@ libgnac_metadata_new_decoded_pad_cb(GstElement      *element,
     g_object_unref(sink_pad);
     return;
   }
-  gst_pad_link(pad, sink_pad);
+
+  g_return_if_fail(
+      libgnac_gst_pad_link(pad, sink_pad, NULL) == GST_PAD_LINK_OK);
 
   caps = gst_pad_get_caps(pad);
   if (gst_caps_is_empty(caps) || gst_caps_is_any(caps)) 
@@ -491,26 +494,6 @@ libgnac_metadata_autoplug_continue_cb(GstElement      *decodebin,
 }
 
 
-static GstElement *
-libgnac_metadata_make_pipeline_element(GstElement   *pipeline, 
-                                       const gchar  *element, 
-                                       GError      **error)
-{
-  GstElement *elem = gst_element_factory_make(element, element);
-  if (!elem) {
-    g_set_error(error, 
-           LIBGNAC_ERROR, 
-           LIBGNAC_ERROR_MISSING_PLUGIN, 
-           _("Failed to create %s element"), 
-           element);
-    return NULL;
-  }
-
-  gst_bin_add(GST_BIN(pipeline), elem);
-  return elem;
-}        
-
-
 static void
 libgnac_metadata_get_file_info(GFile *uri, LibgnacMetadata *md)
 {
@@ -564,6 +547,7 @@ libgnac_metadata_extract(LibgnacMetadata  *md,
   g_return_val_if_fail(uri, NULL);
 
   gchar       *string_uri;
+  GError      *metadata_error = NULL;
   LibgnacTags *tags = NULL;
   
   string_uri = g_file_get_uri(uri);
@@ -587,30 +571,48 @@ libgnac_metadata_extract(LibgnacMetadata  *md,
     /* store file-size, location and filename */
     libgnac_metadata_get_file_info(uri, md);
 
-    pipeline = gst_pipeline_new("pipeline");
-    g_return_val_if_fail(pipeline, NULL);
+    pipeline = libgnac_gst_pipeline_new(&metadata_error);
+    if (metadata_error) {
+      g_propagate_error(error, metadata_error);
+      return NULL;
+    }
 
-    source = libgnac_metadata_make_pipeline_element(pipeline, "giosrc", error);
-    g_return_val_if_fail(source, NULL);
+    source = libgnac_gst_make_pipeline_element(pipeline, "giosrc",
+        &metadata_error);
+    if (metadata_error) {
+      libgnac_debug("source creation failed");
+      g_propagate_error(error, metadata_error);
+      return NULL;
+    }
     g_object_set(G_OBJECT(source), "file", md->priv->uri, NULL);
 
-    decodebin = libgnac_metadata_make_pipeline_element(pipeline, "decodebin2", error);
-    g_return_val_if_fail(decodebin, NULL);
+    decodebin = libgnac_gst_make_pipeline_element(pipeline, "decodebin2",
+        &metadata_error);
+    if (metadata_error) {
+      g_propagate_error(error, metadata_error);
+      return NULL;
+    }
 
-    md->priv->sink = libgnac_metadata_make_pipeline_element(pipeline, "fakesink", error);
-    g_return_val_if_fail(md->priv->sink, NULL);
+    md->priv->sink = libgnac_gst_make_pipeline_element(pipeline, "fakesink",
+        &metadata_error);
+    if (metadata_error) {
+      g_propagate_error(error, metadata_error);
+      return NULL;
+    }
 
-    // XXX find out how to get rate/channels using decodebin instead of decodebin2...
     g_signal_connect(decodebin, "autoplug-continue", 
         G_CALLBACK(libgnac_metadata_autoplug_continue_cb), md);
     g_signal_connect_object(decodebin, "new-decoded-pad", 
         G_CALLBACK(libgnac_metadata_new_decoded_pad_cb), md, 0);
 
-    gst_element_link(source, decodebin);
+    g_return_val_if_fail(
+        libgnac_gst_element_link(source, decodebin, error),
+        FALSE);
     md->priv->pipeline = pipeline;
 
     bus = gst_element_get_bus(GST_ELEMENT(pipeline));
-    gst_bus_set_sync_handler(bus, (GstBusSyncHandler)libgnac_metadata_bus_sync_handler, md);
+    gst_bus_set_sync_handler(bus,
+        (GstBusSyncHandler)libgnac_metadata_bus_sync_handler, md);
     gst_object_unref(bus);
     GstStateChangeReturn state_return;
     gint timeout_cycle;
@@ -620,7 +622,8 @@ libgnac_metadata_extract(LibgnacMetadata  *md,
       if (state_return != GST_STATE_CHANGE_ASYNC || md->priv->eos) {
         break;
       }
-      state_return = gst_element_get_state(md->priv->pipeline, &current_state, NULL, GST_SECOND);
+      state_return = gst_element_get_state(md->priv->pipeline, &current_state,
+          NULL, GST_SECOND);
     }
 
     if ((state_return == GST_STATE_CHANGE_FAILURE) ||
@@ -649,14 +652,16 @@ libgnac_metadata_extract(LibgnacMetadata  *md,
     else if (state_return != GST_STATE_CHANGE_FAILURE) {
       GstBus *message_bus = gst_element_get_bus(md->priv->pipeline);
       if (message_bus) {
-        gst_bus_post(message_bus, gst_message_new_application(GST_OBJECT(md->priv->pipeline), NULL));
+        gst_bus_post(message_bus, gst_message_new_application(GST_OBJECT(
+            md->priv->pipeline), NULL));
         gst_object_unref(message_bus);
       }
       while (!md->priv->eos);
     }
     
     libgnac_metadata_destroy_pipeline(md);
-    g_hash_table_insert(md->priv->tags_table, g_strdup(string_uri), md->priv->metadata);
+    g_hash_table_insert(md->priv->tags_table, g_strdup(string_uri),
+        md->priv->metadata);
     tags = md->priv->metadata;
 
     // TODO We don't need to save anything in metadata anymore
diff --git a/src/gnac-main.c b/src/gnac-main.c
index 9025011..71cb670 100644
--- a/src/gnac-main.c
+++ b/src/gnac-main.c
@@ -621,7 +621,7 @@ static void
 gnac_file_chooser_file_activated_cb(GtkFileChooser *chooser,
                                     gpointer        user_data)
 {
-  gnac_file_chooser_response(GTK_DIALOG(chooser), GTK_RESPONSE_NONE, NULL); 
+  gnac_file_chooser_response_cb(GTK_DIALOG(chooser), GTK_RESPONSE_NONE, NULL);
 }
 
 
@@ -632,7 +632,7 @@ gnac_file_chooser_key_press_event_cb(GtkWidget   *widget,
 {
   if (event->type == GDK_KEY_PRESS && event->keyval == GDK_Return)
   {
-    gnac_file_chooser_response(GTK_DIALOG(widget), GTK_RESPONSE_NONE, NULL); 
+    gnac_file_chooser_response_cb(GTK_DIALOG(widget), GTK_RESPONSE_NONE, NULL);
     return TRUE;
   }
   return FALSE;
@@ -640,9 +640,9 @@ gnac_file_chooser_key_press_event_cb(GtkWidget   *widget,
 
 
 void
-gnac_file_chooser_response(GtkDialog *dialog, 
-                           gint       response, 
-                           gpointer   user_data)
+gnac_file_chooser_response_cb(GtkDialog *dialog,
+                              gint       response,
+                              gpointer   user_data)
 {
   GSList *list_path;
   GSList *list_files = NULL;
@@ -1006,7 +1006,7 @@ gnac_on_ui_convert_cb(GtkWidget *widget,
           "folder-hierarchy", folder_hierarchy,
           "folder-path", folder_path,
           "folder-type", gnac_gconf_get_int(GNAC_GCONF_FOLDER_TYPE), 
-          "pipeline-description", gnac_profiles_get_pipeline(),
+          "audio-description", gnac_profiles_get_pipeline(),
           "rename-pattern", rename_pattern,
           "strip-special", gnac_gconf_get_boolean(GNAC_GCONF_STRIP_SPECIAL),
           NULL);
@@ -1071,7 +1071,7 @@ gnac_on_ui_add_cb(GtkWidget *widget,
   gnac_add_filters(GTK_FILE_CHOOSER(file_chooser));
 
   g_signal_connect(file_chooser, "response", 
-                  G_CALLBACK(gnac_file_chooser_response), data);
+                  G_CALLBACK(gnac_file_chooser_response_cb), data);
   g_signal_connect(file_chooser, "key-press-event", 
                   G_CALLBACK(gnac_file_chooser_key_press_event_cb), data);
   g_signal_connect(file_chooser, "file-activated", 
diff --git a/src/gnac-main.h b/src/gnac-main.h
index 2e04e49..e76b215 100644
--- a/src/gnac-main.h
+++ b/src/gnac-main.h
@@ -102,8 +102,8 @@ gnac_on_file_monitor_changed_cb(GFileMonitor      *monitor,
                                 gpointer           user_data);
 
 void
-gnac_file_chooser_response(GtkDialog *dialog, 
-                           gint       response, 
-                           gpointer   user_data);
+gnac_file_chooser_response_cb(GtkDialog *dialog,
+                              gint       response,
+                              gpointer   user_data);
 
 #endif /* GNAC_MAIN_H */



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