From 98d54377f9a793ffc0ed0aff31e828ec772a8d10 Mon Sep 17 00:00:00 2001 From: Rick Pasetto <rick@lindenlab.com> Date: Thu, 19 Nov 2009 16:47:29 -0800 Subject: Make time-based media "forward" and "back" different from navigate forward and navigate back --- indra/newview/llpanelprimmediacontrols.cpp | 46 +++++++++++++++++-- indra/newview/llpanelprimmediacontrols.h | 4 ++ .../default/xui/en/panel_prim_media_controls.xml | 53 +++++++++++++++++++++- 3 files changed, 98 insertions(+), 5 deletions(-) diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 12ad070efd..80d2a9425c 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -102,6 +102,8 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() : mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeUp", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeUp, this)); mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeDown", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeDown, this)); mCommitCallbackRegistrar.add("MediaCtrl.ToggleMute", boost::bind(&LLPanelPrimMediaControls::onToggleMute, this)); + mCommitCallbackRegistrar.add("MediaCtrl.SkipBack", boost::bind(&LLPanelPrimMediaControls::onClickSkipBack, this)); + mCommitCallbackRegistrar.add("MediaCtrl.SkipForward", boost::bind(&LLPanelPrimMediaControls::onClickSkipForward, this)); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_prim_media_controls.xml"); mInactivityTimer.reset(); @@ -135,6 +137,8 @@ BOOL LLPanelPrimMediaControls::postBuild() mMediaAddress = getChild<LLUICtrl>("media_address_url"); mMediaPlaySliderPanel = getChild<LLUICtrl>("media_play_position"); mMediaPlaySliderCtrl = getChild<LLUICtrl>("media_play_slider"); + mSkipFwdCtrl = getChild<LLUICtrl>("skip_forward"); + mSkipBackCtrl = getChild<LLUICtrl>("skip_back"); mVolumeCtrl = getChild<LLUICtrl>("media_volume"); mVolumeBtn = getChild<LLButton>("media_volume_button"); mVolumeUpCtrl = getChild<LLUICtrl>("volume_up"); @@ -329,12 +333,17 @@ void LLPanelPrimMediaControls::updateShape() mReloadCtrl->setVisible(FALSE); mMediaStopCtrl->setVisible(has_focus); mHomeCtrl->setVisible(FALSE); - mBackCtrl->setEnabled(has_focus); - mFwdCtrl->setEnabled(has_focus); + // No nav controls + mBackCtrl->setVisible(FALSE); + mFwdCtrl->setEnabled(FALSE); mMediaAddressCtrl->setVisible(false); mMediaAddressCtrl->setEnabled(false); mMediaPlaySliderPanel->setVisible(has_focus && !mini_controls); mMediaPlaySliderPanel->setEnabled(has_focus && !mini_controls); + mSkipFwdCtrl->setVisible(has_focus && !mini_controls); + mSkipFwdCtrl->setEnabled(has_focus && !mini_controls); + mSkipBackCtrl->setVisible(has_focus && !mini_controls); + mSkipBackCtrl->setEnabled(has_focus && !mini_controls); mVolumeCtrl->setVisible(has_focus); mVolumeUpCtrl->setVisible(has_focus); @@ -435,6 +444,10 @@ void LLPanelPrimMediaControls::updateShape() mMediaAddressCtrl->setEnabled(has_focus && !mini_controls); mMediaPlaySliderPanel->setVisible(FALSE); mMediaPlaySliderPanel->setEnabled(FALSE); + mSkipFwdCtrl->setVisible(FALSE); + mSkipFwdCtrl->setEnabled(FALSE); + mSkipBackCtrl->setVisible(FALSE); + mSkipBackCtrl->setEnabled(FALSE); mVolumeCtrl->setVisible(FALSE); mVolumeUpCtrl->setVisible(FALSE); @@ -789,7 +802,7 @@ void LLPanelPrimMediaControls::onClickForward() focusOnTarget(); LLViewerMediaImpl* impl = getTargetMediaImpl(); - + if (impl) { impl->navigateForward(); @@ -866,12 +879,39 @@ void LLPanelPrimMediaControls::onClickStop() } } +void LLPanelPrimMediaControls::onClickSkipBack() +{ + focusOnTarget(); + + LLViewerMediaImpl* impl =getTargetMediaImpl(); + + if (impl) + { + // XXX Oddly, the impl has the policy that "skipping" is really navigating + impl->navigateBack(); + } +} + +void LLPanelPrimMediaControls::onClickSkipForward() +{ + focusOnTarget(); + + LLViewerMediaImpl* impl = getTargetMediaImpl(); + + if (impl) + { + // XXX Oddly, the impl has the policy that "skipping" is really navigating + impl->navigateForward(); + } +} + void LLPanelPrimMediaControls::onClickZoom() { focusOnTarget(); nextZoomLevel(); } + void LLPanelPrimMediaControls::nextZoomLevel() { int index = 0; diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h index 124fa9cce4..aeee3685ed 100644 --- a/indra/newview/llpanelprimmediacontrols.h +++ b/indra/newview/llpanelprimmediacontrols.h @@ -95,6 +95,8 @@ private: void onClickPause(); void onClickStop(); void onClickZoom(); + void onClickSkipBack(); + void onClickSkipForward(); void onCommitURL(); void updateZoom(); @@ -137,6 +139,8 @@ private: LLUICtrl *mHomeCtrl; LLUICtrl *mUnzoomCtrl; LLUICtrl *mOpenCtrl; + LLUICtrl *mSkipBackCtrl; + LLUICtrl *mSkipFwdCtrl; LLUICtrl *mZoomCtrl; LLPanel *mMediaProgressPanel; LLProgressBar *mMediaProgressBar; diff --git a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml index 98025e28db..00e3116217 100644 --- a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml +++ b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml @@ -86,7 +86,7 @@ auto_resize="false" height="22" layout="topleft" - tool_tip="Step back" + tool_tip="Navigate back" width="22" left="0" top_delta="4"> @@ -111,7 +111,7 @@ hover_glow_amount="0.15" height="22" layout="topleft" - tool_tip="Step forward" + tool_tip="Navigate forward" top_delta="0" min_width="22" width="22"> @@ -359,6 +359,55 @@ function="MediaCtrl.CommitURL" /> function="MediaCtrl.JumpProgress" /> </slider_bar> </layout_panel> + <layout_panel + name="skip_back" + auto_resize="false" + user_resize="false" + layout="topleft" + min_width="22" + width="22"> + <button + image_overlay="SkipBackward_Off" + image_disabled="PushButton_Disabled" + image_disabled_selected="PushButton_Disabled" + image_selected="PushButton_Selected" + image_unselected="PushButton_Off" + hover_glow_amount="0.15" + auto_resize="false" + height="22" + layout="topleft" + tool_tip="Step back" + top="-14" + width="22" + left="0"> + <button.commit_callback + function="MediaCtrl.SkipBack" /> + </button> + </layout_panel> + <layout_panel + name="skip_forward" + auto_resize="false" + user_resize="false" + layout="topleft" + min_width="22" + width="22"> + <button + image_overlay="SkipForward_Off" + image_disabled="PushButton_Disabled" + image_disabled_selected="PushButton_Disabled" + image_selected="PushButton_Selected" + image_unselected="PushButton_Off" + hover_glow_amount="0.15" + height="22" + layout="topleft" + tool_tip="Step forward" + top="-14" + min_width="22" + width="22"> + <button.commit_callback + function="MediaCtrl.SkipForward" /> + </button> + </layout_panel> <layout_panel name="media_volume" auto_resize="false" -- cgit v1.2.3 From a8b603f33ef71ab8afae66236579d41a09b2fce1 Mon Sep 17 00:00:00 2001 From: Rick Pasetto <rick@lindenlab.com> Date: Thu, 19 Nov 2009 18:34:37 -0800 Subject: Push the policy that "back", "forward" and "stop" do different things out of LLViewerMedia. Now, LLViewerMedia has explicit skipBack() and skipForward() functions, and the buttons in LLPanelPrimMediaControls now map onto those functions neatly. --- indra/newview/llpanelprimmediacontrols.cpp | 21 ++++-- indra/newview/llpanelprimmediacontrols.h | 2 + indra/newview/llviewermedia.cpp | 79 +++++++++++----------- indra/newview/llviewermedia.h | 2 + indra/newview/llviewerparcelmedia.cpp | 5 +- .../default/xui/en/panel_prim_media_controls.xml | 3 +- 6 files changed, 63 insertions(+), 49 deletions(-) diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 80d2a9425c..aca0e1d5c7 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -54,6 +54,7 @@ #include "llpanelprimmediacontrols.h" #include "llpluginclassmedia.h" #include "llprogressbar.h" +#include "llstring.h" #include "llviewercontrol.h" #include "llviewerparcelmgr.h" #include "llviewermedia.h" @@ -92,6 +93,7 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() : mCommitCallbackRegistrar.add("MediaCtrl.Forward", boost::bind(&LLPanelPrimMediaControls::onClickForward, this)); mCommitCallbackRegistrar.add("MediaCtrl.Home", boost::bind(&LLPanelPrimMediaControls::onClickHome, this)); mCommitCallbackRegistrar.add("MediaCtrl.Stop", boost::bind(&LLPanelPrimMediaControls::onClickStop, this)); + mCommitCallbackRegistrar.add("MediaCtrl.MediaStop", boost::bind(&LLPanelPrimMediaControls::onClickMediaStop, this)); mCommitCallbackRegistrar.add("MediaCtrl.Reload", boost::bind(&LLPanelPrimMediaControls::onClickReload, this)); mCommitCallbackRegistrar.add("MediaCtrl.Play", boost::bind(&LLPanelPrimMediaControls::onClickPlay, this)); mCommitCallbackRegistrar.add("MediaCtrl.Pause", boost::bind(&LLPanelPrimMediaControls::onClickPause, this)); @@ -149,6 +151,7 @@ BOOL LLPanelPrimMediaControls::postBuild() mLeftBookend = getChild<LLUICtrl>("left_bookend"); mRightBookend = getChild<LLUICtrl>("right_bookend"); mBackgroundImage = LLUI::getUIImage(getString("control_background_image_name")); + LLStringUtil::convertToF32(getString("skip_step"), mSkipStep); // These are currently removed...but getChild creates a "dummy" widget. // This class handles them missing. @@ -873,6 +876,18 @@ void LLPanelPrimMediaControls::onClickStop() LLViewerMediaImpl* impl = getTargetMediaImpl(); + if(impl) + { + impl->navigateStop(); + } +} + +void LLPanelPrimMediaControls::onClickMediaStop() +{ + focusOnTarget(); + + LLViewerMediaImpl* impl = getTargetMediaImpl(); + if(impl) { impl->stop(); @@ -887,8 +902,7 @@ void LLPanelPrimMediaControls::onClickSkipBack() if (impl) { - // XXX Oddly, the impl has the policy that "skipping" is really navigating - impl->navigateBack(); + impl->skipBack(mSkipStep); } } @@ -900,8 +914,7 @@ void LLPanelPrimMediaControls::onClickSkipForward() if (impl) { - // XXX Oddly, the impl has the policy that "skipping" is really navigating - impl->navigateForward(); + impl->skipForward(mSkipStep); } } diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h index aeee3685ed..54fc4e343f 100644 --- a/indra/newview/llpanelprimmediacontrols.h +++ b/indra/newview/llpanelprimmediacontrols.h @@ -97,6 +97,7 @@ private: void onClickZoom(); void onClickSkipBack(); void onClickSkipForward(); + void onClickMediaStop(); void onCommitURL(); void updateZoom(); @@ -158,6 +159,7 @@ private: LLUICtrl *mLeftBookend; LLUICtrl *mRightBookend; LLUIImage* mBackgroundImage; + F32 mSkipStep; LLUICtrl *mMediaPanelScroll; LLButton *mScrollUpCtrl; diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 3a7c54479b..e55523c11e 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -278,7 +278,7 @@ viewer_media_t LLViewerMedia::newMediaImpl( } else { - media_impl->stop(); + media_impl->unload(); media_impl->mTextureId = texture_id; media_impl->mMediaWidth = media_width; media_impl->mMediaHeight = media_height; @@ -1092,15 +1092,7 @@ void LLViewerMediaImpl::stop() { if(mMediaSource) { - if(mMediaSource->pluginSupportsMediaBrowser()) - { - mMediaSource->browse_stop(); - } - else - { - mMediaSource->stop(); - } - + mMediaSource->stop(); // destroyMediaSource(); } } @@ -1132,6 +1124,40 @@ void LLViewerMediaImpl::seek(F32 time) } } +////////////////////////////////////////////////////////////////////////////////////////// +void LLViewerMediaImpl::skipBack(F32 step_scale) +{ + if(mMediaSource) + { + if(mMediaSource->pluginSupportsMediaTime()) + { + F64 back_step = mMediaSource->getCurrentTime() - (mMediaSource->getDuration()*step_scale); + if(back_step < 0.0) + { + back_step = 0.0; + } + mMediaSource->seek(back_step); + } + } +} + +////////////////////////////////////////////////////////////////////////////////////////// +void LLViewerMediaImpl::skipForward(F32 step_scale) +{ + if(mMediaSource) + { + if(mMediaSource->pluginSupportsMediaTime()) + { + F64 forward_step = mMediaSource->getCurrentTime() + (mMediaSource->getDuration()*step_scale); + if(forward_step > mMediaSource->getDuration()) + { + forward_step = mMediaSource->getDuration(); + } + mMediaSource->seek(forward_step); + } + } +} + ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::setVolume(F32 volume) { @@ -1339,21 +1365,7 @@ void LLViewerMediaImpl::navigateBack() { if (mMediaSource) { - if(mMediaSource->pluginSupportsMediaTime()) - { - F64 step_scale = 0.02; // temp , can be changed - F64 back_step = mMediaSource->getCurrentTime() - (mMediaSource->getDuration()*step_scale); - if(back_step < 0.0) - { - back_step = 0.0; - } - mMediaSource->seek(back_step); - //mMediaSource->start(-2.0); - } - else - { - mMediaSource->browse_back(); - } + mMediaSource->browse_back(); } } @@ -1362,21 +1374,7 @@ void LLViewerMediaImpl::navigateForward() { if (mMediaSource) { - if(mMediaSource->pluginSupportsMediaTime()) - { - F64 step_scale = 0.02; // temp , can be changed - F64 forward_step = mMediaSource->getCurrentTime() + (mMediaSource->getDuration()*step_scale); - if(forward_step > mMediaSource->getDuration()) - { - forward_step = mMediaSource->getDuration(); - } - mMediaSource->seek(forward_step); - //mMediaSource->start(2.0); - } - else - { - mMediaSource->browse_forward(); - } + mMediaSource->browse_forward(); } } @@ -1525,7 +1523,6 @@ void LLViewerMediaImpl::navigateStop() { mMediaSource->browse_stop(); } - } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index f4afce6c4c..ac12112ed4 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -149,6 +149,8 @@ public: void pause(); void start(); void seek(F32 time); + void skipBack(F32 step_scale); + void skipForward(F32 step_scale); void setVolume(F32 volume); void updateVolume(); F32 getVolume(); diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index 7559fd8e72..cb2099b3b0 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -218,7 +218,7 @@ void LLViewerParcelMedia::play(LLParcel* parcel) 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->unload(); sMediaImpl = LLViewerMedia::newMediaImpl( placeholder_texture_id, @@ -261,8 +261,7 @@ void LLViewerParcelMedia::stop() // We need to remove the media HUD if it is up. LLViewerMediaFocus::getInstance()->clearFocus(); - // This will kill the media instance. - sMediaImpl->stop(); + // This will unload & kill the media instance. sMediaImpl = NULL; } diff --git a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml index 00e3116217..88049fe7d1 100644 --- a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml +++ b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml @@ -8,6 +8,7 @@ mouse_opaque="false" width="800"> <string name="control_background_image_name">Inspector_Background</string> + <string name="skip_step">0.2</string> <panel name="media_region" bottom="125" @@ -165,7 +166,7 @@ min_width="22" width="22"> <button.commit_callback - function="MediaCtrl.Stop" /> + function="MediaCtrl.MediaStop" /> </button> </layout_panel> <layout_panel -- cgit v1.2.3 From 1c57d96aa747d6754de664c601ec40f688f5963e Mon Sep 17 00:00:00 2001 From: Rick Pasetto <rick@lindenlab.com> Date: Fri, 20 Nov 2009 13:09:39 -0800 Subject: Delete the media impl instead of just unloading it. From Review #41 feedback. --- indra/newview/llviewerparcelmedia.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index cb2099b3b0..f61dbb1b39 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -218,7 +218,7 @@ void LLViewerParcelMedia::play(LLParcel* parcel) 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->unload(); + sMediaImpl = NULL; sMediaImpl = LLViewerMedia::newMediaImpl( placeholder_texture_id, -- cgit v1.2.3 From 766af6102ec2f2d4f161966a39726af98ce4752f Mon Sep 17 00:00:00 2001 From: Rick Pasetto <rick@lindenlab.com> Date: Fri, 20 Nov 2009 13:11:39 -0800 Subject: DEV-41991 DEV-42756 : un-do the "fix" for the race condition regarding media data overwriting. I think the problem is that this floater's state is not updated properly when the server response comes in. This needs more thought. --- indra/newview/llfloatertools.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 9854d2594b..386fb7f909 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -43,6 +43,7 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "lldraghandle.h" +#include "llerror.h" #include "llfloaterbuildoptions.h" #include "llfloatermediasettings.h" #include "llfloateropenobject.h" @@ -1122,11 +1123,27 @@ void LLFloaterTools::getMediaState() LLVOVolume* object = dynamic_cast<LLVOVolume*>(node->getObject()); if (NULL != object) { - if (!object->permModify() || object->isMediaDataBeingFetched()) + if (!object->permModify()) { + LL_INFOS("LLFloaterTools: media") + << "Selection not editable due to lack of modify permissions on object id " + << object->getID() << LL_ENDL; + editable = false; break; } + // XXX DISABLE this for now, because when the fetch finally + // does come in, the state of this floater doesn't properly + // update. This needs more thought. +// if (object->isMediaDataBeingFetched()) +// { +// LL_INFOS("LLFloaterTools: media") +// << "Selection not editable due to media data being fetched for object id " +// << object->getID() << LL_ENDL; +// +// editable = false; +// break; +// } } } } -- cgit v1.2.3