gst/qtdemux/qtdemux.c: Add support for tmpo tag (BPM).

Original commit message from CVS:
* gst/qtdemux/qtdemux.c:
Add support for tmpo tag (BPM).
This commit is contained in:
Stefan Kost 2008-08-04 07:05:33 +00:00
parent df707c6664
commit aa7a44190e
2 changed files with 36 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2008-08-04 Stefan Kost <ensonic@users.sf.net>
* gst/qtdemux/qtdemux.c:
Add support for tmpo tag (BPM).
2008-08-03 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* ext/flac/gstflacenc.c: (gst_flac_enc_query_peer_total_samples),

View file

@ -3815,6 +3815,32 @@ qtdemux_tag_add_num (GstQTDemux * qtdemux, const char *tag1,
}
}
static void
qtdemux_tag_add_tmpo (GstQTDemux * qtdemux, const char *tag1, GNode * node)
{
GNode *data;
int len;
int type;
int n1;
data = qtdemux_tree_get_child_by_type (node, FOURCC_data);
if (data) {
len = QT_UINT32 (data->data);
type = QT_UINT32 ((guint8 *) data->data + 8);
GST_DEBUG_OBJECT (qtdemux, "have tempo tag, type=%d,len=%d", type, len);
/* some files wrongly have a type 0x0f=15, but it should be 0x15 */
if ((type == 0x00000015 || type == 0x0000000f) && len >= 16) {
n1 = QT_UINT16 ((guint8 *) data->data + 16);
if (n1) {
/* do not add bpm=0 */
GST_DEBUG_OBJECT (qtdemux, "adding tag %d", n1);
gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE,
tag1, (gdouble) n1, NULL);
}
}
}
}
static void
qtdemux_tag_add_date (GstQTDemux * qtdemux, const char *tag, GNode * node)
{
@ -4002,6 +4028,11 @@ qtdemux_parse_udta (GstQTDemux * qtdemux, GNode * udta)
qtdemux_tag_add_str (qtdemux, GST_TAG_GENRE, node);
}
}
node = qtdemux_tree_get_child_by_type (ilst, FOURCC_tmpo);
if (node) {
qtdemux_tag_add_tmpo (qtdemux, GST_TAG_BEATS_PER_MINUTE, node);
}
}
typedef struct