X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/7e9d85cd54eec034bf4e98afef42f827084f54c3..69933717a48409574f6bcd0611f07b9f86611179:/lib/service/servicemp3.cpp diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 4e56496a..225d90f6 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include /* for subtitles */ #include @@ -35,6 +36,7 @@ eServiceFactoryMP3::eServiceFactoryMP3() extensions.push_back("mkv"); extensions.push_back("avi"); extensions.push_back("dat"); + extensions.push_back("flac"); sc->addServiceFactory(eServiceFactoryMP3::id, this, extensions); } @@ -679,6 +681,8 @@ int eServiceMP3::getInfo(int w) case sTracknumber: case sGenre: case sVideoType: + case sTimeCreate: + case sUser+12: return resIsString; case sCurrentTitle: tag = GST_TAG_TRACK_NUMBER; @@ -703,6 +707,8 @@ int eServiceMP3::getInfo(int w) std::string eServiceMP3::getInfoString(int w) { + if ( !m_stream_tags ) + return ""; gchar *tag = 0; switch (w) { @@ -727,22 +733,29 @@ std::string eServiceMP3::getInfoString(int w) case sVideoType: tag = GST_TAG_VIDEO_CODEC; break; + case sTimeCreate: + GDate *date; + if (gst_tag_list_get_date(m_stream_tags, GST_TAG_DATE, &date)) + { + gchar res[5]; + g_date_strftime (res, sizeof(res), "%Y", date); + return (std::string)res; + } + break; + case sUser+12: + return m_error_message; default: return ""; } - - if (!m_stream_tags || !tag) + if ( !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 ""; } @@ -913,6 +926,9 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg) audio.type = gstCheckAudioPad(str); m_audioStreams.push_back(audio); } + + gst_tag_list_free(tags); + m_event((iPlayableService*)this, evUpdatedInfo); break; } case GST_MESSAGE_ASYNC_DONE: @@ -947,6 +963,19 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg) } } } + case GST_MESSAGE_ELEMENT: + { + if ( gst_is_missing_plugin_message(msg) ) + { + gchar *description = gst_missing_plugin_message_get_description(msg); + if ( description ) + { + m_error_message = description; + g_free(description); + m_event((iPlayableService*)this, evUser+12); + } + } + } default: break; }