aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2006-03-22 23:03:57 +0000
committerFelix Domke <tmbinc@elitedvb.net>2006-03-22 23:03:57 +0000
commit371447724a1e150c37a777e58a4725a3d2561c01 (patch)
tree3e10bbd3d5ed9dc9d506c4e1ab33c3caa1634b11
parenta9a5762212343755d01839f520b853a2e78eca0e (diff)
downloadenigma2-371447724a1e150c37a777e58a4725a3d2561c01.tar.gz
enigma2-371447724a1e150c37a777e58a4725a3d2561c01.zip
add tag information for audio files
-rw-r--r--lib/service/iservice.h7
-rw-r--r--lib/service/servicemp3.cpp59
-rw-r--r--lib/service/servicemp3.h2
3 files changed, 68 insertions, 0 deletions
diff --git a/lib/service/iservice.h b/lib/service/iservice.h
index 354f90a2..e74fa0a6 100644
--- a/lib/service/iservice.h
+++ b/lib/service/iservice.h
@@ -252,6 +252,13 @@ public:
sDescription,
sTimeCreate, // unix time or string
+
+ sTitle,
+ sArtist,
+ sAlbum,
+ sComment,
+ sTracknumber,
+ sGenre,
};
enum { resNA = -1, resIsString = -2 };
diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp
index 730c4e7b..0308a56d 100644
--- a/lib/service/servicemp3.cpp
+++ b/lib/service/servicemp3.cpp
@@ -344,6 +344,65 @@ RESULT eServiceMP3::getName(std::string &name)
return 0;
}
+int eServiceMP3::getInfo(int w)
+{
+ switch (w)
+ {
+ case sTitle:
+ case sArtist:
+ case sAlbum:
+ case sComment:
+ case sTracknumber:
+ case sGenre:
+ return resIsString;
+ default:
+ return resNA;
+ }
+}
+
+std::string eServiceMP3::getInfoString(int w)
+{
+ gchar *tag = 0;
+ switch (w)
+ {
+ case sTitle:
+ tag = GST_TAG_TITLE;
+ break;
+ case sArtist:
+ tag = GST_TAG_ARTIST;
+ break;
+ case sAlbum:
+ tag = GST_TAG_ALBUM;
+ break;
+ case sComment:
+ tag = GST_TAG_COMMENT;
+ break;
+ case sTracknumber:
+ tag = GST_TAG_TRACK_NUMBER;
+ break;
+ case sGenre:
+ tag = GST_TAG_GENRE;
+ break;
+ default:
+ return "";
+ }
+
+ if (!m_stream_tags || !tag)
+ return "";
+
+ gchar *value;
+
+ if (gst_tag_list_get_string(m_stream_tags, tag, &value))
+ {
+ std::string res = value;
+ g_free(value);
+ return res;
+ }
+
+ return "";
+}
+
+
void foreach(const GstTagList *list, const gchar *tag, gpointer user_data)
{
if (tag)
diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h
index 9fcfa74e..279c3cf1 100644
--- a/lib/service/servicemp3.h
+++ b/lib/service/servicemp3.h
@@ -78,6 +78,8 @@ public:
// iServiceInformation
RESULT getName(std::string &name);
+ int getInfo(int w);
+ std::string getInfoString(int w);
private:
friend class eServiceFactoryMP3;
std::string m_filename;