From 4590daf2020dc8e2576a73ff7ade50f1a5a571f6 Mon Sep 17 00:00:00 2001 From: Tim-Philipp Müller Date: Fri, 2 Oct 2009 00:23:34 +0100 Subject: qtdemux: remove internal genre table No need to maintain our own genre table in qtdemux. The genres are identical to the ID3 genres, so we can just use libgsttag's gst_tag_id3_genre_get() to look them up. --- gst/qtdemux/qtdemux.c | 50 ++++++++++++-------------------------------------- 1 file changed, 12 insertions(+), 38 deletions(-) (limited to 'gst/qtdemux') diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index dc61faf3..905c6d44 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -3,6 +3,7 @@ * Copyright (C) <2003> David A. Schleef * Copyright (C) <2006> Wim Taymans * Copyright (C) <2007> Julien Moutte + * Copyright (C) <2009> Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -5248,41 +5249,7 @@ static void qtdemux_tag_add_gnre (GstQTDemux * qtdemux, const char *tag, const char *dummy, GNode * node) { - static const gchar *genres[] = { - "N/A", "Blues", "Classic Rock", "Country", "Dance", "Disco", - "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", - "Other", "Pop", "R&B", "Rap", "Reggae", "Rock", "Techno", - "Industrial", "Alternative", "Ska", "Death Metal", "Pranks", - "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", - "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental", - "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", - "AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative", - "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", - "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk", - "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta", - "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", - "Cabaret", "New Wave", "Psychadelic", "Rave", "Showtunes", - "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz", "Polka", - "Retro", "Musical", "Rock & Roll", "Hard Rock", "Folk", - "Folk/Rock", "National Folk", "Swing", "Fast-Fusion", "Bebob", - "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde", - "Gothic Rock", "Progressive Rock", "Psychedelic Rock", - "Symphonic Rock", "Slow Rock", "Big Band", "Chorus", - "Easy Listening", "Acoustic", "Humour", "Speech", "Chanson", - "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", - "Primus", "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", - "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", - "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", - "Euro-House", "Dance Hall", "Goa", "Drum & Bass", "Club House", - "Hardcore", "Terror", "Indie", "BritPop", "NegerPunk", - "Polsk Punk", "Beat", "Christian Gangsta", "Heavy Metal", - "Black Metal", "Crossover", "Contemporary C", "Christian Rock", - "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop", "SynthPop" - }; GNode *data; - int len; - int type; - int n; data = qtdemux_tree_get_child_by_type (node, FOURCC_data); @@ -5295,14 +5262,21 @@ qtdemux_tag_add_gnre (GstQTDemux * qtdemux, const char *tag, const char *dummy, } if (data) { + guint len, type, n; + len = QT_UINT32 (data->data); type = QT_UINT32 ((guint8 *) data->data + 8); if (type == 0x00000000 && len >= 18) { n = QT_UINT16 ((guint8 *) data->data + 16); - if (n > 0 && n < sizeof (genres) / sizeof (char *)) { - GST_DEBUG_OBJECT (qtdemux, "adding %d [%s]", n, genres[n]); - gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE, - tag, genres[n], NULL); + if (n > 0) { + const gchar *genre; + + genre = gst_tag_id3_genre_get (n - 1); + if (genre != NULL) { + GST_DEBUG_OBJECT (qtdemux, "adding %d [%s]", n, genre); + gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE, + tag, genre, NULL); + } } } } -- cgit