From 113053b504971cb36c7f67f4d0cd56983910a523 Mon Sep 17 00:00:00 2001 From: callum Date: Thu, 15 Oct 2009 15:08:10 -0700 Subject: Fixed defects - added back getLoadedDuration() code that mysteriously vanished and fix name of function that checks the title. See http://10.1.19.90:8080/go?page=ReviewDisplay&reviewid=19 --- .../quicktime/media_plugin_quicktime.cpp | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp index 9b378fcd92..7100d03f05 100644 --- a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp +++ b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp @@ -532,7 +532,8 @@ private: // update state machine processState(); -titleChanged( "" ); + // see if title arrived and if so, update member variable with contents + checkTitle(); // special code for looping - need to rewind at the end of the movie if ( mIsLooping ) @@ -595,6 +596,19 @@ titleChanged( "" ); }; }; + 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 ); @@ -696,17 +710,23 @@ titleChanged( "" ); return true; }; - // called by this plugin when the title changes - // this creates the message and sends it back to the host app - void titleChanged( std::string title ) + // 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; }; }; -- cgit v1.2.3