From 104b117154022da6ec8e54bea04ff76e5692f93a Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Thu, 31 Mar 2016 15:26:53 -0700 Subject: Faster to copy changes than merge branches. --- indra/newview/llinventorymodel.cpp | 153 ----------------- indra/newview/llinventorymodel.h | 2 - indra/newview/llinventoryobserver.cpp | 30 +--- indra/newview/lltooldraganddrop.cpp | 60 ------- indra/newview/llviewerinventory.cpp | 314 ++++++---------------------------- indra/newview/llviewerinventory.h | 6 +- 6 files changed, 64 insertions(+), 501 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index bdbe253723..ea57067f93 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2693,24 +2693,13 @@ void LLInventoryModel::registerCallbacks(LLMessageSystem* msg) msg->setHandlerFuncFast(_PREHASH_RemoveInventoryObjects, processRemoveInventoryObjects, NULL); - //msg->setHandlerFuncFast(_PREHASH_ExchangeCallingCard, - // processExchangeCallingcard, - // NULL); - //msg->setHandlerFuncFast(_PREHASH_AddCallingCard, - // processAddCallingcard, - // NULL); - //msg->setHandlerFuncFast(_PREHASH_DeclineCallingCard, - // processDeclineCallingcard, - // NULL); msg->setHandlerFuncFast(_PREHASH_SaveAssetIntoInventory, processSaveAssetIntoInventory, NULL); msg->setHandlerFuncFast(_PREHASH_BulkUpdateInventory, processBulkUpdateInventory, NULL); - msg->setHandlerFunc("InventoryDescendents", processInventoryDescendents); msg->setHandlerFunc("MoveInventoryItem", processMoveInventoryItem); - msg->setHandlerFunc("FetchInventoryReply", processFetchInventoryReply); } @@ -2730,14 +2719,6 @@ void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, vo } -// static -void LLInventoryModel::processFetchInventoryReply(LLMessageSystem* msg, void**) -{ - // no accounting - gInventory.messageUpdateCore(msg, false); -} - - bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, U32 mask) { //make sure our added inventory observer is active @@ -3180,85 +3161,6 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) InventoryCallbackInfo cbinfo = (*inv_it); gInventoryCallbacks.fire(cbinfo.mCallback, cbinfo.mInvID); } - - //gInventory.validate(); - - // Don't show the inventory. We used to call showAgentInventory here. - //LLFloaterInventory* view = LLFloaterInventory::getActiveInventory(); - //if(view) - //{ - // const BOOL take_keyboard_focus = FALSE; - // view->setSelection(category.getUUID(), take_keyboard_focus ); - // LLView* focus_view = gFocusMgr.getKeyboardFocus(); - // LLFocusMgr::FocusLostCallback callback = gFocusMgr.getFocusCallback(); - // // HACK to open inventory offers that are accepted. This information - // // really needs to flow through the instant messages and inventory - // // transfer/update messages. - // if (LLFloaterInventory::sOpenNextNewItem) - // { - // view->openSelected(); - // LLFloaterInventory::sOpenNextNewItem = FALSE; - // } - // - // // restore keyboard focus - // gFocusMgr.setKeyboardFocus(focus_view); - //} -} - -// static -void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) -{ - LLUUID agent_id; - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); - if(agent_id != gAgent.getID()) - { - LL_WARNS() << "Got a UpdateInventoryItem for the wrong agent." << LL_ENDL; - return; - } - LLUUID parent_id; - msg->getUUID("AgentData", "FolderID", parent_id); - LLUUID owner_id; - msg->getUUID("AgentData", "OwnerID", owner_id); - S32 version; - msg->getS32("AgentData", "Version", version); - S32 descendents; - msg->getS32("AgentData", "Descendents", descendents); - - S32 i; - S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); - LLPointer tcategory = new LLViewerInventoryCategory(owner_id); - for(i = 0; i < count; ++i) - { - tcategory->unpackMessage(msg, _PREHASH_FolderData, i); - gInventory.updateCategory(tcategory); - } - - count = msg->getNumberOfBlocksFast(_PREHASH_ItemData); - LLPointer titem = new LLViewerInventoryItem; - for(i = 0; i < count; ++i) - { - titem->unpackMessage(msg, _PREHASH_ItemData, i); - // If the item has already been added (e.g. from link prefetch), then it doesn't need to be re-added. - if (gInventory.getItem(titem->getUUID())) - { - LL_DEBUGS("Inventory") << "Skipping prefetched item [ Name: " << titem->getName() - << " | Type: " << titem->getActualType() << " | ItemUUID: " << titem->getUUID() << " ] " << LL_ENDL; - continue; - } - gInventory.updateItem(titem); - } - - // set version and descendentcount according to message. - LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id); - if(cat) - { - cat->setVersion(version); - cat->setDescendentCount(descendents); - // Get this UUID on the changed list so that whatever's listening for it - // will get triggered. - gInventory.addChangedMask(LLInventoryObserver::INTERNAL, cat->getUUID()); - } - gInventory.notifyObservers(); } // static @@ -3527,30 +3429,6 @@ void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, c } } -//* @param[in] items vector of items in order to be saved. -/* -void LLInventoryModel::saveItemsOrder(const LLInventoryModel::item_array_t& items) -{ - int sortField = 0; - - // current order is saved by setting incremental values (1, 2, 3, ...) for the sort field - for (item_array_t::const_iterator i = items.begin(); i != items.end(); ++i) - { - LLViewerInventoryItem* item = *i; - - item->setSortField(++sortField); - item->setComplete(TRUE); - item->updateServer(FALSE); - - updateItem(item); - - // Tell the parent folder to refresh its sort order. - addChangedMask(LLInventoryObserver::SORT, item->getParentUUID()); - } - - notifyObservers(); -} -*/ // See also LLInventorySort where landmarks in the Favorites folder are sorted. class LLViewerInventoryItemSort { @@ -3561,37 +3439,6 @@ public: } }; -/** - * Sorts passed items by LLViewerInventoryItem sort field. - * - * @param[in, out] items - array of items, not sorted. - */ -//static void rearrange_item_order_by_sort_field(LLInventoryModel::item_array_t& items) -//{ -// static LLViewerInventoryItemSort sort_functor; -// std::sort(items.begin(), items.end(), sort_functor); -//} - -// * @param source_item_id - LLUUID of the source item to be moved into new position -// * @param target_item_id - LLUUID of the target item before which source item should be placed. -/* -void LLInventoryModel::rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id) -{ - LLInventoryModel::cat_array_t cats; - LLInventoryModel::item_array_t items; - LLIsType is_type(LLAssetType::AT_LANDMARK); - LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); - gInventory.collectDescendentsIf(favorites_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type); - - // ensure items are sorted properly before changing order. EXT-3498 - rearrange_item_order_by_sort_field(items); - - // update order - updateItemsOrder(items, source_item_id, target_item_id); - - saveItemsOrder(items); -} -*/ //---------------------------------------------------------------------------- // *NOTE: DEBUG functionality diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index e1e6db19eb..bfa56bcec0 100755 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -623,9 +623,7 @@ public: static void processRemoveInventoryObjects(LLMessageSystem* msg, void**); static void processSaveAssetIntoInventory(LLMessageSystem* msg, void**); static void processBulkUpdateInventory(LLMessageSystem* msg, void**); - static void processInventoryDescendents(LLMessageSystem* msg, void**); static void processMoveInventoryItem(LLMessageSystem* msg, void**); - static void processFetchInventoryReply(LLMessageSystem* msg, void**); protected: bool messageUpdateCore(LLMessageSystem* msg, bool do_accounting, U32 mask = 0x0); diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 6c81378622..776bb1c601 100755 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -241,33 +241,11 @@ void fetch_items_from_llsd(const LLSD& items_llsd) gInventory.requestPost(true, url, body[i], handler, (i ? "Library Item" : "Inventory Item")); continue; } + else + { + LL_WARNS("INVENTORY") << "Failed to get capability." << LL_ENDL; + } - LLMessageSystem* msg = gMessageSystem; - BOOL start_new_message = TRUE; - for (S32 j=0; jnewMessageFast(_PREHASH_FetchInventory); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - } - msg->nextBlockFast(_PREHASH_InventoryData); - msg->addUUIDFast(_PREHASH_OwnerID, item_entry["owner_id"].asUUID()); - msg->addUUIDFast(_PREHASH_ItemID, item_entry["item_id"].asUUID()); - if (msg->isSendFull(NULL)) - { - start_new_message = TRUE; - gAgent.sendReliableMessage(); - } - } - if (!start_new_message) - { - gAgent.sendReliableMessage(); - } } } diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 98586e3b3d..27c4c90857 100755 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -223,66 +223,6 @@ void LLCategoryDropObserver::done() } delete this; } -/* Doesn't seem to be used anymore. -class LLCategoryDropDescendentsObserver : public LLInventoryFetchDescendentsObserver -{ -public: - LLCategoryDropDescendentsObserver( - const LLUUID& obj_id, LLToolDragAndDrop::ESource src) : - mObjectID(obj_id), - mSource(src) - {} - ~LLCategoryDropDescendentsObserver() {} - virtual void done(); - -protected: - LLUUID mObjectID; - LLToolDragAndDrop::ESource mSource; -}; - -void LLCategoryDropDescendentsObserver::done() -{ - - gInventory.removeObserver(this); - uuid_vec_t::iterator it = mComplete.begin(); - uuid_vec_t::iterator end = mComplete.end(); - LLViewerInventoryCategory::cat_array_t cats; - LLViewerInventoryItem::item_array_t items; - for(; it != end; ++it) - { - gInventory.collectDescendents( - (*it), - cats, - items, - LLInventoryModel::EXCLUDE_TRASH); - } - - S32 count = items.size(); - if (count) - { - std::set unique_ids; - for(S32 i = 0; i < count; ++i) - { - unique_ids.insert(items.get(i)->getUUID()); - } - uuid_vec_t ids; - std::back_insert_iterator copier(ids); - std::copy(unique_ids.begin(), unique_ids.end(), copier); - LLCategoryDropObserver* dropper; - dropper = new LLCategoryDropObserver(ids, mObjectID, mSource); - dropper->startFetch(); - if (dropper->isDone()) - { - dropper->done(); - } - else - { - gInventory.addObserver(dropper); - } - } - delete this; -} -*/ S32 LLToolDragAndDrop::sOperationId = 0; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 0ee873d7a1..10de787a3a 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -384,16 +384,20 @@ void LLViewerInventoryItem::updateServer(BOOL is_new) const LLInventoryModel::LLCategoryUpdate up(mParentUUID, is_new ? 1 : 0); gInventory.accountForUpdate(up); - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_UpdateInventoryItem); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_TransactionID, mTransactionID); - msg->nextBlockFast(_PREHASH_InventoryData); - msg->addU32Fast(_PREHASH_CallbackID, 0); - packMessage(msg); - gAgent.sendReliableMessage(); + LLSD updates = asLLSD(); + // Replace asset_id and/or shadow_id with transaction_id (hash_id) + if (updates.has("asset_id")) + { + updates.erase("asset_id"); + updates["hash_id"] = getTransactionID(); + } + if (updates.has("shadow_id")) + { + updates.erase("shadow_id"); + updates["hash_id"] = getTransactionID(); + } + AISAPI::completion_t cr = boost::bind(&doInventoryCb, NULL, _1); + AISAPI::UpdateItem(getUUID(), updates, cr); } void LLViewerInventoryItem::fetchFromServer(void) const @@ -636,17 +640,9 @@ void LLViewerInventoryCategory::updateServer(BOOL is_new) const return; } - LLInventoryModel::LLCategoryUpdate up(mParentUUID, is_new ? 1 : 0); - gInventory.accountForUpdate(up); - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_UpdateInventoryFolder); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_FolderData); - packMessage(msg); - gAgent.sendReliableMessage(); + LLSD new_llsd = asLLSD(); + AISAPI::completion_t cr = boost::bind(&doInventoryCb, NULL, _1); + AISAPI::UpdateCategory(getUUID(), new_llsd, cr); } S32 LLViewerInventoryCategory::getVersion() const @@ -669,18 +665,6 @@ bool LLViewerInventoryCategory::fetch() mDescendentsRequested.reset(); mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY); - // bitfield - // 1 = by date - // 2 = folders by date - // Need to mask off anything but the first bit. - // This comes from LLInventoryFilter from llfolderview.h - U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER) & 0x1; - - // *NOTE: For bug EXT-2879, originally commented out - // gAgent.getRegion()->getCapability in order to use the old - // message-based system. This has been uncommented now that - // AIS folks are aware of the issue and have a fix in process. - // see ticket for details. std::string url; if (gAgent.getRegion()) @@ -695,24 +679,6 @@ bool LLViewerInventoryCategory::fetch() { LLInventoryModelBackgroundFetch::instance().start(mUUID, false); } - else - { //Deprecated, but if we don't have a capability, use the old system. - LL_INFOS(LOG_INV) << "FetchInventoryDescendents2 capability not found. Using deprecated UDP message." << LL_ENDL; - - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("FetchInventoryDescendents"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->nextBlock("InventoryData"); - msg->addUUID("FolderID", mUUID); - msg->addUUID("OwnerID", mOwnerID); - - msg->addS32("SortOrder", sort_order); - msg->addBOOL("FetchFolders", FALSE); - msg->addBOOL("FetchItems", TRUE); - gAgent.sendReliableMessage(); - } return true; } return false; @@ -905,17 +871,16 @@ void LLViewerInventoryCategory::changeType(LLFolderType::EType new_folder_type) const LLUUID &parent_id = getParentUUID(); const std::string &name = getName(); - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_UpdateInventoryFolder); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_FolderData); - msg->addUUIDFast(_PREHASH_FolderID, folder_id); - msg->addUUIDFast(_PREHASH_ParentID, parent_id); - msg->addS8Fast(_PREHASH_Type, new_folder_type); - msg->addStringFast(_PREHASH_Name, name); - gAgent.sendReliableMessage(); + LLPointer new_cat = new LLViewerInventoryCategory(folder_id, + parent_id, + new_folder_type, + name, + gAgent.getID()); + + + LLSD new_llsd = new_cat->asLLSD(); + AISAPI::completion_t cr = boost::bind(&doInventoryCb, NULL, _1); + AISAPI::UpdateCategory(folder_id, new_llsd, cr); setPreferredType(new_folder_type); gInventory.addChangedMask(LLInventoryObserver::LABEL, folder_id); @@ -1289,40 +1254,10 @@ void link_inventory_array(const LLUUID& category, << " UUID:" << category << " ] " << LL_ENDL; #endif } - - if (AISAPI::isAvailable()) - { - LLSD new_inventory = LLSD::emptyMap(); - new_inventory["links"] = links; - AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t(); - AISAPI::CreateInventory(category, new_inventory, cr); - } - else - { - LLMessageSystem* msg = gMessageSystem; - for (LLSD::array_iterator iter = links.beginArray(); iter != links.endArray(); ++iter ) - { - msg->newMessageFast(_PREHASH_LinkInventoryItem); - msg->nextBlock(_PREHASH_AgentData); - { - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - } - msg->nextBlock(_PREHASH_InventoryBlock); - { - LLSD link = (*iter); - msg->addU32Fast(_PREHASH_CallbackID, gInventoryCallbacks.registerCB(cb)); - msg->addUUIDFast(_PREHASH_FolderID, category); - msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); - msg->addUUIDFast(_PREHASH_OldItemID, link["linked_id"].asUUID()); - msg->addS8Fast(_PREHASH_Type, link["type"].asInteger()); - msg->addS8Fast(_PREHASH_InvType, link["inv_type"].asInteger()); - msg->addStringFast(_PREHASH_Name, link["name"].asString()); - msg->addStringFast(_PREHASH_Description, link["desc"].asString()); - } - gAgent.sendReliableMessage(); - } - } + LLSD new_inventory = LLSD::emptyMap(); + new_inventory["links"] = links; + AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); + AISAPI::CreateInventory(category, new_inventory, cr); } void move_inventory_item( @@ -1354,49 +1289,21 @@ void update_inventory_item( LLPointer cb) { const LLUUID& item_id = update_item->getUUID(); - if (AISAPI::isAvailable()) - { - LLSD updates = update_item->asLLSD(); - // Replace asset_id and/or shadow_id with transaction_id (hash_id) - if (updates.has("asset_id")) - { - updates.erase("asset_id"); - updates["hash_id"] = update_item->getTransactionID(); - } - if (updates.has("shadow_id")) - { - updates.erase("shadow_id"); - updates["hash_id"] = update_item->getTransactionID(); - } - AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t(); - AISAPI::UpdateItem(item_id, updates, cr); - } - else - { - LLPointer obj = gInventory.getItem(item_id); - LL_DEBUGS(LOG_INV) << "item_id: [" << item_id << "] name " << (update_item ? update_item->getName() : "(NOT FOUND)") << LL_ENDL; - if(obj) - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_UpdateInventoryItem); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_TransactionID, update_item->getTransactionID()); - msg->nextBlockFast(_PREHASH_InventoryData); - msg->addU32Fast(_PREHASH_CallbackID, 0); - update_item->packMessage(msg); - gAgent.sendReliableMessage(); - - LLInventoryModel::LLCategoryUpdate up(update_item->getParentUUID(), 0); - gInventory.accountForUpdate(up); - gInventory.updateItem(update_item); - if (cb) - { - cb->fire(item_id); - } - } - } + + LLSD updates = update_item->asLLSD(); + // Replace asset_id and/or shadow_id with transaction_id (hash_id) + if (updates.has("asset_id")) + { + updates.erase("asset_id"); + updates["hash_id"] = update_item->getTransactionID(); + } + if (updates.has("shadow_id")) + { + updates.erase("shadow_id"); + updates["hash_id"] = update_item->getTransactionID(); + } + AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); + AISAPI::UpdateItem(item_id, updates, cr); } // Note this only supports updating an existing item. Goes through AISv3 @@ -1407,41 +1314,8 @@ void update_inventory_item( const LLSD& updates, LLPointer cb) { - if (AISAPI::isAvailable()) - { - AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t(); - AISAPI::UpdateItem(item_id, updates, cr); - } - else - { - LLPointer obj = gInventory.getItem(item_id); - LL_DEBUGS(LOG_INV) << "item_id: [" << item_id << "] name " << (obj ? obj->getName() : "(NOT FOUND)") << LL_ENDL; - if(obj) - { - LLPointer new_item(new LLViewerInventoryItem); - new_item->copyViewerItem(obj); - new_item->fromLLSD(updates,false); - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_UpdateInventoryItem); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_TransactionID, new_item->getTransactionID()); - msg->nextBlockFast(_PREHASH_InventoryData); - msg->addU32Fast(_PREHASH_CallbackID, 0); - new_item->packMessage(msg); - gAgent.sendReliableMessage(); - - LLInventoryModel::LLCategoryUpdate up(new_item->getParentUUID(), 0); - gInventory.accountForUpdate(up); - gInventory.updateItem(new_item); - if (cb) - { - cb->fire(item_id); - } - } - } + AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); + AISAPI::UpdateItem(item_id, updates, cr); } void update_inventory_category( @@ -1461,32 +1335,9 @@ void update_inventory_category( LLPointer new_cat = new LLViewerInventoryCategory(obj); new_cat->fromLLSD(updates); - // FIXME - restore this once the back-end work has been done. - if (AISAPI::isAvailable()) - { - LLSD new_llsd = new_cat->asLLSD(); - AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t(); - AISAPI::UpdateCategory(cat_id, new_llsd, cr); - } - else // no cap - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_UpdateInventoryFolder); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_FolderData); - new_cat->packMessage(msg); - gAgent.sendReliableMessage(); - - LLInventoryModel::LLCategoryUpdate up(new_cat->getParentUUID(), 0); - gInventory.accountForUpdate(up); - gInventory.updateCategory(new_cat); - if (cb) - { - cb->fire(cat_id); - } - } + LLSD new_llsd = new_cat->asLLSD(); + AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); + AISAPI::UpdateCategory(cat_id, new_llsd, cr); } } @@ -1604,41 +1455,8 @@ void remove_inventory_category( LLNotificationsUtil::add("CannotRemoveProtectedCategories"); return; } - if (AISAPI::isAvailable()) - { - AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t(); - AISAPI::RemoveCategory(cat_id, cr); - } - else // no cap - { - // RemoveInventoryFolder does not remove children, so must - // clear descendents first. - LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(cat_id); - if(children != LLInventoryModel::CHILDREN_NO) - { - LL_DEBUGS(LOG_INV) << "Will purge descendents first before deleting category " << cat_id << LL_ENDL; - LLPointer wrap_cb = new LLRemoveCategoryOnDestroy(cat_id, cb); - purge_descendents_of(cat_id, wrap_cb); - return; - } - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_RemoveInventoryFolder); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_FolderData); - msg->addUUIDFast(_PREHASH_FolderID, cat_id); - gAgent.sendReliableMessage(); - - // Update inventory and call callback immediately since - // message-based system has no callback mechanism (!) - gInventory.onObjectDeletedFromServer(cat_id); - if (cb) - { - cb->fire(cat_id); - } - } + AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); + AISAPI::RemoveCategory(cat_id, cr); } else { @@ -1857,29 +1675,11 @@ void slam_inventory_folder(const LLUUID& folder_id, const LLSD& contents, LLPointer cb) { - if (AISAPI::isAvailable()) - { - LL_DEBUGS(LOG_INV) << "using AISv3 to slam folder, id " << folder_id - << " new contents: " << ll_pretty_print_sd(contents) << LL_ENDL; + LL_DEBUGS(LOG_INV) << "using AISv3 to slam folder, id " << folder_id + << " new contents: " << ll_pretty_print_sd(contents) << LL_ENDL; - AISAPI::completion_t cr = (cb) ? boost::bind(&doInventoryCb, cb, _1) : AISAPI::completion_t(); - AISAPI::SlamFolder(folder_id, contents, cr); - } - else // no cap - { - LL_DEBUGS(LOG_INV) << "using item-by-item calls to slam folder, id " << folder_id - << " new contents: " << ll_pretty_print_sd(contents) << LL_ENDL; - for (LLSD::array_const_iterator it = contents.beginArray(); - it != contents.endArray(); - ++it) - { - const LLSD& item_contents = *it; - LLViewerInventoryItem *item = new LLViewerInventoryItem; - item->fromLLSD(item_contents); - link_inventory_object(folder_id, item, cb); - } - remove_folder_contents(folder_id,false,cb); - } + AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); + AISAPI::SlamFolder(folder_id, contents, cr); } void remove_folder_contents(const LLUUID& category, bool keep_outfit_links, diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 4e91e4110a..9c2a640a1a 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -387,9 +387,9 @@ void update_inventory_item( LLPointer cb); void update_inventory_category( - const LLUUID& cat_id, - const LLSD& updates, - LLPointer cb); + const LLUUID& cat_id, + const LLSD& updates, + LLPointer cb); void remove_inventory_items( LLInventoryObject::object_list_t& items, -- cgit v1.2.3 From 1337bff4acc8b53b29bcbe1203c620b9b0fb3b09 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Thu, 31 Mar 2016 16:42:18 -0700 Subject: Needs prototype. --- indra/newview/llviewerinventory.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 9c2a640a1a..5194679a0c 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -38,6 +38,7 @@ class LLInventoryPanel; class LLFolderView; class LLFolderBridge; class LLViewerInventoryCategory; +class LLInventoryCallback; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLViewerInventoryItem -- cgit v1.2.3 From 718b68db629c14fae6c89716ccd961a57c738bb2 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Thu, 31 Mar 2016 17:10:10 -0700 Subject: I hate polluting the commit history. --- indra/newview/llviewerinventory.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 10de787a3a..5616c27370 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -396,7 +396,7 @@ void LLViewerInventoryItem::updateServer(BOOL is_new) const updates.erase("shadow_id"); updates["hash_id"] = getTransactionID(); } - AISAPI::completion_t cr = boost::bind(&doInventoryCb, NULL, _1); + AISAPI::completion_t cr = boost::bind(&doInventoryCb, (LLPointer)NULL, _1); AISAPI::UpdateItem(getUUID(), updates, cr); } @@ -641,7 +641,7 @@ void LLViewerInventoryCategory::updateServer(BOOL is_new) const } LLSD new_llsd = asLLSD(); - AISAPI::completion_t cr = boost::bind(&doInventoryCb, NULL, _1); + AISAPI::completion_t cr = boost::bind(&doInventoryCb, (LLPointer)NULL, _1); AISAPI::UpdateCategory(getUUID(), new_llsd, cr); } @@ -879,7 +879,7 @@ void LLViewerInventoryCategory::changeType(LLFolderType::EType new_folder_type) LLSD new_llsd = new_cat->asLLSD(); - AISAPI::completion_t cr = boost::bind(&doInventoryCb, NULL, _1); + AISAPI::completion_t cr = boost::bind(&doInventoryCb, (LLPointer) NULL, _1); AISAPI::UpdateCategory(folder_id, new_llsd, cr); setPreferredType(new_folder_type); -- cgit v1.2.3 From 76d1551e2ce53f8c26a8f5ced6c27c9a85e8a19f Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 20 Apr 2016 17:46:59 +0300 Subject: MAINT-6341 Changing properties of the object in inventory are not saved after transfer it to next owner --- indra/newview/llviewerinventory.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 5616c27370..d0813544f8 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -389,12 +389,18 @@ void LLViewerInventoryItem::updateServer(BOOL is_new) const if (updates.has("asset_id")) { updates.erase("asset_id"); - updates["hash_id"] = getTransactionID(); + if(getTransactionID().notNull()) + { + updates["hash_id"] = getTransactionID(); + } } if (updates.has("shadow_id")) { updates.erase("shadow_id"); - updates["hash_id"] = getTransactionID(); + if(getTransactionID().notNull()) + { + updates["hash_id"] = getTransactionID(); + } } AISAPI::completion_t cr = boost::bind(&doInventoryCb, (LLPointer)NULL, _1); AISAPI::UpdateItem(getUUID(), updates, cr); -- cgit v1.2.3 From 5f57257185f1535aae1967b2b6d8a40c154bef83 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 1 Jul 2016 14:52:51 -0700 Subject: MAINT-6481 FIX Media controls not present --- indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index 3852d10c44..5dd866db80 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -214,7 +214,7 @@ void MediaPluginLibVLC::receiveMessage( const char* message_string ) LLSD versions = LLSD::emptyMap(); versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION; versions[LLPLUGIN_MESSAGE_CLASS_MEDIA] = LLPLUGIN_MESSAGE_CLASS_MEDIA_VERSION; - versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER] = LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER_VERSION; + versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME] = LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME_VERSION; message.setValueLLSD("versions", versions); std::ostringstream s; -- cgit v1.2.3 From f868e29945806fd6cefde65067ae2c870ac112a6 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 6 Jul 2016 16:52:24 -0400 Subject: increment viewer version to 4.0.7 --- indra/newview/VIEWER_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index d13e837c8e..43beb4001b 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -4.0.6 +4.0.7 -- cgit v1.2.3 From d59ce04495be43ab1dc68c1a78b3ca6eb2e7b01e Mon Sep 17 00:00:00 2001 From: callum_linden Date: Thu, 7 Jul 2016 09:10:39 -0700 Subject: MAINT-6527 FIX -volume plays at full amount +50m away - volume was not set for media outside attenuation zone so played at random value --- indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index 5dd866db80..fdad990b7c 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -189,6 +189,7 @@ void MediaPluginLibVLC::playMedia() gVLCCallbackContext.texture_pixels = mPixels; gVLCCallbackContext.mp = gLibVLCMediaPlayer; + libvlc_audio_set_volume(gLibVLCMediaPlayer, 0); libvlc_video_set_callbacks(gLibVLCMediaPlayer, lock, unlock, display, &gVLCCallbackContext); libvlc_video_set_format(gLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth); libvlc_media_player_play(gLibVLCMediaPlayer); -- cgit v1.2.3 From 8ae7828643fbb04a52a52abefa2133a761dd4179 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Mon, 11 Jul 2016 19:46:11 -0700 Subject: MAINT-6527 and MAINT-6528 FIX - max volume and media playing prior URLs --- indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'indra') diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index fdad990b7c..e00602bad8 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -189,10 +189,35 @@ void MediaPluginLibVLC::playMedia() gVLCCallbackContext.texture_pixels = mPixels; gVLCCallbackContext.mp = gLibVLCMediaPlayer; + // Send a "navigate begin" event. + // This is really a browser message but the QuickTime plugin did it and + // the media system relies on this message to update internal state so we must send it too + // Note: see "navigate_complete" message below too + // https://jira.secondlife.com/browse/MAINT-6528 + LLPluginMessage message_begin(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "navigate_begin"); + message_begin.setValue("uri", mURL); + message_begin.setValueBoolean("history_back_available", false); + message_begin.setValueBoolean("history_forward_available", false); + sendMessage(message_begin); + + // volume should be initialized - when media is in range, the distance based attenuation + // will set the correct value + // https://jira.secondlife.com/browse/MAINT-6527 libvlc_audio_set_volume(gLibVLCMediaPlayer, 0); libvlc_video_set_callbacks(gLibVLCMediaPlayer, lock, unlock, display, &gVLCCallbackContext); libvlc_video_set_format(gLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth); libvlc_media_player_play(gLibVLCMediaPlayer); + + // Send a "navigate complete" event. + // This is really a browser message but the QuickTime plugin did it and + // the media system relies on this message to update internal state so we must send it too + // Note: see "navigate_begin" message above too + // https://jira.secondlife.com/browse/MAINT-6528 + LLPluginMessage message_complete(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "navigate_complete"); + message_complete.setValue("uri", mURL); + message_complete.setValueS32("result_code", 200); + message_complete.setValue("result_string", "OK"); + sendMessage(message_complete); } //////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 1c4dbc64abc7ff176b5dcbbc64d0454968efad74 Mon Sep 17 00:00:00 2001 From: Callum Linden Date: Fri, 15 Jul 2016 12:18:00 -0700 Subject: MAINT-6577 FIX No sound in MOAP or browser video --- indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 42 +++++++++++++++++----- 1 file changed, 33 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index e00602bad8..8ef4ee2a27 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -54,6 +54,7 @@ class MediaPluginLibVLC : void initVLC(); void playMedia(); void resetVLC(); + void setVolume(const F64 volume); static void* lock(void* data, void** p_pixels); static void unlock(void* data, void* id, void* const* raw_pixels); @@ -72,6 +73,7 @@ class MediaPluginLibVLC : struct gVLCContext gVLCCallbackContext; std::string mURL; + F64 mCurVolume; }; //////////////////////////////////////////////////////////////////////////////// @@ -90,6 +92,8 @@ MediaPluginLibVLC::MediaPluginLibVLC( LLPluginInstance::sendMessageFunction host gLibVLCMedia = 0; gLibVLCMediaPlayer = 0; + mCurVolume = 0.0; + mURL = std::string(); } @@ -200,10 +204,10 @@ void MediaPluginLibVLC::playMedia() message_begin.setValueBoolean("history_forward_available", false); sendMessage(message_begin); - // volume should be initialized - when media is in range, the distance based attenuation - // will set the correct value - // https://jira.secondlife.com/browse/MAINT-6527 - libvlc_audio_set_volume(gLibVLCMediaPlayer, 0); + // volume level gets set before VLC is initialized (thanks media system) so we have to record + // it in mCurVolume and set it again here so that volume levels are correctly initialized + setVolume(mCurVolume); + libvlc_video_set_callbacks(gLibVLCMediaPlayer, lock, unlock, display, &gVLCCallbackContext); libvlc_video_set_format(gLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth); libvlc_media_player_play(gLibVLCMediaPlayer); @@ -220,6 +224,28 @@ void MediaPluginLibVLC::playMedia() sendMessage(message_complete); } +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginLibVLC::setVolume(const F64 volume) +{ + mCurVolume = volume; + + if (gLibVLCMediaPlayer) + { + int result = libvlc_audio_set_volume(gLibVLCMediaPlayer, (int)(volume * 100)); + if (result != 0) + { + // volume wasn't set but not much to be done here + } + } + else + { + // volume change was requested but VLC wasn't ready. + // that's okay thought because we saved the value in mCurVolume and + // the next volume change after the VLC system is initilzied will set it + } +} + //////////////////////////////////////////////////////////////////////////////// // void MediaPluginLibVLC::receiveMessage( const char* message_string ) @@ -388,11 +414,9 @@ void MediaPluginLibVLC::receiveMessage( const char* message_string ) } else if (message_name == "set_volume") { - if (gLibVLCMediaPlayer) - { - F64 volume = message_in.getValueReal("volume"); - libvlc_audio_set_volume(gLibVLCMediaPlayer, (int)(volume * 100)); - } + // volume comes in 0 -> 1.0 + F64 volume = message_in.getValueReal("volume"); + setVolume(volume); } } } -- cgit v1.2.3 From eebbda288d9ba4f8f3061c05ff5eb2d7b0d1cb35 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Mon, 18 Jul 2016 20:09:18 +0300 Subject: Backed out changeset: 5fe5ad059c05 --- indra/llrender/llglslshader.cpp | 22 ----------- indra/llrender/llglslshader.h | 1 - indra/llrender/llrender.cpp | 8 ---- indra/llrender/llrender.h | 1 - indra/llrender/llshadermgr.cpp | 1 - indra/llrender/llshadermgr.h | 3 +- .../shaders/class1/deferred/diffuseV.glsl | 11 ------ .../shaders/class1/deferred/fullbrightV.glsl | 11 ------ .../shaders/class1/objects/fullbrightV.glsl | 13 ------- .../shaders/class1/objects/simpleV.glsl | 12 +----- indra/newview/lldrawpool.cpp | 45 ---------------------- 11 files changed, 2 insertions(+), 126 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 2554ccdbe4..58c1186a3e 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -1274,28 +1274,6 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c } } -void LLGLSLShader::uniform1b(U32 index, GLboolean x) -{ - if (mProgramObject > 0) - { - if (mUniform.size() <= index) - { - UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; - return; - } - - if (mUniform[index] >= 0) - { - std::map::iterator iter = mValue.find(mUniform[index]); - if (iter == mValue.end() || iter->second.mV[0] != x) - { - glUniform1iARB(mUniform[index], x); - mValue[mUniform[index]] = LLVector4(x, 0.f, 0.f, 0.f); - } - } - } -} - GLint LLGLSLShader::getUniformLocation(const LLStaticHashedString& uniform) { GLint ret = -1; diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 8663a5a5ff..0746e8760a 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -125,7 +125,6 @@ public: void uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); void uniform4fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); void uniformMatrix4fv(const LLStaticHashedString& uniform, U32 count, GLboolean transpose, const GLfloat *v); - void uniform1b(U32 index, GLboolean b); void setMinimumAlpha(F32 minimum); diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index b5ed67f66a..69420dd0bb 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1466,14 +1466,6 @@ U32 LLRender::getMatrixMode() return mMatrixMode; } -void LLRender::setInverseTexCoordByY(bool v) -{ - LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - if (shader) - { - shader->uniform1b(LLShaderMgr::INVERSE_TEX_Y, v); - } -} void LLRender::loadIdentity() { diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 4c3547f8e4..a67fb8da52 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -355,7 +355,6 @@ public: void multMatrix(const GLfloat* m); void matrixMode(U32 mode); U32 getMatrixMode(); - void setInverseTexCoordByY(bool v); const glh::matrix4f& getModelviewMatrix(); const glh::matrix4f& getProjectionMatrix(); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 7d857c6930..55f0791174 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1190,7 +1190,6 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("origin"); mReservedUniforms.push_back("display_gamma"); - mReservedUniforms.push_back("invert_tex_y"); llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS); std::set dupe_check; diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 50b7c8b9d9..394b38f832 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -215,8 +215,7 @@ public: TERRAIN_ALPHARAMP, SHINY_ORIGIN, - DISPLAY_GAMMA, - INVERSE_TEX_Y, +DISPLAY_GAMMA, END_RESERVED_UNIFORMS } eGLSLReservedUniforms; diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl index 7e83389f6e..3c026796c8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl @@ -26,13 +26,6 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -uniform bool invert_tex_y = false; -const mat4 invTexM = mat4( - 1, 0, 0, 0, - 0,-1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 -); ATTRIBUTE vec3 position; ATTRIBUTE vec4 diffuse_color; @@ -51,10 +44,6 @@ void main() //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - if(invert_tex_y) - { - vary_texcoord0 = vec2(invTexM * vec4(vary_texcoord0,0,1)).xy; - } passTextureIndex(); vary_normal = normalize(normal_matrix * normal); diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index 2595712882..8e899e3e0f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -26,13 +26,6 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -uniform bool invert_tex_y = false; -const mat4 invTexM = mat4( - 1, 0, 0, 0, - 0,-1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 -); ATTRIBUTE vec3 position; @@ -69,10 +62,6 @@ void main() #endif vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - if(invert_tex_y) - { - vary_texcoord0 = vec2(invTexM * vec4(vary_texcoord0,0,1)).xy; - } calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl index a8efcd9857..fc20d3270e 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl @@ -26,14 +26,6 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; - -uniform bool invert_tex_y = false; -const mat4 invTexM = mat4( - 1, 0, 0, 0, - 0,-1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 -); ATTRIBUTE vec3 position; void passTextureIndex(); @@ -57,11 +49,6 @@ void main() vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - - if(invert_tex_y) - { - vary_texcoord0 = vec2(invTexM * vec4(vary_texcoord0,0,1)).xy; - } calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl index c744dc1397..37a20383e2 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -27,13 +27,6 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -uniform bool invert_tex_y = false; -const mat4 invTexM = mat4( - 1, 0, 0, 0, - 0,-1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 -); ATTRIBUTE vec3 position; void passTextureIndex(); @@ -58,10 +51,7 @@ void main() gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; - if(invert_tex_y) - { - vary_texcoord0 = vec2(invTexM * vec4(vary_texcoord0,0,1)).xy; - } + vec3 norm = normalize(normal_matrix * normal); diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index a6cf917cbd..f74164aea6 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -473,10 +473,6 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba if (params.mTextureList[i].notNull()) { gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE); - if (LLViewerTexture::MEDIA_TEXTURE == params.mTextureList[i]->getType()) - { - gGL.setInverseTexCoordByY(true); - } } } } @@ -486,54 +482,13 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba { params.mTexture->addTextureStats(params.mVSize); gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ; - - if (!gPipeline.mVertexShadersEnabled) - { - if (LLViewerTexture::MEDIA_TEXTURE == params.mTexture->getType() && !params.mTextureMatrix) - { - static const float fIdntInvY[] = { - 1, 0, 0, 0, - 0, -1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - }; - - gGL.getTexUnit(0)->activate(); - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadMatrix((GLfloat*)fIdntInvY); - gPipeline.mTextureMatrixOps++; - - tex_setup = true; - } - } - else - { - gGL.setInverseTexCoordByY(LLViewerTexture::MEDIA_TEXTURE == params.mTexture->getType()); - } - if (params.mTextureMatrix) { tex_setup = true; gGL.getTexUnit(0)->activate(); gGL.matrixMode(LLRender::MM_TEXTURE); gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix); - - if (LLViewerTexture::MEDIA_TEXTURE == params.mTexture->getType() && !gPipeline.mVertexShadersEnabled) - { - static const float fIdntInvY[] = { - 1, 0, 0, 0, - 0, -1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - }; - - gGL.multMatrix(fIdntInvY); - gPipeline.mMatrixOpCount++; - } - gPipeline.mTextureMatrixOps++; - - tex_setup = true; } } else -- cgit v1.2.3 From cd47f86c4ab6dd2bdeb98db06acd64d02cdff96f Mon Sep 17 00:00:00 2001 From: Callum Linden Date: Tue, 19 Jul 2016 12:42:49 -0700 Subject: MAINT-6578 Add back Y Flip into QuickTime plugin used in OS X to match viewer setting --- indra/media_plugins/quicktime/media_plugin_quicktime.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp index 6d4c6ca43d..893fb738ce 100755 --- a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp +++ b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp @@ -311,9 +311,7 @@ private: MatrixRecord transform; SetIdentityMatrix( &transform ); // transforms are additive so start from identify matrix double scaleX = (double) mWidth / mNaturalWidth; - - // 2016-05-31 CP remove local flip (via -1.0) since texture coods for media on a prim are now flipped for VLC/CEF - double scaleY = 1.0 * (double) mHeight / mNaturalHeight; + double scaleY = -1.0 * (double) mHeight / mNaturalHeight; double centerX = mWidth / 2.0; double centerY = mHeight / 2.0; ScaleMatrix( &transform, X2Fix( scaleX ), X2Fix( scaleY ), X2Fix( centerX ), X2Fix( centerY ) ); -- cgit v1.2.3 From 8a25489591d6f7c6c8aa95c98bbdcfe06d075c00 Mon Sep 17 00:00:00 2001 From: Callum Linden Date: Wed, 20 Jul 2016 19:54:54 -0700 Subject: MAINT-6578 Broken texture batching - fixed along with misc LibVLC plugin additions (status, titles, looping) --- indra/media_plugins/base/media_plugin_base.cpp | 1 + indra/media_plugins/base/media_plugin_base.h | 3 +- indra/media_plugins/cef/media_plugin_cef.cpp | 4 +- indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 635 +++++++++++++-------- indra/newview/llmediactrl.cpp | 2 +- 5 files changed, 408 insertions(+), 237 deletions(-) (limited to 'indra') diff --git a/indra/media_plugins/base/media_plugin_base.cpp b/indra/media_plugins/base/media_plugin_base.cpp index 37c498664a..a813d5f465 100644 --- a/indra/media_plugins/base/media_plugin_base.cpp +++ b/indra/media_plugins/base/media_plugin_base.cpp @@ -73,6 +73,7 @@ std::string MediaPluginBase::statusString() case STATUS_PLAYING: result = "playing"; break; case STATUS_PAUSED: result = "paused"; break; case STATUS_DONE: result = "done"; break; + case STATUS_BUFFERING: result = "buffering"; break; default: // keep the empty string break; diff --git a/indra/media_plugins/base/media_plugin_base.h b/indra/media_plugins/base/media_plugin_base.h index 38b8226bb3..99bc49fc70 100644 --- a/indra/media_plugins/base/media_plugin_base.h +++ b/indra/media_plugins/base/media_plugin_base.h @@ -56,7 +56,8 @@ protected: STATUS_ERROR, STATUS_PLAYING, STATUS_PAUSED, - STATUS_DONE + STATUS_DONE, + STATUS_BUFFERING } EStatus; /** Plugin shared memory. */ diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index be16ff7946..28a8a5886a 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -189,7 +189,7 @@ void MediaPluginCEF::onPageChangedCallback(unsigned char* pixels, int x, int y, mPopupH = height; mPopupW = width; mPopupX = x; - mPopupY = y; + mPopupY = mHeight - y - height; } } else @@ -526,7 +526,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) message.setValueU32("internalformat", GL_RGB); message.setValueU32("format", GL_BGRA); message.setValueU32("type", GL_UNSIGNED_BYTE); - message.setValueBoolean("coords_opengl", false); + message.setValueBoolean("coords_opengl", true); sendMessage(message); } else if (message_name == "set_user_data_path") diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index 8ef4ee2a27..f2e8252d3a 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -1,30 +1,30 @@ /** - * @file media_plugin_libvlc.cpp - * @brief LibVLC plugin for LLMedia API plugin system - * - * @cond - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - * @endcond - */ +* @file media_plugin_libvlc.cpp +* @brief LibVLC plugin for LLMedia API plugin system +* +* @cond +* $LicenseInfo:firstyear=2008&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +* @endcond +*/ #include "linden_common.h" @@ -40,61 +40,78 @@ //////////////////////////////////////////////////////////////////////////////// // class MediaPluginLibVLC : - public MediaPluginBase + public MediaPluginBase { - public: - MediaPluginLibVLC( LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data ); - ~MediaPluginLibVLC(); +public: + MediaPluginLibVLC(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data); + ~MediaPluginLibVLC(); - /*virtual*/ void receiveMessage( const char* message_string ); + /*virtual*/ void receiveMessage(const char* message_string); - private: - bool init(); +private: + bool init(); - void initVLC(); - void playMedia(); - void resetVLC(); - void setVolume(const F64 volume); + void initVLC(); + void playMedia(); + void resetVLC(); + void setVolume(const F64 volume); + void updateTitle(const char* title); - static void* lock(void* data, void** p_pixels); - static void unlock(void* data, void* id, void* const* raw_pixels); - static void display(void* data, void* id); + static void* lock(void* data, void** p_pixels); + static void unlock(void* data, void* id, void* const* raw_pixels); + static void display(void* data, void* id); - libvlc_instance_t* gLibVLC; - libvlc_media_t* gLibVLCMedia; - libvlc_media_player_t* gLibVLCMediaPlayer; + /*virtual*/ void setDirty(int left, int top, int right, int bottom) override; - struct gVLCContext - { - unsigned char* texture_pixels; - libvlc_media_player_t* mp; - MediaPluginLibVLC* parent; - }; - struct gVLCContext gVLCCallbackContext; + static void eventCallbacks(const libvlc_event_t* event, void* ptr); + + libvlc_instance_t* mLibVLC; + libvlc_media_t* mLibVLCMedia; + libvlc_media_player_t* mLibVLCMediaPlayer; + + struct mLibVLCContext + { + unsigned char* texture_pixels; + libvlc_media_player_t* mp; + MediaPluginLibVLC* parent; + }; + struct mLibVLCContext mLibVLCCallbackContext; + + std::string mURL; + F64 mCurVolume; + + bool mIsLooping; - std::string mURL; - F64 mCurVolume; + float mCurTime; + float mDuration; }; //////////////////////////////////////////////////////////////////////////////// // -MediaPluginLibVLC::MediaPluginLibVLC( LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data ) : - MediaPluginBase( host_send_func, host_user_data ) +MediaPluginLibVLC::MediaPluginLibVLC(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data) : +MediaPluginBase(host_send_func, host_user_data) { mTextureWidth = 0; mTextureHeight = 0; - mWidth = 0; - mHeight = 0; - mDepth = 4; - mPixels = 0; + mWidth = 0; + mHeight = 0; + mDepth = 4; + mPixels = 0; - gLibVLC = 0; - gLibVLCMedia = 0; - gLibVLCMediaPlayer = 0; + mLibVLC = 0; + mLibVLCMedia = 0; + mLibVLCMediaPlayer = 0; mCurVolume = 0.0; + mIsLooping = false; + + mCurTime = 0.0; + mDuration = 0.0; + mURL = std::string(); + + setStatus(STATUS_NONE); } //////////////////////////////////////////////////////////////////////////////// @@ -107,7 +124,7 @@ MediaPluginLibVLC::~MediaPluginLibVLC() // void* MediaPluginLibVLC::lock(void* data, void** p_pixels) { - struct gVLCContext* context = (gVLCContext*)data; + struct mLibVLCContext* context = (mLibVLCContext*)data; *p_pixels = context->texture_pixels; @@ -118,15 +135,16 @@ void* MediaPluginLibVLC::lock(void* data, void** p_pixels) // void MediaPluginLibVLC::unlock(void* data, void* id, void* const* raw_pixels) { - // nothing to do here for the moment. - // we can modify the raw_pixels here if we want to. + // nothing to do here for the moment + // we *could* modify pixels here to, for example, Y flip, but this is done with + // a VLC video filter transform. } //////////////////////////////////////////////////////////////////////////////// // void MediaPluginLibVLC::display(void* data, void* id) { - struct gVLCContext* context = (gVLCContext*)data; + struct mLibVLCContext* context = (mLibVLCContext*)data; context->parent->setDirty(0, 0, context->parent->mWidth, context->parent->mHeight); } @@ -138,12 +156,13 @@ void MediaPluginLibVLC::initVLC() char const* vlc_argv[] = { "--no-xlib", + "--video-filter=transform{type=vflip}", // MAINT-6578 Y flip textures in plugin vs client }; int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv); - gLibVLC = libvlc_new(vlc_argc, vlc_argv); + mLibVLC = libvlc_new(vlc_argc, vlc_argv); - if (!gLibVLC) + if (!mLibVLC) { // for the moment, if this fails, the plugin will fail and // the media sub-system will tell the viewer something went wrong. @@ -154,9 +173,91 @@ void MediaPluginLibVLC::initVLC() // void MediaPluginLibVLC::resetVLC() { - libvlc_media_player_stop(gLibVLCMediaPlayer); - libvlc_media_player_release(gLibVLCMediaPlayer); - libvlc_release(gLibVLC); + libvlc_media_player_stop(mLibVLCMediaPlayer); + libvlc_media_player_release(mLibVLCMediaPlayer); + libvlc_release(mLibVLC); +} + +//////////////////////////////////////////////////////////////////////////////// +// *virtual* +void MediaPluginLibVLC::setDirty(int left, int top, int right, int bottom) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "updated"); + + message.setValueS32("left", left); + message.setValueS32("top", top); + message.setValueS32("right", right); + message.setValueS32("bottom", bottom); + + 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) +{ + MediaPluginLibVLC* parent = (MediaPluginLibVLC*)ptr; + if (parent == 0) + { + return; + } + + switch (event->type) + { + case libvlc_MediaPlayerOpening: + parent->setStatus(STATUS_LOADING); + break; + + case libvlc_MediaPlayerBuffering: + parent->setStatus(STATUS_BUFFERING); + break; + + case libvlc_MediaPlayerPlaying: + parent->mDuration = (float)(libvlc_media_get_duration(parent->mLibVLCMedia)) / 1000.0f; + parent->setStatus(STATUS_PLAYING); + break; + + case libvlc_MediaPlayerPaused: + parent->setStatus(STATUS_PAUSED); + break; + + case libvlc_MediaPlayerStopped: + parent->setStatus(STATUS_DONE); + break; + + case libvlc_MediaPlayerEndReached: + parent->setStatus(STATUS_DONE); + break; + + case libvlc_MediaPlayerEncounteredError: + parent->setStatus(STATUS_ERROR); + break; + + case libvlc_MediaPlayerTimeChanged: + parent->mCurTime = (float)libvlc_media_player_get_time(parent->mLibVLCMediaPlayer) / 1000.0f; + break; + + case libvlc_MediaPlayerPositionChanged: + break; + + case libvlc_MediaPlayerLengthChanged: + parent->mDuration = (float)libvlc_media_get_duration(parent->mLibVLCMedia) / 1000.0f; + break; + + case libvlc_MediaPlayerTitleChanged: + { + char* title = libvlc_media_get_meta(parent->mLibVLCMedia, libvlc_meta_Title); + if (title) + { + parent->updateTitle(title); + } + } + break; + } } //////////////////////////////////////////////////////////////////////////////// @@ -168,30 +269,73 @@ void MediaPluginLibVLC::playMedia() return; } - if (gLibVLCMediaPlayer) + if (mLibVLCMediaPlayer) + { + // stop listening to events while we reset things + libvlc_event_manager_t* em = libvlc_media_player_event_manager(mLibVLCMediaPlayer); + if (em) + { + libvlc_event_detach(em, libvlc_MediaPlayerOpening, eventCallbacks, NULL); + libvlc_event_detach(em, libvlc_MediaPlayerBuffering, eventCallbacks, NULL); + libvlc_event_detach(em, libvlc_MediaPlayerPlaying, eventCallbacks, NULL); + libvlc_event_detach(em, libvlc_MediaPlayerPaused, eventCallbacks, NULL); + libvlc_event_detach(em, libvlc_MediaPlayerStopped, eventCallbacks, NULL); + libvlc_event_detach(em, libvlc_MediaPlayerEndReached, eventCallbacks, NULL); + libvlc_event_detach(em, libvlc_MediaPlayerEncounteredError, eventCallbacks, NULL); + libvlc_event_detach(em, libvlc_MediaPlayerTimeChanged, eventCallbacks, NULL); + libvlc_event_detach(em, libvlc_MediaPlayerPositionChanged, eventCallbacks, NULL); + libvlc_event_detach(em, libvlc_MediaPlayerLengthChanged, eventCallbacks, NULL); + libvlc_event_detach(em, libvlc_MediaPlayerTitleChanged, eventCallbacks, NULL); + }; + + libvlc_media_player_stop(mLibVLCMediaPlayer); + libvlc_media_player_release(mLibVLCMediaPlayer); + + mLibVLCMediaPlayer = 0; + } + + if (mLibVLCMedia) { - libvlc_media_player_stop(gLibVLCMediaPlayer); - libvlc_media_player_release(gLibVLCMediaPlayer); + libvlc_media_release(mLibVLCMedia); + + mLibVLCMedia = 0; } - gLibVLCMedia = libvlc_media_new_location(gLibVLC, mURL.c_str()); - if (!gLibVLCMedia) + mLibVLCMedia = libvlc_media_new_location(mLibVLC, mURL.c_str()); + if (!mLibVLCMedia) { - gLibVLCMediaPlayer = 0; + mLibVLCMediaPlayer = 0; + setStatus(STATUS_ERROR); return; } - gLibVLCMediaPlayer = libvlc_media_player_new_from_media(gLibVLCMedia); - if (!gLibVLCMediaPlayer) + mLibVLCMediaPlayer = libvlc_media_player_new_from_media(mLibVLCMedia); + if (!mLibVLCMediaPlayer) { + setStatus(STATUS_ERROR); return; } - libvlc_media_release(gLibVLCMedia); + // listen to events + libvlc_event_manager_t* em = libvlc_media_player_event_manager(mLibVLCMediaPlayer); + if (em) + { + libvlc_event_attach(em, libvlc_MediaPlayerOpening, eventCallbacks, this); + libvlc_event_attach(em, libvlc_MediaPlayerBuffering, eventCallbacks, this); + libvlc_event_attach(em, libvlc_MediaPlayerPlaying, eventCallbacks, this); + libvlc_event_attach(em, libvlc_MediaPlayerPaused, eventCallbacks, this); + libvlc_event_attach(em, libvlc_MediaPlayerStopped, eventCallbacks, this); + libvlc_event_attach(em, libvlc_MediaPlayerEndReached, eventCallbacks, this); + libvlc_event_attach(em, libvlc_MediaPlayerEncounteredError, eventCallbacks, this); + libvlc_event_attach(em, libvlc_MediaPlayerTimeChanged, eventCallbacks, this); + libvlc_event_attach(em, libvlc_MediaPlayerPositionChanged, eventCallbacks, this); + libvlc_event_attach(em, libvlc_MediaPlayerLengthChanged, eventCallbacks, this); + libvlc_event_attach(em, libvlc_MediaPlayerTitleChanged, eventCallbacks, this); + } - gVLCCallbackContext.parent = this; - gVLCCallbackContext.texture_pixels = mPixels; - gVLCCallbackContext.mp = gLibVLCMediaPlayer; + mLibVLCCallbackContext.parent = this; + mLibVLCCallbackContext.texture_pixels = mPixels; + mLibVLCCallbackContext.mp = mLibVLCMediaPlayer; // Send a "navigate begin" event. // This is really a browser message but the QuickTime plugin did it and @@ -208,9 +352,24 @@ void MediaPluginLibVLC::playMedia() // it in mCurVolume and set it again here so that volume levels are correctly initialized setVolume(mCurVolume); - libvlc_video_set_callbacks(gLibVLCMediaPlayer, lock, unlock, display, &gVLCCallbackContext); - libvlc_video_set_format(gLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth); - libvlc_media_player_play(gLibVLCMediaPlayer); + setStatus(STATUS_LOADED); + + libvlc_video_set_callbacks(mLibVLCMediaPlayer, lock, unlock, display, &mLibVLCCallbackContext); + libvlc_video_set_format(mLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth); + + if (mIsLooping) + { + libvlc_media_add_option(mLibVLCMedia, "input-repeat=-1"); + } + + libvlc_media_player_play(mLibVLCMediaPlayer); + + // send a "location_changed" message - this informs the media system + // that a new URL is the 'current' one and is used extensively. + // Again, this is really a browser message but we will use it here. + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "location_changed"); + message.setValue("uri", mURL); + sendMessage(message); // Send a "navigate complete" event. // This is really a browser message but the QuickTime plugin did it and @@ -224,15 +383,24 @@ void MediaPluginLibVLC::playMedia() sendMessage(message_complete); } +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginLibVLC::updateTitle(const char* title) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "name_text"); + message.setValue("name", title); + sendMessage(message); +} + //////////////////////////////////////////////////////////////////////////////// // void MediaPluginLibVLC::setVolume(const F64 volume) { mCurVolume = volume; - if (gLibVLCMediaPlayer) + if (mLibVLCMediaPlayer) { - int result = libvlc_audio_set_volume(gLibVLCMediaPlayer, (int)(volume * 100)); + int result = libvlc_audio_set_volume(mLibVLCMediaPlayer, (int)(volume * 100)); if (result != 0) { // volume wasn't set but not much to be done here @@ -248,26 +416,26 @@ void MediaPluginLibVLC::setVolume(const F64 volume) //////////////////////////////////////////////////////////////////////////////// // -void MediaPluginLibVLC::receiveMessage( const char* message_string ) +void MediaPluginLibVLC::receiveMessage(const char* message_string) { - LLPluginMessage message_in; - - if(message_in.parse(message_string) >= 0) - { - std::string message_class = message_in.getClass(); - std::string message_name = message_in.getName(); - if(message_class == LLPLUGIN_MESSAGE_CLASS_BASE) - { - if(message_name == "init") - { + LLPluginMessage message_in; + + if (message_in.parse(message_string) >= 0) + { + std::string message_class = message_in.getClass(); + std::string message_name = message_in.getName(); + if (message_class == LLPLUGIN_MESSAGE_CLASS_BASE) + { + if (message_name == "init") + { initVLC(); - LLPluginMessage message("base", "init_response"); - LLSD versions = LLSD::emptyMap(); - versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION; - versions[LLPLUGIN_MESSAGE_CLASS_MEDIA] = LLPLUGIN_MESSAGE_CLASS_MEDIA_VERSION; + LLPluginMessage message("base", "init_response"); + LLSD versions = LLSD::emptyMap(); + versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION; + versions[LLPLUGIN_MESSAGE_CLASS_MEDIA] = LLPLUGIN_MESSAGE_CLASS_MEDIA_VERSION; versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME] = LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME_VERSION; - message.setValueLLSD("versions", versions); + message.setValueLLSD("versions", versions); std::ostringstream s; s << "LibVLC plugin "; @@ -277,96 +445,96 @@ void MediaPluginLibVLC::receiveMessage( const char* message_string ) s << "."; s << LIBVLC_VERSION_REVISION; - message.setValue("plugin_version", s.str()); - sendMessage(message); - } - else if(message_name == "idle") - { - } - else if(message_name == "cleanup") - { + message.setValue("plugin_version", s.str()); + sendMessage(message); + } + else if (message_name == "idle") + { + } + else if (message_name == "cleanup") + { resetVLC(); - } - else if(message_name == "shm_added") - { - SharedSegmentInfo info; - info.mAddress = message_in.getValuePointer("address"); - info.mSize = (size_t)message_in.getValueS32("size"); - std::string name = message_in.getValue("name"); - - mSharedSegments.insert(SharedSegmentMap::value_type(name, info)); - - } - else if(message_name == "shm_remove") - { - std::string name = message_in.getValue("name"); - - SharedSegmentMap::iterator iter = mSharedSegments.find(name); - if(iter != mSharedSegments.end()) - { - if(mPixels == iter->second.mAddress) - { - libvlc_media_player_stop(gLibVLCMediaPlayer); - libvlc_media_player_release(gLibVLCMediaPlayer); - gLibVLCMediaPlayer = 0; - - mPixels = NULL; - mTextureSegmentName.clear(); - } - mSharedSegments.erase(iter); - } - else - { + } + else if (message_name == "shm_added") + { + SharedSegmentInfo info; + info.mAddress = message_in.getValuePointer("address"); + info.mSize = (size_t)message_in.getValueS32("size"); + std::string name = message_in.getValue("name"); + + mSharedSegments.insert(SharedSegmentMap::value_type(name, info)); + + } + else if (message_name == "shm_remove") + { + std::string name = message_in.getValue("name"); + + SharedSegmentMap::iterator iter = mSharedSegments.find(name); + if (iter != mSharedSegments.end()) + { + if (mPixels == iter->second.mAddress) + { + libvlc_media_player_stop(mLibVLCMediaPlayer); + libvlc_media_player_release(mLibVLCMediaPlayer); + mLibVLCMediaPlayer = 0; + + mPixels = NULL; + mTextureSegmentName.clear(); + } + mSharedSegments.erase(iter); + } + else + { //std::cerr << "MediaPluginWebKit::receiveMessage: unknown shared memory region!" << std::endl; - } - - // Send the response so it can be cleaned up. - LLPluginMessage message("base", "shm_remove_response"); - message.setValue("name", name); - sendMessage(message); - } - else - { + } + + // Send the response so it can be cleaned up. + LLPluginMessage message("base", "shm_remove_response"); + message.setValue("name", name); + sendMessage(message); + } + else + { //std::cerr << "MediaPluginWebKit::receiveMessage: unknown base message: " << message_name << std::endl; - } - } - else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA) - { - if(message_name == "init") - { - LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "texture_params"); - message.setValueS32("default_width", 1024); - message.setValueS32("default_height", 1024); - message.setValueS32("depth", mDepth); + } + } + else if (message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA) + { + if (message_name == "init") + { + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "texture_params"); + message.setValueS32("default_width", 1024); + message.setValueS32("default_height", 1024); + message.setValueS32("depth", mDepth); message.setValueU32("internalformat", GL_RGB); - message.setValueU32("format", GL_BGRA_EXT); - message.setValueU32("type", GL_UNSIGNED_BYTE); - message.setValueBoolean("coords_opengl", false); - sendMessage(message); - } - else if(message_name == "size_change") - { - std::string name = message_in.getValue("name"); - S32 width = message_in.getValueS32("width"); - S32 height = message_in.getValueS32("height"); - S32 texture_width = message_in.getValueS32("texture_width"); - S32 texture_height = message_in.getValueS32("texture_height"); - - if(!name.empty()) - { - // Find the shared memory region with this name - SharedSegmentMap::iterator iter = mSharedSegments.find(name); - if(iter != mSharedSegments.end()) - { - mPixels = (unsigned char*)iter->second.mAddress; - mWidth = width; - mHeight = height; - mTextureWidth = texture_width; - mTextureHeight = texture_height; + message.setValueU32("format", GL_BGRA_EXT); + message.setValueU32("type", GL_UNSIGNED_BYTE); + message.setValueBoolean("coords_opengl", true); + sendMessage(message); + } + else if (message_name == "size_change") + { + std::string name = message_in.getValue("name"); + S32 width = message_in.getValueS32("width"); + S32 height = message_in.getValueS32("height"); + S32 texture_width = message_in.getValueS32("texture_width"); + S32 texture_height = message_in.getValueS32("texture_height"); + + if (!name.empty()) + { + // Find the shared memory region with this name + SharedSegmentMap::iterator iter = mSharedSegments.find(name); + if (iter != mSharedSegments.end()) + { + mPixels = (unsigned char*)iter->second.mAddress; + mWidth = width; + mHeight = height; + mTextureWidth = texture_width; + mTextureHeight = texture_height; playMedia(); }; - }; + }; LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response"); message.setValue("name", name); @@ -375,74 +543,75 @@ void MediaPluginLibVLC::receiveMessage( const char* message_string ) message.setValueS32("texture_width", texture_width); message.setValueS32("texture_height", texture_height); sendMessage(message); - } - else if(message_name == "load_uri") - { + } + else if (message_name == "load_uri") + { mURL = message_in.getValue("uri"); playMedia(); - } - } - else - if (message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME) - { - if (message_name == "stop") + } + } + else + if (message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME) { - if (gLibVLCMediaPlayer) + if (message_name == "stop") { - libvlc_media_player_stop(gLibVLCMediaPlayer); + if (mLibVLCMediaPlayer) + { + libvlc_media_player_stop(mLibVLCMediaPlayer); + } } - } - else if (message_name == "start") - { - if (gLibVLCMediaPlayer) + else if (message_name == "start") { - libvlc_media_player_play(gLibVLCMediaPlayer); + if (mLibVLCMediaPlayer) + { + libvlc_media_player_play(mLibVLCMediaPlayer); + } } - } - else if (message_name == "pause") - { - if (gLibVLCMediaPlayer) + else if (message_name == "pause") { - libvlc_media_player_pause(gLibVLCMediaPlayer); + if (mLibVLCMediaPlayer) + { + libvlc_media_player_pause(mLibVLCMediaPlayer); + } + } + else if (message_name == "seek") + { + } + else if (message_name == "set_loop") + { + mIsLooping = true; + } + else if (message_name == "set_volume") + { + // volume comes in 0 -> 1.0 + F64 volume = message_in.getValueReal("volume"); + setVolume(volume); } } - else if (message_name == "seek") - { - } - else if (message_name == "set_loop") - { - } - else if (message_name == "set_volume") - { - // volume comes in 0 -> 1.0 - F64 volume = message_in.getValueReal("volume"); - setVolume(volume); - } - } - } + } } //////////////////////////////////////////////////////////////////////////////// // bool MediaPluginLibVLC::init() { - LLPluginMessage message( LLPLUGIN_MESSAGE_CLASS_MEDIA, "name_text" ); - message.setValue( "name", "LibVLC Plugin" ); - sendMessage( message ); + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "name_text"); + message.setValue("name", "LibVLC Plugin"); + sendMessage(message); - return true; + return true; }; //////////////////////////////////////////////////////////////////////////////// // -int init_media_plugin( LLPluginInstance::sendMessageFunction host_send_func, - void* host_user_data, - LLPluginInstance::sendMessageFunction *plugin_send_func, - void **plugin_user_data ) +int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, + void* host_user_data, + LLPluginInstance::sendMessageFunction *plugin_send_func, + void **plugin_user_data) { - MediaPluginLibVLC* self = new MediaPluginLibVLC( host_send_func, host_user_data ); - *plugin_send_func = MediaPluginLibVLC::staticReceiveMessage; - *plugin_user_data = ( void* )self; + MediaPluginLibVLC* self = new MediaPluginLibVLC(host_send_func, host_user_data); + *plugin_send_func = MediaPluginLibVLC::staticReceiveMessage; + *plugin_user_data = (void*)self; - return 0; + return 0; } diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 08c927483f..9cf3249983 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -911,7 +911,7 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y) } x = ll_round((F32)x * LLUI::getScaleFactor().mV[VX]); - if ( coords_opengl ) + if ( ! coords_opengl ) { y = ll_round((F32)(y) * LLUI::getScaleFactor().mV[VY]); } -- cgit v1.2.3 From f0eab8b36ff6ffcb2e76d3e23b0cd35346cb4a3b Mon Sep 17 00:00:00 2001 From: Callum Linden Date: Thu, 21 Jul 2016 09:46:42 -0700 Subject: Add a comment about order of operation that might be important for those that follow --- indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index f2e8252d3a..948639f125 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -357,6 +357,8 @@ void MediaPluginLibVLC::playMedia() libvlc_video_set_callbacks(mLibVLCMediaPlayer, lock, unlock, display, &mLibVLCCallbackContext); libvlc_video_set_format(mLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth); + // note this relies on the "set_loop" message arriving before the "start" (play) one + // but that appears to always be the case if (mIsLooping) { libvlc_media_add_option(mLibVLCMedia, "input-repeat=-1"); -- cgit v1.2.3 From befb0446c50cd950315f12d9f545d0e072e8e87b Mon Sep 17 00:00:00 2001 From: Callum Linden Date: Thu, 21 Jul 2016 15:20:00 -0700 Subject: Remove new 'buffering' state for video media - seemed like it'd be useful but it broke things --- indra/media_plugins/base/media_plugin_base.cpp | 1 - indra/media_plugins/base/media_plugin_base.h | 3 +-- indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 6 ------ 3 files changed, 1 insertion(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/media_plugins/base/media_plugin_base.cpp b/indra/media_plugins/base/media_plugin_base.cpp index a813d5f465..37c498664a 100644 --- a/indra/media_plugins/base/media_plugin_base.cpp +++ b/indra/media_plugins/base/media_plugin_base.cpp @@ -73,7 +73,6 @@ std::string MediaPluginBase::statusString() case STATUS_PLAYING: result = "playing"; break; case STATUS_PAUSED: result = "paused"; break; case STATUS_DONE: result = "done"; break; - case STATUS_BUFFERING: result = "buffering"; break; default: // keep the empty string break; diff --git a/indra/media_plugins/base/media_plugin_base.h b/indra/media_plugins/base/media_plugin_base.h index 99bc49fc70..38b8226bb3 100644 --- a/indra/media_plugins/base/media_plugin_base.h +++ b/indra/media_plugins/base/media_plugin_base.h @@ -56,8 +56,7 @@ protected: STATUS_ERROR, STATUS_PLAYING, STATUS_PAUSED, - STATUS_DONE, - STATUS_BUFFERING + STATUS_DONE } EStatus; /** Plugin shared memory. */ diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index 948639f125..9b5b51f56a 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -212,10 +212,6 @@ void MediaPluginLibVLC::eventCallbacks(const libvlc_event_t* event, void* ptr) parent->setStatus(STATUS_LOADING); break; - case libvlc_MediaPlayerBuffering: - parent->setStatus(STATUS_BUFFERING); - break; - case libvlc_MediaPlayerPlaying: parent->mDuration = (float)(libvlc_media_get_duration(parent->mLibVLCMedia)) / 1000.0f; parent->setStatus(STATUS_PLAYING); @@ -276,7 +272,6 @@ void MediaPluginLibVLC::playMedia() if (em) { libvlc_event_detach(em, libvlc_MediaPlayerOpening, eventCallbacks, NULL); - libvlc_event_detach(em, libvlc_MediaPlayerBuffering, eventCallbacks, NULL); libvlc_event_detach(em, libvlc_MediaPlayerPlaying, eventCallbacks, NULL); libvlc_event_detach(em, libvlc_MediaPlayerPaused, eventCallbacks, NULL); libvlc_event_detach(em, libvlc_MediaPlayerStopped, eventCallbacks, NULL); @@ -321,7 +316,6 @@ void MediaPluginLibVLC::playMedia() if (em) { libvlc_event_attach(em, libvlc_MediaPlayerOpening, eventCallbacks, this); - libvlc_event_attach(em, libvlc_MediaPlayerBuffering, eventCallbacks, this); libvlc_event_attach(em, libvlc_MediaPlayerPlaying, eventCallbacks, this); libvlc_event_attach(em, libvlc_MediaPlayerPaused, eventCallbacks, this); libvlc_event_attach(em, libvlc_MediaPlayerStopped, eventCallbacks, this); -- cgit v1.2.3 From 8cd9569cefdd7877859e87a67dd93d1962328e6d Mon Sep 17 00:00:00 2001 From: Callum Linden Date: Thu, 21 Jul 2016 21:06:06 -0700 Subject: First pass at enabling time based media (videos) scrubbing controls --- indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 5 +++ indra/newview/llpanelprimmediacontrols.cpp | 46 ++++++++++++++-------- indra/newview/llpanelprimmediacontrols.h | 8 +++- .../default/xui/en/panel_prim_media_controls.xml | 8 ++-- 4 files changed, 46 insertions(+), 21 deletions(-) (limited to 'indra') diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index 9b5b51f56a..c1e34b5c8f 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -572,6 +572,11 @@ void MediaPluginLibVLC::receiveMessage(const char* message_string) } else if (message_name == "seek") { + if (mDuration > 0) + { + F64 normalized_offset = message_in.getValueReal("time") / mDuration; + libvlc_media_player_set_position(mLibVLCMediaPlayer, normalized_offset); + } } else if (message_name == "set_loop") { diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 763657ebad..0bcd8a9e63 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -95,7 +95,8 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() : mVolumeSliderVisible(0), mWindowShade(NULL), mHideImmediately(false), - mSecureURL(false) + mSecureURL(false), + mMediaPlaySliderCtrlMouseDownValue(0.0) { mCommitCallbackRegistrar.add("MediaCtrl.Close", boost::bind(&LLPanelPrimMediaControls::onClickClose, this)); mCommitCallbackRegistrar.add("MediaCtrl.Back", boost::bind(&LLPanelPrimMediaControls::onClickBack, this)); @@ -109,7 +110,8 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() : mCommitCallbackRegistrar.add("MediaCtrl.Open", boost::bind(&LLPanelPrimMediaControls::onClickOpen, this)); mCommitCallbackRegistrar.add("MediaCtrl.Zoom", boost::bind(&LLPanelPrimMediaControls::onClickZoom, this)); mCommitCallbackRegistrar.add("MediaCtrl.CommitURL", boost::bind(&LLPanelPrimMediaControls::onCommitURL, this)); - mCommitCallbackRegistrar.add("MediaCtrl.JumpProgress", boost::bind(&LLPanelPrimMediaControls::onCommitSlider, this)); + mCommitCallbackRegistrar.add("MediaCtrl.MouseDown", boost::bind(&LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseDown, this)); + mCommitCallbackRegistrar.add("MediaCtrl.MouseUp", boost::bind(&LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseUp, this)); mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeUp", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeUp, this)); mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeDown", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeDown, this)); mCommitCallbackRegistrar.add("MediaCtrl.Volume", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeSlider, this)); @@ -1246,26 +1248,38 @@ void LLPanelPrimMediaControls::setCurrentURL() #endif // USE_COMBO_BOX_FOR_MEDIA_URL } -void LLPanelPrimMediaControls::onCommitSlider() + +void LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseDown() { - focusOnTarget(); + mMediaPlaySliderCtrlMouseDownValue = mMediaPlaySliderCtrl->getValue().asReal(); - LLViewerMediaImpl* media_impl = getTargetMediaImpl(); - if (media_impl) + mUpdateSlider = false; +} + +void LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseUp() +{ + F64 cur_value = mMediaPlaySliderCtrl->getValue().asReal(); + + if (mMediaPlaySliderCtrlMouseDownValue != cur_value) { - // get slider value - F64 slider_value = mMediaPlaySliderCtrl->getValue().asReal(); - if(slider_value <= 0.0) - { - media_impl->stop(); - } - else + focusOnTarget(); + + LLViewerMediaImpl* media_impl = getTargetMediaImpl(); + if (media_impl) { - media_impl->seek(slider_value*mMovieDuration); - //mUpdateSlider= false; + if (cur_value <= 0.0) + { + media_impl->stop(); + } + else + { + media_impl->seek(cur_value * mMovieDuration); + } } + + mUpdateSlider = true; } -} +} void LLPanelPrimMediaControls::onCommitVolumeUp() { diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h index 6d2eb3430e..21d5236074 100644 --- a/indra/newview/llpanelprimmediacontrols.h +++ b/indra/newview/llpanelprimmediacontrols.h @@ -107,8 +107,10 @@ private: void updateZoom(); void setCurrentURL(); - void onCommitSlider(); - + + void onMediaPlaySliderCtrlMouseDown(); + void onMediaPlaySliderCtrlMouseUp(); + void onCommitVolumeUp(); void onCommitVolumeDown(); void onCommitVolumeSlider(); @@ -219,6 +221,8 @@ private: S32 mVolumeSliderVisible; LLNotificationPtr mActiveNotification; + + F64 mMediaPlaySliderCtrlMouseDownValue; }; #endif // LL_PANELPRIMMEDIACONTROLS_H 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 eb67d07601..068e4420bc 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 @@ -374,9 +374,11 @@ layout="topleft" tool_tip="Movie play progress" width="200"> - - + + + Date: Fri, 22 Jul 2016 13:56:26 -0700 Subject: More Y flip madness - 2D media on OS X is has flipped Y mouse coords but correct on 3D/MOAP - reluctantly adding per platform switch --- indra/newview/llmediactrl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 9cf3249983..5fed925dda 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -907,7 +907,14 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y) if(mMediaSource && mMediaSource->hasMedia()) { +// on OS X (maybe Linux) and on 2D media like login/search, the coords are wrong. +// they are fine on 3D media - so we flip (or is it unflip) them here for anything +// except windows (Which appears to be correct on both counts) +#if LL_WINDOWS coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL(); +#else + coords_opengl = ! mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL(); +#endif } x = ll_round((F32)x * LLUI::getScaleFactor().mV[VX]); -- cgit v1.2.3 From 6f09cf76cd79108fcdc213f1f945540f08442c5d Mon Sep 17 00:00:00 2001 From: Callum Linden Date: Fri, 22 Jul 2016 16:27:53 -0700 Subject: Polish web content floater - rename to reflect it now does all media. remove developer options when Develop menu closed. start at google home page by default. --- indra/newview/llfloaterwebcontent.cpp | 22 ++--- indra/newview/llfloaterwebcontent.h | 3 +- .../skins/default/xui/en/floater_web_content.xml | 108 +++++++++++++-------- indra/newview/skins/default/xui/en/menu_login.xml | 6 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 25 +---- 5 files changed, 84 insertions(+), 80 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index c039b3b8f4..adb3322759 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -82,7 +82,7 @@ LLFloaterWebContent::LLFloaterWebContent( const Params& params ) mCommitCallbackRegistrar.add( "WebContent.Stop", boost::bind( &LLFloaterWebContent::onClickStop, this )); mCommitCallbackRegistrar.add( "WebContent.EnterAddress", boost::bind( &LLFloaterWebContent::onEnterAddress, this )); mCommitCallbackRegistrar.add( "WebContent.PopExternal", boost::bind(&LLFloaterWebContent::onPopExternal, this)); - mCommitCallbackRegistrar.add( "WebContent.TestVideo", boost::bind(&LLFloaterWebContent::onTestVideo, this, _2)); + mCommitCallbackRegistrar.add( "WebContent.TestURL", boost::bind(&LLFloaterWebContent::onTestURL, this, _2)); } BOOL LLFloaterWebContent::postBuild() @@ -111,6 +111,9 @@ BOOL LLFloaterWebContent::postBuild() // initialize the URL history using the system URL History manager initializeURLHistory(); + // if "Develop" Menu open, sety a flag and change things to be more useful for devs + mDevelopMode = gSavedSettings.getBOOL("QAMode"); + return TRUE; } @@ -196,8 +199,6 @@ void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height) width + getRect().getWidth() - browser_rect.getWidth(), height + getRect().getHeight() - browser_rect.getHeight()); - LL_DEBUGS() << "geometry change: " << geom << LL_ENDL; - LLRect new_rect; getParent()->screenRectToLocal(geom, &new_rect); setShape(new_rect); @@ -206,8 +207,6 @@ void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height) // static void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p) { - LL_DEBUGS() << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << LL_ENDL; - if (!p.id.isProvided()) { p.id = LLUUID::generateNewID().asString(); @@ -225,12 +224,6 @@ void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p) // and close the least recently opened one if this will put us over the limit. LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class); - LL_DEBUGS() << "total instance count is " << instances.size() << LL_ENDL; - - for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++) - { - LL_DEBUGS() << " " << (*iter)->getKey()["target"] << LL_ENDL; - } if(instances.size() >= (size_t)browser_window_limit) { @@ -242,7 +235,6 @@ void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p) void LLFloaterWebContent::open_media(const Params& p) { - // Specifying a mime type of text/html here causes the plugin system to skip the MIME type probe and just open a browser plugin. LLViewerMedia::proxyWindowOpened(p.target(), p.id()); mWebBrowser->setHomePageUrl(p.url); mWebBrowser->setTarget(p.target); @@ -252,6 +244,10 @@ void LLFloaterWebContent::open_media(const Params& p) getChild("status_bar")->setVisible(p.show_chrome); getChild("nav_controls")->setVisible(p.show_chrome); + + // turn additional debug controls on but only for Develop mode (Develop menu open) + getChild("debug_controls")->setVisible(mDevelopMode); + bool address_entry_enabled = p.allow_address_entry && !p.trusted_content; mAllowNavigation = p.allow_back_forward_navigation; getChildView("address")->setEnabled(address_entry_enabled); @@ -516,7 +512,7 @@ void LLFloaterWebContent::onPopExternal() }; } -void LLFloaterWebContent::onTestVideo(std::string url) +void LLFloaterWebContent::onTestURL(std::string url) { LLStringUtil::trim(url); if (url.length() > 0) diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h index 519b575b38..1157d0aab8 100644 --- a/indra/newview/llfloaterwebcontent.h +++ b/indra/newview/llfloaterwebcontent.h @@ -92,7 +92,7 @@ protected: void onClickStop(); void onEnterAddress(); void onPopExternal(); - void onTestVideo(std::string url); + void onTestURL(std::string url); static void preCreate(Params& p); void open_media(const Params& ); @@ -114,6 +114,7 @@ protected: std::string mUUID; bool mShowPageTitle; bool mAllowNavigation; + bool mDevelopMode; }; #endif // LL_LLFLOATERWEBCONTENT_H diff --git a/indra/newview/skins/default/xui/en/floater_web_content.xml b/indra/newview/skins/default/xui/en/floater_web_content.xml index 7b63a67415..4473ce0cda 100644 --- a/indra/newview/skins/default/xui/en/floater_web_content.xml +++ b/indra/newview/skins/default/xui/en/floater_web_content.xml @@ -25,10 +25,10 @@ @@ -152,112 +152,136 @@ + + + - - - - - + label="Media Browser" + name="Media Browser"> + parameter="http://google.com"/> - - - - + label="Media Browser" + name="Media Browser" + shortcut="control|alt|shift|Z"> + parameter="http://google.com"/> Date: Mon, 25 Jul 2016 12:09:55 -0700 Subject: Remove unncessary Y flip --- indra/newview/llmediactrl.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 5fed925dda..9cf3249983 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -907,14 +907,7 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y) if(mMediaSource && mMediaSource->hasMedia()) { -// on OS X (maybe Linux) and on 2D media like login/search, the coords are wrong. -// they are fine on 3D media - so we flip (or is it unflip) them here for anything -// except windows (Which appears to be correct on both counts) -#if LL_WINDOWS coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL(); -#else - coords_opengl = ! mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL(); -#endif } x = ll_round((F32)x * LLUI::getScaleFactor().mV[VX]); -- cgit v1.2.3