Show
Ignore:
Timestamp:
02/27/09 18:00:28 (4 years ago)
Author:
robert
Message:

Ported across from using boost pointers, and prepped for integration of audio interface into core OSG

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp

    r9818 r9826  
    1414namespace osgFFmpeg { 
    1515 
     16class 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; } 
    1631 
     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}; 
    1756 
    1857class FFmpegDecoderVideo : public OpenThreads::Thread 
     
    4180private: 
    4281 
    43     typedef boost::shared_ptr<AVFrame> FramePtr; 
    4482    typedef std::vector<uint8_t> Buffer; 
    4583