FFmpeg
Macros | Functions
fits.c File Reference
#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/dict.h"
#include "libavutil/error.h"
#include "libavutil/log.h"
#include "fits.h"

Go to the source code of this file.

Macros

#define CHECK_KEYWORD(key)
 
#define CHECK_VALUE(key, val)
 

Functions

int avpriv_fits_header_init (FITSHeader *header, FITSHeaderState state)
 Initialize a single header line. More...
 
static int dict_set_if_not_null (AVDictionary ***metadata, char *keyword, char *value)
 
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 respectively. More...
 
int avpriv_fits_header_parse_line (void *avcl, FITSHeader *header, const uint8_t line[80], AVDictionary ***metadata)
 Parse a single header line. More...
 

Macro Definition Documentation

◆ CHECK_KEYWORD

#define CHECK_KEYWORD (   key)
Value:
if (strcmp(keyword, key)) { \
av_log(avcl, AV_LOG_ERROR, "expected %s keyword, found %s = %s\n", key, keyword, value); \
}

Definition at line 101 of file fits.c.

◆ CHECK_VALUE

#define CHECK_VALUE (   key,
  val 
)
Value:
if (sscanf(value, "%d", &header->val) != 1) { \
av_log(avcl, AV_LOG_ERROR, "invalid value of %s keyword, %s = %s\n", key, keyword, value); \
}

Definition at line 107 of file fits.c.

Function Documentation

◆ avpriv_fits_header_init()

int avpriv_fits_header_init ( FITSHeader header,
FITSHeaderState  state 
)

Initialize a single header line.

Parameters
headerpointer to the header
statecurrent state of parsing the header
Returns
0 if successful otherwise AVERROR_INVALIDDATA

Definition at line 31 of file fits.c.

Referenced by fits_read_header(), and fits_read_packet().

◆ dict_set_if_not_null()

static int dict_set_if_not_null ( AVDictionary ***  metadata,
char *  keyword,
char *  value 
)
static

Definition at line 48 of file fits.c.

Referenced by avpriv_fits_header_parse_line().

◆ read_keyword_value()

static int read_keyword_value ( const uint8_t *  ptr8,
char *  keyword,
char *  value 
)
static

Extract keyword and value from a header line (80 bytes) and store them in keyword and value strings respectively.

Parameters
ptr8pointer to the data
keywordpointer to the char array in which keyword is to be stored
valuepointer to the char array in which value is to be stored
Returns
0 if calculated successfully otherwise AVERROR_INVALIDDATA

Definition at line 62 of file fits.c.

Referenced by avpriv_fits_header_parse_line().

◆ avpriv_fits_header_parse_line()

int avpriv_fits_header_parse_line ( void *  avcl,
FITSHeader header,
const uint8_t  line[80],
AVDictionary ***  metadata 
)

Parse a single header line.

Parameters
avclused in av_log
headerpointer to the header
lineone header line
metadataused to store metadata while decoding
Returns
0 if successful otherwise AVERROR_INVALIDDATA

Definition at line 113 of file fits.c.

Referenced by fits_read_header(), and is_image().

AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
key
const char * key
Definition: hwcontext_opencl.c:189
header
static const uint8_t header[24]
Definition: sdr2.c:68
value
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
Definition: writing_filters.txt:86
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61