diff options
author | Armin Weatherwax | 2010-06-14 12:04:49 +0200 |
---|---|---|
committer | Armin Weatherwax | 2010-09-23 15:38:25 +0200 |
commit | 35df5441d3e2789663532c948731aff3a1e04728 (patch) | |
tree | ac7674289784a5f96106ea507637055a8dada78a /linden/indra/llinventory | |
parent | Changed version to Experimental 2010.09.18 (diff) | |
download | meta-impy-35df5441d3e2789663532c948731aff3a1e04728.zip meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.gz meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.bz2 meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.xz |
llmediaplugins first step
Diffstat (limited to 'linden/indra/llinventory')
-rw-r--r-- | linden/indra/llinventory/llparcel.cpp | 125 | ||||
-rw-r--r-- | linden/indra/llinventory/llparcel.h | 25 |
2 files changed, 150 insertions, 0 deletions
diff --git a/linden/indra/llinventory/llparcel.cpp b/linden/indra/llinventory/llparcel.cpp index 9c27476..547862f 100644 --- a/linden/indra/llinventory/llparcel.cpp +++ b/linden/indra/llinventory/llparcel.cpp | |||
@@ -199,6 +199,12 @@ void LLParcel::init(const LLUUID &owner_id, | |||
199 | mObscureMusic = 1; | 199 | mObscureMusic = 1; |
200 | mMediaWidth = 0; | 200 | mMediaWidth = 0; |
201 | mMediaHeight = 0; | 201 | mMediaHeight = 0; |
202 | setMediaCurrentURL(LLStringUtil::null); | ||
203 | mMediaURLFilterEnable = FALSE; | ||
204 | mMediaURLFilterList = LLSD::emptyArray(); | ||
205 | mMediaAllowNavigate = TRUE; | ||
206 | mMediaURLTimeout = 0.0f; | ||
207 | mMediaPreventCameraZoom = FALSE; | ||
202 | 208 | ||
203 | mGroupID.setNull(); | 209 | mGroupID.setNull(); |
204 | 210 | ||
@@ -314,6 +320,56 @@ void LLParcel::setMediaHeight(S32 height) | |||
314 | { | 320 | { |
315 | mMediaHeight = height; | 321 | mMediaHeight = height; |
316 | } | 322 | } |
323 | |||
324 | void LLParcel::setMediaCurrentURL(const std::string& url) | ||
325 | { | ||
326 | mMediaCurrentURL = url; | ||
327 | // The escaping here must match the escaping in the database | ||
328 | // abstraction layer if it's ever added. | ||
329 | // This should really filter the url in some way. Other than | ||
330 | // simply requiring non-printable. | ||
331 | LLStringFn::replace_nonprintable_in_ascii(mMediaCurrentURL, LL_UNKNOWN_CHAR); | ||
332 | |||
333 | } | ||
334 | |||
335 | void LLParcel::setMediaURLResetTimer(F32 time) | ||
336 | { | ||
337 | mMediaResetTimer.start(); | ||
338 | mMediaResetTimer.setTimerExpirySec(time); | ||
339 | } | ||
340 | |||
341 | void LLParcel::setMediaURLFilterList(LLSD list) | ||
342 | { | ||
343 | // sanity check LLSD | ||
344 | // must be array of strings | ||
345 | if (!list.isArray()) | ||
346 | { | ||
347 | return; | ||
348 | } | ||
349 | |||
350 | for (S32 i = 0; i < list.size(); i++) | ||
351 | { | ||
352 | if (!list[i].isString()) | ||
353 | return; | ||
354 | } | ||
355 | |||
356 | // can't be too big | ||
357 | const S32 MAX_SIZE = 50; | ||
358 | if (list.size() > MAX_SIZE) | ||
359 | { | ||
360 | LLSD new_list = LLSD::emptyArray(); | ||
361 | |||
362 | for (S32 i = 0; i < llmin(list.size(), MAX_SIZE); i++) | ||
363 | { | ||
364 | new_list.append(list[i]); | ||
365 | } | ||
366 | |||
367 | list = new_list; | ||
368 | } | ||
369 | |||
370 | mMediaURLFilterList = list; | ||
371 | } | ||
372 | |||
317 | // virtual | 373 | // virtual |
318 | void LLParcel::setLocalID(S32 local_id) | 374 | void LLParcel::setLocalID(S32 local_id) |
319 | { | 375 | { |
@@ -568,6 +624,34 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr | |||
568 | return input_stream.good(); | 624 | return input_stream.good(); |
569 | } | 625 | } |
570 | 626 | ||
627 | BOOL LLParcel::importMediaURLFilter(std::istream& input_stream, std::string& url) | ||
628 | { | ||
629 | skip_to_end_of_next_keyword("{", input_stream); | ||
630 | |||
631 | while(input_stream.good()) | ||
632 | { | ||
633 | skip_comments_and_emptyspace(input_stream); | ||
634 | std::string line, keyword, value; | ||
635 | get_line(line, input_stream, MAX_STRING); | ||
636 | get_keyword_and_value(keyword, value, line); | ||
637 | |||
638 | if ("}" == keyword) | ||
639 | { | ||
640 | break; | ||
641 | } | ||
642 | else if ("url" == keyword) | ||
643 | { | ||
644 | url = value; | ||
645 | } | ||
646 | else | ||
647 | { | ||
648 | llwarns << "Unknown keyword in parcel media url filter section: <" | ||
649 | << keyword << ">" << llendl; | ||
650 | } | ||
651 | } | ||
652 | return input_stream.good(); | ||
653 | } | ||
654 | |||
571 | // Assumes we are in a block "ParcelData" | 655 | // Assumes we are in a block "ParcelData" |
572 | void LLParcel::packMessage(LLMessageSystem* msg) | 656 | void LLParcel::packMessage(LLMessageSystem* msg) |
573 | { | 657 | { |
@@ -606,9 +690,15 @@ void LLParcel::packMessage(LLSD& msg) | |||
606 | msg["media_height"] = getMediaHeight(); | 690 | msg["media_height"] = getMediaHeight(); |
607 | msg["auto_scale"] = getMediaAutoScale(); | 691 | msg["auto_scale"] = getMediaAutoScale(); |
608 | msg["media_loop"] = getMediaLoop(); | 692 | msg["media_loop"] = getMediaLoop(); |
693 | msg["media_current_url"] = getMediaCurrentURL(); | ||
609 | msg["obscure_media"] = getObscureMedia(); | 694 | msg["obscure_media"] = getObscureMedia(); |
610 | msg["obscure_music"] = getObscureMusic(); | 695 | msg["obscure_music"] = getObscureMusic(); |
611 | msg["media_id"] = getMediaID(); | 696 | msg["media_id"] = getMediaID(); |
697 | msg["media_allow_navigate"] = getMediaAllowNavigate(); | ||
698 | msg["media_prevent_camera_zoom"] = getMediaPreventCameraZoom(); | ||
699 | msg["media_url_timeout"] = getMediaURLTimeout(); | ||
700 | msg["media_url_filter_enable"] = getMediaURLFilterEnable(); | ||
701 | msg["media_url_filter_list"] = getMediaURLFilterList(); | ||
612 | msg["group_id"] = getGroupID(); | 702 | msg["group_id"] = getGroupID(); |
613 | msg["pass_price"] = mPassPrice; | 703 | msg["pass_price"] = mPassPrice; |
614 | msg["pass_hours"] = mPassHours; | 704 | msg["pass_hours"] = mPassHours; |
@@ -678,6 +768,21 @@ void LLParcel::unpackMessage(LLMessageSystem* msg) | |||
678 | mObscureMedia = true; | 768 | mObscureMedia = true; |
679 | mObscureMusic = true; | 769 | mObscureMusic = true; |
680 | } | 770 | } |
771 | |||
772 | if(msg->getNumberOfBlocks("MediaLinkSharing") > 0) | ||
773 | { | ||
774 | msg->getString("MediaLinkSharing", "MediaCurrentURL", buffer); | ||
775 | setMediaCurrentURL(buffer); | ||
776 | msg->getU8 ( "MediaLinkSharing", "MediaAllowNavigate", mMediaAllowNavigate ); | ||
777 | msg->getU8 ( "MediaLinkSharing", "MediaURLFilterEnable", mMediaURLFilterEnable ); | ||
778 | msg->getU8 ( "MediaLinkSharing", "MediaPreventCameraZoom", mMediaPreventCameraZoom ); | ||
779 | msg->getF32( "MediaLinkSharing", "MediaURLTimeout", mMediaURLTimeout); | ||
780 | } | ||
781 | else | ||
782 | { | ||
783 | setMediaCurrentURL(LLStringUtil::null); | ||
784 | } | ||
785 | |||
681 | } | 786 | } |
682 | 787 | ||
683 | void LLParcel::packAccessEntries(LLMessageSystem* msg, | 788 | void LLParcel::packAccessEntries(LLMessageSystem* msg, |
@@ -994,6 +1099,20 @@ BOOL LLParcel::isSaleTimerExpired(const U64& time) | |||
994 | return expired; | 1099 | return expired; |
995 | } | 1100 | } |
996 | 1101 | ||
1102 | BOOL LLParcel::isMediaResetTimerExpired(const U64& time) | ||
1103 | { | ||
1104 | if (mMediaResetTimer.getStarted() == FALSE) | ||
1105 | { | ||
1106 | return FALSE; | ||
1107 | } | ||
1108 | BOOL expired = mMediaResetTimer.checkExpirationAndReset(0.0); | ||
1109 | if (expired) | ||
1110 | { | ||
1111 | mMediaResetTimer.stop(); | ||
1112 | } | ||
1113 | return expired; | ||
1114 | } | ||
1115 | |||
997 | 1116 | ||
998 | void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group) | 1117 | void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group) |
999 | { | 1118 | { |
@@ -1117,6 +1236,12 @@ void LLParcel::clearParcel() | |||
1117 | mObscureMusic = 1; | 1236 | mObscureMusic = 1; |
1118 | mMediaWidth = 0; | 1237 | mMediaWidth = 0; |
1119 | mMediaHeight = 0; | 1238 | mMediaHeight = 0; |
1239 | setMediaCurrentURL(LLStringUtil::null); | ||
1240 | setMediaURLFilterList(LLSD::emptyArray()); | ||
1241 | setMediaURLFilterEnable(FALSE); | ||
1242 | setMediaAllowNavigate(TRUE); | ||
1243 | setMediaPreventCameraZoom(FALSE); | ||
1244 | setMediaURLTimeout(0.0f); | ||
1120 | setMusicURL(LLStringUtil::null); | 1245 | setMusicURL(LLStringUtil::null); |
1121 | setInEscrow(FALSE); | 1246 | setInEscrow(FALSE); |
1122 | setAuthorizedBuyerID(LLUUID::null); | 1247 | setAuthorizedBuyerID(LLUUID::null); |
diff --git a/linden/indra/llinventory/llparcel.h b/linden/indra/llinventory/llparcel.h index 6f5ae87..47571d0 100644 --- a/linden/indra/llinventory/llparcel.h +++ b/linden/indra/llinventory/llparcel.h | |||
@@ -247,6 +247,14 @@ public: | |||
247 | void setObscureMusic( U8 flagIn ) { mObscureMusic = flagIn; } | 247 | void setObscureMusic( U8 flagIn ) { mObscureMusic = flagIn; } |
248 | void setMediaWidth(S32 width); | 248 | void setMediaWidth(S32 width); |
249 | void setMediaHeight(S32 height); | 249 | void setMediaHeight(S32 height); |
250 | void setMediaCurrentURL(const std::string& url); | ||
251 | void setMediaURLFilterEnable(U8 enable) { mMediaURLFilterEnable = enable; } | ||
252 | void setMediaURLFilterList(LLSD list); | ||
253 | void setMediaAllowNavigate(U8 enable) { mMediaAllowNavigate = enable; } | ||
254 | void setMediaURLTimeout(F32 timeout) { mMediaURLTimeout = timeout; } | ||
255 | void setMediaPreventCameraZoom(U8 enable) { mMediaPreventCameraZoom = enable; } | ||
256 | |||
257 | void setMediaURLResetTimer(F32 time); | ||
250 | virtual void setLocalID(S32 local_id); | 258 | virtual void setLocalID(S32 local_id); |
251 | 259 | ||
252 | // blow away all the extra crap lurking in parcels, including urls, access lists, etc | 260 | // blow away all the extra crap lurking in parcels, including urls, access lists, etc |
@@ -300,6 +308,7 @@ public: | |||
300 | // BOOL importStream(std::istream& input_stream); | 308 | // BOOL importStream(std::istream& input_stream); |
301 | BOOL importAccessEntry(std::istream& input_stream, LLAccessEntry* entry); | 309 | BOOL importAccessEntry(std::istream& input_stream, LLAccessEntry* entry); |
302 | // BOOL exportStream(std::ostream& output_stream); | 310 | // BOOL exportStream(std::ostream& output_stream); |
311 | BOOL importMediaURLFilter(std::istream& input_stream, std::string& url); | ||
303 | 312 | ||
304 | void packMessage(LLMessageSystem* msg); | 313 | void packMessage(LLMessageSystem* msg); |
305 | void packMessage(LLSD& msg); | 314 | void packMessage(LLSD& msg); |
@@ -341,8 +350,15 @@ public: | |||
341 | S32 getMediaHeight() const { return mMediaHeight; } | 350 | S32 getMediaHeight() const { return mMediaHeight; } |
342 | U8 getMediaAutoScale() const { return mMediaAutoScale; } | 351 | U8 getMediaAutoScale() const { return mMediaAutoScale; } |
343 | U8 getMediaLoop() const { return mMediaLoop; } | 352 | U8 getMediaLoop() const { return mMediaLoop; } |
353 | const std::string& getMediaCurrentURL() const { return mMediaCurrentURL; } | ||
344 | U8 getObscureMedia() const { return mObscureMedia; } | 354 | U8 getObscureMedia() const { return mObscureMedia; } |
345 | U8 getObscureMusic() const { return mObscureMusic; } | 355 | U8 getObscureMusic() const { return mObscureMusic; } |
356 | U8 getMediaURLFilterEnable() const { return mMediaURLFilterEnable; } | ||
357 | LLSD getMediaURLFilterList() const { return mMediaURLFilterList; } | ||
358 | U8 getMediaAllowNavigate() const { return mMediaAllowNavigate; } | ||
359 | F32 getMediaURLTimeout() const { return mMediaURLTimeout; } | ||
360 | U8 getMediaPreventCameraZoom() const { return mMediaPreventCameraZoom; } | ||
361 | |||
346 | S32 getLocalID() const { return mLocalID; } | 362 | S32 getLocalID() const { return mLocalID; } |
347 | const LLUUID& getOwnerID() const { return mOwnerID; } | 363 | const LLUUID& getOwnerID() const { return mOwnerID; } |
348 | const LLUUID& getGroupID() const { return mGroupID; } | 364 | const LLUUID& getGroupID() const { return mGroupID; } |
@@ -418,6 +434,7 @@ public: | |||
418 | BOOL getRecordTransaction() const { return mRecordTransaction; } | 434 | BOOL getRecordTransaction() const { return mRecordTransaction; } |
419 | void setRecordTransaction(BOOL record) { mRecordTransaction = record; } | 435 | void setRecordTransaction(BOOL record) { mRecordTransaction = record; } |
420 | 436 | ||
437 | BOOL isMediaResetTimerExpired(const U64& time); | ||
421 | 438 | ||
422 | // more accessors | 439 | // more accessors |
423 | U32 getParcelFlags() const { return mParcelFlags; } | 440 | U32 getParcelFlags() const { return mParcelFlags; } |
@@ -595,6 +612,8 @@ protected: | |||
595 | LLVector3 mUserLookAt; | 612 | LLVector3 mUserLookAt; |
596 | ELandingType mLandingType; | 613 | ELandingType mLandingType; |
597 | LLTimer mSaleTimerExpires; | 614 | LLTimer mSaleTimerExpires; |
615 | LLTimer mMediaResetTimer; | ||
616 | |||
598 | S32 mGraceExtension; | 617 | S32 mGraceExtension; |
599 | BOOL mRecordTransaction; | 618 | BOOL mRecordTransaction; |
600 | 619 | ||
@@ -624,9 +643,15 @@ protected: | |||
624 | S32 mMediaHeight; | 643 | S32 mMediaHeight; |
625 | U8 mMediaAutoScale; | 644 | U8 mMediaAutoScale; |
626 | U8 mMediaLoop; | 645 | U8 mMediaLoop; |
646 | std::string mMediaCurrentURL; | ||
627 | U8 mObscureMedia; | 647 | U8 mObscureMedia; |
628 | U8 mObscureMusic; | 648 | U8 mObscureMusic; |
629 | LLUUID mMediaID; | 649 | LLUUID mMediaID; |
650 | U8 mMediaURLFilterEnable; | ||
651 | LLSD mMediaURLFilterList; | ||
652 | U8 mMediaAllowNavigate; | ||
653 | U8 mMediaPreventCameraZoom; | ||
654 | F32 mMediaURLTimeout; | ||
630 | S32 mPassPrice; | 655 | S32 mPassPrice; |
631 | F32 mPassHours; | 656 | F32 mPassHours; |
632 | LLVector3 mAABBMin; | 657 | LLVector3 mAABBMin; |