diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpanelprimmediacontrols.cpp | 59 | ||||
-rw-r--r-- | indra/newview/llpanelprimmediacontrols.h | 6 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 79 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewerparcelmedia.cpp | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_prim_media_controls.xml | 56 |
6 files changed, 157 insertions, 50 deletions
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 12ad070efd..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)); @@ -102,6 +104,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 +139,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"); @@ -145,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. @@ -329,12 +336,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 +447,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 +805,7 @@ void LLPanelPrimMediaControls::onClickForward() focusOnTarget(); LLViewerMediaImpl* impl = getTargetMediaImpl(); - + if (impl) { impl->navigateForward(); @@ -862,16 +878,53 @@ void LLPanelPrimMediaControls::onClickStop() if(impl) { + impl->navigateStop(); + } +} + +void LLPanelPrimMediaControls::onClickMediaStop() +{ + focusOnTarget(); + + LLViewerMediaImpl* impl = getTargetMediaImpl(); + + if(impl) + { impl->stop(); } } +void LLPanelPrimMediaControls::onClickSkipBack() +{ + focusOnTarget(); + + LLViewerMediaImpl* impl =getTargetMediaImpl(); + + if (impl) + { + impl->skipBack(mSkipStep); + } +} + +void LLPanelPrimMediaControls::onClickSkipForward() +{ + focusOnTarget(); + + LLViewerMediaImpl* impl = getTargetMediaImpl(); + + if (impl) + { + impl->skipForward(mSkipStep); + } +} + 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..54fc4e343f 100644 --- a/indra/newview/llpanelprimmediacontrols.h +++ b/indra/newview/llpanelprimmediacontrols.h @@ -95,6 +95,9 @@ private: void onClickPause(); void onClickStop(); void onClickZoom(); + void onClickSkipBack(); + void onClickSkipForward(); + void onClickMediaStop(); void onCommitURL(); void updateZoom(); @@ -137,6 +140,8 @@ private: LLUICtrl *mHomeCtrl; LLUICtrl *mUnzoomCtrl; LLUICtrl *mOpenCtrl; + LLUICtrl *mSkipBackCtrl; + LLUICtrl *mSkipFwdCtrl; LLUICtrl *mZoomCtrl; LLPanel *mMediaProgressPanel; LLProgressBar *mMediaProgressBar; @@ -154,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(); } } @@ -1133,6 +1125,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) { mRequestedVolume = 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 98025e28db..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" @@ -86,7 +87,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 +112,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"> @@ -165,7 +166,7 @@ min_width="22" width="22"> <button.commit_callback - function="MediaCtrl.Stop" /> + function="MediaCtrl.MediaStop" /> </button> </layout_panel> <layout_panel @@ -360,6 +361,55 @@ function="MediaCtrl.CommitURL" /> </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" user_resize="false" |