void LLViewerParcelMedia::playStreamingMusic(LLParcel* parcel, bool filter) { std::string music_url = parcel->getMusicURL(); LLStringUtil::trim(music_url); if (!music_url.empty() && gSavedSettings.getBOOL("MediaEnableFilter") && (filter || !allowedMedia(music_url))) { // If filtering is needed or in case music_url just changed // to something we did not yet approve. filterMedia(parcel, 1); } else if (gAudiop) { LLStringUtil::trim(music_url); LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl(); if(stream && stream->supportsAdjustableBufferSizes()) stream->setBufferSizes(gSavedSettings.getU32("SHFMODExStreamBufferSize"),gSavedSettings.getU32("SHFMODExDecodeBufferSize")); gAudiop->startInternetStream(music_url); if (music_url.empty()) { LLOverlayBar::audioFilterStop(); } else { LLOverlayBar::audioFilterPlay(); } } }
void LLViewerParcelMedia::playStreamingMusic(LLParcel* parcel, bool filter) { std::string music_url = parcel->getMusicURL(); LLStringUtil::trim(music_url); if (!music_url.empty() && gSavedSettings.getBOOL("MediaEnableFilter") && (filter || !allowedMedia(music_url))) { // If filtering is needed or in case music_url just changed // to something we did not yet approve. filterMedia(parcel, 1, COMMAND_ORIGIN_LOCAL); } else if (gAudioStream) { LLStringUtil::trim(music_url); gAudioStream->startInternetStream(music_url); if (music_url.empty()) { LLOverlayBar::audioFilterStop(); } else { LLOverlayBar::audioFilterPlay(); } } }
// static void LLViewerParcelMedia::play(LLParcel* parcel, bool filter) { lldebugs << "LLViewerParcelMedia::play" << llendl; if (!parcel) return; if (!gSavedSettings.getBOOL("AudioStreamingVideo")) return; std::string media_url = parcel->getMediaURL(); LLStringUtil::trim(media_url); if (!media_url.empty() && gSavedSettings.getBOOL("MediaEnableFilter") && (filter || !allowedMedia(media_url))) { // If filtering is needed or in case media_url just changed // to something we did not yet approve. LLViewerParcelMediaAutoPlay::playStarted(); filterMedia(parcel, 0); return; } std::string mime_type = parcel->getMediaType(); LLUUID placeholder_texture_id = parcel->getMediaID(); U8 media_auto_scale = parcel->getMediaAutoScale(); U8 media_loop = parcel->getMediaLoop(); S32 media_width = parcel->getMediaWidth(); S32 media_height = parcel->getMediaHeight(); // Debug print // LL_DEBUGS("Media") << "Play media type : " << mime_type << ", url : " << media_url << LL_ENDL; if (!sMediaImpl || (sMediaImpl && (sMediaImpl->getMediaURL() != media_url || sMediaImpl->getMimeType() != mime_type || sMediaImpl->getMediaTextureID() != placeholder_texture_id))) { if (sMediaImpl) { // Delete the old media impl first so they don't fight over the texture. sMediaImpl->stop(); } LL_DEBUGS("Media") << "new media impl with mime type " << mime_type << ", url " << media_url << LL_ENDL; // There is no media impl, or it has just been deprecated, make a new one sMediaImpl = LLViewerMedia::newMediaImpl(media_url, placeholder_texture_id, media_width, media_height, media_auto_scale, media_loop, mime_type); } // The url, mime type and texture are now the same, call play again if (sMediaImpl->getMediaURL() == media_url && sMediaImpl->getMimeType() == mime_type && sMediaImpl->getMediaTextureID() == placeholder_texture_id) { LL_DEBUGS("Media") << "playing with existing url " << media_url << LL_ENDL; sMediaImpl->play(); } LLFirstUse::useMedia(); LLViewerParcelMediaAutoPlay::playStarted(); }
// static void LLViewerParcelMedia::play(LLParcel* parcel, bool filter) { lldebugs << "LLViewerParcelMedia::play" << llendl; if (!parcel) return; if (!gSavedSettings.getBOOL("AudioStreamingMedia")) return; std::string media_url = parcel->getMediaURL(); LLStringUtil::trim(media_url); if (!media_url.empty() && gSavedSettings.getBOOL("MediaEnableFilter") && (filter || !allowedMedia(media_url))) { // If filtering is needed or in case media_url just changed // to something we did not yet approve. LLViewerParcelMediaAutoPlay::playStarted(); filterMedia(parcel, 0); return; } std::string mime_type = parcel->getMediaType(); LLUUID placeholder_texture_id = parcel->getMediaID(); U8 media_auto_scale = parcel->getMediaAutoScale(); U8 media_loop = parcel->getMediaLoop(); S32 media_width = parcel->getMediaWidth(); S32 media_height = parcel->getMediaHeight(); if(sMediaImpl) { // If the url and mime type are the same, call play again if(sMediaImpl->getMediaURL() == media_url && sMediaImpl->getMimeType() == mime_type && sMediaImpl->getMediaTextureID() == placeholder_texture_id) { LL_DEBUGS("Media") << "playing with existing url " << media_url << LL_ENDL; sMediaImpl->play(); } // Else if the texture id's are the same, navigate and rediscover type // MBW -- This causes other state from the previous parcel (texture size, autoscale, and looping) to get re-used incorrectly. // It's also not really necessary -- just creating a new instance is fine. // else if(sMediaImpl->getMediaTextureID() == placeholder_texture_id) // { // sMediaImpl->navigateTo(media_url, mime_type, true); // } else { // Since the texture id is different, we need to generate a new impl // Delete the old one first so they don't fight over the texture. sMediaImpl = NULL; // A new impl will be created below. } } // Don't ever try to play if the media type is set to "none/none" if(stricmp(mime_type.c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0) { if(!sMediaImpl) { LL_DEBUGS("Media") << "new media impl with mime type " << mime_type << ", url " << media_url << LL_ENDL; // There is no media impl, make a new one sMediaImpl = LLViewerMedia::newMediaImpl( placeholder_texture_id, media_width, media_height, media_auto_scale, media_loop); sMediaImpl->setIsParcelMedia(true); sMediaImpl->navigateTo(media_url, mime_type, true); } LLFirstUse::useMedia(); LLViewerParcelMediaAutoPlay::playStarted(); } }
// static void LLViewerParcelMedia::play(LLParcel* parcel, bool filter, const ECommandOrigin origin) { lldebugs << "LLViewerParcelMedia::play" << llendl; if (!parcel) return; if (!gSavedSettings.getBOOL("AudioStreamingVideo")) return; std::string media_url = parcel->getMediaURL(); LLStringUtil::trim(media_url); if (!media_url.empty() && gSavedSettings.getBOOL("MediaEnableFilter") && filter && (!allowedMedia(media_url) || origin == COMMAND_ORIGIN_REMOTE)) { // If filtering is needed or in case media_url just changed // to something we did not yet approve. LLViewerParcelMediaAutoPlay::playStarted(); filterMedia(parcel, 0, origin); return; } std::string mime_type = parcel->getMediaType(); LLUUID placeholder_texture_id = parcel->getMediaID(); U8 media_auto_scale = parcel->getMediaAutoScale(); U8 media_loop = parcel->getMediaLoop(); S32 media_width = parcel->getMediaWidth(); S32 media_height = parcel->getMediaHeight(); // Debug print // LL_DEBUGS("Media") << "Play media type : " << mime_type << ", url : " << media_url << LL_ENDL; if(sMediaImpl) { // If the url and mime type are the same, call play again if(sMediaImpl->getMediaURL() == media_url && sMediaImpl->getMimeType() == mime_type && sMediaImpl->getMediaTextureID() == placeholder_texture_id) { LL_DEBUGS("Media") << "playing with existing url " << media_url << LL_ENDL; sMediaImpl->play(); } // Else if the texture id's are the same, navigate and rediscover type // MBW -- This causes other state from the previous parcel (texture size, autoscale, and looping) to get re-used incorrectly. // It's also not really necessary -- just creating a new instance is fine. // else if(sMediaImpl->getMediaTextureID() == placeholder_texture_id) // { // sMediaImpl->navigateTo(media_url, mime_type, true); // } else { // Since the texture id is different, we need to generate a new impl LL_DEBUGS("Media") << "new media impl with mime type " << mime_type << ", url " << media_url << LL_ENDL; // Delete the old one first so they don't fight over the texture. sMediaImpl->stop(); sMediaImpl = LLViewerMedia::newMediaImpl(media_url, placeholder_texture_id, media_width, media_height, media_auto_scale, media_loop, mime_type); } } else { // There is no media impl, make a new one sMediaImpl = LLViewerMedia::newMediaImpl(media_url, placeholder_texture_id, media_width, media_height, media_auto_scale, media_loop, mime_type); } LLFirstUse::useMedia(); LLViewerParcelMediaAutoPlay::playStarted(); }