summaryrefslogtreecommitdiff
path: root/indra/media_plugins
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-22 17:24:02 +0800
committerErik Kundiman <erik@megapahit.org>2024-08-22 17:24:02 +0800
commit78c6c73770202cedcc92d4b19bccd4ffe9075bef (patch)
tree707c74228e50847ff4bcc5669d76981ff7a70601 /indra/media_plugins
parent1bc3c10bed75272dbe9137609048a1aa7c678ffe (diff)
Stream notification
https://megapahit.com/show_bug.cgi?id=56 I could make such metadata setting triggered by an event only on the media plugin's side, not on the viewer's side. I had tried adding a MEDIA_EVENT_NOWPLAYING_CHANGED and hoped that mediactrl, viewerparcelmedia, or viewermedia would react to it, but no, so this is the best I could come up with for now, to keep checking if what's now playing has been updated or not. I intentionally didn't clear mNowPlaying the way mURL is, so that it wouldn't notify one last double after the player stops streaming. mNowPlaying and mMediaNowPlaying need to be kept in their last states so that the comparison is correct. I also intentionally didn't put the notification inside the MEDIA_PLAYING scope, cause the flow somehow never got into that scope.
Diffstat (limited to 'indra/media_plugins')
-rw-r--r--indra/media_plugins/libvlc/media_plugin_libvlc.cpp14
1 files changed, 14 insertions, 0 deletions
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);