summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llplugin/llpluginclassmedia.cpp4
-rw-r--r--indra/llplugin/llpluginclassmedia.h2
-rw-r--r--indra/media_plugins/libvlc/media_plugin_libvlc.cpp14
-rw-r--r--indra/newview/llviewermedia_streamingaudio.cpp7
-rw-r--r--indra/newview/llviewermedia_streamingaudio.h1
5 files changed, 28 insertions, 0 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index cffbe3d8bd..2024579021 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 == "nowplaying_text")
+ {
+ mMediaNowPlaying = message.getValue("nowplaying");
+ }
else if(message_name == "pick_file")
{
mIsMultipleFilePick = message.getValueBoolean("multiple_files");
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index 5d2f3bbb79..109f3880c5 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& getMediaNowPlaying() const { return mMediaNowPlaying; };
std::string getMediaDescription() const { return mMediaDescription; };
// Crash the plugin. If you use this outside of a testbed, you will be punished.
@@ -428,6 +429,7 @@ protected:
bool mCanPaste;
std::string mMediaName;
+ std::string mMediaNowPlaying;
std::string mMediaDescription;
LLColor4 mBackgroundColor;
diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
index a5d8f885fd..8ae9931dd4 100644
--- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
+++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
@@ -294,6 +294,15 @@ void MediaPluginLibVLC::eventCallbacks(const libvlc_event_t* event, void* ptr)
}
}
break;
+ case libvlc_MediaMetaChanged:
+ auto now_playing = libvlc_media_get_meta(parent->mLibVLCMedia, libvlc_meta_NowPlaying);
+ if (now_playing)
+ {
+ LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "nowplaying_text");
+ message.setValue("nowplaying", now_playing);
+ parent->sendMessage(message);
+ }
+ break;
}
}
@@ -348,6 +357,11 @@ void MediaPluginLibVLC::playMedia()
libvlc_event_attach(em, libvlc_MediaPlayerLengthChanged, eventCallbacks, this);
libvlc_event_attach(em, libvlc_MediaPlayerTitleChanged, eventCallbacks, this);
}
+ auto event_manager = libvlc_media_event_manager(mLibVLCMedia);
+ if (event_manager)
+ {
+ libvlc_event_attach(event_manager, libvlc_MediaMetaChanged, eventCallbacks, this);
+ }
libvlc_video_set_callbacks(mLibVLCMediaPlayer, lock, unlock, display, &mLibVLCCallbackContext);
libvlc_video_set_format(mLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth);
diff --git a/indra/newview/llviewermedia_streamingaudio.cpp b/indra/newview/llviewermedia_streamingaudio.cpp
index af3a21c183..15b6e3f802 100644
--- a/indra/newview/llviewermedia_streamingaudio.cpp
+++ b/indra/newview/llviewermedia_streamingaudio.cpp
@@ -34,6 +34,7 @@
#include "llmimetypes.h"
#include "lldir.h"
+#include "llnotificationmanager.h"
LLStreamingAudio_MediaPlugins::LLStreamingAudio_MediaPlugins() :
mMediaPlugin(NULL),
@@ -114,6 +115,12 @@ int LLStreamingAudio_MediaPlugins::isPlaying()
LLPluginClassMediaOwner::EMediaStatus status =
mMediaPlugin->getStatus();
+ auto nowPlaying = mMediaPlugin->getMediaNowPlaying();
+ if (mNowPlaying != nowPlaying)
+ {
+ LLNotificationsUI::LLNotificationManager::instance().onChat(LLChat{llformat("Now playing %s.", nowPlaying.c_str())}, LLSD{});
+ mNowPlaying = nowPlaying;
+ }
switch (status)
{
diff --git a/indra/newview/llviewermedia_streamingaudio.h b/indra/newview/llviewermedia_streamingaudio.h
index bf4d92c29e..5abefcdb0b 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 mNowPlaying;
F32 mGain;
};