Commit 8c723814 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Speed up vlc_meta_TypeToLocalizedString()

parent 2222eb84
......@@ -26,6 +26,8 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_playlist.h>
#include <vlc_url.h>
......@@ -47,28 +49,29 @@ struct vlc_meta_t
/* FIXME bad name convention */
const char * vlc_meta_TypeToLocalizedString( vlc_meta_type_t meta_type )
{
switch( meta_type )
static const char posix_names[][16] =
{
case vlc_meta_Title: return _("Title");
case vlc_meta_Artist: return _("Artist");
case vlc_meta_Genre: return _("Genre");
case vlc_meta_Copyright: return _("Copyright");
case vlc_meta_Album: return _("Album");
case vlc_meta_TrackNumber: return _("Track number");
case vlc_meta_Description: return _("Description");
case vlc_meta_Rating: return _("Rating");
case vlc_meta_Date: return _("Date");
case vlc_meta_Setting: return _("Setting");
case vlc_meta_URL: return _("URL");
case vlc_meta_Language: return _("Language");
case vlc_meta_NowPlaying: return _("Now Playing");
case vlc_meta_Publisher: return _("Publisher");
case vlc_meta_EncodedBy: return _("Encoded by");
case vlc_meta_ArtworkURL: return _("Artwork URL");
case vlc_meta_TrackID: return _("Track ID");
default: abort();
}
[vlc_meta_Title] = N_("Title"),
[vlc_meta_Artist] = N_("Artist"),
[vlc_meta_Genre] = N_("Genre"),
[vlc_meta_Copyright] = N_("Copyright"),
[vlc_meta_Album] = N_("Album"),
[vlc_meta_TrackNumber] = N_("Track number"),
[vlc_meta_Description] = N_("Description"),
[vlc_meta_Rating] = N_("Rating"),
[vlc_meta_Date] = N_("Date"),
[vlc_meta_Setting] = N_("Setting"),
[vlc_meta_URL] = N_("URL"),
[vlc_meta_Language] = N_("Language"),
[vlc_meta_NowPlaying] = N_("Now Playing"),
[vlc_meta_Publisher] = N_("Publisher"),
[vlc_meta_EncodedBy] = N_("Encoded by"),
[vlc_meta_ArtworkURL] = N_("Artwork URL"),
[vlc_meta_TrackID] = N_("Track ID"),
};
assert (meta_type < (sizeof(posix_names) / sizeof(posix_names[0])));
return vlc_gettext (posix_names[meta_type]);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment