Go to the documentation of this file.
   40     header->image_extension = 0;
 
   43     header->data_min_found = 0;
 
   44     header->data_max_found = 0;
 
   66     for (
i = 0; 
i < 8 && ptr8[
i] != 
' '; 
i++) {
 
   73         while (
i < 80 && ptr8[
i] == 
' ') {
 
   80             if (ptr8[
i-1] == 
'\'') {
 
   81                 for (; 
i < 80 && ptr8[
i] != 
'\''; 
i++) {
 
   85             } 
else if (ptr8[
i-1] == 
'(') {
 
   86                 for (; 
i < 80 && ptr8[
i] != 
')'; 
i++) {
 
   91                 for (; 
i < 80 && ptr8[
i] != 
' ' && ptr8[
i] != 
'/'; 
i++) {
 
  101 #define CHECK_KEYWORD(key) \ 
  102     if (strcmp(keyword, key)) { \ 
  103         av_log(avcl, AV_LOG_ERROR, "expected %s keyword, found %s = %s\n", key, keyword, value); \ 
  104         return AVERROR_INVALIDDATA; \ 
  107 #define CHECK_VALUE(key, val) \ 
  108     if (sscanf(value, "%d", &header->val) != 1) { \ 
  109         av_log(avcl, AV_LOG_ERROR, "invalid value of %s keyword, %s = %s\n", key, keyword, value); \ 
  110         return AVERROR_INVALIDDATA; \ 
  118     char keyword[10], 
value[72], 
c;
 
  125         if (
value[0] == 
'F') {
 
  127         } 
else if (
value[0] != 
'T') {
 
  137         if (!strcmp(
value, 
"'IMAGE   '")) {
 
  138             header->image_extension = 1;
 
  151         case  64: 
case -64: 
break;
 
  173         ret = sscanf(keyword, 
"NAXIS%d", &dim_no);
 
  174         if (
ret != 1 || dim_no != 
header->naxis_index + 1) {
 
  191         if (!strcmp(keyword, 
"BLANK") && sscanf(
value, 
"%"SCNd64
"", &t) == 1) {
 
  194         } 
else if (!strcmp(keyword, 
"BSCALE") && sscanf(
value, 
"%lf", &
d) == 1) {
 
  198         } 
else if (!strcmp(keyword, 
"BZERO") && sscanf(
value, 
"%lf", &
d) == 1) {
 
  200         } 
else if (!strcmp(keyword, 
"CTYPE3") && !strncmp(
value, 
"'RGB", 4)) {
 
  202         } 
else if (!strcmp(keyword, 
"DATAMAX") && sscanf(
value, 
"%lf", &
d) == 1) {
 
  203             header->data_max_found = 1;
 
  205         } 
else if (!strcmp(keyword, 
"DATAMIN") && sscanf(
value, 
"%lf", &
d) == 1) {
 
  206             header->data_min_found = 1;
 
  208         } 
else if (!strcmp(keyword, 
"END")) {
 
  210         } 
else if (!strcmp(keyword, 
"GROUPS") && sscanf(
value, 
"%c", &
c) == 1) {
 
  212         } 
else if (!strcmp(keyword, 
"GCOUNT") && sscanf(
value, 
"%"SCNd64
"", &t) == 1) {
 
  213             if (t < 0 || t > INT_MAX)
 
  216         } 
else if (!strcmp(keyword, 
"PCOUNT") && sscanf(
value, 
"%"SCNd64
"", &t) == 1) {
 
  217             if (t < 0 || t > INT_MAX)
 
  
#define AV_LOG_WARNING
Something somehow does not look correct.
 
#define CHECK_VALUE(key, val)
 
static int read_keyword_value(const uint8_t *ptr8, char *keyword, char *value)
Extract keyword and value from a header line (80 bytes) and store them in keyword and value strings r...
 
int avpriv_fits_header_parse_line(void *avcl, FITSHeader *header, const uint8_t line[80], AVDictionary ***metadata)
Parse a single header line.
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
 
#define CHECK_KEYWORD(key)
 
static int dict_set_if_not_null(AVDictionary ***metadata, char *keyword, char *value)
 
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
 
static const uint8_t header[24]
 
int avpriv_fits_header_init(FITSHeader *header, FITSHeaderState state)
Initialize a single header line.
 
#define i(width, name, range_min, range_max)
 
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
 
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
 
#define AVERROR_INVALIDDATA
Invalid data found when processing input.