00001 #ifndef IMAGE_MPLAYEROUTPUT_H 00002 #define IMAGE_MPLAYEROUTPUT_H 00003 00004 #include "mimasconfig.h" 00005 #ifdef HAVE_MKSTEMP 00006 #include "image_output.h" 00007 #include "rgba.h" 00008 00009 namespace mimas { 00010 00019 template< typename T > 00020 class image_mplayeroutput: public image_output< T > 00021 { 00022 public: 00026 image_mplayeroutput( int _width, int _height ) 00027 throw (mimasexception); 00029 virtual ~image_mplayeroutput(void); 00031 virtual void write( const const_image_ref< T > &image ); 00032 protected: 00034 int width; 00036 int height; 00038 std::string pipename; 00040 int imgpipe; 00042 FILE *mplayer; 00043 }; 00044 00045 template<> 00046 void image_mplayeroutput< rgba< unsigned char > >::write 00047 ( const const_image_ref< rgba< unsigned char > > &image ); 00048 template<> 00049 void image_mplayeroutput< unsigned char >::write 00050 ( const const_image_ref< unsigned char > &image ); 00051 00053 template< typename T, typename U > 00054 inline image_mplayeroutput< T > &operator<< 00055 ( image_mplayeroutput< T > &output, 00056 const const_image_ref< U > &im ) 00057 { 00058 if ( typeid( T ) == typeid( U ) ) 00059 output.write( (const_image_ref< T > &)im ); 00060 else { 00061 output.write( image< T >( im ) ); 00062 }; 00063 return output; 00064 } 00065 00067 00069 00070 }; 00071 00072 #include "image_mplayeroutput.tcc" 00073 #endif 00074 00075 #endif