diff options
30 files changed, 865 insertions, 1281 deletions
diff --git a/autobuild.xml b/autobuild.xml index 072dfa678a..ff2216d767 100755 --- a/autobuild.xml +++ b/autobuild.xml @@ -1484,11 +1484,11 @@              <key>archive</key>              <map>                <key>hash</key> -              <string>29a1f64df46094eda0d681821a98d17e</string> +              <string>7db18237c7ac2f49a9d17a4c5ca7b23e</string>                <key>hash_algorithm</key>                <string>md5</string>                <key>url</key> -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llceflib_3p-llceflib/rev/311349/arch/Darwin/installer/llceflib-1.5.3.311349-darwin-311349.tar.bz2</string> +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llceflib_3p-llceflib/rev/315268/arch/Darwin/installer/llceflib-1.5.3.315268-darwin-315268.tar.bz2</string>              </map>              <key>name</key>              <string>darwin</string> @@ -1498,18 +1498,18 @@              <key>archive</key>              <map>                <key>hash</key> -              <string>827b7c339a2cd401d9d23f9ee02cb83f</string> +              <string>0dc2c50d785dfd5ff7098d262ed29499</string>                <key>hash_algorithm</key>                <string>md5</string>                <key>url</key> -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llceflib_3p-llceflib/rev/311349/arch/CYGWIN/installer/llceflib-1.5.3.311349-windows-311349.tar.bz2</string> +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llceflib_3p-llceflib/rev/315268/arch/CYGWIN/installer/llceflib-1.5.3.315268-windows-315268.tar.bz2</string>              </map>              <key>name</key>              <string>windows</string>            </map>          </map>          <key>version</key> -        <string>1.5.3.311349</string> +        <string>1.5.3.315268</string>        </map>        <key>llphysicsextensions_source</key>        <map> @@ -2135,6 +2135,34 @@          <key>version</key>          <string>0.8.0.1</string>        </map> +      <key>vlc-bin</key> +      <map> +        <key>copyright</key> +        <string>Copyright (C) 1998-2016 VLC authors and VideoLAN</string> +        <key>license</key> +        <string>GPL2</string> +        <key>license_file</key> +        <string>LICENSES/vlc.txt</string> +        <key>name</key> +        <string>vlc-bin</string> +        <key>platforms</key> +        <map> +          <key>windows</key> +          <map> +            <key>archive</key> +            <map> +              <key>hash</key> +              <string>3bdbb86adc2119a0b7bb17a54372dcd2</string> +              <key>url</key> +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-vlc-bin/rev/315283/arch/CYGWIN/installer/vlc_bin-2.2.3.315283-windows-315283.tar.bz2</string> +            </map> +            <key>name</key> +            <string>windows</string> +          </map> +        </map> +        <key>version</key> +        <string>2.2.3.315283</string> +      </map>        <key>xmlrpc-epi</key>        <map>          <key>copyright</key> diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 6dc8e3dfbf..6620dfa3cb 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -24,7 +24,6 @@ set(cmake_SOURCE_FILES      DirectX.cmake      DragDrop.cmake      EXPAT.cmake -##  ExamplePlugin.cmake      FindAPR.cmake      FindAutobuild.cmake      FindBerkeleyDB.cmake @@ -91,7 +90,6 @@ set(cmake_SOURCE_FILES      Prebuilt.cmake      PulseAudio.cmake      Python.cmake -    QuickTimePlugin.cmake      TemplateCheck.cmake      Tut.cmake      UI.cmake @@ -100,6 +98,7 @@ set(cmake_SOURCE_FILES      Variables.cmake      ViewerMiscLibs.cmake      VisualLeakDetector.cmake +    LibVLCPlugin.cmake      XmlRpcEpi.cmake      ZLIB.cmake      ) diff --git a/indra/cmake/LibVLCPlugin.cmake b/indra/cmake/LibVLCPlugin.cmake new file mode 100644 index 0000000000..0d2c46bac0 --- /dev/null +++ b/indra/cmake/LibVLCPlugin.cmake @@ -0,0 +1,22 @@ +# -*- cmake -*- +include(Linking) +include(Prebuilt) + +if (USESYSTEMLIBS) +    set(LIBVLCPLUGIN OFF CACHE BOOL +        "LIBVLCPLUGIN support for the llplugin/llmedia test apps.") +else (USESYSTEMLIBS) +    use_prebuilt_binary(vlc-bin) +    set(LIBVLCPLUGIN ON CACHE BOOL +        "LIBVLCPLUGIN support for the llplugin/llmedia test apps.") +        set(VLC_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/vlc) +endif (USESYSTEMLIBS) + +if (WINDOWS) +    set(VLC_PLUGIN_LIBRARIES +        libvlc.lib +        libvlccore.lib +    ) +elseif (DARWIN) +elseif (LINUX) +endif (WINDOWS) diff --git a/indra/cmake/QuickTimePlugin.cmake b/indra/cmake/QuickTimePlugin.cmake deleted file mode 100644 index c08e153ee3..0000000000 --- a/indra/cmake/QuickTimePlugin.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# -*- cmake -*- - -if(INSTALL_PROPRIETARY) -  include(Prebuilt) -  if (WINDOWS) -    use_prebuilt_binary(quicktime) -  endif (WINDOWS) -endif(INSTALL_PROPRIETARY) - -if (DARWIN) -  include(CMakeFindFrameworks) -  find_library(QUICKTIME_LIBRARY QuickTime) -elseif (WINDOWS) -  set(QUICKTIME_SDK_DIR "$ENV{PROGRAMFILES}/QuickTime SDK" -      CACHE PATH "Location of the QuickTime SDK.") - -  find_library(DEBUG_QUICKTIME_LIBRARY qtmlclient.lib -               PATHS -               ${ARCH_PREBUILT_DIRS_DEBUG} -               "${QUICKTIME_SDK_DIR}\\libraries" -               ) - -  find_library(RELEASE_QUICKTIME_LIBRARY qtmlclient.lib -               PATHS -               ${ARCH_PREBUILT_DIRS_RELEASE} -               "${QUICKTIME_SDK_DIR}\\libraries" -               ) - -  if (DEBUG_QUICKTIME_LIBRARY AND RELEASE_QUICKTIME_LIBRARY) -    set(QUICKTIME_LIBRARY  -        optimized ${RELEASE_QUICKTIME_LIBRARY} -        debug ${DEBUG_QUICKTIME_LIBRARY} -        ) -         -  endif (DEBUG_QUICKTIME_LIBRARY AND RELEASE_QUICKTIME_LIBRARY) -   -  include_directories( -    ${LIBS_PREBUILT_DIR}/include/quicktime -    "${QUICKTIME_SDK_DIR}\\CIncludes" -    ) -endif (DARWIN) - -mark_as_advanced(QUICKTIME_LIBRARY) - -if (QUICKTIME_LIBRARY) -  set(QUICKTIME ON CACHE BOOL "Build with QuickTime streaming media support.") -endif (QUICKTIME_LIBRARY) - diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index b30bc1aed6..2554ccdbe4 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -349,8 +349,8 @@ void LLGLSLShader::unloadInternal()          for (GLsizei i = 0; i < count; i++)          {              glDetachObjectARB(mProgramObject, obj[i]); -            glDeleteObjectARB(obj[i]); -        } +                glDeleteObjectARB(obj[i]); +            }          glDeleteObjectARB(mProgramObject); @@ -1274,6 +1274,28 @@ 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<GLint, LLVector4>::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 0746e8760a..8663a5a5ff 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -125,6 +125,7 @@ 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 69420dd0bb..b5ed67f66a 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1466,6 +1466,14 @@ 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 a67fb8da52..4c3547f8e4 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -355,6 +355,7 @@ 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 b297223c2e..7d857c6930 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -520,7 +520,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string&  		if (!filename.empty())  		{              LL_CONT << "From " << filename << ":\n"; -        } +		}          LL_CONT << log << LL_ENDL;  	}   } @@ -1190,6 +1190,7 @@ 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<std::string> dupe_check; diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 394b38f832..50b7c8b9d9 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -215,7 +215,8 @@ public:  		TERRAIN_ALPHARAMP,  		SHINY_ORIGIN, -DISPLAY_GAMMA, +		DISPLAY_GAMMA, +		INVERSE_TEX_Y,  		END_RESERVED_UNIFORMS  	} eGLSLReservedUniforms; diff --git a/indra/media_plugins/CMakeLists.txt b/indra/media_plugins/CMakeLists.txt index 24eb3947b4..7ef29b9027 100644 --- a/indra/media_plugins/CMakeLists.txt +++ b/indra/media_plugins/CMakeLists.txt @@ -7,12 +7,12 @@ if (LINUX)  endif (LINUX)  if (WINDOWS OR DARWIN) -    add_subdirectory(quicktime)      add_subdirectory(cef)  endif (WINDOWS OR DARWIN)  if (WINDOWS)      add_subdirectory(winmmshim) +    add_subdirectory(libvlc)  endif (WINDOWS)  ### add_subdirectory(example) diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index 8d9d1dd975..d61bd680df 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -488,7 +488,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", true); +				message.setValueBoolean("coords_opengl", false);  				sendMessage(message);  			}  			else if (message_name == "set_user_data_path") diff --git a/indra/media_plugins/libvlc/CMakeLists.txt b/indra/media_plugins/libvlc/CMakeLists.txt new file mode 100644 index 0000000000..535d29125b --- /dev/null +++ b/indra/media_plugins/libvlc/CMakeLists.txt @@ -0,0 +1,86 @@ +# -*- cmake -*- + +project(media_plugin_libvlc) + +include(00-Common) +include(LLCommon) +include(LLImage) +include(LLPlugin) +include(LLMath) +include(LLRender) +include(LLWindow) +include(Linking) +include(PluginAPI) +include(MediaPluginBase) +include(OpenGL) + +include(LibVLCPlugin) + +include_directories( +    ${LLPLUGIN_INCLUDE_DIRS} +    ${MEDIA_PLUGIN_BASE_INCLUDE_DIRS} +    ${LLCOMMON_INCLUDE_DIRS} +    ${LLMATH_INCLUDE_DIRS} +    ${LLIMAGE_INCLUDE_DIRS} +    ${LLRENDER_INCLUDE_DIRS} +    ${LLWINDOW_INCLUDE_DIRS} +    ${VLC_INCLUDE_DIR} +) +include_directories(SYSTEM +    ${LLCOMMON_SYSTEM_INCLUDE_DIRS} +    ) + + +### media_plugin_libvlc + +if(NOT WORD_SIZE EQUAL 32) +  if(WINDOWS) +    add_definitions(/FIXED:NO) +  else(WINDOWS) # not windows therefore gcc LINUX and DARWIN +    add_definitions(-fPIC) +  endif(WINDOWS) +endif(NOT WORD_SIZE EQUAL 32) + +set(media_plugin_libvlc_SOURCE_FILES +    media_plugin_libvlc.cpp +    ) + +add_library(media_plugin_libvlc +    SHARED +    ${media_plugin_libvlc_SOURCE_FILES} +) + +target_link_libraries(media_plugin_libvlc +  ${LLPLUGIN_LIBRARIES} +  ${MEDIA_PLUGIN_BASE_LIBRARIES} +  ${LLCOMMON_LIBRARIES} +  ${VLC_PLUGIN_LIBRARIES} +  ${PLUGIN_API_WINDOWS_LIBRARIES} +) + +add_dependencies(media_plugin_libvlc +  ${LLPLUGIN_LIBRARIES} +  ${MEDIA_PLUGIN_BASE_LIBRARIES} +  ${LLCOMMON_LIBRARIES} +) + +if (WINDOWS) +  set_target_properties( +    media_plugin_libvlc +    PROPERTIES +    LINK_FLAGS "/MANIFEST:NO /SAFESEH:NO /LTCG /NODEFAULTLIB:LIBCMT" +    ) +endif (WINDOWS) + +if (DARWIN) +  # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name +  set_target_properties( +    media_plugin_libvlc +    PROPERTIES +    PREFIX "" +    BUILD_WITH_INSTALL_RPATH 1 +    INSTALL_NAME_DIR "@executable_path" +    LINK_FLAGS "-exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/../base/media_plugin_base.exp" +  ) + +endif (DARWIN) diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp new file mode 100644 index 0000000000..92bfc15113 --- /dev/null +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -0,0 +1,406 @@ +/** + * @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" + +#include "llgl.h" +#include "llplugininstance.h" +#include "llpluginmessage.h" +#include "llpluginmessageclasses.h" +#include "media_plugin_base.h" + +#include "vlc/vlc.h" +#include "vlc/libvlc_version.h" + +//////////////////////////////////////////////////////////////////////////////// +// +class MediaPluginLibVLC : +        public MediaPluginBase +{ +    public: +        MediaPluginLibVLC( LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data ); +        ~MediaPluginLibVLC(); + +        /*virtual*/ void receiveMessage( const char* message_string ); + +    private: +        bool init(); + +		void initVLC(); +		void playMedia(); +		void resetVLC(); + +		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; + +		struct gVLCContext +		{ +			unsigned char* texture_pixels; +			libvlc_media_player_t* mp; +			MediaPluginLibVLC* parent; +		}; +		struct gVLCContext gVLCCallbackContext; + +		std::string mURL; +}; + +//////////////////////////////////////////////////////////////////////////////// +// +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; + +	gLibVLC = 0; +	gLibVLCMedia = 0; +	gLibVLCMediaPlayer = 0; + +	mURL = std::string(); +} + +//////////////////////////////////////////////////////////////////////////////// +// +MediaPluginLibVLC::~MediaPluginLibVLC() +{ +} + +///////////////////////////////////////////////////////////////////////////////// +// +void* MediaPluginLibVLC::lock(void* data, void** p_pixels) +{ +	struct gVLCContext* context = (gVLCContext*)data; + +	*p_pixels = context->texture_pixels; + +	return NULL; +} + +///////////////////////////////////////////////////////////////////////////////// +// +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. +} + +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginLibVLC::display(void* data, void* id) +{ +	struct gVLCContext* context = (gVLCContext*)data; + +	context->parent->setDirty(0, 0, context->parent->mWidth, context->parent->mHeight); +} + +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginLibVLC::initVLC() +{ +	char const* vlc_argv[] = +	{ +		"--no-xlib", +	}; + +	int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv); +	gLibVLC = libvlc_new(vlc_argc, vlc_argv); + +	if (!gLibVLC) +	{ +		// for the moment, if this fails, the plugin will fail and  +		// the media sub-system will tell the viewer something went wrong. +	} +} + +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginLibVLC::resetVLC() +{ +	libvlc_media_player_stop(gLibVLCMediaPlayer); +	libvlc_media_player_release(gLibVLCMediaPlayer); +	libvlc_release(gLibVLC); +} + +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginLibVLC::playMedia() +{ +	if (mURL.length() == 0) +	{ +		return; +	} + +	if (gLibVLCMediaPlayer) +	{ +		libvlc_media_player_stop(gLibVLCMediaPlayer); +		libvlc_media_player_release(gLibVLCMediaPlayer); +	} + +	gLibVLCMedia = libvlc_media_new_location(gLibVLC, mURL.c_str()); +	if (!gLibVLCMedia) +	{ +		printf("libvlc_media_new_location failed\n"); +	} +	else +	{ +		printf("libvlc_media_new_location ok\n"); +	} + +	gLibVLCMediaPlayer = libvlc_media_player_new_from_media(gLibVLCMedia); +	if (!gLibVLCMediaPlayer) +	{ +		printf("libvlc_media_player_new_from_media failed\n"); +	} +	else +	{ +		printf("libvlc_media_player_new_from_media ok...\n"); +	} + +	libvlc_media_release(gLibVLCMedia); + + +	gVLCCallbackContext.parent = this; +	gVLCCallbackContext.texture_pixels = mPixels; +	gVLCCallbackContext.mp = gLibVLCMediaPlayer; + +	libvlc_video_set_callbacks(gLibVLCMediaPlayer, lock, unlock, display, &gVLCCallbackContext); +	libvlc_video_set_format(gLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth); +	libvlc_media_player_play(gLibVLCMediaPlayer); +} + +//////////////////////////////////////////////////////////////////////////////// +// +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") +            { +				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; +                versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER] = LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER_VERSION; +                message.setValueLLSD("versions", versions); + +				std::ostringstream s; +				s << "LibVLC plugin "; +				s << LIBVLC_VERSION_MAJOR; +				s << "."; +				s << LIBVLC_VERSION_MINOR; +				s << "."; +				s << LIBVLC_VERSION_REVISION; + +                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 +                { +					//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 +            { +				//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); +				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; + +						playMedia(); +					}; +                }; + +				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response"); +				message.setValue("name", name); +				message.setValueS32("width", width); +				message.setValueS32("height", height); +				message.setValueS32("texture_width", texture_width); +				message.setValueS32("texture_height", texture_height); +				sendMessage(message); +            } +            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")
 +			{
 +				if (gLibVLCMediaPlayer)
 +				{
 +					libvlc_media_player_stop(gLibVLCMediaPlayer);
 +				}
 +			}
 +			else if (message_name == "start")
 +			{
 +				if (gLibVLCMediaPlayer)
 +				{
 +					libvlc_media_player_play(gLibVLCMediaPlayer);
 +				}
 +			}
 +			else if (message_name == "pause")
 +			{
 +				if (gLibVLCMediaPlayer)
 +				{
 +					libvlc_media_player_pause(gLibVLCMediaPlayer);
 +				}
 +			}
 +			else if (message_name == "seek")
 +			{
 +			}
 +			else if (message_name == "set_loop")
 +			{
 +			}
 +			else if (message_name == "set_volume")
 +			{
 +				if (gLibVLCMediaPlayer)
 +				{
 +					F64 volume = message_in.getValueReal("volume");
 +					libvlc_audio_set_volume(gLibVLCMediaPlayer, (int)(volume * 100));
 +				}
 +			}
 +		}
 +    } +} + +//////////////////////////////////////////////////////////////////////////////// +// +bool MediaPluginLibVLC::init() +{ +    LLPluginMessage message( LLPLUGIN_MESSAGE_CLASS_MEDIA, "name_text" ); +    message.setValue( "name", "LibVLC Plugin" ); +    sendMessage( message ); + +    return true; +}; + +//////////////////////////////////////////////////////////////////////////////// +// +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; + +    return 0; +} diff --git a/indra/media_plugins/quicktime/CMakeLists.txt b/indra/media_plugins/quicktime/CMakeLists.txt deleted file mode 100644 index c5615145be..0000000000 --- a/indra/media_plugins/quicktime/CMakeLists.txt +++ /dev/null @@ -1,90 +0,0 @@ -# -*- cmake -*- - -project(media_plugin_quicktime) - -include(00-Common) -include(LLCommon) -include(LLImage) -include(LLPlugin) -include(LLMath) -include(LLRender) -include(LLWindow) -include(Linking) -include(PluginAPI) -include(MediaPluginBase) -include(OpenGL) -include(QuickTimePlugin) -include(Boost) - -include_directories( -    ${LLPLUGIN_INCLUDE_DIRS} -    ${MEDIA_PLUGIN_BASE_INCLUDE_DIRS} -    ${LLCOMMON_INCLUDE_DIRS} -    ${LLMATH_INCLUDE_DIRS} -    ${LLIMAGE_INCLUDE_DIRS} -    ${LLRENDER_INCLUDE_DIRS} -    ${LLWINDOW_INCLUDE_DIRS} -) -include_directories(SYSTEM -    ${LLCOMMON_SYSTEM_INCLUDE_DIRS} -    ) - -if (DARWIN) -    include(CMakeFindFrameworks) -    find_library(CARBON_LIBRARY Carbon) -endif (DARWIN) - - -### media_plugin_quicktime - -set(media_plugin_quicktime_SOURCE_FILES -    media_plugin_quicktime.cpp -    ) - -add_library(media_plugin_quicktime -    SHARED -    ${media_plugin_quicktime_SOURCE_FILES} -) - -target_link_libraries(media_plugin_quicktime -  ${LLPLUGIN_LIBRARIES} -  ${MEDIA_PLUGIN_BASE_LIBRARIES} -  ${LLCOMMON_LIBRARIES} -  ${QUICKTIME_LIBRARY} -  ${PLUGIN_API_WINDOWS_LIBRARIES} -) - -if (WINDOWS) -  set_target_properties( -    media_plugin_quicktime -    PROPERTIES -    LINK_FLAGS "/MANIFEST:NO /SAFESEH:NO /NODEFAULTLIB:LIBCMT" -    LINK_FLAGS_DEBUG "/MANIFEST:NO /SAFESEH:NO /NODEFAULTLIB:LIBCMTD" -    ) -endif (WINDOWS) - -if (QUICKTIME) - -    add_definitions(-DLL_QUICKTIME_ENABLED=1) - -    if (DARWIN) -      # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name -      set_target_properties( -        media_plugin_quicktime -        PROPERTIES -        PREFIX "" -        BUILD_WITH_INSTALL_RPATH 1 -        INSTALL_NAME_DIR "@executable_path" -        LINK_FLAGS "-exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/../base/media_plugin_base.exp" -      ) - -# We use a bunch of deprecated system APIs. -    set_source_files_properties( -        media_plugin_quicktime.cpp PROPERTIES -        COMPILE_FLAGS -Wno-deprecated-declarations -        ) -    find_library(CARBON_LIBRARY Carbon) -    target_link_libraries(media_plugin_quicktime ${CARBON_LIBRARY}) -  endif (DARWIN) -endif (QUICKTIME) - diff --git a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp deleted file mode 100644 index 7ef5a0fe44..0000000000 --- a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp +++ /dev/null @@ -1,1084 +0,0 @@ -/** - * @file media_plugin_quicktime.cpp - * @brief QuickTime 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" - -#include "llgl.h" -  -#include "llplugininstance.h" -#include "llpluginmessage.h" -#include "llpluginmessageclasses.h" -#include "media_plugin_base.h" -  -#if LL_QUICKTIME_ENABLED -  -#if defined(LL_DARWIN) -#include <QuickTime/QuickTime.h> -#elif defined(LL_WINDOWS) -#include "llwin32headers.h" -#include "MacTypes.h" -#include "QTML.h" -#include "Movies.h" -#include "QDoffscreen.h" -#include "FixMath.h" -#include "QTLoadLibraryUtils.h" -#endif - - - -// TODO: Make sure that the only symbol exported from this library is LLPluginInitEntryPoint -//////////////////////////////////////////////////////////////////////////////// -// -class MediaPluginQuickTime : public MediaPluginBase -{ -public: -	MediaPluginQuickTime(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data); -	~MediaPluginQuickTime(); - -	/* virtual */ void receiveMessage(const char *message_string); - -private: - -	int mNaturalWidth; -	int mNaturalHeight; -	Movie mMovieHandle; -	GWorldPtr mGWorldHandle; -	ComponentInstance mMovieController; -	int mCurVolume; -	bool mMediaSizeChanging; -	bool mIsLooping; -	std::string mMovieTitle; -	bool mReceivedTitle; -	const int mMinWidth; -	const int mMaxWidth; -	const int mMinHeight; -	const int mMaxHeight; -	F64 mPlayRate; -	std::string mNavigateURL; - -	enum ECommand { -		COMMAND_NONE, -		COMMAND_STOP, -		COMMAND_PLAY, -		COMMAND_FAST_FORWARD, -		COMMAND_FAST_REWIND, -		COMMAND_PAUSE, -		COMMAND_SEEK, -	}; -	ECommand mCommand; - -	// Override this to add current time and duration to the message -	/*virtual*/ void 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); - -		if(mMovieHandle) -		{ -			message.setValueReal("current_time", getCurrentTime()); -			message.setValueReal("duration", getDuration()); -			message.setValueReal("current_rate", Fix2X(GetMovieRate(mMovieHandle))); -		} - -		sendMessage(message); -	} - - -	static Rect rectFromSize(int width, int height) -	{ -		Rect result; - - -		result.left = 0; -		result.top = 0; -		result.right = width; -		result.bottom = height; - -		return result; -	} - -	Fixed getPlayRate(void) -	{ -		Fixed result; -		if(mPlayRate == 0.0f) -		{ -			// Default to the movie's preferred rate -			result = GetMoviePreferredRate(mMovieHandle); -			if(result == 0) -			{ -				// Don't return a 0 play rate, ever. -				std::cerr << "Movie's preferred rate is 0, forcing to 1.0." << std::endl; -				result = X2Fix(1.0f); -			} -		} -		else -		{ -			result = X2Fix(mPlayRate); -		} - -		return result; -	} - -	void load( const std::string url ) -	{ - -		if ( url.empty() ) -			return; - -		// Stop and unload any existing movie before starting another one. -		unload(); - -		setStatus(STATUS_LOADING); - -		//In case std::string::c_str() makes a copy of the url data, -		//make sure there is memory to hold it before allocating memory for handle. -		//if fails, NewHandleClear(...) should return NULL. -		const char* url_string = url.c_str() ; -		Handle handle = NewHandleClear( ( Size )( url.length() + 1 ) ); - -		if ( NULL == handle || noErr != MemError() || NULL == *handle ) -		{ -			setStatus(STATUS_ERROR); -			return; -		} - -		BlockMove( url_string, *handle, ( Size )( url.length() + 1 ) ); - -		OSErr err = NewMovieFromDataRef( &mMovieHandle, newMovieActive | newMovieDontInteractWithUser | newMovieAsyncOK | newMovieIdleImportOK, nil, handle, URLDataHandlerSubType ); -		DisposeHandle( handle ); -		if ( noErr != err ) -		{ -			setStatus(STATUS_ERROR); -			return; -		}; -		 -		mNavigateURL = url; -		LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "navigate_begin"); -		message.setValue("uri", mNavigateURL); -		sendMessage(message); - -		// do pre-roll actions (typically fired for streaming movies but not always) -		PrePrerollMovie( mMovieHandle, 0, getPlayRate(), moviePrePrerollCompleteCallback, ( void * )this ); - -		Rect movie_rect = rectFromSize(mWidth, mHeight); - -		// make a new movie controller -		mMovieController = NewMovieController( mMovieHandle, &movie_rect, mcNotVisible | mcTopLeftMovie ); - -		// movie controller -		MCSetActionFilterWithRefCon( mMovieController, mcActionFilterCallBack, ( long )this ); - -		SetMoviePlayHints( mMovieHandle, hintsAllowDynamicResize, hintsAllowDynamicResize ); - -		// function that gets called when a frame is drawn -		SetMovieDrawingCompleteProc( mMovieHandle, movieDrawingCallWhenChanged, movieDrawingCompleteCallback, ( long )this ); - -		setStatus(STATUS_LOADED); - -		sizeChanged(); -	}; - -	bool unload() -	{ -		// new movie and have to get title again -		mReceivedTitle = false; - -		if ( mMovieHandle ) -		{ -			StopMovie( mMovieHandle ); -			if ( mMovieController ) -			{ -				MCMovieChanged( mMovieController, mMovieHandle ); -			}; -		}; - -		if ( mMovieController ) -		{ -			MCSetActionFilterWithRefCon( mMovieController, NULL, (long)this ); -			DisposeMovieController( mMovieController ); -			mMovieController = NULL; -		}; - -		if ( mMovieHandle ) -		{ -			SetMovieDrawingCompleteProc( mMovieHandle, movieDrawingCallWhenChanged, nil, ( long )this ); -			DisposeMovie( mMovieHandle ); -			mMovieHandle = NULL; -		}; - -        mGWorldHandle = NULL; -         -		setStatus(STATUS_NONE); - -		return true; -	} - -	bool navigateTo( const std::string url ) -	{ -		unload(); -		load( url ); - -		return true; -	}; - -	bool sizeChanged() -	{ -		if ( ! mMovieHandle ) -			return false; - -		// Check to see whether the movie's natural size has updated -		{ -			int width, height; -			getMovieNaturalSize(&width, &height); -			if((width != 0) && (height != 0) && ((width != mNaturalWidth) || (height != mNaturalHeight))) -			{ -				mNaturalWidth = width; -				mNaturalHeight = height; - -				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_request"); -				message.setValue("name", mTextureSegmentName); -				message.setValueS32("width", width); -				message.setValueS32("height", height); -				sendMessage(message); -				//std::cerr << "<--- Sending size change request to application with name: " << mTextureSegmentName << " - size is " << width << " x " << height << std::endl; -			} -		} -         - -		// sanitize destination size -		Rect dest_rect = rectFromSize(mWidth, mHeight); - -		// media depth won't change -		int depth_bits = mDepth * 8; -		long rowbytes = mDepth * mTextureWidth; - -		if(mPixels != NULL) -		{ -			// We have pixels.  Set up a GWorld pointing at the texture. -			OSErr result = QTNewGWorldFromPtr( &mGWorldHandle, depth_bits, &dest_rect, NULL, NULL, 0, (Ptr)mPixels, rowbytes); -			if ( noErr != result ) -			{ -				// TODO: unrecoverable??  throw exception?  return something? -				return false; -			} -		} -		else -		{ -			// We don't have pixels. Create a fake GWorld we can point the movie at when it's not safe to render normally. -			Rect tempRect = rectFromSize(1, 1); -			OSErr result = QTNewGWorld( &mGWorldHandle, depth_bits, &tempRect, NULL, NULL, 0); -			if ( noErr != result ) -			{ -				// TODO: unrecoverable??  throw exception?  return something? -				return false; -			} -		} - -		SetMovieGWorld( mMovieHandle, mGWorldHandle, NULL ); -         -		// Set up the movie display matrix -		{ -			// scale movie to fit rect and invert vertically to match opengl image format -			MatrixRecord transform; -			SetIdentityMatrix( &transform );	// transforms are additive so start from identify matrix -			double scaleX = (double) mWidth / mNaturalWidth; -			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 ) ); -			SetMovieMatrix( mMovieHandle, &transform ); -		} - -		// update movie controller -		if ( mMovieController ) -		{ -			MCSetControllerPort( mMovieController, mGWorldHandle ); -			MCPositionController( mMovieController, &dest_rect, &dest_rect, -								  mcTopLeftMovie | mcPositionDontInvalidate ); -			MCMovieChanged( mMovieController, mMovieHandle ); -		} - - -		// Emit event with size change so the calling app knows about it too -		// TODO: -		//LLMediaEvent event( this ); -		//mEventEmitter.update( &LLMediaObserver::onMediaSizeChange, event ); - -		return true; -	} -	static Boolean mcActionFilterCallBack( MovieController mc, short action, void *params, long ref ) -	{ -		Boolean result = false; - -		MediaPluginQuickTime* self = ( MediaPluginQuickTime* )ref; - -		switch( action ) -		{ -			// handle window resizing -			case mcActionControllerSizeChanged: -				// Ensure that the movie draws correctly at the new size -				self->sizeChanged(); -				break; - -			// Block any movie controller actions that open URLs. -			case mcActionLinkToURL: -			case mcActionGetNextURL: -			case mcActionLinkToURLExtended: -				// Prevent the movie controller from handling the message -				result = true; -				break; - -			default: -				break; -		}; - -		return result; -	}; - -	static OSErr movieDrawingCompleteCallback( Movie call_back_movie, long ref ) -	{ -		MediaPluginQuickTime* self = ( MediaPluginQuickTime* )ref; - -		// IMPORTANT: typically, a consumer who is observing this event will set a flag -		// when this event is fired then render later. Be aware that the media stream -		// can change during this period - dimensions, depth, format etc. -		//LLMediaEvent event( self ); -//		self->updateQuickTime(); -		// TODO ^^^ - - -		if ( self->mWidth > 0 && self->mHeight > 0 ) -			self->setDirty( 0, 0, self->mWidth, self->mHeight ); - -		return noErr; -	}; - -	static void moviePrePrerollCompleteCallback( Movie movie, OSErr preroll_err, void *ref ) -	{ -		MediaPluginQuickTime* self = ( MediaPluginQuickTime* )ref; - -		// TODO: -		//LLMediaEvent event( self ); -		//self->mEventEmitter.update( &LLMediaObserver::onMediaPreroll, event ); -		 -		// Send a "navigate complete" event. -		LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "navigate_complete"); -		message.setValue("uri", self->mNavigateURL); -		message.setValueS32("result_code", 200); -		message.setValue("result_string", "OK"); -		self->sendMessage(message); -	}; - - -	void rewind() -	{ -		GoToBeginningOfMovie( mMovieHandle ); -		MCMovieChanged( mMovieController, mMovieHandle ); -	}; - -	bool processState() -	{ -		if ( mCommand == COMMAND_PLAY ) -		{ -			if ( mStatus == STATUS_LOADED || mStatus == STATUS_PAUSED || mStatus == STATUS_PLAYING || mStatus == STATUS_DONE ) -			{ -				long state = GetMovieLoadState( mMovieHandle ); - -				if ( state >= kMovieLoadStatePlaythroughOK ) -				{ -					// if the movie is at the end (generally because it reached it naturally) -					// and we play is requested, jump back to the start of the movie. -					// note: this is different from having loop flag set. -					if ( IsMovieDone( mMovieHandle ) ) -					{ -						Fixed rate = X2Fix( 0.0 ); -						MCDoAction( mMovieController, mcActionPlay, (void*)rate ); -						rewind(); -					}; - -					MCDoAction( mMovieController, mcActionPrerollAndPlay, (void*)getPlayRate() ); -					MCDoAction( mMovieController, mcActionSetVolume, (void*)mCurVolume ); -					setStatus(STATUS_PLAYING); -					mCommand = COMMAND_NONE; -				}; -			}; -		} -		else -		if ( mCommand == COMMAND_STOP ) -		{ -			if ( mStatus == STATUS_PLAYING || mStatus == STATUS_PAUSED || mStatus == STATUS_DONE ) -			{ -				if ( GetMovieLoadState( mMovieHandle ) >= kMovieLoadStatePlaythroughOK ) -				{ -					Fixed rate = X2Fix( 0.0 ); -					MCDoAction( mMovieController, mcActionPlay, (void*)rate ); -					rewind(); - -					setStatus(STATUS_LOADED); -					mCommand = COMMAND_NONE; -				}; -			}; -		} -		else -		if ( mCommand == COMMAND_PAUSE ) -		{ -			if ( mStatus == STATUS_PLAYING ) -			{ -				if ( GetMovieLoadState( mMovieHandle ) >= kMovieLoadStatePlaythroughOK ) -				{ -					Fixed rate = X2Fix( 0.0 ); -					MCDoAction( mMovieController, mcActionPlay, (void*)rate ); -					setStatus(STATUS_PAUSED); -					mCommand = COMMAND_NONE; -				}; -			}; -		}; - -		return true; -	}; - -	void play(F64 rate) -	{ -		mPlayRate = rate; -		mCommand = COMMAND_PLAY; -	}; - -	void stop() -	{ -		mCommand = COMMAND_STOP; -	}; - -	void pause() -	{ -		mCommand = COMMAND_PAUSE; -	}; - -	void getMovieNaturalSize(int *movie_width, int *movie_height) -	{ -		Rect rect; - -		GetMovieNaturalBoundsRect( mMovieHandle, &rect ); - -		int width  = ( rect.right - rect.left ); -		int height = ( rect.bottom - rect.top ); - -		// make sure width and height fall in valid range -		if ( width < mMinWidth ) -			width = mMinWidth; - -		if ( width > mMaxWidth ) -			width = mMaxWidth; - -		if ( height < mMinHeight ) -			height = mMinHeight; - -		if ( height > mMaxHeight ) -			height = mMaxHeight; - -		// return the new rect -		*movie_width = width; -		*movie_height = height; -	} - -	void updateQuickTime(int milliseconds) -	{ -		if ( ! mMovieHandle ) -			return; - -		if ( ! mMovieController ) -			return; - -		// this wasn't required in 1.xx viewer but we have to manually  -		// work the Windows message pump now -		#if defined( LL_WINDOWS ) -		MSG msg; -		while ( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )  -		{ -			GetMessage( &msg, NULL, 0, 0 ); -			TranslateMessage( &msg ); -			DispatchMessage( &msg ); -		}; -		#endif - -		MCIdle( mMovieController ); - -		if ( ! mGWorldHandle ) -			return; - -		if ( mMediaSizeChanging ) -			return; - -		// update state machine -		processState(); - -		// see if title arrived and if so, update member variable with contents -		checkTitle(); -		 -		// QT call to see if we are at the end - can't do with controller -		if ( IsMovieDone( mMovieHandle ) ) -		{ -			// special code for looping - need to rewind at the end of the movie -			if ( mIsLooping ) -			{ -				// go back to start -				rewind(); - -				if ( mMovieController ) -				{ -					// kick off new play -					MCDoAction( mMovieController, mcActionPrerollAndPlay, (void*)getPlayRate() ); - -					// set the volume -					MCDoAction( mMovieController, mcActionSetVolume, (void*)mCurVolume ); -				}; -			} -			else -			{ -				if(mStatus == STATUS_PLAYING) -				{ -					setStatus(STATUS_DONE); -				} -			} -		} - -	}; -     -	void seek( F64 time ) -	{ -		if ( mMovieController ) -		{ -			TimeRecord when; -			when.scale = GetMovieTimeScale( mMovieHandle ); -			when.base = 0; - -			// 'time' is in (floating point) seconds.  The timebase time will be in 'units', where -			// there are 'scale' units per second. -			SInt64 raw_time = ( SInt64 )( time * (double)( when.scale ) ); - -			when.value.hi = ( SInt32 )( raw_time >> 32 ); -			when.value.lo = ( SInt32 )( ( raw_time & 0x00000000FFFFFFFF ) ); - -			MCDoAction( mMovieController, mcActionGoToTime, &when ); -		}; -	}; - -	F64 getLoadedDuration() 	  	  -	{ 	  	  -		TimeValue duration; 	  	  -		if(GetMaxLoadedTimeInMovie( mMovieHandle, &duration ) != noErr) 	  	  -		{ 	  	  -			// If GetMaxLoadedTimeInMovie returns an error, return the full duration of the movie. 	  	  -			duration = GetMovieDuration( mMovieHandle ); 	  	  -		} 	  	  -		TimeValue scale = GetMovieTimeScale( mMovieHandle ); 	  	  - -		return (F64)duration / (F64)scale; 	  	  -	}; 	  	  - -	F64 getDuration() -	{ -		TimeValue duration = GetMovieDuration( mMovieHandle ); -		TimeValue scale = GetMovieTimeScale( mMovieHandle ); - -		return (F64)duration / (F64)scale; -	}; - -	F64 getCurrentTime() -	{ -		TimeValue curr_time = GetMovieTime( mMovieHandle, 0 ); -		TimeValue scale = GetMovieTimeScale( mMovieHandle ); - -		return (F64)curr_time / (F64)scale; -	}; - -	void setVolume( F64 volume ) -	{ -		mCurVolume = (short)(volume * ( double ) 0x100 ); - -		if ( mMovieController ) -		{ -			MCDoAction( mMovieController, mcActionSetVolume, (void*)mCurVolume ); -		}; -	}; - -	//////////////////////////////////////////////////////////////////////////////// -	// -	void update(int milliseconds = 0) -	{ -		updateQuickTime(milliseconds); -	}; - -	//////////////////////////////////////////////////////////////////////////////// -	// -	void mouseDown( int x, int y ) -	{ -	}; - -	//////////////////////////////////////////////////////////////////////////////// -	// -	void mouseUp( int x, int y ) -	{ -	}; - -	//////////////////////////////////////////////////////////////////////////////// -	// -	void mouseMove( int x, int y ) -	{ -	}; - -	//////////////////////////////////////////////////////////////////////////////// -	// -	void keyPress( unsigned char key ) -	{ -	}; - -	//////////////////////////////////////////////////////////////////////////////// -	// Grab movie title into mMovieTitle - should be called repeatedly -	// until it returns true since movie title takes a while to become  -	// available. -	const bool getMovieTitle() -	{ -		// grab meta data from movie -		QTMetaDataRef media_data_ref; -		OSErr result = QTCopyMovieMetaData( mMovieHandle, &media_data_ref ); -		if ( noErr != result )  -			return false; - -		// look up "Display Name" in meta data -		OSType meta_data_key = kQTMetaDataCommonKeyDisplayName; -		QTMetaDataItem item = kQTMetaDataItemUninitialized; -		result = (OSErr)QTMetaDataGetNextItem( media_data_ref, kQTMetaDataStorageFormatWildcard,  -										0, kQTMetaDataKeyFormatCommon,  -										(const UInt8 *)&meta_data_key,  -										sizeof( meta_data_key ), &item ); -		if ( noErr != result )  -			return false; - -		// find the size of the title -		ByteCount size; -		result = (OSErr)QTMetaDataGetItemValue( media_data_ref, item, NULL, 0, &size ); -		if ( noErr != result || size <= 0 /*|| size > 1024  FIXME: arbitrary limit */ )  -			return false; - -		// allocate some space and grab it -		UInt8* item_data = new UInt8[ size + 1 ]; -		memset( item_data, 0, ( size + 1 ) * sizeof( UInt8 ) ); -		result = (OSErr)QTMetaDataGetItemValue( media_data_ref, item, item_data, size, NULL ); -		if ( noErr != result )  -		{ -			delete [] item_data; -			return false; -		}; - -		// save it -		if ( strlen( (char*)item_data ) ) -			mMovieTitle = std::string( (char* )item_data ); -		else -			mMovieTitle = ""; - -		// clean up -		delete [] item_data; - -		return true; -	}; - -	// called regularly to see if title changed -	void checkTitle() -	{ -		// we did already receive title so keep checking -		if ( ! mReceivedTitle ) -		{ -			// grab title from movie meta data -			if ( getMovieTitle() ) -			{ -				// pass back to host application -				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "name_text"); -				message.setValue("name", mMovieTitle ); -				sendMessage( message ); - -				// stop looking once we find a title for this movie. -				// TODO: this may to be reset if movie title changes -				// during playback but this is okay for now -				mReceivedTitle = true; -			}; -		}; -	}; -}; - -MediaPluginQuickTime::MediaPluginQuickTime( -	LLPluginInstance::sendMessageFunction host_send_func, -	void *host_user_data ) : -	MediaPluginBase(host_send_func, host_user_data), -	mMinWidth( 0 ), -	mMaxWidth( 2048 ), -	mMinHeight( 0 ), -	mMaxHeight( 2048 ) -{ -//	std::cerr << "MediaPluginQuickTime constructor" << std::endl; - -	mNaturalWidth = -1; -	mNaturalHeight = -1; -	mMovieHandle = 0; -	mGWorldHandle = 0; -	mMovieController = 0; -	mCurVolume = 0x99; -	mMediaSizeChanging = false; -	mIsLooping = false; -	mMovieTitle = std::string(); -	mReceivedTitle = false; -	mCommand = COMMAND_NONE; -	mPlayRate = 0.0f; -	mStatus = STATUS_NONE; -} - -MediaPluginQuickTime::~MediaPluginQuickTime() -{ -//	std::cerr << "MediaPluginQuickTime destructor" << std::endl; - -	ExitMovies(); - -#ifdef LL_WINDOWS -	TerminateQTML(); -//		std::cerr << "QuickTime closing down" << std::endl; -#endif -} - - -void MediaPluginQuickTime::receiveMessage(const char *message_string) -{ -//	std::cerr << "MediaPluginQuickTime::receiveMessage: received message: \"" << message_string << "\"" << std::endl; -	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("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; -				// Normally a plugin would only specify one of these two subclasses, but this is a demo... -				versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME] = LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME_VERSION; -				message.setValueLLSD("versions", versions); - -				#ifdef LL_WINDOWS - -				// QuickTime 7.6.4 has an issue (that was not present in 7.6.2) with initializing QuickTime -				// according to this article: http://lists.apple.com/archives/QuickTime-API/2009/Sep/msg00097.html -				// The solution presented there appears to work. -				QTLoadLibrary("qtcf.dll"); - -				// main initialization for QuickTime - only required on Windows -				OSErr result = InitializeQTML( 0L ); -				if ( result != noErr ) -				{ -					//TODO: If no QT on Windows, this fails - respond accordingly. -				} -				else -				{ -					//std::cerr << "QuickTime initialized" << std::endl; -				}; -				#endif - -				// required for both Windows and Mac -				EnterMovies(); - -				std::string plugin_version = "QuickTime media plugin, QuickTime version "; - -				long version = 0; -				Gestalt( gestaltQuickTimeVersion, &version ); -				std::ostringstream codec( "" ); -				codec << std::hex << version << std::dec; -				plugin_version += codec.str(); -				message.setValue("plugin_version", plugin_version); -				sendMessage(message); -			} -			else if(message_name == "idle") -			{ -				// no response is necessary here. -				F64 time = message_in.getValueReal("time"); - -				// Convert time to milliseconds for update() -				update((int)(time * 1000.0f)); -			} -			else if(message_name == "cleanup") -			{ -				// TODO: clean up here -                LLPluginMessage message("base", "goodbye"); -                sendMessage(message); -            } -			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"); -//				std::cerr << "MediaPluginQuickTime::receiveMessage: shared memory added, name: " << name -//					<< ", size: " << info.mSize -//					<< ", address: " << info.mAddress -//					<< std::endl; - -				mSharedSegments.insert(SharedSegmentMap::value_type(name, info)); - -			} -			else if(message_name == "shm_remove") -			{ -				std::string name = message_in.getValue("name"); - -//				std::cerr << "MediaPluginQuickTime::receiveMessage: shared memory remove, name = " << name << std::endl; - -				SharedSegmentMap::iterator iter = mSharedSegments.find(name); -				if(iter != mSharedSegments.end()) -				{ -					if(mPixels == iter->second.mAddress) -					{ -						// This is the currently active pixel buffer.  Make sure we stop drawing to it. -						mPixels = NULL; -						mTextureSegmentName.clear(); - -						// Make sure the movie GWorld is no longer pointed at the shared segment. -						sizeChanged(); -					} -					mSharedSegments.erase(iter); -				} -				else -				{ -//					std::cerr << "MediaPluginQuickTime::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 -			{ -//				std::cerr << "MediaPluginQuickTime::receiveMessage: unknown base message: " << message_name << std::endl; -			} -		} -		else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA) -		{ -			if(message_name == "init") -			{ -				// This is the media init message -- all necessary data for initialization should have been received. - -				// Plugin gets to decide the texture parameters to use. -				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "texture_params"); -				#if defined(LL_WINDOWS) -					// Values for Windows -					mDepth = 3; -					message.setValueU32("format", GL_RGB); -					message.setValueU32("type", GL_UNSIGNED_BYTE); - -					// We really want to pad the texture width to a multiple of 32 bytes, but since we're using 3-byte pixels, it doesn't come out even. -					// Padding to a multiple of 3*32 guarantees it'll divide out properly. -					message.setValueU32("padding", 32 * 3); -				#else -					// Values for Mac -					mDepth = 4; -					message.setValueU32("format", GL_BGRA_EXT); -					#ifdef __BIG_ENDIAN__ -						message.setValueU32("type", GL_UNSIGNED_INT_8_8_8_8_REV ); -					#else -						message.setValueU32("type", GL_UNSIGNED_INT_8_8_8_8); -					#endif - -					// Pad texture width to a multiple of 32 bytes, to line up with cache lines. -					message.setValueU32("padding", 32); -				#endif -				message.setValueS32("depth", mDepth); -				message.setValueU32("internalformat", GL_RGB); -				message.setValueBoolean("coords_opengl", true);	// true == use OpenGL-style coordinates, false == (0,0) is upper left. -				message.setValueBoolean("allow_downsample", 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"); - -				//std::cerr << "---->Got size change instruction from application with name: " << name << " - size is " << width << " x " << height << std::endl; - -				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response"); -				message.setValue("name", name); -				message.setValueS32("width", width); -				message.setValueS32("height", height); -				message.setValueS32("texture_width", texture_width); -				message.setValueS32("texture_height", texture_height); -				sendMessage(message); - -				if(!name.empty()) -				{ -					// Find the shared memory region with this name -					SharedSegmentMap::iterator iter = mSharedSegments.find(name); -					if(iter != mSharedSegments.end()) -					{ -//						std::cerr << "%%% Got size change, new size is " << width << " by " << height << std::endl; -//						std::cerr << "%%%%  texture size is " << texture_width << " by " << texture_height << std::endl; - -						mPixels = (unsigned char*)iter->second.mAddress; -						mTextureSegmentName = name; -						mWidth = width; -						mHeight = height; - -						mTextureWidth = texture_width; -						mTextureHeight = texture_height; - -						mMediaSizeChanging = false; - -						sizeChanged(); - -						update(); -					}; -				}; -			} -			else if(message_name == "load_uri") -			{ -				std::string uri = message_in.getValue("uri"); -				load( uri ); -				sendStatus(); -			} -			else if(message_name == "mouse_event") -			{ -				std::string event = message_in.getValue("event"); -				S32 x = message_in.getValueS32("x"); -				S32 y = message_in.getValueS32("y"); - -				if(event == "down") -				{ -					mouseDown(x, y); -				} -				else if(event == "up") -				{ -					mouseUp(x, y); -				} -				else if(event == "move") -				{ -					mouseMove(x, y); -				}; -			}; -		} -		else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME) -		{ -			if(message_name == "stop") -			{ -				stop(); -			} -			else if(message_name == "start") -			{ -				F64 rate = 0.0; -				if(message_in.hasValue("rate")) -				{ -					rate = message_in.getValueReal("rate"); -				} -				play(rate); -			} -			else if(message_name == "pause") -			{ -				pause(); -			} -			else if(message_name == "seek") -			{ -				F64 time = message_in.getValueReal("time"); -				seek(time); -			} -			else if(message_name == "set_loop") -			{ -				bool loop = message_in.getValueBoolean("loop"); -				mIsLooping = loop; -			} -			else if(message_name == "set_volume") -			{ -				F64 volume = message_in.getValueReal("volume"); -				setVolume(volume); -			} -		} -		else -		{ -//			std::cerr << "MediaPluginQuickTime::receiveMessage: unknown message class: " << message_class << std::endl; -		}; -	}; -} - -int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data) -{ -	MediaPluginQuickTime *self = new MediaPluginQuickTime(host_send_func, host_user_data); -	*plugin_send_func = MediaPluginQuickTime::staticReceiveMessage; -	*plugin_user_data = (void*)self; - -	return 0; -} - -#else // LL_QUICKTIME_ENABLED - -// Stubbed-out class with constructor/destructor (necessary or windows linker -// will just think its dead code and optimize it all out) -class MediaPluginQuickTime : public MediaPluginBase -{ -public: -	MediaPluginQuickTime(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data); -	~MediaPluginQuickTime(); -	/* virtual */ void receiveMessage(const char *message_string); -}; - -MediaPluginQuickTime::MediaPluginQuickTime( -	LLPluginInstance::sendMessageFunction host_send_func, -	void *host_user_data ) : -	MediaPluginBase(host_send_func, host_user_data) -{ -    // no-op -} - -MediaPluginQuickTime::~MediaPluginQuickTime() -{ -    // no-op -} - -void MediaPluginQuickTime::receiveMessage(const char *message_string) -{ -    // no-op -} - -// We're building without quicktime enabled.  Just refuse to initialize. -int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data) -{ -    return -1; -} - -#endif // LL_QUICKTIME_ENABLED diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 8d863631cf..9ffc99adb2 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1753,6 +1753,7 @@ if (WINDOWS)        SLPlugin        media_plugin_quicktime        media_plugin_cef +      media_plugin_libvlc        winmm_shim        windows-crash-logger        ) @@ -2075,7 +2076,7 @@ if (DARWIN)        ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py      ) -  add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_quicktime media_plugin_cef mac-crash-logger) +  add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_quicktime media_plugin_libvlc media_plugin_cef mac-crash-logger)    add_dependencies(${VIEWER_BINARY_NAME} mac-crash-logger)    if (ENABLE_SIGNING) diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl index 3c026796c8..7e83389f6e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl @@ -26,6 +26,13 @@  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; @@ -44,6 +51,10 @@ 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 8e899e3e0f..2595712882 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -26,6 +26,13 @@  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; @@ -62,6 +69,10 @@ 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 fc20d3270e..a8efcd9857 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl @@ -26,6 +26,14 @@  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(); @@ -49,6 +57,11 @@ 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 37a20383e2..c744dc1397 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -27,6 +27,13 @@ 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(); @@ -51,7 +58,10 @@ 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/llappviewer.cpp b/indra/newview/llappviewer.cpp index b6d02ea2f8..7529254466 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -124,6 +124,7 @@  #include "llcoros.h"  #if !LL_LINUX  #include "cef/llceflib.h" +#include "vlc/libvlc_version.h"  #endif  // Third party library includes @@ -3339,9 +3340,19 @@ LLSD LLAppViewer::getViewerInfo() const  	}  #if !LL_LINUX +	std::ostringstream ver_codec; +	ver_codec << LIBVLC_VERSION_MAJOR; +	ver_codec << "."; +	ver_codec << LIBVLC_VERSION_MINOR; +	ver_codec << "."; +	ver_codec << LIBVLC_VERSION_REVISION; +	info["LIBVLC_VERSION"] = ver_codec.str(); +  	info["LLCEFLIB_VERSION"] = LLCEFLIB_VERSION;  #else  	info["LLCEFLIB_VERSION"] = "Undefined"; + +	info["LIBVLC_VERSION"] = "Undefined";  #endif  	S32 packets_in = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN); diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index f74164aea6..a6cf917cbd 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -473,6 +473,10 @@ 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); +					}  				}  			}  		} @@ -482,13 +486,54 @@ 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 diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 024e315632..c039b3b8f4 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -81,7 +81,8 @@ LLFloaterWebContent::LLFloaterWebContent( const Params& params )  	mCommitCallbackRegistrar.add( "WebContent.Reload", boost::bind( &LLFloaterWebContent::onClickReload, this ));  	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.PopExternal", boost::bind(&LLFloaterWebContent::onPopExternal, this)); +	mCommitCallbackRegistrar.add( "WebContent.TestVideo", boost::bind(&LLFloaterWebContent::onTestVideo, this, _2));  }  BOOL LLFloaterWebContent::postBuild() @@ -229,7 +230,7 @@ void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)  		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)  		{ @@ -243,9 +244,9 @@ 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, HTTP_CONTENT_TEXT_HTML); +	mWebBrowser->setHomePageUrl(p.url);  	mWebBrowser->setTarget(p.target); -	mWebBrowser->navigateTo(p.url, HTTP_CONTENT_TEXT_HTML, p.clean_browser); +	mWebBrowser->navigateTo(p.url);  	set_current_url(p.url); @@ -499,7 +500,7 @@ void LLFloaterWebContent::onEnterAddress()      LLStringUtil::trim(url);  	if ( url.length() > 0 )  	{ -		mWebBrowser->navigateTo(url, HTTP_CONTENT_TEXT_HTML); +		mWebBrowser->navigateTo(url);  	};  } @@ -508,9 +509,18 @@ void LLFloaterWebContent::onPopExternal()  	// make sure there is at least something there.  	// (perhaps this test should be for minimum length of a URL)  	std::string url = mAddressCombo->getValue().asString(); -    LLStringUtil::trim(url); -	if ( url.length() > 0 ) +	LLStringUtil::trim(url); +	if (url.length() > 0) +	{ +		LLWeb::loadURLExternal(url); +	}; +} + +void LLFloaterWebContent::onTestVideo(std::string url) +{ +	LLStringUtil::trim(url); +	if (url.length() > 0)  	{ -		LLWeb::loadURLExternal( url ); +		mWebBrowser->navigateTo(url);  	};  } diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h index 4291fd9f2c..519b575b38 100644 --- a/indra/newview/llfloaterwebcontent.h +++ b/indra/newview/llfloaterwebcontent.h @@ -92,6 +92,7 @@ protected:  	void onClickStop();  	void onEnterAddress();  	void onPopExternal(); +	void onTestVideo(std::string url);  	static void preCreate(Params& p);  	void open_media(const Params& ); 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 a80440e844..86be363245 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 @@      <layout_panel        auto_resize="false"        default_tab_group="1" -      height="22" +      height="44"        layout="topleft"        left="0" -      min_height="20" +      min_height="40"        name="nav_controls"        top="400"        width="770"> @@ -152,6 +152,90 @@          <button.commit_callback            function="WebContent.PopExternal" />        </button> + +      <button +        image_overlay="Video_URL_Off" +		    image_disabled="PushButton_Disabled" +		    image_disabled_selected="PushButton_Disabled" +		    image_selected="PushButton_Selected" +		    image_unselected="PushButton_Off" +        chrome="true" +        tool_tip="MPEG4 Video Test" +        enabled="true" +        follows="left|top" +        height="22" +        layout="topleft" +        left="1" +        name="VLC Plugin Test" +        top="22" +        width="22"> +        <button.commit_callback +          function="WebContent.TestVideo" +          parameter="https://callum-linden.s3.amazonaws.com/sample_media/ss.mp4"/> +      </button> + +      <button +        image_overlay="Video_URL_Off" +		    image_disabled="PushButton_Disabled" +		    image_disabled_selected="PushButton_Disabled" +		    image_selected="PushButton_Selected" +		    image_unselected="PushButton_Off" +        chrome="true" +        tool_tip="MKV Video Test" +        enabled="true" +        follows="left|top" +        height="22" +        layout="topleft" +        left="27" +        name="VLC Plugin Test" +        top="22" +        width="22"> +        <button.commit_callback +          function="WebContent.TestVideo" +          parameter="https://callum-linden.s3.amazonaws.com/sample_media/jellyfish.mkv"/> +      </button> + +      <button +        image_overlay="Video_URL_Off" +		    image_disabled="PushButton_Disabled" +		    image_disabled_selected="PushButton_Disabled" +		    image_selected="PushButton_Selected" +		    image_unselected="PushButton_Off" +        chrome="true" +        tool_tip="WebM Video Test" +        enabled="true" +        follows="left|top" +        height="22" +        layout="topleft" +        left="51" +        name="VLC Plugin Test" +        top="22" +        width="22"> +        <button.commit_callback +          function="WebContent.TestVideo" +          parameter="https://callum-linden.s3.amazonaws.com/sample_media/kubo.webm"/> +      </button> + +      <button +        image_overlay="Video_URL_Off" +		    image_disabled="PushButton_Disabled" +		    image_disabled_selected="PushButton_Disabled" +		    image_selected="PushButton_Selected" +		    image_unselected="PushButton_Off" +        chrome="true" +        tool_tip="MP3 audio Test" +        enabled="true" +        follows="left|top" +        height="22" +        layout="topleft" +        left="75" +        name="VLC Plugin Test" +        top="22" +        width="22"> +        function="WebContent.TestVideo" +        parameter="https://callum-linden.s3.amazonaws.com/alegria.mp3"/> +      </button> +      </layout_panel>      <layout_panel        height="40" diff --git a/indra/newview/skins/default/xui/en/mime_types.xml b/indra/newview/skins/default/xui/en/mime_types.xml index 7cb4a6e53b..2867204318 100644 --- a/indra/newview/skins/default/xui/en/mime_types.xml +++ b/indra/newview/skins/default/xui/en/mime_types.xml @@ -130,10 +130,21 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</scheme> -	<mimetype name="blank"> +  <scheme name="libvlc"> +    <label name="libvlc_label"> +      LibVLC supported media +    </label> +    <widgettype> +      movie +    </widgettype> +    <impl> +      media_plugin_libvlc +    </impl> +  </scheme> +  <mimetype name="blank">  		<label name="blank_label">  			- None -  		</label> @@ -163,7 +174,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="video/*"> @@ -174,7 +185,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_libvlc  		</impl>  	</mimetype>  	<mimetype name="image/*"> @@ -196,7 +207,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_libvlc  		</impl>  	</mimetype>  	<mimetype name="application/javascript"> @@ -218,7 +229,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="application/pdf"> @@ -295,7 +306,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="audio/mpeg"> @@ -306,7 +317,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="audio/x-aiff"> @@ -317,7 +328,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="audio/x-wav"> @@ -328,7 +339,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype menu="1" name="image/bmp"> @@ -438,7 +449,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_libvlc  		</impl>  	</mimetype>  	<mimetype name="video/mp4"> @@ -449,10 +460,21 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_libvlc  		</impl>  	</mimetype> -	<mimetype menu="1" name="video/quicktime"> +  <mimetype name="application/octet-stream"> +    <label name="video/octet-stream"> +      Movie +    </label> +    <widgettype> +      movie +    </widgettype> +    <impl> +      media_plugin_libvlc +    </impl> +  </mimetype> +  <mimetype menu="1" name="video/quicktime">  		<label name="video/quicktime_label">  			Movie (QuickTime)  		</label> @@ -460,7 +482,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_libvlc  		</impl>  	</mimetype>  	<mimetype name="video/x-ms-asf"> @@ -471,7 +493,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_libvlc  		</impl>  	</mimetype>  	<mimetype name="video/x-ms-wmv"> @@ -482,7 +504,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype menu="1" name="video/x-msvideo"> @@ -493,7 +515,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  </mimetypes> diff --git a/indra/newview/skins/default/xui/en/mime_types_mac.xml b/indra/newview/skins/default/xui/en/mime_types_mac.xml index f71c24b2e4..e20b621cce 100644 --- a/indra/newview/skins/default/xui/en/mime_types_mac.xml +++ b/indra/newview/skins/default/xui/en/mime_types_mac.xml @@ -130,7 +130,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</scheme>  	<mimetype name="blank"> @@ -141,7 +141,7 @@  			none  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="none/none"> @@ -163,7 +163,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="video/*"> @@ -174,7 +174,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="image/*"> @@ -196,7 +196,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="application/javascript"> @@ -218,7 +218,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="application/pdf"> @@ -295,7 +295,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="audio/mpeg"> @@ -306,7 +306,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="audio/x-aiff"> @@ -317,7 +317,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="audio/x-wav"> @@ -328,7 +328,7 @@  			audio  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype menu="1" name="image/bmp"> @@ -438,7 +438,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="video/mp4"> @@ -449,7 +449,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype menu="1" name="video/quicktime"> @@ -460,7 +460,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="video/x-ms-asf"> @@ -471,7 +471,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype name="video/x-ms-wmv"> @@ -482,7 +482,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  	<mimetype menu="1" name="video/x-msvideo"> @@ -493,7 +493,7 @@  			movie  		</widgettype>  		<impl> -			media_plugin_quicktime +			media_plugin_cef  		</impl>  	</mimetype>  </mimetypes> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index ae63546082..3be74218a2 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -51,12 +51,13 @@ OpenGL Version: [OPENGL_VERSION]  J2C Decoder Version: [J2C_VERSION]  Audio Driver Version: [AUDIO_DRIVER_VERSION]  LLCEFLib/CEF Version: [LLCEFLIB_VERSION] +LibVLC Version: [LIBVLC_VERSION]  Voice Server Version: [VOICE_VERSION]  	</string>  	<string name="AboutTraffic">Packets Lost: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number,1]%)</string>  	<string name="ErrorFetchingServerReleaseNotesURL">Error fetching server release notes URL.</string>  	<string name="BuildConfiguration">Build Configuration</string> - +	  	<!--  progress -->  	<string name="ProgressRestoring">Restoring...</string>  	<string name="ProgressChangingResolution">Changing resolution...</string> diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 1c77cf805e..e7f517518b 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -436,6 +436,11 @@ class Windows_i686_Manifest(ViewerManifest):              self.path("media_plugin_cef.dll")              self.end_prefix() +        # Media plugins - LibVLC +        if self.prefix(src='../media_plugins/libvlc/%s' % self.args['configuration'], dst="llplugin"): +            self.path("media_plugin_libvlc.dll") +            self.end_prefix() +          # winmm.dll shim          if self.prefix(src='../media_plugins/winmmshim/%s' % self.args['configuration'], dst=""):              self.path("winmm.dll") @@ -542,6 +547,12 @@ class Windows_i686_Manifest(ViewerManifest):              self.path("zh-TW.pak")              self.end_prefix() +            if self.prefix(src=os.path.join(os.pardir, 'packages', 'bin', 'release'), dst="llplugin"): +                self.path("libvlc.dll") +                self.path("libvlccore.dll") +                self.path("plugins/") +                self.end_prefix() +          # pull in the crash logger and updater from other projects          # tag:"crash-logger" here as a cue to the exporter          self.path(src='../win_crash_logger/%s/windows-crash-logger.exe' % self.args['configuration'],  | 
