Changeset 9826
- Timestamp:
- 02/27/09 18:00:28 (4 years ago)
- Location:
- OpenSceneGraph/trunk/src/osgPlugins/ffmpeg
- Files:
-
- 9 modified
-
AudioSinkInterface.hpp (modified) (2 diffs)
-
FFmpegDecoder.cpp (modified) (1 diff)
-
FFmpegDecoder.hpp (modified) (2 diffs)
-
FFmpegDecoderAudio.cpp (modified) (1 diff)
-
FFmpegDecoderAudio.hpp (modified) (2 diffs)
-
FFmpegDecoderVideo.cpp (modified) (1 diff)
-
FFmpegDecoderVideo.hpp (modified) (2 diffs)
-
FFmpegImageStream.cpp (modified) (1 diff)
-
FFmpegImageStream.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/AudioSinkInterface.hpp
r9816 r9826 1 1 2 #ifndef HEADER_GUARD_OSGFFMPEG_AUDIO_SINK_INTERFACE_H3 #define HEADER_GUARD_OSGFFMPEG_AUDIO_SINK_INTERFACE_H2 #ifndef OSG_AUDIOSINKINTERFACE_H 3 #define OSG_AUDIOSINKINTERFACE_H 4 4 5 5 #include <osg/Object> … … 7 7 8 8 9 namespace osg FFmpeg9 namespace osg 10 10 { 11 11 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp
r9816 r9826 47 47 throw std::runtime_error("av_open_input_file() failed"); 48 48 49 m_format_context.reset(p_format_context , av_close_input_file);49 m_format_context.reset(p_format_context); 50 50 51 51 // Retrieve stream info -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoder.hpp
r9816 r9826 3 3 #define HEADER_GUARD_OSGFFMPEG_FFMPEG_DECODER_H 4 4 5 #include <boost/shared_ptr.hpp>6 7 5 #include "FFmpegDecoderAudio.hpp" 8 6 #include "FFmpegDecoderVideo.hpp" 9 7 8 #include <osg/Notify> 10 9 11 10 12 11 namespace osgFFmpeg { 13 12 13 class FormatContextPtr 14 { 15 public: 16 17 typedef AVFormatContext T; 18 19 explicit FormatContextPtr() : _ptr(0) {} 20 explicit FormatContextPtr(T* ptr) : _ptr(ptr) {} 21 22 ~FormatContextPtr() 23 { 24 cleanup(); 25 } 26 27 T* get() { return _ptr; } 28 29 T * operator-> () const // never throws 30 { 31 return _ptr; 32 } 33 34 void reset(T* ptr) 35 { 36 if (ptr==_ptr) return; 37 cleanup(); 38 _ptr = ptr; 39 } 40 41 void cleanup() 42 { 43 if (_ptr) 44 { 45 osg::notify(osg::NOTICE)<<"Calling av_close_input_file("<<_ptr<<")"<<std::endl; 46 av_close_input_file(_ptr); 47 } 48 _ptr = 0; 49 } 50 51 52 53 protected: 54 55 T* _ptr; 56 }; 14 57 15 58 … … 46 89 }; 47 90 48 typedef boost::shared_ptr<AVFormatContext> FormatContextPtr;49 91 typedef BoundedMessageQueue<FFmpegPacket> PacketQueue; 50 92 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp
r9818 r9826 107 107 108 108 109 void FFmpegDecoderAudio::setAudioSink(osg::ref_ptr< AudioSinkInterface> audio_sink)109 void FFmpegDecoderAudio::setAudioSink(osg::ref_ptr<osg::AudioSinkInterface> audio_sink) 110 110 { 111 111 // The FFmpegDecoderAudio object takes the responsability of destroying the audio_sink. -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.hpp
r9818 r9826 31 31 virtual void run(); 32 32 33 void setAudioSink(osg::ref_ptr< AudioSinkInterface> audio_sink);33 void setAudioSink(osg::ref_ptr<osg::AudioSinkInterface> audio_sink); 34 34 void fillBuffer(void * buffer, size_t size); 35 35 … … 42 42 43 43 //typedef boost::shared_ptr<AVFrame> FramePtr; 44 typedef osg::ref_ptr< AudioSinkInterface> SinkPtr;44 typedef osg::ref_ptr<osg::AudioSinkInterface> SinkPtr; 45 45 typedef std::vector<uint8_t> Buffer; 46 46 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp
r9818 r9826 73 73 74 74 // Allocate video frame 75 m_frame.reset(avcodec_alloc_frame() , av_free);75 m_frame.reset(avcodec_alloc_frame()); 76 76 77 77 // Allocate converted RGB frame 78 m_frame_rgba.reset(avcodec_alloc_frame() , av_free);78 m_frame_rgba.reset(avcodec_alloc_frame()); 79 79 m_buffer_rgba.resize(avpicture_get_size(PIX_FMT_RGB32, width(), height())); 80 80 m_buffer_rgba_public.resize(m_buffer_rgba.size()); -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp
r9818 r9826 14 14 namespace osgFFmpeg { 15 15 16 class FramePtr 17 { 18 public: 19 20 typedef AVFrame T; 21 22 explicit FramePtr() : _ptr(0) {} 23 explicit FramePtr(T* ptr) : _ptr(ptr) {} 24 25 ~FramePtr() 26 { 27 cleanup(); 28 } 29 30 T* get() { return _ptr; } 16 31 32 T * operator-> () const // never throws 33 { 34 return _ptr; 35 } 36 37 void reset(T* ptr) 38 { 39 if (ptr==_ptr) return; 40 cleanup(); 41 _ptr = ptr; 42 } 43 44 void cleanup() 45 { 46 if (_ptr) av_free(_ptr); 47 _ptr = 0; 48 } 49 50 51 52 protected: 53 54 T* _ptr; 55 }; 17 56 18 57 class FFmpegDecoderVideo : public OpenThreads::Thread … … 41 80 private: 42 81 43 typedef boost::shared_ptr<AVFrame> FramePtr;44 82 typedef std::vector<uint8_t> Buffer; 45 83 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp
r9816 r9826 122 122 123 123 124 void FFmpegImageStream::setAudioSink(osg:: ref_ptr<AudioSinkInterface>audio_sink)124 void FFmpegImageStream::setAudioSink(osg::AudioSinkInterface* audio_sink) 125 125 { 126 126 m_decoder->audio_decoder().setAudioSink(audio_sink); 127 127 } 128 129 128 130 129 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.hpp
r9816 r9826 54 54 virtual void quit(bool waitForThreadToExit = true); 55 55 56 void setAudioSink(osg::ref_ptr<AudioSinkInterface> audio_sink); 56 virtual void setAudioSink(osg::AudioSinkInterface* audio_sink); 57 57 58 void fillAudioBuffer(void * const buffer, const size_t size); 58 59
