From Rafa Gaitan, "Current ffmpeg plugin didn't support pause and seek, I have added this

functionality and I also modified osgmovie example to support "seek"."

Note from Robert Osfield, changes osgmovie to use '>' for the seek as '+' was already used in a separate submission that had been merged.
This commit is contained in:
Robert Osfield
2009-11-20 14:31:11 +00:00
parent 733431004a
commit 3ef770a9ff
5 changed files with 102 additions and 3 deletions

View File

@@ -118,6 +118,7 @@ protected:
bool _trackMouse;
ImageStreamList _imageStreamList;
unsigned int _seekIncr;
};
@@ -237,6 +238,23 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
}
return true;
}
else if (ea.getKey()=='>')
{
for(ImageStreamList::iterator itr=_imageStreamList.begin();
itr!=_imageStreamList.end();
++itr)
{
std::cout<<"Seeking"<<std::endl;
if(_seekIncr > 3) _seekIncr = 0;
double length = (*itr)->getLength();
double t_pos = (length/4.0f)*_seekIncr;
//(*itr)->rewind();
(*itr)->seek(t_pos);
(*itr)->play();
_seekIncr++;
}
return true;
}
else if (ea.getKey()=='L')
{
for(ImageStreamList::iterator itr=_imageStreamList.begin();
@@ -309,6 +327,7 @@ void MovieEventHandler::getUsage(osg::ApplicationUsage& usage) const
usage.addKeyboardMouseBinding("+","Increase speed of movie");
usage.addKeyboardMouseBinding("-","Decrease speed of movie");
usage.addKeyboardMouseBinding("o","Display frame rate of movie");
usage.addKeyboardMouseBinding(">","Advance the movie using seek");
}