Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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* )
00067 {
00068 }
00069
00070 Type4CC type;
00071 boost::uint8_t* data;
00072
00073 size_t size;
00074 size_t width;
00075 size_t height;
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 }
00111 }
00112
00113 #endif // __VIDEOCONVERTER_H__