2006-07-18 23:21:48 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2004-03-09 17:42:07 +08:00
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSG_IMAGESTREAM
|
|
|
|
#define OSG_IMAGESTREAM 1
|
|
|
|
|
|
|
|
#include <osg/Image>
|
2009-02-28 04:16:08 +08:00
|
|
|
#include <osg/AudioStream>
|
2004-03-09 17:42:07 +08:00
|
|
|
|
|
|
|
namespace osg {
|
|
|
|
|
|
|
|
/**
|
2004-09-13 23:14:11 +08:00
|
|
|
* Image Stream class.
|
|
|
|
*/
|
2005-04-12 01:14:17 +08:00
|
|
|
class OSG_EXPORT ImageStream : public Image
|
2004-03-09 17:42:07 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ImageStream();
|
|
|
|
|
2004-09-13 23:14:11 +08:00
|
|
|
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
2004-03-09 17:42:07 +08:00
|
|
|
ImageStream(const ImageStream& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
|
|
|
|
|
|
|
virtual Object* cloneType() const { return new ImageStream(); }
|
|
|
|
virtual Object* clone(const CopyOp& copyop) const { return new ImageStream(*this,copyop); }
|
|
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ImageStream*>(obj)!=0; }
|
|
|
|
virtual const char* libraryName() const { return "osg"; }
|
|
|
|
virtual const char* className() const { return "ImageStream"; }
|
|
|
|
|
2004-09-13 23:14:11 +08:00
|
|
|
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
|
2004-03-09 17:42:07 +08:00
|
|
|
virtual int compare(const Image& rhs) const;
|
|
|
|
|
2005-11-18 01:44:48 +08:00
|
|
|
enum StreamStatus
|
2004-03-09 17:42:07 +08:00
|
|
|
{
|
2005-02-25 01:07:37 +08:00
|
|
|
INVALID,
|
2004-03-09 17:42:07 +08:00
|
|
|
PLAYING,
|
|
|
|
PAUSED,
|
|
|
|
REWINDING
|
|
|
|
};
|
|
|
|
|
2008-08-15 20:45:20 +08:00
|
|
|
virtual void seek(double /*time*/) {}
|
|
|
|
|
2004-03-09 17:42:07 +08:00
|
|
|
virtual void play() { _status=PLAYING; }
|
|
|
|
|
|
|
|
virtual void pause() { _status=PAUSED; }
|
|
|
|
|
|
|
|
virtual void rewind() { _status=REWINDING; }
|
2004-07-23 17:15:22 +08:00
|
|
|
|
2004-09-13 23:14:11 +08:00
|
|
|
virtual void quit(bool /*waitForThreadToExit*/ = true) {}
|
2004-03-09 17:42:07 +08:00
|
|
|
|
|
|
|
StreamStatus getStatus() { return _status; }
|
|
|
|
|
2004-08-24 20:55:15 +08:00
|
|
|
|
|
|
|
enum LoopingMode
|
|
|
|
{
|
|
|
|
NO_LOOPING,
|
|
|
|
LOOPING
|
|
|
|
};
|
|
|
|
|
2008-10-07 01:02:20 +08:00
|
|
|
void setLoopingMode(LoopingMode mode)
|
|
|
|
{
|
|
|
|
if (_loopingMode == mode) return;
|
|
|
|
|
|
|
|
_loopingMode = mode;
|
|
|
|
applyLoopingMode();
|
|
|
|
}
|
|
|
|
|
2004-08-24 20:55:15 +08:00
|
|
|
LoopingMode getLoopingMode() const { return _loopingMode; }
|
|
|
|
|
2010-08-10 01:02:31 +08:00
|
|
|
virtual double getCreationTime() const { return HUGE_VAL; }
|
2007-04-26 16:11:09 +08:00
|
|
|
virtual double getLength() const { return 0.0; }
|
2009-03-11 23:12:46 +08:00
|
|
|
virtual double getFrameRate() const { return 0.0; }
|
2011-12-24 00:27:25 +08:00
|
|
|
virtual double getCurrentTime() const { return 0.0; }
|
2009-03-11 23:12:46 +08:00
|
|
|
|
2004-03-09 17:42:07 +08:00
|
|
|
virtual void setReferenceTime(double) {}
|
|
|
|
virtual double getReferenceTime() const { return 0.0; }
|
|
|
|
|
|
|
|
virtual void setTimeMultiplier(double) {}
|
2007-06-28 22:19:30 +08:00
|
|
|
virtual double getTimeMultiplier() const { return 0.0; }
|
|
|
|
|
|
|
|
virtual void setVolume(float) {}
|
|
|
|
virtual float getVolume() const { return 0.0f; }
|
2009-02-28 04:16:08 +08:00
|
|
|
|
|
|
|
typedef std::vector< osg::ref_ptr<osg::AudioStream> > AudioStreams;
|
|
|
|
void setAudioStreams(const AudioStreams& asl) { _audioStreams = asl; }
|
|
|
|
AudioStreams& getAudioStreams() { return _audioStreams; }
|
|
|
|
const AudioStreams& getAudioStreams() const { return _audioStreams; }
|
2004-03-09 17:42:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2007-06-02 03:19:23 +08:00
|
|
|
virtual void applyLoopingMode() {}
|
2004-03-09 17:42:07 +08:00
|
|
|
|
|
|
|
virtual ~ImageStream() {}
|
|
|
|
|
|
|
|
StreamStatus _status;
|
2004-08-24 20:55:15 +08:00
|
|
|
LoopingMode _loopingMode;
|
2009-02-28 04:16:08 +08:00
|
|
|
|
|
|
|
AudioStreams _audioStreams;
|
2004-03-09 17:42:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|