| [5328] | 1 | /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield |
|---|
| [2793] | 2 | * |
|---|
| 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. |
|---|
| 7 | * |
|---|
| 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. |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | #ifndef OSG_IMAGESTREAM |
|---|
| 15 | #define OSG_IMAGESTREAM 1 |
|---|
| 16 | |
|---|
| 17 | #include <osg/Image> |
|---|
| [9827] | 18 | #include <osg/AudioStream> |
|---|
| [2793] | 19 | |
|---|
| 20 | namespace osg { |
|---|
| 21 | |
|---|
| 22 | /** |
|---|
| [3405] | 23 | * Image Stream class. |
|---|
| 24 | */ |
|---|
| [4021] | 25 | class OSG_EXPORT ImageStream : public Image |
|---|
| [2793] | 26 | { |
|---|
| 27 | public: |
|---|
| 28 | ImageStream(); |
|---|
| 29 | |
|---|
| [3405] | 30 | /** Copy constructor using CopyOp to manage deep vs shallow copy. */ |
|---|
| [2793] | 31 | ImageStream(const ImageStream& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY); |
|---|
| 32 | |
|---|
| 33 | virtual Object* cloneType() const { return new ImageStream(); } |
|---|
| 34 | virtual Object* clone(const CopyOp& copyop) const { return new ImageStream(*this,copyop); } |
|---|
| 35 | virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ImageStream*>(obj)!=0; } |
|---|
| 36 | virtual const char* libraryName() const { return "osg"; } |
|---|
| 37 | virtual const char* className() const { return "ImageStream"; } |
|---|
| 38 | |
|---|
| [3405] | 39 | /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ |
|---|
| [2793] | 40 | virtual int compare(const Image& rhs) const; |
|---|
| 41 | |
|---|
| [4803] | 42 | enum StreamStatus |
|---|
| [2793] | 43 | { |
|---|
| [3859] | 44 | INVALID, |
|---|
| [2793] | 45 | PLAYING, |
|---|
| 46 | PAUSED, |
|---|
| 47 | REWINDING |
|---|
| 48 | }; |
|---|
| 49 | |
|---|
| [8755] | 50 | virtual void seek(double /*time*/) {} |
|---|
| 51 | |
|---|
| [2793] | 52 | virtual void play() { _status=PLAYING; } |
|---|
| 53 | |
|---|
| 54 | virtual void pause() { _status=PAUSED; } |
|---|
| 55 | |
|---|
| 56 | virtual void rewind() { _status=REWINDING; } |
|---|
| [3179] | 57 | |
|---|
| [3405] | 58 | virtual void quit(bool /*waitForThreadToExit*/ = true) {} |
|---|
| [2793] | 59 | |
|---|
| 60 | StreamStatus getStatus() { return _status; } |
|---|
| 61 | |
|---|
| [3317] | 62 | |
|---|
| 63 | enum LoopingMode |
|---|
| 64 | { |
|---|
| 65 | NO_LOOPING, |
|---|
| 66 | LOOPING |
|---|
| 67 | }; |
|---|
| 68 | |
|---|
| [8990] | 69 | void setLoopingMode(LoopingMode mode) |
|---|
| 70 | { |
|---|
| 71 | if (_loopingMode == mode) return; |
|---|
| 72 | |
|---|
| 73 | _loopingMode = mode; |
|---|
| 74 | applyLoopingMode(); |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| [3317] | 77 | LoopingMode getLoopingMode() const { return _loopingMode; } |
|---|
| 78 | |
|---|
| 79 | |
|---|
| [6557] | 80 | virtual double getLength() const { return 0.0; } |
|---|
| [9910] | 81 | virtual double getFrameRate() const { return 0.0; } |
|---|
| 82 | |
|---|
| [2793] | 83 | virtual void setReferenceTime(double) {} |
|---|
| 84 | virtual double getReferenceTime() const { return 0.0; } |
|---|
| 85 | |
|---|
| 86 | virtual void setTimeMultiplier(double) {} |
|---|
| [7042] | 87 | virtual double getTimeMultiplier() const { return 0.0; } |
|---|
| [2793] | 88 | |
|---|
| [7042] | 89 | virtual void setVolume(float) {} |
|---|
| 90 | virtual float getVolume() const { return 0.0f; } |
|---|
| [9827] | 91 | |
|---|
| 92 | typedef std::vector< osg::ref_ptr<osg::AudioStream> > AudioStreams; |
|---|
| 93 | void setAudioStreams(const AudioStreams& asl) { _audioStreams = asl; } |
|---|
| 94 | AudioStreams& getAudioStreams() { return _audioStreams; } |
|---|
| 95 | const AudioStreams& getAudioStreams() const { return _audioStreams; } |
|---|
| [7042] | 96 | |
|---|
| [2793] | 97 | |
|---|
| 98 | protected: |
|---|
| [6802] | 99 | virtual void applyLoopingMode() {} |
|---|
| [2793] | 100 | |
|---|
| 101 | virtual ~ImageStream() {} |
|---|
| 102 | |
|---|
| 103 | StreamStatus _status; |
|---|
| [3317] | 104 | LoopingMode _loopingMode; |
|---|
| [9827] | 105 | |
|---|
| 106 | AudioStreams _audioStreams; |
|---|
| [2793] | 107 | }; |
|---|
| 108 | |
|---|
| 109 | } // namespace |
|---|
| 110 | |
|---|
| 111 | #endif |
|---|