Removed the default play() in the MPEG, QuickTime and Xine plugins, moving

it into the osgmovie application, and into readNodeFile method where
--movie is now available for detecting movie code.
This commit is contained in:
Robert Osfield 2005-02-22 20:56:56 +00:00
parent e01990d419
commit e2f6dc5bf4
5 changed files with 31 additions and 11 deletions

View File

@ -250,6 +250,8 @@ int main(int argc, char** argv)
if (arguments.isString(i))
{
osg::Image* image = osgDB::readImageFile(arguments[i]);
osg::ImageStream* imagestream = dynamic_cast<osg::ImageStream*>(image);
if (imagestream) imagestream->play();
geode->addDrawable(createTexturedQuadGeometry(pos,image->s(),image->t(),image));
geode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);

View File

@ -13,6 +13,7 @@
#include <osg/Notify>
#include <osg/Object>
#include <osg/Image>
#include <osg/ImageStream>
#include <osg/Node>
#include <osg/Group>
#include <osg/Geode>
@ -121,6 +122,17 @@ Node* osgDB::readNodeFiles(osg::ArgumentParser& arguments,const ReaderWriter::Op
if (image.valid()) nodeList.push_back(osg::createGeodeForImage(image.get()));
}
while (arguments.read("--movie",filename))
{
osg::ref_ptr<osg::Image> image = readImageFile(filename.c_str(), options);
osg::ref_ptr<osg::ImageStream> imageStream = dynamic_cast<osg::ImageStream*>(image.get());
if (image.valid())
{
imageStream->play();
nodeList.push_back(osg::createGeodeForImage(imageStream.get()));
}
}
while (arguments.read("--dem",filename))
{
osg::HeightField* hf = readHeightFieldFile(filename.c_str(), options);

View File

@ -30,7 +30,7 @@ class ReaderWriterMPEG : public osgDB::ReaderWriter
if (fileName.empty()) return ReadResult::FILE_NOT_FOUND;
osg::MpegImageStream* mpeg = new osg::MpegImageStream(fileName.c_str());
mpeg->play();
// mpeg->play();
return mpeg;
}

View File

@ -71,7 +71,7 @@ class ReaderWriterQT : public osgDB::ReaderWriter
// state on the ImageStream... will integrated as is right now
// to get things off the ground.
osg::QuicktimeImageStream* moov = new osg::QuicktimeImageStream(fileName);
moov->play();
// moov->play();
return moov;
}

View File

@ -69,18 +69,24 @@ class XineImageStream : public osg::ImageStream
_ready = false;
// play();
}
virtual void play()
{
if (_status!=PLAYING)
{
osg::notify(osg::NOTICE)<<"XineImageStream::play()"<<std::endl;
xine_play(_stream, 0, 0);
// imageStream->play();
while (!_ready)
{
osg::notify(osg::NOTICE)<<"waiting..."<<std::endl;
usleep(10000);
}
}
virtual void play() { _status=PLAYING; }
_status=PLAYING;
}
virtual void pause() { _status=PAUSED; }