CVD 0.8
cvd/videobufferwithdata.h
00001 /*                       
00002     This file is part of the CVD Library.
00003 
00004     Copyright (C) 2005 The Authors
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Lesser General Public
00008     License as published by the Free Software Foundation; either
00009     version 2.1 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Lesser General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public
00017     License along with this library; if not, write to the Free Software
00018     Foundation, Inc., 
00019     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 */
00021 #ifndef CVD_VIDEOBUFFERWITHDATA_H
00022 #define CVD_VIDEOBUFFERWITHDATA_H
00023 
00024 #include <cvd/videobuffer.h>
00025 #include <memory>
00026 
00027 namespace CVD {
00028 
00035 template <class T, class D> 
00036 class VideoBufferWithData: public VideoBuffer<T> 
00037 {
00038     public: 
00039         VideoBufferWithData(std::auto_ptr<VideoBuffer<T> >& buf_, std::auto_ptr<D>& d)
00040         :VideoBuffer<T>(buf_->type()), buf(buf_),extra_data(d)
00041         {}
00042 
00043         ImageRef size()
00044         {
00045             return buf->size();
00046         }
00047 
00048         virtual RawVideoBuffer* source_buffer()
00049         {
00050             return buf.get();
00051         }
00052 
00053         VideoFrame<T>* get_frame()
00054         {
00055             return buf->get_frame();
00056         }
00057 
00058         void put_frame(VideoFrame<T>* f)
00059         {
00060             buf->put_frame(f);
00061         }   
00062 
00063         bool frame_pending()
00064         {
00065             return buf->frame_pending();
00066         }   
00067 
00068         void flush()
00069         {
00070             return buf->flush();
00071         }   
00072 
00073         double frame_rate()
00074         {
00075             return buf->frame_rate();
00076         }
00077 
00078         void seek_to(double time)
00079         {
00080             return buf->seek_to(time);
00081         }
00082 
00083 
00084     private:
00085         std::auto_ptr<VideoBuffer<T> > buf;
00086     public:
00087         std::auto_ptr<D> extra_data;
00088 };
00089 
00090 }
00091 
00092 #endif