fvff.h

00001
00002 /***************************************************************************
00003  *  fvff.h - FireVision file format
00004  *
00005  *  Created: Fri Mar 28 11:12:38 2008
00006  *  Copyright  2008  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023
00024 #ifndef __FIREVISION_FVUTILS_FILEFORMAT_FVFF_H_
00025 #define __FIREVISION_FVUTILS_FILEFORMAT_FVFF_H_
00026 
00027 #pragma pack(push,4)
00028 
00029 #ifndef __STDC_LIMIT_MACROS
00030 #define __STDC_LIMIT_MACROS
00031 #endif
00032 #include <stdint.h>
00033
00034 #define FVFF_COMMENT_SIZE 256
00035 
00036 /** Header for a FireVision file format file.
00037  * The header defines the basic parameters needed to correctly interpret the
00038  * following file contents.
00039  *
00040  * The header defines a magic by which a rectinfo can be identified. This is
00041  * defined by the actual content of the file.
00042  * The version is stored as a sequential number. This version has to be changed
00043  * whenever either the header or the file data format changes. The version is set
00044  * by the concrete data implementation.
00045  * The file defines the endianess of the supplied data.
00046  * There are several reserved bits that may be used later to store flags. The field
00047  * num_blocks define how many info blocks there are in this file.
00048  *
00049  * Directly following the header is the content specific header. It has to be exactly
00050  * the size given in spec_head_size.
00051  */
00052 typedef struct _fvff_header_t {
00053   uint16_t magic_token;         /**< magic token */
00054   uint16_t version    :  4;     /**< version of the data file, this header defines version 1 */
00055   uint16_t endianess  :  1;     /**< endianess of the file, 0 means little endian, 1 means big endian */
00056   uint16_t reserved   : 11;     /**< reserved for future use */
00057   uint16_t num_blocks;          /**< number of rectification info blocks in this file */
00058   uint32_t spec_head_size;      /**< data specific header size */
00059   uint64_t created_sec;         /**< creation unix timestamp, seconds */
00060   uint64_t created_usec;        /**< creation unix timestamp, useconds */
00061   char     comment[FVFF_COMMENT_SIZE];  /**< optional comment */
00062 } fvff_header_t;
00063
00064 
00065 /** Block header.
00066  * Each block in a FvFF file has a block header. This header defines only the basic
00067  * characteristics that are needed to parse the file.
00068  * Directly following the header is the content specific block header. The size has to
00069  * be set in spec_head_size.
00070  */
00071 typedef struct _fvff_block_header_t {
00072   uint32_t type;                /**< The type of the block, content-specific */
00073   uint32_t size;                /**< size in bytes of this block, does not include any headers */
00074   uint32_t spec_head_size;      /**< the size of the following content specific block header */
00075 } fvff_block_header_t;
00076
00077
00078 #pragma pack(pop)
00079 #endif