From 5a2aaba40f6b23b9497eceb0cb4e753c1255732e Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Fri, 23 Aug 2024 21:48:07 +0800 Subject: Stream notification header uses title metadata --- indra/llplugin/llpluginclassmedia.cpp | 4 ++++ indra/llplugin/llpluginclassmedia.h | 2 ++ indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 7 +++++++ indra/newview/llviewermedia_streamingaudio.cpp | 6 +++++- indra/newview/llviewermedia_streamingaudio.h | 1 + 5 files changed, 19 insertions(+), 1 deletion(-) 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; }; -- cgit v1.2.3