rtl433  UNKNOWN
RTL-433 utility
fileformat.c File Reference

Various utility functions handling file formats. More...

Functions

char const * file_basename (char const *path)
 
void check_read_file_info (file_info_t *info)
 
void check_write_file_info (file_info_t *info)
 
char const * file_info_string (file_info_t *info)
 
static void file_type_set_format (uint32_t *type, uint32_t val)
 
static void file_type_set_content (uint32_t *type, uint32_t val)
 
static uint32_t file_type_guess_auto_format (uint32_t type)
 
static void file_type (char const *filename, file_info_t *info)
 
char const * last_plain_colon (char const *p)
 
int parse_file_info (char const *filename, file_info_t *info)
 This will detect file info and overrides. More...
 
void assert_file_type (int check, char const *spec)
 
void assert_str_equal (char const *a, char const *b)
 
int main (int argc, char **argv)
 

Detailed Description

Various utility functions handling file formats.

Copyright (C) 2018 Christian Zuckschwerdt

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Function Documentation

◆ assert_file_type()

void assert_file_type ( int  check,
char const *  spec 
)

References parse_file_info().

Referenced by main().

◆ assert_str_equal()

void assert_str_equal ( char const *  a,
char const *  b 
)

Referenced by main().

◆ check_read_file_info()

void check_read_file_info ( file_info_t info)

◆ check_write_file_info()

void check_write_file_info ( file_info_t info)

◆ file_basename()

char const* file_basename ( char const *  path)

Referenced by data_acquired_handler().

◆ file_info_string()

char const* file_info_string ( file_info_t info)

◆ file_type()

◆ file_type_guess_auto_format()

static uint32_t file_type_guess_auto_format ( uint32_t  type)
static

◆ file_type_set_content()

static void file_type_set_content ( uint32_t type,
uint32_t  val 
)
static

Referenced by file_type().

◆ file_type_set_format()

static void file_type_set_format ( uint32_t type,
uint32_t  val 
)
static

Referenced by file_type().

◆ last_plain_colon()

char const* last_plain_colon ( char const *  p)

Referenced by main(), and parse_file_info().

◆ main()

int main ( int  argc,
char **  argv 
)

◆ parse_file_info()

int parse_file_info ( char const *  filename,
file_info_t info 
)

This will detect file info and overrides.

Parse "[0-9]+(\.[0-9]+)?[A-Za-z]" as frequency (suffix "M" or "[kMG]?Hz") or sample rate (suffix "k" or "[kMG]?sps")

Parse "[A-Za-z][0-9A-Za-z]+" as format or content specifier:

2ch formats: "cu8", "cs8", "cs16", "cs32", "cf32" 1ch formats: "u8", "s8", "s16", "u16", "s32", "u32", "f32" text formats: "vcd", "ook" content types: "iq", "i", "q", "am", "fm", "logic"

Parses left to right, with the exception of a prefix up to the last colon ":" This prefix is the forced override, parsed last and removed from the filename.

All matches are case-insensitive.

default detection, e.g.: path/filename.am.s16 overrides, e.g.: am:s16:path/filename.ext other styles are detected but discouraged, e.g.: am-s16:path/filename.ext, am.s16:path/filename.ext, path/filename.am_s16

References file_type(), file_type_guess_auto_format(), file_info_t::format, last_plain_colon(), file_info_t::path, file_info_t::raw_format, and file_info_t::spec.

Referenced by add_dumper(), assert_file_type(), and main().