From d02906b12ee335676e11ac883981e75f4df2cacc Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 12 Oct 2009 17:21:26 -0700 Subject: Added an optional "loaded_duration" parameter to the 'updated' message. This is the duration through which the time-based media has loaded, and should be between zero and the value of the "duration" parameter. If the parameter is not supplied, it will be implicitly set to the same value as the "duration" parameter, so the movie will appear fully loaded. This can be queried with LLPluginClassMedia::getLoadedDuration(). Made the "loaded_duration" parameter also implicitly set the progress percentage and send out MEDIA_EVENT_PROGRESS_UPDATED messages when it changes. Made the quicktime plugin set the "loaded_duration" parameter in its update messages. --- indra/media_plugins/quicktime/media_plugin_quicktime.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indra/media_plugins/quicktime') diff --git a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp index fbda65120d..556865f771 100644 --- a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp +++ b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp @@ -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 ); -- cgit v1.2.3