summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-02-09 22:10:32 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-02-09 22:10:32 +0200
commit78830a3a403c4884755b237632d78f01d5eaaf44 (patch)
treee41cdd81f5a7078b7990c69c61546a2f723b2af9
parentb9e0f5fd3b6f37e0dc47f4a66eaeea58ef67ac54 (diff)
SL-16827 Time slider not working for some music
-rw-r--r--indra/media_plugins/libvlc/media_plugin_libvlc.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
index 8e18b5c6a7..46ebbd31c5 100644
--- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
+++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
@@ -73,6 +73,7 @@ private:
static void display(void* data, void* id);
/*virtual*/ void setDirty(int left, int top, int right, int bottom) /* override, but that is not supported in gcc 4.6 */;
+ void setDurationDirty();
static void eventCallbacks(const libvlc_event_t* event, void* ptr);
@@ -214,6 +215,19 @@ void MediaPluginLibVLC::setDirty(int left, int top, int right, int bottom)
}
////////////////////////////////////////////////////////////////////////////////
+// *virtual*
+void MediaPluginLibVLC::setDurationDirty()
+{
+ LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "updated");
+
+ message.setValueReal("current_time", mCurTime);
+ message.setValueReal("duration", mDuration);
+ message.setValueReal("current_rate", 1.0f);
+
+ sendMessage(message);
+}
+
+////////////////////////////////////////////////////////////////////////////////
//
void MediaPluginLibVLC::eventCallbacks(const libvlc_event_t* event, void* ptr)
{
@@ -233,6 +247,7 @@ void MediaPluginLibVLC::eventCallbacks(const libvlc_event_t* event, void* ptr)
parent->mDuration = (float)(libvlc_media_get_duration(parent->mLibVLCMedia)) / 1000.0f;
parent->mVlcStatus = STATUS_PLAYING;
parent->setVolumeVLC();
+ parent->setDurationDirty();
break;
case libvlc_MediaPlayerPaused:
@@ -245,6 +260,8 @@ void MediaPluginLibVLC::eventCallbacks(const libvlc_event_t* event, void* ptr)
case libvlc_MediaPlayerEndReached:
parent->mVlcStatus = STATUS_DONE;
+ parent->mCurTime = parent->mDuration;
+ parent->setDurationDirty();
break;
case libvlc_MediaPlayerEncounteredError:
@@ -253,6 +270,7 @@ void MediaPluginLibVLC::eventCallbacks(const libvlc_event_t* event, void* ptr)
case libvlc_MediaPlayerTimeChanged:
parent->mCurTime = (float)libvlc_media_player_get_time(parent->mLibVLCMediaPlayer) / 1000.0f;
+ parent->setDurationDirty();
break;
case libvlc_MediaPlayerPositionChanged:
@@ -260,6 +278,7 @@ void MediaPluginLibVLC::eventCallbacks(const libvlc_event_t* event, void* ptr)
case libvlc_MediaPlayerLengthChanged:
parent->mDuration = (float)libvlc_media_get_duration(parent->mLibVLCMedia) / 1000.0f;
+ parent->setDurationDirty();
break;
case libvlc_MediaPlayerTitleChanged:
@@ -641,7 +660,7 @@ void MediaPluginLibVLC::receiveMessage(const char* message_string)
if (!libvlc_media_player_is_playing(mLibVLCMediaPlayer))
{
// if paused, won't trigger update, update now
- setDirty(0, 0, mWidth, mHeight);
+ setDurationDirty();
}
}
}