*! 8.2.2 changes related to temperatures measurement and embedding in the Exif MakerNote
*!
*! Revision 1.13 2011/12/22 05:33:06 elphel
*! Added trigger command
*!
*! Revision 1.12 2010/08/16 17:10:24 elphel
*! added reporting frame number (for inter-camera synchronization)
*!
*! Revision 1.11 2010/08/10 21:14:31 elphel
*! 8.0.8.39 - added EEPROM support for multiplexor and sensor boards, so autocampars.php uses application-specific defaults. Exif Orientation tag support, camera Model reflects application and optional mode (i.e. camera number in Eyesis)
*!
*! Revision 1.10 2010/08/03 06:13:51 elphel
*! bugfix - was not copying last 8 bytes of MakerNote
*!
*! Revision 1.9 2010/08/01 19:30:24 elphel
*! new readonly parameter FRAME_SIZE and it support in the applications
*!
*! Revision 1.8 2010/07/20 20:13:34 elphel
*! 8.0.8.33 - added MakerNote info for composite images made with multisensor cameras (with 10359 board)
*!
*! Revision 1.7 2010/03/04 06:41:40 elphel
*! 8.0.7.3 - more data to makerNote
*!
*! Revision 1.6 2010/02/18 22:59:26 elphel
*! 8.0.7.1 - file extension/mime type depends on color mode now (*.jpeg, *.jp4, *.jp46)
*!
*! Revision 1.5 2009/12/28 06:24:17 elphel
*! 8.0.6.6 - added MakerNote to Exif, it icludes channels gains and gammas/black levels
*!
*! Revision 1.4 2009/10/12 19:20:23 elphel
*! Added "Content-Disposition" support to suggest filenames to save images
*!
*! Revision 1.3 2009/02/25 17:47:51 spectr_rain
*! removed deprecated dependency
*!
*! Revision 1.2 2009/02/18 06:25:41 elphel
*! fixed unterminated string of 1 character (GPS mode - 2/3)
*!
*! Revision 1.1.1.1 2008/11/27 20:04:01 elphel
*!
*!
*! Revision 1.11 2008/11/03 18:42:21 elphel
*! comment typo
*!
*! Revision 1.10 2008/10/29 04:18:28 elphel
*! v.8.0.alpha10 made a separate structure for global parameters (not related to particular frames in a frame queue)
*!
*! Revision 1.9 2008/10/25 19:51:40 elphel
*! updated copyright year
*!
*! Revision 1.8 2008/10/21 21:28:52 elphel
*! support for xml meta output
*!
*! Revision 1.7 2008/10/13 16:55:53 elphel
*! removed (some) obsolete P_* parameters, renamed CIRCLSEEK to LSEEK_CIRC constants (same as other similar)
*!
*! Revision 1.6 2008/10/11 18:46:07 elphel
*! snapshot
*!
*! Revision 1.5 2008/10/06 08:31:08 elphel
*! snapshot, first images
*!
*! Revision 1.4 2008/09/07 19:48:08 elphel
*! snapshot
*!
*! Revision 1.3 2008/08/11 19:10:45 elphel
*! reduced syntax "complaints" from KDevelop
*!
*! Revision 1.2 2008/05/16 06:06:54 elphel
*! supporting variable JPEG header length
*!
*! Revision 1.14 2008/04/22 22:14:56 elphel
*! Added malloc failures handling, syslog logging of such events
*!
*! Revision 1.13 2008/04/16 20:30:33 elphel
*! added optional fps reduction to multipart JPEGs
*!
*! Revision 1.11 2008/04/07 09:13:35 elphel
*! Changes related to new Exif generation/processing
*!
*! Revision 1.10 2008/03/22 04:39:53 elphel
*! remove complaints about "&_time=..."
*!
*! Revision 1.9 2007/12/03 08:28:45 elphel
*! Multiple changes, mostly cleanup
*!
*! Revision 1.8 2007/11/16 08:56:19 elphel
*! Added support for 2 additional commands to check circbuf usage
*!
*! Revision 1.7 2007/11/04 23:25:16 elphel
*! removed extra (used during debug) munmap that caused segfault after sending "img" (so no /nxt/save)
*!
*! Revision 1.6 2007/11/04 05:47:40 elphel
*! Cleaned up from debug code inserted to fight mmap/caching bug (fixed by now)
*!
*! Revision 1.5 2007/11/01 18:59:37 elphel
*! debugging mmap/caching problems
*!
*! Revision 1.4 2007/10/30 16:56:06 elphel
*! release 7.1.4.5 - working on "can not find 0xffff in frame parameters" bug. Temporary fix
*!
*! Revision 1.3 2007/10/27 00:55:32 elphel
*! untested revision - need to go
*!
*! Revision 1.2 2007/10/11 06:42:28 elphel
*! Fixed bug - /meta command should return trivial xml file, not 1x1 pixel gif
*!
*! Revision 1.1.1.1 2007/10/02 19:44:54 elphel
*! This is a fresh tree based on elphel353-2.10
*!
*! Revision 1.4 2007/10/02 19:44:54 elphel
*! More functionality (buffer manipulation commands, clean interface, xml responces)
*!
*! Revision 1.3 2007/09/29 16:21:25 elphel
*! removed IOCTL usage from /dev/circbuf, improved comments, other minor changes
*!
*! Revision 1.2 2007/09/25 23:35:16 elphel
*! added Exif initialization, made it to work in background mode
*!
*! Revision 1.1 2007/09/23 06:49:10 elphel
*! Simple web server designed for particular task - serving camera JPEG images. It is faster, than through any of the web servers tested. Only some of the functionality is implemented (no Exif yet, no synchronization with the camera)
*!
*!
*/
*! FILE NAME : imgsrv.c
*! DESCRIPTION: Simple and fast HTTP server to send camera still images
*! 8.2.2 changes related to temperatures measurement and embedding in the Exif MakerNote
*!
*! Revision 1.13 2011/12/22 05:33:06 elphel
*! Added trigger command
*!
*! Revision 1.12 2010/08/16 17:10:24 elphel
*! added reporting frame number (for inter-camera synchronization)
*!
*! Revision 1.11 2010/08/10 21:14:31 elphel
*! 8.0.8.39 - added EEPROM support for multiplexor and sensor boards, so autocampars.php uses application-specific defaults. Exif Orientation tag support, camera Model reflects application and optional mode (i.e. camera number in Eyesis)
*!
*! Revision 1.10 2010/08/03 06:13:51 elphel
*! bugfix - was not copying last 8 bytes of MakerNote
*!
*! Revision 1.9 2010/08/01 19:30:24 elphel
*! new readonly parameter FRAME_SIZE and it support in the applications
*!
*! Revision 1.8 2010/07/20 20:13:34 elphel
*! 8.0.8.33 - added MakerNote info for composite images made with multisensor cameras (with 10359 board)
*!
*! Revision 1.7 2010/03/04 06:41:40 elphel
*! 8.0.7.3 - more data to makerNote
*!
*! Revision 1.6 2010/02/18 22:59:26 elphel
*! 8.0.7.1 - file extension/mime type depends on color mode now (*.jpeg, *.jp4, *.jp46)
*!
*! Revision 1.5 2009/12/28 06:24:17 elphel
*! 8.0.6.6 - added MakerNote to Exif, it icludes channels gains and gammas/black levels
*!
*! Revision 1.4 2009/10/12 19:20:23 elphel
*! Added "Content-Disposition" support to suggest filenames to save images
*!
*! Revision 1.3 2009/02/25 17:47:51 spectr_rain
*! removed deprecated dependency
*!
*! Revision 1.2 2009/02/18 06:25:41 elphel
*! fixed unterminated string of 1 character (GPS mode - 2/3)
*!
*! Revision 1.1.1.1 2008/11/27 20:04:01 elphel
*!
*!
*! Revision 1.11 2008/11/03 18:42:21 elphel
*! comment typo
*!
*! Revision 1.10 2008/10/29 04:18:28 elphel
*! v.8.0.alpha10 made a separate structure for global parameters (not related to particular frames in a frame queue)
*!
*! Revision 1.9 2008/10/25 19:51:40 elphel
*! updated copyright year
*!
*! Revision 1.8 2008/10/21 21:28:52 elphel
*! support for xml meta output
*!
*! Revision 1.7 2008/10/13 16:55:53 elphel
*! removed (some) obsolete P_* parameters, renamed CIRCLSEEK to LSEEK_CIRC constants (same as other similar)
*!
*! Revision 1.6 2008/10/11 18:46:07 elphel
*! snapshot
*!
*! Revision 1.5 2008/10/06 08:31:08 elphel
*! snapshot, first images
*!
*! Revision 1.4 2008/09/07 19:48:08 elphel
*! snapshot
*!
*! Revision 1.3 2008/08/11 19:10:45 elphel
*! reduced syntax "complaints" from KDevelop
*!
*! Revision 1.2 2008/05/16 06:06:54 elphel
*! supporting variable JPEG header length
*!
*! Revision 1.14 2008/04/22 22:14:56 elphel
*! Added malloc failures handling, syslog logging of such events
*!
*! Revision 1.13 2008/04/16 20:30:33 elphel
*! added optional fps reduction to multipart JPEGs
*!
*! Revision 1.11 2008/04/07 09:13:35 elphel
*! Changes related to new Exif generation/processing
*!
*! Revision 1.10 2008/03/22 04:39:53 elphel
*! remove complaints about "&_time=..."
*!
*! Revision 1.9 2007/12/03 08:28:45 elphel
*! Multiple changes, mostly cleanup
*!
*! Revision 1.8 2007/11/16 08:56:19 elphel
*! Added support for 2 additional commands to check circbuf usage
*!
*! Revision 1.7 2007/11/04 23:25:16 elphel
*! removed extra (used during debug) munmap that caused segfault after sending "img" (so no /nxt/save)
*!
*! Revision 1.6 2007/11/04 05:47:40 elphel
*! Cleaned up from debug code inserted to fight mmap/caching bug (fixed by now)
*!
*! Revision 1.5 2007/11/01 18:59:37 elphel
*! debugging mmap/caching problems
*!
*! Revision 1.4 2007/10/30 16:56:06 elphel
*! release 7.1.4.5 - working on "can not find 0xffff in frame parameters" bug. Temporary fix
*!
*! Revision 1.3 2007/10/27 00:55:32 elphel
*! untested revision - need to go
*!
*! Revision 1.2 2007/10/11 06:42:28 elphel
*! Fixed bug - /meta command should return trivial xml file, not 1x1 pixel gif
*!
*! Revision 1.1.1.1 2007/10/02 19:44:54 elphel
*! This is a fresh tree based on elphel353-2.10
*!
*! Revision 1.4 2007/10/02 19:44:54 elphel
*! More functionality (buffer manipulation commands, clean interface, xml responces)
*!
*! Revision 1.3 2007/09/29 16:21:25 elphel
*! removed IOCTL usage from /dev/circbuf, improved comments, other minor changes
*!
*! Revision 1.2 2007/09/25 23:35:16 elphel
*! added Exif initialization, made it to work in background mode
*!
*! Revision 1.1 2007/09/23 06:49:10 elphel
*! Simple web server designed for particular task - serving camera JPEG images. It is faster, than through any of the web servers tested. Only some of the functionality is implemented (no Exif yet, no synchronization with the camera)
memcpy(&frame_params,(unsignedlong*)&ccam_dma_buf[frameParamPointer>>2],32);/// ccam_dma_buf - global
// jpeg_len=frame_params.frame_length;
///// Copy timestamp (goes after the image data)
// timestamp_start=jpeg_start+((jpeg_len+CCAM_MMAP_META+3) & (~0x1f)) + 32 - CCAM_MMAP_META_SEC; //! magic shift - should index first byte of the time stamp
...
...
@@ -616,28 +620,33 @@ int metaXML(int fd_circ, int mode) { /// mode: 0 - new (send headers), 1 - con
#define COLORMODE_MONO4 14 // monochrome, 4 blocks (but still with 2x2 macroblocks)
*/
printf("Content-Type: image/%s\r\n",mime_type);
if(saveImage)printf("Content-Disposition: attachment; filename=\"elphelimg_%ld.%s\"\r\n",frame_params.timestamp_sec,extension);/// does not open, asks for filename to save
elseprintf("Content-Disposition: inline; filename=\"elphelimg_%ld.%s\"\r\n",frame_params.timestamp_sec,extension);/// opens in browser, asks to save on right-click
*/
printf("Content-Type: image/%s\r\n",mime_type);
if(saveImage)printf("Content-Disposition: attachment; filename=\"elphelimg_%ld.%s\"\r\n",frame_params.timestamp_sec,extension);/// does not open, asks for filename to save
elseprintf("Content-Disposition: inline; filename=\"elphelimg_%ld.%s\"\r\n",frame_params.timestamp_sec,extension);/// opens in browser, asks to save on right-click
if(bufferImageData){/*! Buffer the whole file before sending over the network to make sure it will not be corrupted if the circular buffer will be overrun) */
l=head_size+exifDataSize;
l=head_size+exifDataSize;
/*! JPEG image data may be split in two segments (rolled over buffer end) - process both variants */
if((jpeg_start+jpeg_len)>buff_size){// two segments