diff options
author | Anchor Linden <anchor@lindenlab.com> | 2018-02-28 22:42:23 -0800 |
---|---|---|
committer | Anchor Linden <anchor@lindenlab.com> | 2018-02-28 22:42:23 -0800 |
commit | 618179a71722e47115a6b021a1eb2be99e46322f (patch) | |
tree | 7cb94aef6fe27ed0497790f07f8c190cf1944f92 /indra/media_plugins/libvlc/media_plugin_libvlc.cpp | |
parent | bfbcd6d16931819c43eea8e83963c9f86c6892dd (diff) | |
parent | 5a12a88f7b53bb99a6b302c35d891a8ecee59855 (diff) |
Merge
Diffstat (limited to 'indra/media_plugins/libvlc/media_plugin_libvlc.cpp')
-rw-r--r-- | indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 59 |
1 files changed, 50 insertions, 9 deletions
diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index ebcdde2960..80702a1079 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -37,6 +37,11 @@ #include "vlc/vlc.h" #include "vlc/libvlc_version.h" +#if LL_WINDOWS +// needed for waveOut call - see below for description +#include <mmsystem.h> +#endif + //////////////////////////////////////////////////////////////////////////////// // class MediaPluginLibVLC : @@ -55,6 +60,7 @@ private: void playMedia(); void resetVLC(); void setVolume(const F64 volume); + void setVolumeVLC(); void updateTitle(const char* title); static void* lock(void* data, void** p_pixels); @@ -161,6 +167,10 @@ void MediaPluginLibVLC::initVLC() "--video-filter=transform{type=vflip}", // MAINT-6578 Y flip textures in plugin vs client }; +#if LL_DARWIN + setenv("VLC_PLUGIN_PATH", ".", 1); +#endif + int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv); mLibVLC = libvlc_new(vlc_argc, vlc_argv); @@ -217,6 +227,7 @@ void MediaPluginLibVLC::eventCallbacks(const libvlc_event_t* event, void* ptr) case libvlc_MediaPlayerPlaying: parent->mDuration = (float)(libvlc_media_get_duration(parent->mLibVLCMedia)) / 1000.0f; parent->mVlcStatus = STATUS_PLAYING; + parent->setVolumeVLC(); break; case libvlc_MediaPlayerPaused: @@ -390,30 +401,60 @@ void MediaPluginLibVLC::updateTitle(const char* title) sendMessage(message); } -//////////////////////////////////////////////////////////////////////////////// -// -void MediaPluginLibVLC::setVolume(const F64 volume) +void MediaPluginLibVLC::setVolumeVLC() { - mCurVolume = volume; - if (mLibVLCMediaPlayer) { - int result = libvlc_audio_set_volume(mLibVLCMediaPlayer, (int)(volume * 100)); - if (result != 0) + int vlc_vol = (int)(mCurVolume * 100); + + int result = libvlc_audio_set_volume(mLibVLCMediaPlayer, vlc_vol); + if (result == 0) + { + // volume change was accepted by LibVLC + } + else { - // volume wasn't set but not much to be done here + // volume change was NOT accepted by LibVLC and not actioned } + +#if LL_WINDOWS + // https ://jira.secondlife.com/browse/MAINT-8119 + // CEF media plugin uses code in media_plugins/cef/windows_volume_catcher.cpp to + // set the actual output volume of the plugin process since there is no API in + // CEF to otherwise do this. + // There are explicit calls to change the volume in LibVLC but sometimes they + // are ignored SLPlugin.exe process volume is set to 0 so you never heard audio + // from the VLC media stream. + // The right way to solve this is to move the volume catcher stuff out of + // the CEF plugin and into it's own folder under media_plugins and have it referenced + // by both CEF and VLC. That's for later. The code there boils down to this so for + // now, as we approach a release, the less risky option is to do it directly vs + // calls to volume catcher code. + DWORD left_channel = (DWORD)(mCurVolume * 65535.0f); + DWORD right_channel = (DWORD)(mCurVolume * 65535.0f); + DWORD hw_volume = left_channel << 16 | right_channel; + waveOutSetVolume(NULL, hw_volume); +#endif } else { // volume change was requested but VLC wasn't ready. - // that's okay thought because we saved the value in mCurVolume and + // that's okay though because we saved the value in mCurVolume and // the next volume change after the VLC system is initilzied will set it } } //////////////////////////////////////////////////////////////////////////////// // +void MediaPluginLibVLC::setVolume(const F64 volume) +{ + mCurVolume = volume; + + setVolumeVLC(); +} + +//////////////////////////////////////////////////////////////////////////////// +// void MediaPluginLibVLC::receiveMessage(const char* message_string) { LLPluginMessage message_in; |