[Xfce4-commits] <parole:master> Language strings in subtitles and audio.

Sean Davis noreply at xfce.org
Sat Jan 26 14:26:01 CET 2013


Updating branch refs/heads/master
         to 10c521fee81359d94de7b55df55ec6b5486fe575 (commit)
       from 4eb3880ccfbe058272f74e7a2b45a2e52e6bf976 (commit)

commit 10c521fee81359d94de7b55df55ec6b5486fe575
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sat Jan 26 08:14:28 2013 -0500

    Language strings in subtitles and audio.

 src/gst/parole-gst.c           |  158 ++++++++++++++++++++--------------------
 src/parole-subtitle-encoding.c |    4 +-
 2 files changed, 82 insertions(+), 80 deletions(-)

diff --git a/src/gst/parole-gst.c b/src/gst/parole-gst.c
index ecb416c..d5cfe2a 100644
--- a/src/gst/parole-gst.c
+++ b/src/gst/parole-gst.c
@@ -2779,93 +2779,95 @@ parole_gst_set_cursor_visible (ParoleGst *gst, gboolean visible)
 GList *
 gst_get_lang_list_for_type (ParoleGst * gst, const gchar * type_name)
 {
-  GList *ret = NULL;
-  gint num = 1;
+    GList *ret = NULL;
+    gint num = 1;
 
-  if (g_str_equal (type_name, "AUDIO")) {
-    gint i, n;
+    if (g_str_equal (type_name, "AUDIO")) {
+        gint i, n;
 
-    g_object_get (G_OBJECT (gst->priv->playbin), "n-audio", &n, NULL);
-    if (n == 0)
-      return NULL;
-
-    for (i = 0; i < n; i++) {
-      GstTagList *tags = NULL;
-
-      g_signal_emit_by_name (G_OBJECT (gst->priv->playbin), "get-audio-tags",
-          i, &tags);
-
-      if (tags) {
-        gchar *lc = NULL, *cd = NULL;
-
-	gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &lc);
-	gst_tag_list_get_string (tags, GST_TAG_CODEC, &lc);
-
-        if (lc) {
-	  ret = g_list_prepend (ret, lc);
-	  g_free (cd);
-	} else if (cd) {
-	  ret = g_list_prepend (ret, cd);
-	} else {
-	  ret = g_list_prepend (ret, g_strdup_printf (_("Audio Track #%d"), num++));
-	}
-	gst_tag_list_free (tags);
-      } else {
-	ret = g_list_prepend (ret, g_strdup_printf (_("Audio Track #%d"), num++));
-      }
-    }
-  } else if (g_str_equal (type_name, "TEXT")) {
-    gint i, n = 0;
-
-    g_object_get (G_OBJECT (gst->priv->playbin), "n-text", &n, NULL);
-    
-    if (n == 0 && gst->priv->use_custom_subtitles == FALSE)
-      return NULL;
-      
-    if ( gst->priv->use_custom_subtitles == TRUE )
-        n--;
+        g_object_get (G_OBJECT (gst->priv->playbin), "n-audio", &n, NULL);
+        if (n == 0)
+            return NULL;
 
-    if (n != 0)
-    {
         for (i = 0; i < n; i++) {
-          GstTagList *tags = NULL;
-
-          g_signal_emit_by_name (G_OBJECT (gst->priv->playbin), "get-text-tags",
-              i, &tags);
+            GstTagList *tags = NULL;
+
+            g_signal_emit_by_name (G_OBJECT (gst->priv->playbin), "get-audio-tags",
+                i, &tags);
+
+            if (tags) {
+                gchar *lc = NULL, *cd = NULL;
+
+                gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &lc);
+                gst_tag_list_get_string (tags, GST_TAG_CODEC, &cd);
+
+                if (lc) {
+                    lc = g_strdup(gst_tag_get_language_name(lc));
+                    ret = g_list_prepend (ret, lc);
+                    g_free (cd);
+                } else if (cd) {
+                    ret = g_list_prepend (ret, cd);
+                } else {
+                    ret = g_list_prepend (ret, g_strdup_printf (_("Audio Track #%d"), num++));
+                }
+                gst_tag_list_free (tags);
+            } else {
+                ret = g_list_prepend (ret, g_strdup_printf (_("Audio Track #%d"), num++));
+            }
+        }
+    } else if (g_str_equal (type_name, "TEXT")) {
+        gint i, n = 0;
 
-          if (tags) {
-            gchar *lc = NULL, *cd = NULL;
+        g_object_get (G_OBJECT (gst->priv->playbin), "n-text", &n, NULL);
+        
+        if (n == 0 && gst->priv->use_custom_subtitles == FALSE)
+            return NULL;
+          
+        if ( gst->priv->use_custom_subtitles == TRUE )
+            n--;
 
-	    gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &lc);
-	    gst_tag_list_get_string (tags, GST_TAG_CODEC, &lc);
-	
-            if (lc) {
-	      ret = g_list_prepend (ret, lc);
-	      g_free (cd);
-	    } else if (cd) {
-	      ret = g_list_prepend (ret, cd);
-	    } else {
-	      ret = g_list_prepend (ret, g_strdup_printf (_("Subtitle #%d"), num++));
-	    }
-	    gst_tag_list_free (tags);
-          } else {
-	    ret = g_list_prepend (ret, g_strdup_printf (_("Subtitle #%d"), num++));
-          }
+        if (n != 0)
+        {
+            for (i = 0; i < n; i++) {
+                GstTagList *tags = NULL;
+
+                g_signal_emit_by_name (G_OBJECT (gst->priv->playbin), "get-text-tags",
+                    i, &tags);
+
+                if (tags) {
+                    gchar *lc = NULL, *cd = NULL;
+
+                gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &lc);
+                gst_tag_list_get_string (tags, GST_TAG_CODEC, &lc);
+
+                if (lc) {
+                    lc = g_strdup(gst_tag_get_language_name(lc));
+                    ret = g_list_prepend (ret, lc);
+                    g_free (cd);
+                } else if (cd) {
+                    ret = g_list_prepend (ret, cd);
+                } else {
+                    ret = g_list_prepend (ret, g_strdup_printf (_("Subtitle #%d"), num++));
+                }
+                    gst_tag_list_free (tags);
+                } else {
+                    ret = g_list_prepend (ret, g_strdup_printf (_("Subtitle #%d"), num++));
+                }
+            }
         }
+        
+        ret = g_list_reverse (ret);
+        
+        if ( gst->priv->use_custom_subtitles == TRUE )
+        {
+            ret = g_list_prepend (ret, g_strdup_printf("%s",gst->priv->custom_subtitles));
+        }
+    } else {
+        g_critical ("Invalid stream type '%s'", type_name);
+        return NULL;
     }
-    
-    ret = g_list_reverse (ret);
-    
-    if ( gst->priv->use_custom_subtitles == TRUE )
-    {
-        ret = g_list_prepend (ret, g_strdup_printf("%s",gst->priv->custom_subtitles));
-    }
-  } else {
-    g_critical ("Invalid stream type '%s'", type_name);
-    return NULL;
-  }
 
-  return ret;
+    return ret;
 }
 
 gboolean
diff --git a/src/parole-subtitle-encoding.c b/src/parole-subtitle-encoding.c
index 5a74896..f2d5486 100644
--- a/src/parole-subtitle-encoding.c
+++ b/src/parole-subtitle-encoding.c
@@ -155,7 +155,7 @@ typedef struct
 {
   int index;
   const char *charset;
-  char *name;
+  const char *name;
 } SubtitleEncoding;
 
 
@@ -451,7 +451,7 @@ subtitle_encoding_create_store (void)
 
   for (i = 0; i < SUBTITLE_ENCODING_LAST; i++) {
     if (strcmp (lastlang, encodings[i].name)) {
-      lastlang = encodings[i].name;
+      lastlang = g_strdup(encodings[i].name);
       gtk_tree_store_append (store, &iter, NULL);
       gtk_tree_store_set (store, &iter, INDEX_COL,
           -1, NAME_COL, lastlang, -1);


More information about the Xfce4-commits mailing list