1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
14#ifndef OSG_IMAGESTREAM
15#define OSG_IMAGESTREAM 1
18#include <osg/AudioStream>
22// forward declare of osg::Texture
28class OSG_EXPORT ImageStream : public Image
33 /** Copy constructor using CopyOp to manage deep vs shallow copy. */
34 ImageStream(const ImageStream& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
36 virtual Object* cloneType() const { return new ImageStream(); }
37 virtual Object* clone(const CopyOp& copyop) const { return new ImageStream(*this,copyop); }
38 virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ImageStream*>(obj)!=0; }
39 virtual const char* libraryName() const { return "osg"; }
40 virtual const char* className() const { return "ImageStream"; }
42 /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
43 virtual int compare(const Image& rhs) const;
53 virtual void seek(double /*time*/) {}
55 virtual void play() { _status=PLAYING; }
57 virtual void pause() { _status=PAUSED; }
59 virtual void rewind() { _status=REWINDING; }
61 virtual void quit(bool /*waitForThreadToExit*/ = true) {}
63 StreamStatus getStatus() const { return _status; }
72 void setLoopingMode(LoopingMode mode)
74 if (_loopingMode == mode) return;
80 LoopingMode getLoopingMode() const { return _loopingMode; }
82 virtual double getCreationTime() const { return HUGE_VAL; }
83 virtual double getLength() const { return 0.0; }
84 virtual double getFrameRate() const { return 0.0; }
85 virtual double getCurrentTime() const { return 0.0; }
87 virtual void setReferenceTime(double) {}
88 virtual double getReferenceTime() const { return 0.0; }
90 virtual void setTimeMultiplier(double) {}
91 virtual double getTimeMultiplier() const { return 0.0; }
93 virtual void setVolume(float) {}
94 virtual float getVolume() const { return 0.0f; }
96 /// set the balance of the audio: -1 = left, 0 = center, 1 = right
97 virtual float getAudioBalance() { return 0.0f; }
98 virtual void setAudioBalance(float /*b*/) {}
100 typedef std::vector< osg::ref_ptr<osg::AudioStream> > AudioStreams;
101 void setAudioStreams(const AudioStreams& asl) { _audioStreams = asl; }
102 AudioStreams& getAudioStreams() { return _audioStreams; }
103 const AudioStreams& getAudioStreams() const { return _audioStreams; }
105 /** create a suitable texture for this imagestream, return NULL, if not supported
106 * implement this method in subclasses to use special technologies like CoreVideo
109 virtual osg::Texture* createSuitableTexture() { return NULL; }
112 virtual void applyLoopingMode() {}
114 virtual ~ImageStream() {}
116 StreamStatus _status;
117 LoopingMode _loopingMode;
119 AudioStreams _audioStreams;