FFmpeg
Loading...
Searching...
No Matches
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.
 
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.
 
int avpriv_fits_header_parse_line (void *avcl, FITSHeader *header, const uint8_t line[80], AVDictionary ***metadata)
 Parse a single header line.
 

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); \
}
double value
Definition eval.c:102
const char * key
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210

Definition at line 103 of file fits.c.

Referenced by avpriv_fits_header_parse_line().

◆ 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); \
}
static const uint8_t header[24]
Definition sdr2.c:68

Definition at line 109 of file fits.c.

Referenced by avpriv_fits_header_parse_line().

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 50 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 64 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 115 of file fits.c.

Referenced by fits_read_header(), and is_image().