gst/matroska/: Add some more tags, improve debugging a bit and make sure that
authorSebastian Dröge <slomo@circular-chaos.org>
Wed, 11 Jun 2008 11:18:23 +0000 (11:18 +0000)
committerSebastian Dröge <slomo@circular-chaos.org>
Wed, 11 Jun 2008 11:18:23 +0000 (11:18 +0000)
Original commit message from CVS:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_parse_metadata_id_simple_tag):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_write_simple_tag):
Add some more tags, improve debugging a bit and make sure that
GValue transformation has succeeded before using the result
as a tag.

ChangeLog
gst/matroska/matroska-demux.c
gst/matroska/matroska-ids.h
gst/matroska/matroska-mux.c

index 64e55f41232b41fc5a03015c996712045036714e..493dfeffe7e486ae7e23cefb26b776e81026ed75 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-06-11  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst/matroska/matroska-demux.c:
+       (gst_matroska_demux_parse_metadata_id_simple_tag):
+       * gst/matroska/matroska-ids.h:
+       * gst/matroska/matroska-mux.c: (gst_matroska_mux_write_simple_tag):
+       Add some more tags, improve debugging a bit and make sure that
+       GValue transformation has succeeded before using the result
+       as a tag.
+
 2008-06-11  Sebastian Dröge  <slomo@circular-chaos.org>
 
        Patch by: Olivier Crete <tester at tester dot ca>
index 7b4933cfdc6a3937a9337b5620adc75e5ce9ce12..1f1456fa3f5625bb57e16f16a4d964412fe2e553 100644 (file)
@@ -2168,10 +2168,16 @@ gst_matroska_demux_parse_metadata_id_simple_tag (GstMatroskaDemux * demux,
     GST_MATROSKA_TAG_ID_ALBUM, GST_TAG_ALBUM}, {
     GST_MATROSKA_TAG_ID_COMMENTS, GST_TAG_COMMENT}, {
     GST_MATROSKA_TAG_ID_BITSPS, GST_TAG_BITRATE}, {
+    GST_MATROSKA_TAG_ID_BPS, GST_TAG_BITRATE}, {
     GST_MATROSKA_TAG_ID_ENCODER, GST_TAG_ENCODER}, {
     GST_MATROSKA_TAG_ID_DATE, GST_TAG_DATE}, {
     GST_MATROSKA_TAG_ID_ISRC, GST_TAG_ISRC}, {
-    GST_MATROSKA_TAG_ID_COPYRIGHT, GST_TAG_COPYRIGHT}
+    GST_MATROSKA_TAG_ID_COPYRIGHT, GST_TAG_COPYRIGHT}, {
+    GST_MATROSKA_TAG_ID_BPM, GST_TAG_BEATS_PER_MINUTE}, {
+    GST_MATROSKA_TAG_ID_TERMS_OF_USE, GST_TAG_LICENSE}, {
+    GST_MATROSKA_TAG_ID_COMPOSER, GST_TAG_COMPOSER}, {
+    GST_MATROSKA_TAG_ID_LEAD_PERFORMER, GST_TAG_PERFORMER}, {
+    GST_MATROSKA_TAG_ID_GENRE, GST_TAG_GENRE}
   };
   GstEbmlRead *ebml = GST_EBML_READ (demux);
 
@@ -2246,9 +2252,13 @@ gst_matroska_demux_parse_metadata_id_simple_tag (GstMatroskaDemux * demux,
         g_value_init (&src, G_TYPE_STRING);
         g_value_set_string (&src, value);
         g_value_init (&dest, dest_type);
-        if (g_value_transform (&src, &dest))
+        if (g_value_transform (&src, &dest)) {
           gst_tag_list_add_values (*p_taglist, GST_TAG_MERGE_APPEND,
               tagname_gst, &dest, NULL);
+        } else {
+          GST_WARNING_OBJECT (demux, "Can't transform tag '%s' with"
+              "value '%s' to target type", tag, value);
+        }
         g_value_unset (&src);
         g_value_unset (&dest);
         break;
index b95111a85722a5669fd5d4c3470e14697ee9d669..a09d56656dfcb6c6dfb8250b877340bf112a4ffb 100644 (file)
  * Matroska tags. Strings.
  */
 
-/* TODO: check for other tags */
-
 #define GST_MATROSKA_TAG_ID_TITLE    "TITLE"
 #define GST_MATROSKA_TAG_ID_AUTHOR   "AUTHOR"
 #define GST_MATROSKA_TAG_ID_ALBUM    "ALBUM"
 #define GST_MATROSKA_TAG_ID_COMMENTS "COMMENTS"
 #define GST_MATROSKA_TAG_ID_BITSPS   "BITSPS"
+#define GST_MATROSKA_TAG_ID_BPS      "BPS"
 #define GST_MATROSKA_TAG_ID_ENCODER  "ENCODER"
 #define GST_MATROSKA_TAG_ID_DATE     "DATE"
 #define GST_MATROSKA_TAG_ID_ISRC     "ISRC"
 #define GST_MATROSKA_TAG_ID_COPYRIGHT "COPYRIGHT"
+#define GST_MATROSKA_TAG_ID_BPM       "BPM"
+#define GST_MATROSKA_TAG_ID_TERMS_OF_USE "TERMS_OF_USE"
+#define GST_MATROSKA_TAG_ID_DATE      "DATE"
+#define GST_MATROSKA_TAG_ID_COMPOSER  "COMPOSER"
+#define GST_MATROSKA_TAG_ID_LEAD_PERFORMER  "LEAD_PERFOMER"
+#define GST_MATROSKA_TAG_ID_GENRE     "GENRE"
 
 /*
  * TODO: add this tag & mappings
- * "URL" -> GST_TAG_LOCATION
- * "BPS" -> GST_TAG_BITRATE
- * "BPM" -> GST_TAG_BEATS_PER_MINUTE
  * "REPLAYGAIN_GAIN" -> GST_TAG_*_GAIN   see http://replaygain.hydrogenaudio.org/rg_data_format.html
  * "REPLAYGAIN_PEAK" -> GST_TAG_*_PEAK   see http://replaygain.hydrogenaudio.org/peak_data_format.html
- * "TERMS_OF_USE" -> GST_TAG_LICENSE
- * "DATE_RECORDED" -> GST_TAG_DATE
- * "COMPOSER" -> GST_TAG_COMPOSER
- * "LEAD_PERFORMER" -> GST_TAG_PERFORMER
- * "GENRE" -> GST_TAG_GENRE
+ * both are depending on the target (track, album?)
  *
  * "TOTAL_PARTS" -> GST_TAG_TRACK_COUNT    depending on target
  * "PART_NUMBER" -> GST_TAG_TRACK_NUMBER   depending on target
  *
- * "EMAIL"       ->
- * "ADDRESS"     ->
- * "FAX"         ->  GST_TAG_CONTACT
- * "PHONE"       ->
+ * "SORT_WITH" -> nested in other elements, GST_TAG_TITLE_SORTNAME, etc
+ *
+ * TODO: maybe add custom gstreamer tags for other standard matroska tags,
+ * see http://matroska.org/technical/specs/tagging/index.html
  *
- * TODO: maybe add custom gstreamer tags for other standard matroska tags
+ * TODO: handle tag targets and nesting correctly
  */
 
 /*
index d41ba0ad32bf816fb87b52bf2441b5059453f4c4..7715402ff23510ed6b78bf26b8d619bfb86177d9 100644 (file)
@@ -1519,10 +1519,18 @@ gst_matroska_mux_write_simple_tag (const GstTagList * list, const gchar * tag,
     GST_MATROSKA_TAG_ID_ALBUM, GST_TAG_ALBUM}, {
     GST_MATROSKA_TAG_ID_COMMENTS, GST_TAG_COMMENT}, {
     GST_MATROSKA_TAG_ID_BITSPS, GST_TAG_BITRATE}, {
+    GST_MATROSKA_TAG_ID_BPS, GST_TAG_BITRATE}, {
+    GST_MATROSKA_TAG_ID_ENCODER, GST_TAG_ENCODER}, {
     GST_MATROSKA_TAG_ID_DATE, GST_TAG_DATE}, {
     GST_MATROSKA_TAG_ID_ISRC, GST_TAG_ISRC}, {
-    GST_MATROSKA_TAG_ID_COPYRIGHT, GST_TAG_COPYRIGHT}
+    GST_MATROSKA_TAG_ID_COPYRIGHT, GST_TAG_COPYRIGHT}, {
+    GST_MATROSKA_TAG_ID_BPM, GST_TAG_BEATS_PER_MINUTE}, {
+    GST_MATROSKA_TAG_ID_TERMS_OF_USE, GST_TAG_LICENSE}, {
+    GST_MATROSKA_TAG_ID_COMPOSER, GST_TAG_COMPOSER}, {
+    GST_MATROSKA_TAG_ID_LEAD_PERFORMER, GST_TAG_PERFORMER}, {
+    GST_MATROSKA_TAG_ID_GENRE, GST_TAG_GENRE}
   };
+
   GstEbmlWrite *ebml = (GstEbmlWrite *) data;
 
   guint i;
@@ -1541,15 +1549,18 @@ gst_matroska_mux_write_simple_tag (const GstTagList * list, const gchar * tag,
       if (!gst_tag_list_copy_value (&src, list, tag))
         break;
       g_value_init (&dest, G_TYPE_STRING);
-      g_value_transform (&src, &dest);
+      if (g_value_transform (&src, &dest)) {
+
+        simpletag_master = gst_ebml_write_master_start (ebml,
+            GST_MATROSKA_ID_SIMPLETAG);
+        gst_ebml_write_ascii (ebml, GST_MATROSKA_ID_TAGNAME, tagname_mkv);
+        gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_TAGSTRING,
+            g_value_get_string (&dest));
+        gst_ebml_write_master_finish (ebml, simpletag_master);
+      } else {
+        GST_WARNING ("Can't transform tag '%s' to string", tagname_mkv);
+      }
       g_value_unset (&src);
-
-      simpletag_master = gst_ebml_write_master_start (ebml,
-          GST_MATROSKA_ID_SIMPLETAG);
-      gst_ebml_write_ascii (ebml, GST_MATROSKA_ID_TAGNAME, tagname_mkv);
-      gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_TAGSTRING,
-          g_value_get_string (&dest));
-      gst_ebml_write_master_finish (ebml, simpletag_master);
       g_value_unset (&dest);
       break;
     }