• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

VideoConverter.h

Go to the documentation of this file.
00001 //   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
00002 // 
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 3 of the License, or
00006 // (at your option) any later version.
00007 // 
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00016 
00017 
00018 #ifndef GNASH_VIDEOCONVERTER_H
00019 #define GNASH_VIDEOCONVERTER_H
00020 
00021 #include <boost/noncopyable.hpp>
00022 #include <boost/cstdint.hpp>
00023 #include <memory>
00024 
00025 namespace gnash {
00026 namespace media {
00027 
00028 
00029 
00031 //
00039 
00040 struct ImgBuf : public boost::noncopyable
00041 {
00042     typedef boost::uint32_t Type4CC;
00043     typedef void (*FreeFunc)(void*);
00044 
00045     ImgBuf(Type4CC t, boost::uint8_t* dataptr, size_t datasize, size_t w,
00046            size_t h)
00047     : type(t),
00048       data(dataptr),
00049       size(datasize),
00050       width(w),
00051       height(h),
00052       dealloc(array_delete)
00053     {}
00054     
00055     ~ImgBuf()
00056     {
00057         dealloc(data);
00058     }
00059     
00060     static void array_delete(void* voidptr)
00061     {
00062         boost::uint8_t* ptr = static_cast<boost::uint8_t*>(voidptr);
00063         delete [] ptr;
00064     }
00065     
00066     static void noop(void* /*voidptr*/)
00067     {
00068     }
00069 
00070     Type4CC type;
00071     boost::uint8_t* data;
00072 
00073     size_t size; // in bytes
00074     size_t width; // in pixels
00075     size_t height; // in pixels
00076     
00077     size_t stride[4];
00078     
00079     FreeFunc dealloc;
00080 };
00081 
00082 
00084 
00085 class VideoConverter : public boost::noncopyable {
00086 
00087 public:
00088     VideoConverter(ImgBuf::Type4CC srcFormat, ImgBuf::Type4CC dstFormat)
00089      : _src_fmt(srcFormat),
00090        _dst_fmt(dstFormat) 
00091     {
00092     }
00093     
00094     virtual ~VideoConverter()
00095     {
00096     }
00097   
00099     //
00102     virtual std::auto_ptr<ImgBuf> convert(const ImgBuf& src) = 0;
00103   
00104 protected:
00105     ImgBuf::Type4CC  _src_fmt;
00106     ImgBuf::Type4CC  _dst_fmt;
00107 };
00108 
00109         
00110 } // gnash.media namespace 
00111 } // gnash namespace
00112 
00113 #endif // __VIDEOCONVERTER_H__

Generated on Thu Sep 30 2010 14:35:04 for Gnash by  doxygen 1.7.1