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

mxcpcMJPEGWriter.cpp

00001 //           ///          //
00002 //          /////        ////
00003 //         /// XXX     XXX ///
00004 //        ///    XXX XXX    ///     $RCSfile: mxcpcMJPEGWriter.cpp,v $  
00005 //       ///       XXX       ///     $Revision: 1.1 $
00006 //      ///      XXX XXX      ///     $Date: 2005/08/09 13:57:26 $
00007 //     ////    XXX     XXX    ////     $Author: cvs-steve $
00008 //    ////                     ////
00009 //   ////  M  O  B  O  T  I  X  ////////////////////////////////////////////////
00010 //  //// Security Vision Systems ///////////////////////////////////////////////
00011 
00012 // Copyright (c) 2005, MOBOTIX AG.
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 #include <mxcpcMJPEGWriter.h>
00018 
00019 #ifdef WIN32
00020 #include <fcntl.h>
00021 #include <io.h>
00022 #else
00023 #include <cstdio>
00024 #endif
00025 #include <cstring>
00026 #include <memory>
00027 
00028 
00029 
00030 mxcpcMJPEGWriter::mxcpcMJPEGWriter(FILE* output_dest) {
00031 
00032   if (output_dest != NULL)
00033     OutputDest = output_dest;
00034   else 
00035     OutputDest = stdout;
00036 
00037 #ifdef O_BINARY // for Win32 (both mxvc and cygwin)
00038   setmode( fileno(OutputDest), O_BINARY );
00039 #endif
00040 
00041   FrameNum = 0;
00042   
00043   ErrorEncountered = false;
00044 }
00045 
00046 
00047 mxcpcMJPEGWriter::~mxcpcMJPEGWriter() {
00048 
00049 
00050 }
00051 
00052 
00053 void mxcpcMJPEGWriter::beginFrame(void) {
00054 
00055   fprintf(stderr, "Begin Frame! \n");
00056 }
00057 
00058 
00059 void mxcpcMJPEGWriter::endFrame(void) {
00060 
00061   fprintf(stderr, "_______________________________________________________End Frame! %d \n", FrameNum );
00062   FrameNum++;
00063 }
00064   
00065 
00066 void mxcpcMJPEGWriter::receiveJPEGBytes(mxcpc::u8 *buffer, int num) {
00067 
00068   if(OutputDest == NULL) {
00069   
00070     ErrorEncountered = true;
00071     return;
00072   }
00073   
00074   if(num < 1) {
00075     
00076     ErrorEncountered = true;  
00077   
00078     return;
00079   }
00080   
00081   if(fwrite(buffer, num, 1, OutputDest) != 1) {
00082     
00083     
00084     OutputDest = 0;
00085     
00086     ErrorEncountered = true;
00087   }
00088 }
00089 
00090 

Generated on Mon Aug 15 03:39:30 2005 for mxcpc by  doxygen 1.4.2-20050421