00001 00032 #ifndef LLMEDIAMANAGER_H 00033 #define LLMEDIAMANAGER_H 00034 00035 #include <map> 00036 #include <set> 00037 00038 #include "llmediaimplcommon.h" 00039 00041 // 00042 class LLMediaManagerData 00043 { 00044 public: 00045 LLMediaManagerData() : 00046 mBrowserParentWindow( 0 ), 00047 mBrowserProfileDir( "" ), 00048 mBrowserProfileName ( "" ), 00049 mBrowserUserAgentId( "" ) 00050 { }; 00051 00052 void setBrowserApplicationDir( const std::string& browser_application_dir ) { mBrowserApplicationDir = browser_application_dir; }; 00053 std::string& getBrowserApplicationDir() { return mBrowserApplicationDir; }; 00054 00055 void setBrowserComponentDir( const std::string& browser_component_dir ) { mBrowserComponentDir = browser_component_dir; }; 00056 std::string& getBrowserComponentDir() { return mBrowserComponentDir; }; 00057 00058 void setBrowserParentWindow( void* browser_parent_window ) { mBrowserParentWindow = browser_parent_window; }; 00059 void* getBrowserParentWindow() { return mBrowserParentWindow; }; 00060 00061 void setBrowserProfileDir( const std::string& browser_profile_dir ) { mBrowserProfileDir = browser_profile_dir; }; 00062 std::string& getBrowserProfileDir() { return mBrowserProfileDir; }; 00063 00064 void setBrowserProfileName( const std::string& browser_profile_name ) { mBrowserProfileName = browser_profile_name; }; 00065 std::string& getBrowserProfileName() { return mBrowserProfileName; }; 00066 00067 void setBrowserUserAgentId( const std::string& browser_user_agent_id ) { mBrowserUserAgentId = browser_user_agent_id; }; 00068 std::string& getBrowserUserAgentId() { return mBrowserUserAgentId; }; 00069 00070 private: 00071 void* mBrowserParentWindow; 00072 std::string mBrowserProfileDir; 00073 std::string mBrowserProfileName; 00074 std::string mBrowserApplicationDir; 00075 std::string mBrowserComponentDir; 00076 std::string mBrowserUserAgentId; 00077 }; 00078 00080 // 00081 class LLMediaManager 00082 { 00083 public: 00084 virtual ~LLMediaManager(); 00085 00086 static void initClass( LLMediaManagerData* init_data ); 00087 static void cleanupClass(); 00088 static LLMediaManager* getInstance(); 00089 00090 // Calls update on all media sources 00091 static void updateClass(); 00092 00093 // Given an URL and mime_type, construct/destroy a playback engine for 00094 // it (a "media impl"). 00095 LLMediaBase* createSourceFromMimeType( std::string scheme, std::string mime_type ); 00096 bool destroySource( LLMediaBase* media_impl ); 00097 00098 // mime type to impl mapping functions 00099 bool addMimeTypeImplNameMap( std::string mime_type, std::string impl_name ); 00100 std::string getImplNameFromMimeType( std::string mime_type ); 00101 00102 // Name accessor for querying type support 00103 bool supportsMediaType( const std::string& impl_name, const std::string& scheme, const std::string& mime_type ); 00104 00105 // convenience functions for getting suggested texture sizes to hold various size media 00106 static int textureWidthFromMediaWidth( int media_width ); 00107 static int textureHeightFromMediaHeight( int media_height ); 00108 00109 private: 00110 LLMediaManager(); 00111 static LLMediaManager* sInstance; 00112 00113 typedef std::set< LLMediaBase* > media_impl_container_t; 00114 media_impl_container_t mMediaImplContainer; 00115 00116 typedef std::map< std::string, std::string > mime_type_impl_name_container_t; 00117 mime_type_impl_name_container_t mMimeTypeImplNameContainer; 00118 }; 00119 00120 #endif // LLMEDIAMANAGER_H