summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-23 21:48:07 +0800
committerErik Kundiman <erik@megapahit.org>2024-08-23 21:48:07 +0800
commit5a2aaba40f6b23b9497eceb0cb4e753c1255732e (patch)
tree7d10b4c04932e58b029bd4a984e6eaa533e28082
parent8081dba75bd761cad54ecb212fbbb5499c75b693 (diff)
Stream notification header uses title metadata
-rw-r--r--indra/llplugin/llpluginclassmedia.cpp4
-rw-r--r--indra/llplugin/llpluginclassmedia.h2
-rw-r--r--indra/media_plugins/libvlc/media_plugin_libvlc.cpp7
-rw-r--r--indra/newview/llviewermedia_streamingaudio.cpp6
-rw-r--r--indra/newview/llviewermedia_streamingaudio.h1
5 files changed, 19 insertions, 1 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index 2da24adbf7..f7f38b83cc 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -1211,6 +1211,10 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mMediaName = message.getValue("name");
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_NAME_CHANGED);
}
+ else if(message_name == "title_text")
+ {
+ mMediaTitle = message.getValue("title");
+ }
else if(message_name == "nowplaying_text")
{
mMediaNowPlaying = message.getValue("nowplaying");
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index 109f3880c5..80862284ff 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -311,6 +311,7 @@ public:
const std::string& getMediaName() const { return mMediaName; };
+ const std::string& getMediaTitle() const { return mMediaTitle; };
const std::string& getMediaNowPlaying() const { return mMediaNowPlaying; };
std::string getMediaDescription() const { return mMediaDescription; };
@@ -429,6 +430,7 @@ protected:
bool mCanPaste;
std::string mMediaName;
+ std::string mMediaTitle;
std::string mMediaNowPlaying;
std::string mMediaDescription;
diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
index 8ae9931dd4..b090734c72 100644
--- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
+++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
@@ -295,6 +295,13 @@ void MediaPluginLibVLC::eventCallbacks(const libvlc_event_t* event, void* ptr)
}
break;
case libvlc_MediaMetaChanged:
+ auto title = libvlc_media_get_meta(parent->mLibVLCMedia, libvlc_meta_Title);
+ if (title)
+ {
+ LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "title_text");
+ message.setValue("title", title);
+ parent->sendMessage(message);
+ }
auto now_playing = libvlc_media_get_meta(parent->mLibVLCMedia, libvlc_meta_NowPlaying);
if (now_playing)
{
diff --git a/indra/newview/llviewermedia_streamingaudio.cpp b/indra/newview/llviewermedia_streamingaudio.cpp
index 15b6e3f802..6e3d84b3bf 100644
--- a/indra/newview/llviewermedia_streamingaudio.cpp
+++ b/indra/newview/llviewermedia_streamingaudio.cpp
@@ -118,8 +118,12 @@ int LLStreamingAudio_MediaPlugins::isPlaying()
auto nowPlaying = mMediaPlugin->getMediaNowPlaying();
if (mNowPlaying != nowPlaying)
{
- LLNotificationsUI::LLNotificationManager::instance().onChat(LLChat{llformat("Now playing %s.", nowPlaying.c_str())}, LLSD{});
+ mTitle = mMediaPlugin->getMediaTitle();
mNowPlaying = nowPlaying;
+ LLChat chat{llformat("Now playing %s.", nowPlaying.c_str())};
+ chat.mFromName = mTitle;
+ chat.mSourceType = CHAT_SOURCE_SYSTEM;
+ LLNotificationsUI::LLNotificationManager::instance().onChat(chat, LLSD{});
}
switch (status)
diff --git a/indra/newview/llviewermedia_streamingaudio.h b/indra/newview/llviewermedia_streamingaudio.h
index 5abefcdb0b..e1f7cd71d9 100644
--- a/indra/newview/llviewermedia_streamingaudio.h
+++ b/indra/newview/llviewermedia_streamingaudio.h
@@ -56,6 +56,7 @@ private:
LLPluginClassMedia *mMediaPlugin;
std::string mURL;
+ std::string mTitle;
std::string mNowPlaying;
F32 mGain;
};