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 @@ ...@@ -26,6 +26,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include <assert.h>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include <vlc_url.h> #include <vlc_url.h>
...@@ -47,28 +49,29 @@ struct vlc_meta_t ...@@ -47,28 +49,29 @@ struct vlc_meta_t
/* FIXME bad name convention */ /* FIXME bad name convention */
const char * vlc_meta_TypeToLocalizedString( vlc_meta_type_t meta_type ) 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"); [vlc_meta_Title] = N_("Title"),
case vlc_meta_Artist: return _("Artist"); [vlc_meta_Artist] = N_("Artist"),
case vlc_meta_Genre: return _("Genre"); [vlc_meta_Genre] = N_("Genre"),
case vlc_meta_Copyright: return _("Copyright"); [vlc_meta_Copyright] = N_("Copyright"),
case vlc_meta_Album: return _("Album"); [vlc_meta_Album] = N_("Album"),
case vlc_meta_TrackNumber: return _("Track number"); [vlc_meta_TrackNumber] = N_("Track number"),
case vlc_meta_Description: return _("Description"); [vlc_meta_Description] = N_("Description"),
case vlc_meta_Rating: return _("Rating"); [vlc_meta_Rating] = N_("Rating"),
case vlc_meta_Date: return _("Date"); [vlc_meta_Date] = N_("Date"),
case vlc_meta_Setting: return _("Setting"); [vlc_meta_Setting] = N_("Setting"),
case vlc_meta_URL: return _("URL"); [vlc_meta_URL] = N_("URL"),
case vlc_meta_Language: return _("Language"); [vlc_meta_Language] = N_("Language"),
case vlc_meta_NowPlaying: return _("Now Playing"); [vlc_meta_NowPlaying] = N_("Now Playing"),
case vlc_meta_Publisher: return _("Publisher"); [vlc_meta_Publisher] = N_("Publisher"),
case vlc_meta_EncodedBy: return _("Encoded by"); [vlc_meta_EncodedBy] = N_("Encoded by"),
case vlc_meta_ArtworkURL: return _("Artwork URL"); [vlc_meta_ArtworkURL] = N_("Artwork URL"),
case vlc_meta_TrackID: return _("Track ID"); [vlc_meta_TrackID] = N_("Track ID"),
};
default: abort();
} 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