aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewermedia.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:59 -0500
committerJacek Antonelli2008-08-15 23:45:59 -0500
commit6e91a9cc3d5a610198cf526a76e2ab642f10ecd7 (patch)
treeb023869f9daa7f61ea3ab27112d37524bdd88de4 /linden/indra/newview/llviewermedia.cpp
parentSecond Life viewer sources 1.20.12 (diff)
downloadmeta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.zip
meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.gz
meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.bz2
meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.xz
Second Life viewer sources 1.20.13
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewermedia.cpp68
1 files changed, 57 insertions, 11 deletions
diff --git a/linden/indra/newview/llviewermedia.cpp b/linden/indra/newview/llviewermedia.cpp
index f318d07..e11d1a2 100644
--- a/linden/indra/newview/llviewermedia.cpp
+++ b/linden/indra/newview/llviewermedia.cpp
@@ -44,6 +44,10 @@
44#include "llmediamanager.h" 44#include "llmediamanager.h"
45#include "lluuid.h" 45#include "lluuid.h"
46 46
47#include <boost/bind.hpp> // for SkinFolder listener
48#include <boost/signal.hpp>
49
50
47// Implementation functions not exported into header file 51// Implementation functions not exported into header file
48class LLViewerMediaImpl 52class LLViewerMediaImpl
49 : public LLMediaObserver 53 : public LLMediaObserver
@@ -55,8 +59,6 @@ class LLViewerMediaImpl
55 mMovieImageHasMips(false) 59 mMovieImageHasMips(false)
56 { } 60 { }
57 61
58 void initControlListeners();
59
60 void destroyMediaSource(); 62 void destroyMediaSource();
61 63
62 void play(const std::string& media_url, 64 void play(const std::string& media_url,
@@ -79,6 +81,15 @@ class LLViewerMediaImpl
79 void updateImagesMediaStreams(); 81 void updateImagesMediaStreams();
80 LLUUID getMediaTextureID(); 82 LLUUID getMediaTextureID();
81 83
84 // Internally set our desired browser user agent string, including
85 // the Second Life version and skin name. Used because we can
86 // switch skins without restarting the app.
87 static void updateBrowserUserAgent();
88
89 // Callback for when the SkinCurrent control is changed to
90 // switch the user agent string to indicate the new skin.
91 static bool handleSkinCurrentChanged(const LLSD& newvalue);
92
82 public: 93 public:
83 94
84 // a single media url with some data and an impl. 95 // a single media url with some data and an impl.
@@ -93,6 +104,8 @@ class LLViewerMediaImpl
93 104
94static LLViewerMediaImpl sViewerMediaImpl; 105static LLViewerMediaImpl sViewerMediaImpl;
95 106
107//////////////////////////////////////////////////////////////////////////////////////////
108
96void LLViewerMediaImpl::destroyMediaSource() 109void LLViewerMediaImpl::destroyMediaSource()
97{ 110{
98 LLMediaManager* mgr = LLMediaManager::getInstance(); 111 LLMediaManager* mgr = LLMediaManager::getInstance();
@@ -405,12 +418,44 @@ void LLViewerMediaImpl::onMediaSizeChange(const EventType& event_in)
405 */ 418 */
406 419
407 420
408//////////////////////////////////////////////////////////////////////////////////////////
409LLUUID LLViewerMediaImpl::getMediaTextureID() 421LLUUID LLViewerMediaImpl::getMediaTextureID()
410{ 422{
411 return mMovieImageID; 423 return mMovieImageID;
412} 424}
413 425
426// static
427void LLViewerMediaImpl::updateBrowserUserAgent()
428{
429 // Don't use user-visible string to avoid
430 // punctuation and strange characters.
431 std::string skin_name = gSavedSettings.getString("SkinCurrent");
432
433 // Just in case we need to check browser differences in A/B test
434 // builds.
435 std::string channel = gSavedSettings.getString("VersionChannelName");
436
437 // append our magic version number string to the browser user agent id
438 // See the HTTP 1.0 and 1.1 specifications for allowed formats:
439 // http://www.ietf.org/rfc/rfc1945.txt section 10.15
440 // http://www.ietf.org/rfc/rfc2068.txt section 3.8
441 // This was also helpful:
442 // http://www.mozilla.org/build/revised-user-agent-strings.html
443 std::ostringstream codec;
444 codec << "SecondLife/";
445 codec << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH << "." << LL_VERSION_BUILD;
446 codec << " (" << channel << "; " << skin_name << " skin)";
447 llinfos << codec.str() << llendl;
448 LLMediaManager::setBrowserUserAgent( codec.str() );
449}
450
451// static
452bool LLViewerMediaImpl::handleSkinCurrentChanged(const LLSD& /*newvalue*/)
453{
454 // gSavedSettings is already updated when this function is called.
455 updateBrowserUserAgent();
456 return true;
457}
458
414////////////////////////////////////////////////////////////////////////////////////////// 459//////////////////////////////////////////////////////////////////////////////////////////
415// Wrapper class 460// Wrapper class
416////////////////////////////////////////////////////////////////////////////////////////// 461//////////////////////////////////////////////////////////////////////////////////////////
@@ -419,6 +464,7 @@ LLUUID LLViewerMediaImpl::getMediaTextureID()
419// static 464// static
420void LLViewerMedia::initClass() 465void LLViewerMedia::initClass()
421{ 466{
467 // *TODO: This looks like a memory leak to me. JC
422 LLMediaManagerData* init_data = new LLMediaManagerData; 468 LLMediaManagerData* init_data = new LLMediaManagerData;
423 469
424// std::string executable_dir = std::string( arg0 ).substr( 0, std::string( arg0 ).find_last_of("\\/") ); 470// std::string executable_dir = std::string( arg0 ).substr( 0, std::string( arg0 ).find_last_of("\\/") );
@@ -450,14 +496,6 @@ void LLViewerMedia::initClass()
450 component_dir += "mozilla"; 496 component_dir += "mozilla";
451#endif 497#endif
452 498
453 // append our magic version number string to the browser user agent id
454 std::ostringstream codec;
455 codec << "[Second Life ";
456 codec << "(" << gSavedSettings.getString("VersionChannelName") << ")";
457 codec << " - " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH << "." << LL_VERSION_BUILD;
458 codec << "]";
459 init_data->setBrowserUserAgentId( codec.str() );
460
461 std::string application_dir = gDirUtilp->getExecutableDir(); 499 std::string application_dir = gDirUtilp->getExecutableDir();
462 500
463 init_data->setBrowserApplicationDir( application_dir ); 501 init_data->setBrowserApplicationDir( application_dir );
@@ -470,6 +508,14 @@ void LLViewerMedia::initClass()
470 508
471 LLMediaManager::initClass( init_data ); 509 LLMediaManager::initClass( init_data );
472 510
511 // We use a custom user agent with viewer version and skin name.
512 LLViewerMediaImpl::updateBrowserUserAgent();
513
514 // Users can change skins while client is running, so make sure
515 // we pick up on changes.
516 gSavedSettings.getControl("SkinCurrent")->getSignal()->connect(
517 boost::bind( LLViewerMediaImpl::handleSkinCurrentChanged, _1 ) );
518
473 LLMediaManager* mm = LLMediaManager::getInstance(); 519 LLMediaManager* mm = LLMediaManager::getInstance();
474 LLMIMETypes::mime_info_map_t::const_iterator it; 520 LLMIMETypes::mime_info_map_t::const_iterator it;
475 for (it = LLMIMETypes::sMap.begin(); it != LLMIMETypes::sMap.end(); ++it) 521 for (it = LLMIMETypes::sMap.begin(); it != LLMIMETypes::sMap.end(); ++it)