Changeset 9910
- Timestamp:
- 03/11/09 16:12:46 (4 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 11 modified
-
include/osg/AudioStream (modified) (1 diff)
-
include/osg/Image (modified) (2 diffs)
-
include/osg/ImageStream (modified) (2 diffs)
-
src/osg/Image.cpp (modified) (2 diffs)
-
src/osgPlugins/ffmpeg/FFmpegAudioStream.cpp (modified) (1 diff)
-
src/osgPlugins/ffmpeg/FFmpegAudioStream.hpp (modified) (1 diff)
-
src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp (modified) (1 diff)
-
src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp (modified) (1 diff)
-
src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp (modified) (3 diffs)
-
src/osgPlugins/ffmpeg/FFmpegImageStream.cpp (modified) (4 diffs)
-
src/osgPlugins/ffmpeg/FFmpegImageStream.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osg/AudioStream
r9847 r9910 60 60 virtual void consumeAudioBuffer(void * const buffer, const size_t size) = 0; 61 61 62 virtual bool audioStream() const = 0;63 62 virtual int audioFrequency() const = 0; 64 63 virtual int audioNbChannels() const = 0; -
OpenSceneGraph/trunk/include/osg/Image
r9888 r9910 186 186 void setPacking(unsigned int packing) { _packing = packing; } 187 187 inline unsigned int getPacking() const { return _packing; } 188 189 inline void setPixelAspectRatio(float pixelAspectRatio) { _pixelAspectRatio = pixelAspectRatio; } 190 inline float getPixelAspectRatio() const { return _pixelAspectRatio; } 188 191 189 192 /** Return the number of bits required for each pixel. */ … … 347 350 GLenum _dataType; 348 351 unsigned int _packing; 352 float _pixelAspectRatio; 349 353 350 354 AllocationMode _allocationMode; -
OpenSceneGraph/trunk/include/osg/ImageStream
r9827 r9910 79 79 80 80 virtual double getLength() const { return 0.0; } 81 81 virtual double getFrameRate() const { return 0.0; } 82 82 83 virtual void setReferenceTime(double) {} 83 84 virtual double getReferenceTime() const { return 0.0; } … … 88 89 virtual void setVolume(float) {} 89 90 virtual float getVolume() const { return 0.0f; } 90 91 91 92 92 typedef std::vector< osg::ref_ptr<osg::AudioStream> > AudioStreams; -
OpenSceneGraph/trunk/src/osg/Image.cpp
r9682 r9910 34 34 35 35 Image::Image() 36 :Object(true) 36 :Object(true), 37 _fileName(""), 38 _writeHint(NO_PREFERENCE), 39 _origin(BOTTOM_LEFT), 40 _s(0), _t(0), _r(0), 41 _internalTextureFormat(0), 42 _pixelFormat(0), 43 _dataType(0), 44 _packing(4), 45 _pixelAspectRatio(1.0), 46 _allocationMode(USE_NEW_DELETE), 47 _data(0L), 48 _modifiedCount(0) 37 49 { 38 50 setDataVariance(STATIC); 39 40 _fileName = "";41 _writeHint = NO_PREFERENCE;42 _origin = BOTTOM_LEFT;43 _s = _t = _r = 0;44 _internalTextureFormat = 0;45 _pixelFormat = (unsigned int)0;46 _dataType = (unsigned int)0;47 _packing = 4;48 49 _allocationMode = USE_NEW_DELETE;50 _data = (unsigned char *)0L;51 52 _modifiedCount = 0;53 51 } 54 52 … … 63 61 _dataType(image._dataType), 64 62 _packing(image._packing), 63 _pixelAspectRatio(image._pixelAspectRatio), 65 64 _data(0L), 66 65 _modifiedCount(image._modifiedCount), -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegAudioStream.cpp
r9850 r9910 52 52 53 53 54 bool FFmpegAudioStream::audioStream() const55 {56 return m_decoder->audio_decoder().validContext();57 }58 59 60 54 61 55 int FFmpegAudioStream::audioFrequency() const -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegAudioStream.hpp
r9847 r9910 22 22 void consumeAudioBuffer(void * const buffer, const size_t size); 23 23 24 bool audioStream() const;25 24 int audioFrequency() const; 26 25 int audioNbChannels() const; -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp
r9869 r9910 131 131 void FFmpegDecoderAudio::fillBuffer(void * const buffer, size_t size) 132 132 { 133 size_t filled = 0;134 133 uint8_t * dst_buffer = reinterpret_cast<uint8_t*>(buffer); 135 134 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp
r9869 r9910 223 223 void FFmpegDecoderVideo::findAspectRatio() 224 224 { 225 double ratio = 0.0;225 float ratio = 0.0f; 226 226 227 227 if (m_context->sample_aspect_ratio.num != 0) 228 ratio = (av_q2d(m_context->sample_aspect_ratio) * m_width) / m_height;229 230 if (ratio <= 0.0 )231 ratio = double(m_width) / double(m_height);232 233 m_ aspect_ratio = ratio;228 ratio = float(av_q2d(m_context->sample_aspect_ratio)); 229 230 if (ratio <= 0.0f) 231 ratio = 1.0f; 232 233 m_pixel_aspect_ratio = ratio; 234 234 } 235 235 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp
r9869 r9910 75 75 int width() const; 76 76 int height() const; 77 double aspectRatio() const;77 float pixelAspectRatio() const; 78 78 bool alphaChannel() const; 79 79 double frameRate() const; … … 115 115 116 116 double m_frame_rate; 117 double m_aspect_ratio;117 float m_pixel_aspect_ratio; 118 118 int m_width; 119 119 int m_height; … … 156 156 157 157 158 inline double FFmpegDecoderVideo::aspectRatio() const158 inline float FFmpegDecoderVideo::pixelAspectRatio() const 159 159 { 160 return m_ aspect_ratio;160 return m_pixel_aspect_ratio; 161 161 } 162 162 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp
r9869 r9910 19 19 m_frame_published_flag(false) 20 20 { 21 setOrigin(osg::Image:: BOTTOM_LEFT);21 setOrigin(osg::Image::TOP_LEFT); 22 22 23 23 std::auto_ptr<FFmpegDecoder> decoder(new FFmpegDecoder); … … 72 72 const_cast<unsigned char *>(m_decoder->video_decoder().image()), NO_DELETE 73 73 ); 74 75 set Origin(osg::Image::TOP_LEFT);76 74 75 setPixelAspectRatio(m_decoder->video_decoder().pixelAspectRatio()); 76 77 77 m_decoder->video_decoder().setUserData(this); 78 78 m_decoder->video_decoder().setPublishCallback(publishNewFrame); … … 141 141 142 142 143 double FFmpegImageStream:: duration() const143 double FFmpegImageStream::getLength() const 144 144 { 145 145 return m_decoder->duration(); … … 148 148 149 149 150 bool FFmpegImageStream::videoAlphaChannel() const 150 double FFmpegImageStream::getFrameRate() const 151 { 152 return m_decoder->video_decoder().frameRate(); 153 } 154 155 156 157 bool FFmpegImageStream::isImageTranslucent() const 151 158 { 152 159 return m_decoder->video_decoder().alphaChannel(); 153 160 } 154 161 155 156 157 double FFmpegImageStream::videoAspectRatio() const158 {159 return m_decoder->video_decoder().aspectRatio();160 }161 162 163 164 double FFmpegImageStream::videoFrameRate() const165 {166 return m_decoder->video_decoder().frameRate();167 }168 162 169 163 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.hpp
r9847 r9910 33 33 virtual void quit(bool waitForThreadToExit = true); 34 34 35 double duration() const; 35 virtual double getLength() const; 36 virtual double getFrameRate() const; 36 37 37 bool videoAlphaChannel() const; 38 double videoAspectRatio() const; 39 double videoFrameRate() const; 40 38 virtual bool isImageTranslucent() const; 41 39 42 40 private:
