ImageStream
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* 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>
#include <osg/AudioStream>
namespace osg {
// forward declare of osg::Texture
class Texture;
class OSG_EXPORT ImageStream : public Image
{
public:
ImageStream();
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"; }
virtual int compare(const Image& rhs) const;
enum StreamStatus
{
INVALID,
PLAYING,
PAUSED,
REWINDING
};
virtual void seek(double /*time*/) {}
virtual void play() { _status=PLAYING; }
virtual void pause() { _status=PAUSED; }
virtual void rewind() { _status=REWINDING; }
virtual void quit(bool /*waitForThreadToExit*/ = true) {}
StreamStatus getStatus() const { return _status; }
enum LoopingMode
{
NO_LOOPING,
LOOPING
};
void setLoopingMode(LoopingMode mode)
{
if (_loopingMode == mode) return;
_loopingMode = mode;
applyLoopingMode();
}
LoopingMode getLoopingMode() const { return _loopingMode; }
virtual double getCreationTime() const { return HUGE_VAL; }
virtual double getLength() const { return 0.0; }
virtual double getFrameRate() const { return 0.0; }
virtual double getCurrentTime() const { return 0.0; }
virtual void setReferenceTime(double) {}
virtual double getReferenceTime() const { return 0.0; }
virtual void setTimeMultiplier(double) {}
virtual double getTimeMultiplier() const { return 0.0; }
virtual void setVolume(float) {}
virtual float getVolume() const { return 0.0f; }
virtual float getAudioBalance() { return 0.0f; }
virtual void setAudioBalance(float /*b*/) {}
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; }
virtual osg::Texture* createSuitableTexture() { return NULL; }
protected:
virtual void applyLoopingMode() {}
virtual ~ImageStream() {}
StreamStatus _status;
LoopingMode _loopingMode;
AudioStreams _audioStreams;
};
} // namespace
#endif
AudioStream
Image
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::ImageStream::getVolume
virtual float getVolume() const
Definition ImageStream:94
osg::ImageStream::isSameKindAs
virtual bool isSameKindAs(const Object *obj) const
Definition ImageStream:38
osg::ImageStream::getCurrentTime
virtual double getCurrentTime() const
Definition ImageStream:85
osg::ImageStream::_status
StreamStatus _status
Definition ImageStream:116
osg::ImageStream::setReferenceTime
virtual void setReferenceTime(double)
Definition ImageStream:87
osg::ImageStream::_audioStreams
AudioStreams _audioStreams
Definition ImageStream:119
osg::ImageStream::setVolume
virtual void setVolume(float)
Definition ImageStream:93
osg::ImageStream::getStatus
StreamStatus getStatus() const
Definition ImageStream:63
osg::ImageStream::getAudioBalance
virtual float getAudioBalance()
set the balance of the audio: -1 = left, 0 = center, 1 = right
Definition ImageStream:97
osg::ImageStream::applyLoopingMode
virtual void applyLoopingMode()
Definition ImageStream:112
osg::ImageStream::className
virtual const char * className() const
Definition ImageStream:40
osg::ImageStream::AudioStreams
std::vector< osg::ref_ptr< osg::AudioStream > > AudioStreams
Definition ImageStream:100
osg::ImageStream::getLoopingMode
LoopingMode getLoopingMode() const
Definition ImageStream:80
osg::ImageStream::getFrameRate
virtual double getFrameRate() const
Definition ImageStream:84
osg::ImageStream::setLoopingMode
void setLoopingMode(LoopingMode mode)
Definition ImageStream:72
osg::ImageStream::createSuitableTexture
virtual osg::Texture * createSuitableTexture()
Definition ImageStream:109
osg::ImageStream::rewind
virtual void rewind()
Definition ImageStream:59
osg::ImageStream::setTimeMultiplier
virtual void setTimeMultiplier(double)
Definition ImageStream:90
osg::ImageStream::quit
virtual void quit(bool=true)
Definition ImageStream:61
osg::ImageStream::cloneType
virtual Object * cloneType() const
Definition ImageStream:36
osg::ImageStream::compare
virtual int compare(const Image &rhs) const
osg::ImageStream::getTimeMultiplier
virtual double getTimeMultiplier() const
Definition ImageStream:91
osg::ImageStream::play
virtual void play()
Definition ImageStream:55
osg::ImageStream::StreamStatus
StreamStatus
Definition ImageStream:46
osg::ImageStream::REWINDING
@ REWINDING
Definition ImageStream:50
osg::ImageStream::PLAYING
@ PLAYING
Definition ImageStream:48
osg::ImageStream::INVALID
@ INVALID
Definition ImageStream:47
osg::ImageStream::PAUSED
@ PAUSED
Definition ImageStream:49
osg::ImageStream::clone
virtual Object * clone(const CopyOp &copyop) const
Definition ImageStream:37
osg::ImageStream::pause
virtual void pause()
Definition ImageStream:57
osg::ImageStream::getReferenceTime
virtual double getReferenceTime() const
Definition ImageStream:88
osg::ImageStream::getLength
virtual double getLength() const
Definition ImageStream:83
osg::ImageStream::seek
virtual void seek(double)
Definition ImageStream:53
osg::ImageStream::setAudioStreams
void setAudioStreams(const AudioStreams &asl)
Definition ImageStream:101
osg::ImageStream::getAudioStreams
const AudioStreams & getAudioStreams() const
Definition ImageStream:103
osg::ImageStream::LoopingMode
LoopingMode
Definition ImageStream:67
osg::ImageStream::LOOPING
@ LOOPING
Definition ImageStream:69
osg::ImageStream::NO_LOOPING
@ NO_LOOPING
Definition ImageStream:68
osg::ImageStream::libraryName
virtual const char * libraryName() const
Definition ImageStream:39
osg::ImageStream::getCreationTime
virtual double getCreationTime() const
Definition ImageStream:82
osg::ImageStream::setAudioBalance
virtual void setAudioBalance(float)
Definition ImageStream:98
osg::ImageStream::_loopingMode
LoopingMode _loopingMode
Definition ImageStream:117
osg::ImageStream::ImageStream
ImageStream(const ImageStream &image, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::ImageStream::ImageStream
ImageStream()
osg::ImageStream::~ImageStream
virtual ~ImageStream()
Definition ImageStream:114
osg::ImageStream::getAudioStreams
AudioStreams & getAudioStreams()
Definition ImageStream:102
osg::Image::Image
Image()
osg::Object
Definition Object:61
osg::Texture
Definition Texture:422
osg
Definition AlphaFunc:19
NULL
#define NULL
Definition osg/Export:55
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39