Merge from remote repo
commit
64514057a4
|
|
@ -133,6 +133,7 @@ void LLPluginClassMedia::reset()
|
|||
mCurrentTime = 0.0f;
|
||||
mDuration = 0.0f;
|
||||
mCurrentRate = 0.0f;
|
||||
mLoadedDuration = 0.0f;
|
||||
}
|
||||
|
||||
void LLPluginClassMedia::idle(void)
|
||||
|
|
@ -705,6 +706,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
|
|||
|
||||
|
||||
bool time_duration_updated = false;
|
||||
int previous_percent = mProgressPercent;
|
||||
|
||||
if(message.hasValue("current_time"))
|
||||
{
|
||||
|
|
@ -722,11 +724,32 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
|
|||
mCurrentRate = message.getValueReal("current_rate");
|
||||
}
|
||||
|
||||
if(message.hasValue("loaded_duration"))
|
||||
{
|
||||
mLoadedDuration = message.getValueReal("loaded_duration");
|
||||
time_duration_updated = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the message doesn't contain a loaded_duration param, assume it's equal to duration
|
||||
mLoadedDuration = mDuration;
|
||||
}
|
||||
|
||||
// Calculate a percentage based on the loaded duration and total duration.
|
||||
if(mDuration != 0.0f) // Don't divide by zero.
|
||||
{
|
||||
mProgressPercent = (int)((mLoadedDuration * 100.0f)/mDuration);
|
||||
}
|
||||
|
||||
if(time_duration_updated)
|
||||
{
|
||||
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_TIME_DURATION_UPDATED);
|
||||
}
|
||||
|
||||
if(previous_percent != mProgressPercent)
|
||||
{
|
||||
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PROGRESS_UPDATED);
|
||||
}
|
||||
}
|
||||
else if(message_name == "media_status")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@ public:
|
|||
F64 getCurrentTime(void) const { return mCurrentTime; };
|
||||
F64 getDuration(void) const { return mDuration; };
|
||||
F64 getCurrentPlayRate(void) { return mCurrentRate; };
|
||||
F64 getLoadedDuration(void) const { return mLoadedDuration; };
|
||||
|
||||
// Initialize the URL history of the plugin by sending
|
||||
// "init_history" message
|
||||
|
|
@ -339,6 +340,7 @@ protected:
|
|||
F64 mCurrentTime;
|
||||
F64 mDuration;
|
||||
F64 mCurrentRate;
|
||||
F64 mLoadedDuration;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ private:
|
|||
message.setValueReal("current_time", getCurrentTime());
|
||||
message.setValueReal("duration", getDuration());
|
||||
message.setValueReal("current_rate", Fix2X(GetMovieRate(mMovieHandle)));
|
||||
message.setValueReal("loaded_duration", getLoadedDuration());
|
||||
}
|
||||
|
||||
sendMessage(message);
|
||||
|
|
@ -593,6 +594,19 @@ private:
|
|||
return (F64)duration / (F64)scale;
|
||||
};
|
||||
|
||||
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 getCurrentTime()
|
||||
{
|
||||
TimeValue curr_time = GetMovieTime( mMovieHandle, 0 );
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ include_directories(
|
|||
|
||||
if (DARWIN)
|
||||
include(CMakeFindFrameworks)
|
||||
find_library(CARBON_LIBRARY Carbon)
|
||||
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
|
||||
endif (DARWIN)
|
||||
|
||||
### demo_plugin
|
||||
|
|
@ -261,6 +261,7 @@ set(llmediaplugintest_SOURCE_FILES
|
|||
|
||||
add_executable(llmediaplugintest
|
||||
WIN32
|
||||
MACOSX_BUNDLE
|
||||
${llmediaplugintest_SOURCE_FILES}
|
||||
)
|
||||
|
||||
|
|
@ -280,6 +281,13 @@ target_link_libraries(llmediaplugintest
|
|||
${PLUGIN_API_WINDOWS_LIBRARIES}
|
||||
)
|
||||
|
||||
if (DARWIN)
|
||||
# The testbed needs to use a couple of CoreFoundation calls now, to deal with being a bundled app.
|
||||
target_link_libraries(llmediaplugintest
|
||||
${COREFOUNDATION_LIBRARY}
|
||||
)
|
||||
endif (DARWIN)
|
||||
|
||||
add_dependencies(llmediaplugintest
|
||||
stage_third_party_libs
|
||||
SLPlugin
|
||||
|
|
@ -300,22 +308,64 @@ endif (DARWIN OR LINUX)
|
|||
|
||||
# Gather build products of the various dependencies into the build directory for the testbed.
|
||||
|
||||
if (DARWIN)
|
||||
# path inside the app bundle where we'll need to copy plugins and other related files
|
||||
set(PLUGINS_DESTINATION_DIR
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llmediaplugintest.app/Contents/Resources
|
||||
)
|
||||
|
||||
# create the Contents/Resources directory
|
||||
add_custom_command(
|
||||
TARGET llmediaplugintest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS
|
||||
-E
|
||||
make_directory
|
||||
${PLUGINS_DESTINATION_DIR}
|
||||
COMMENT "Creating Resources directory in app bundle."
|
||||
)
|
||||
|
||||
# copy the llcommon dylib and its dependencies to Contents/Resources.
|
||||
get_target_property(BUILT_LLCOMMON llcommon LOCATION)
|
||||
add_custom_command(TARGET llmediaplugintest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_LLCOMMON} ${PLUGINS_DESTINATION_DIR}
|
||||
DEPENDS ${BUILT_LLCOMMON}
|
||||
)
|
||||
# FIXME: these paths should come from somewhere reliable. The canonical list seems to be in indra/newview/viewer_manifest.py
|
||||
add_custom_command(TARGET llmediaplugintest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.0.3.7.dylib ${PLUGINS_DESTINATION_DIR}
|
||||
DEPENDS ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.0.3.7.dylib
|
||||
)
|
||||
add_custom_command(TARGET llmediaplugintest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.0.3.8.dylib ${PLUGINS_DESTINATION_DIR}
|
||||
DEPENDS ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.0.3.8.dylib
|
||||
)
|
||||
add_custom_command(TARGET llmediaplugintest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.0.5.0.dylib ${PLUGINS_DESTINATION_DIR}
|
||||
DEPENDS ${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.0.5.0.dylib
|
||||
)
|
||||
else (DARWIN)
|
||||
set(PLUGINS_DESTINATION_DIR
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
|
||||
)
|
||||
endif (DARWIN)
|
||||
|
||||
get_target_property(BUILT_SLPLUGIN SLPlugin LOCATION)
|
||||
add_custom_command(TARGET llmediaplugintest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_SLPLUGIN} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_SLPLUGIN} ${PLUGINS_DESTINATION_DIR}
|
||||
DEPENDS ${BUILT_SLPLUGIN}
|
||||
)
|
||||
|
||||
if (DARWIN OR WINDOWS)
|
||||
get_target_property(BUILT_WEBKIT_PLUGIN media_plugin_webkit LOCATION)
|
||||
add_custom_command(TARGET llmediaplugintest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_WEBKIT_PLUGIN} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_WEBKIT_PLUGIN} ${PLUGINS_DESTINATION_DIR}
|
||||
DEPENDS ${BUILT_WEBKIT_PLUGIN}
|
||||
)
|
||||
|
||||
get_target_property(BUILT_QUICKTIME_PLUGIN media_plugin_quicktime LOCATION)
|
||||
add_custom_command(TARGET llmediaplugintest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_QUICKTIME_PLUGIN} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_QUICKTIME_PLUGIN} ${PLUGINS_DESTINATION_DIR}
|
||||
DEPENDS ${BUILT_QUICKTIME_PLUGIN}
|
||||
)
|
||||
|
||||
|
|
@ -325,16 +375,16 @@ if (DARWIN OR WINDOWS)
|
|||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${CMAKE_CURRENT_BINARY_DIR}/
|
||||
DEPENDS ${BUILT_LLMEDIAPLUGINTEST}
|
||||
)
|
||||
# also copy it to the build configuration directory, which is what the mac wants...
|
||||
# also copy it to the same place as SLPlugin, which is what the mac wants...
|
||||
add_custom_command(TARGET llmediaplugintest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${PLUGINS_DESTINATION_DIR}
|
||||
DEPENDS ${BUILT_LLMEDIAPLUGINTEST}
|
||||
)
|
||||
endif (DARWIN OR WINDOWS)
|
||||
|
||||
if (DARWIN)
|
||||
add_custom_command(TARGET llmediaplugintest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libllqtwebkit.dylib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libllqtwebkit.dylib ${PLUGINS_DESTINATION_DIR}
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libllqtwebkit.dylib
|
||||
)
|
||||
endif (DARWIN)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
#if __APPLE__
|
||||
#include <GLUT/glut.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#else
|
||||
#define FREEGLUT_STATIC
|
||||
#include "GL/freeglut.h"
|
||||
|
|
@ -2111,6 +2112,25 @@ void glutMouseButton( int button, int state, int x, int y )
|
|||
//
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
#if LL_DARWIN
|
||||
// Set the current working directory to <application bundle>/Contents/Resources/
|
||||
CFURLRef resources_url = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
|
||||
if(resources_url != NULL)
|
||||
{
|
||||
CFStringRef resources_string = CFURLCopyFileSystemPath(resources_url, kCFURLPOSIXPathStyle);
|
||||
CFRelease(resources_url);
|
||||
if(resources_string != NULL)
|
||||
{
|
||||
char buffer[PATH_MAX] = "";
|
||||
if(CFStringGetCString(resources_string, buffer, sizeof(buffer), kCFStringEncodingUTF8))
|
||||
{
|
||||
chdir(buffer);
|
||||
}
|
||||
CFRelease(resources_string);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
glutInit( &argc, argv );
|
||||
glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue