diff --git a/indra/llaudio/llstreamingaudio_fmodex.cpp b/indra/llaudio/llstreamingaudio_fmodex.cpp
index 42f30aa1c4..88d166180a 100644
--- a/indra/llaudio/llstreamingaudio_fmodex.cpp
+++ b/indra/llaudio/llstreamingaudio_fmodex.cpp
@@ -42,6 +42,12 @@ public:
bool stopStream(); // Returns true if the stream was successfully stopped.
bool ready();
+ // Streamtitle display
+ bool hasNewMetadata();
+ std::string getCurrentArtist();
+ std::string getCurrentTitle();
+ //
+
const std::string& getURL() { return mInternetStreamURL; }
FMOD_OPENSTATE getOpenState(unsigned int* percentbuffered=NULL, bool* starving=NULL, bool* diskbusy=NULL);
@@ -52,6 +58,11 @@ protected:
bool mReady;
std::string mInternetStreamURL;
+
+ // Streamtitle display
+ char* mArtist;
+ char* mTitle;
+ //
};
@@ -299,6 +310,38 @@ void LLStreamingAudio_FMODEX::setGain(F32 vol)
}
}
+// Streamtitle display
+bool LLStreamingAudio_FMODEX::hasNewMetadata()
+{
+ if (mCurrentInternetStreamp)
+ {
+ return mCurrentInternetStreamp->hasNewMetadata();
+ }
+
+ return false;
+}
+
+std::string LLStreamingAudio_FMODEX::getCurrentTitle()
+{
+ if (mCurrentInternetStreamp)
+ {
+ return mCurrentInternetStreamp->getCurrentTitle();
+ }
+
+ return "";
+}
+
+std::string LLStreamingAudio_FMODEX::getCurrentArtist()
+{
+ if (mCurrentInternetStreamp)
+ {
+ return mCurrentInternetStreamp->getCurrentArtist();
+ }
+
+ return "";
+}
+//
+
///////////////////////////////////////////////////////
// manager of possibly-multiple internet audio streams
@@ -390,3 +433,47 @@ void LLStreamingAudio_FMODEX::setBufferSizes(U32 streambuffertime, U32 decodebuf
settings.defaultDecodeBufferSize = decodebuffertime;//ms
mSystem->setAdvancedSettings(&settings);
}
+
+// Streamtitle display
+bool LLAudioStreamManagerFMODEX::hasNewMetadata()
+{
+ bool ret = false;
+
+ FMOD_TAG tag;
+ FMOD_RESULT res;
+
+ res = mInternetStream->getTag("TITLE", 0, &tag);
+ if (res == FMOD_OK)
+ {
+ char* new_title = (char*)tag.data;
+ if (new_title != mTitle)
+ {
+ mTitle = new_title;
+ ret = true;
+ }
+ }
+
+ res = mInternetStream->getTag("ARTIST", 0, &tag);
+ if (res == FMOD_OK)
+ {
+ char* new_artist = (char*)tag.data;
+ if (new_artist != mArtist)
+ {
+ mArtist = new_artist;
+ ret = true;
+ }
+ }
+
+ return ret;
+}
+
+std::string LLAudioStreamManagerFMODEX::getCurrentTitle()
+{
+ return std::string(mTitle);
+}
+
+std::string LLAudioStreamManagerFMODEX::getCurrentArtist()
+{
+ return std::string(mArtist);
+}
+//
diff --git a/indra/llaudio/llstreamingaudio_fmodex.h b/indra/llaudio/llstreamingaudio_fmodex.h
index 1dee18ae7d..664985cf58 100644
--- a/indra/llaudio/llstreamingaudio_fmodex.h
+++ b/indra/llaudio/llstreamingaudio_fmodex.h
@@ -58,6 +58,13 @@ class LLStreamingAudio_FMODEX : public LLStreamingAudioInterface
/*virtual*/ bool supportsAdjustableBufferSizes(){return true;}
/*virtual*/ void setBufferSizes(U32 streambuffertime, U32 decodebuffertime);
+
+ // Streamtitle display
+ virtual bool hasNewMetadata();
+ virtual std::string getCurrentArtist();
+ virtual std::string getCurrentTitle();
+ //
+
private:
FMOD::System *mSystem;
diff --git a/indra/newview/streamtitledisplay.cpp b/indra/newview/streamtitledisplay.cpp
index d3e5e15601..200a692160 100644
--- a/indra/newview/streamtitledisplay.cpp
+++ b/indra/newview/streamtitledisplay.cpp
@@ -52,19 +52,21 @@ void StreamTitleDisplay::checkMetadata()
static LLCachedControl ShowStreamMetadata(gSavedSettings, "ShowStreamMetadata");
static LLCachedControl StreamMetadataAnnounceToChat(gSavedSettings, "StreamMetadataAnnounceToChat");
- if(!gAudiop)
+ if (!gAudiop)
+ {
return;
- if(gAudiop->getStreamingAudioImpl()->hasNewMetadata() && (ShowStreamMetadata > 0 || StreamMetadataAnnounceToChat))
+ }
+ if ((ShowStreamMetadata > 0 || StreamMetadataAnnounceToChat) && gAudiop->getStreamingAudioImpl()->hasNewMetadata())
{
std::string chat = "";
std::string title = gAudiop->getStreamingAudioImpl()->getCurrentTitle();
std::string artist = gAudiop->getStreamingAudioImpl()->getCurrentArtist();
- if(artist.length() > 0)
+ if (artist.length() > 0)
{
chat = artist;
}
- if(title.length() > 0)
+ if (title.length() > 0)
{
if (chat.length() > 0)
{
@@ -88,7 +90,7 @@ void StreamTitleDisplay::checkMetadata()
{
LLSD args;
args["TITLE"] = title;
- if(artist.length() > 0)
+ if (artist.length() > 0)
{
args["ARTIST"] = artist;
LLNotificationsUtil::add("StreamMetadata", args);