Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

mxcpcMJPEGWriter.h

00001 //           ///          //                                        Mx clientSDK
00002 //          /////        ////                    Mx Crossplatform Client Library
00003 //         /// XXX     XXX ///
00004 //        ///    XXX XXX    ///     $RCSfile: mxcpcMJPEGWriter.h,v $
00005 //       ///       XXX       ///     $Revision: 1.4 $
00006 //      ///      XXX XXX      ///     $Date: 2006/01/11 19:07:06 $
00007 //     ////    XXX     XXX    ////     $Author: cvs-kai $
00008 //    ////                     ////
00009 //   ////  M  O  B  O  T  I  X  ////////////////////////////////////////////////
00010 //  //// Security Vision Systems //////////////////////////////////////////////
00011 //                                                                          //
00012 //  Copyright (C) 2005 - 2006, MOBOTIX AG, Germany                         //
00013 //  This software is made available under the BSD licence. Please refer   //
00014 //  to the file LICENCE.TXT contained in this distribution for details.  //
00015 //                                                                      //
00016 //  /////////////////////////////////////////////////////////////////////
00017 
00018 
00019 
00020 #ifndef __MXCPC_MJPEGWRITER_H__
00021 #define __MXCPC_MJPEGWRITER_H__
00022 
00023 
00024 
00025 #include <mxcpcJPEGReceiver.h>
00026 #include <mxcpcBinaryFileWriter.h>
00027 
00028 #include <cstdio>
00029 
00030 
00031 
00032 //! Generates an <tt>MJPEG</tt> stream.
00033 /*!
00034  *  \ingroup mxcpc_core
00035  *
00036  *  If invoked by specifying a filename to the constructor, the respective file
00037  *  is automatically opened for writing. It is also automatically closed again
00038  *  when the MJPEG writer is deleted later.
00039  *
00040  *  If, on the other hand, the MJPEG writer is invoked by specifying a 
00041  *  <tt>POSIX</tt> file descriptor to the constructor, the file descriptor is 
00042  *  used instead. Note that in this case the corresponing file is <b>not 
00043  *  closed</b> upon writer destruction.
00044  *
00045  *  If a separator string is specified to the constructor, the MJPEG writer will
00046  *  operate in HTTP support mode: before, between and after the frames 
00047  *  appropriate lines are inserted that allow for providing a HTTP MJPEG
00048  *  server push. 
00049  */
00050 class mxcpcMJPEGWriter : public mxcpcJPEGReceiver,
00051                          public mxcpcBinaryFileWriter {
00052 
00053  private:
00054   int FrameNum;
00055   char *Separator;
00056   
00057  public:
00058   mxcpcMJPEGWriter(const char *filename,
00059                    const char *separator = 0);
00060   mxcpcMJPEGWriter(int file_descriptor,
00061                    const char *separator = 0);
00062   ~mxcpcMJPEGWriter();
00063  private:
00064   void installSeparator(const char *separator);
00065   
00066  public:
00067   //! (Re)implemented.
00068   void beginFrame(void);
00069   //! (Re)implemented.
00070   void endFrame(void);
00071   //! (Re)implemented.
00072   void receiveJPEGBytes(const mxcpc::u8 *buffer, int num);
00073 };
00074 
00075 
00076 
00077 #endif   // __MXCPC_MJPEGWRITER_H__

Generated on Mon Jan 30 15:52:43 2006 for mxcpc by  doxygen 1.4.4