id3v2tag->addFrame (frame);
}
+static void
+add_bpm_tag (ID3v2::Tag * id3v2tag, const GstTagList * list,
+ const gchar * tag, guint num_tags, const gchar * frame_id)
+{
+ gdouble bpm;
+
+ if (gst_tag_list_get_double_index (list, tag, 0, &bpm)) {
+ ID3v2::TextIdentificationFrame * frame;
+ gchar *tag_str;
+
+ tag_str = g_strdup_printf ("%u", (guint)bpm);
+
+ GST_DEBUG ("Setting %s to %s", tag, tag_str);
+ frame = new ID3v2::TextIdentificationFrame ("TBPM", String::UTF8);
+ id3v2tag->addFrame (frame);
+ frame->setText (tag_str);
+ g_free (tag_str);
+ }
+}
+
/* id3demux produces these for frames it cannot parse */
#define GST_ID3_DEMUX_TAG_ID3V2_FRAME "private-id3v2-frame"
GST_TAG_TRACK_PEAK, add_relative_volume_tag, ""}, {
GST_TAG_TRACK_GAIN, add_relative_volume_tag, ""}, {
GST_TAG_ALBUM_PEAK, add_relative_volume_tag, ""}, {
- GST_TAG_ALBUM_GAIN, add_relative_volume_tag, ""}
+ GST_TAG_ALBUM_GAIN, add_relative_volume_tag, ""}, {
+ GST_TAG_BEATS_PER_MINUTE, add_bpm_tag, ""}
};
#define TEST_ALBUM_GAIN 0.78
#define TEST_TRACK_PEAK 0.83
#define TEST_ALBUM_PEAK 0.18
+#define TEST_BPM 113.0
/* for dummy mp3 frame sized MP3_FRAME_SIZE bytes,
* start: ff fb b0 44 00 00 08 00 00 4b 00 00 00 00 00 00 */
GST_TAG_ALBUM_PEAK, TEST_ALBUM_PEAK, NULL);
}
if (mask & (1 << 12)) {
+ gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
+ GST_TAG_BEATS_PER_MINUTE, TEST_BPM, NULL);
}
if (mask & (1 << 13)) {
}
fail_unless_sorta_equals_float (peak, TEST_ALBUM_PEAK);
}
if (mask & (1 << 12)) {
+ gdouble bpm;
+
+ fail_unless (gst_tag_list_get_double (tags, GST_TAG_BEATS_PER_MINUTE,
+ &bpm));
+ fail_unless_sorta_equals_float (bpm, TEST_BPM);
}
if (mask & (1 << 13)) {
}