ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
options.h File Reference

⚙️ Command-line options parsing and configuration management for ascii-chat More...

Go to the source code of this file.

Data Structures

struct  options_state
 Consolidated options structure. More...
 

Macros

#define COLOR_MODE_AUTO   TERM_COLOR_AUTO
 Backward compatibility aliases for color mode enum values.
 
#define COLOR_MODE_NONE   TERM_COLOR_NONE
 Monochrome mode.
 
#define COLOR_MODE_16   TERM_COLOR_16
 16-color mode (alias)
 
#define COLOR_MODE_16_COLOR   TERM_COLOR_16
 16-color mode (full name)
 
#define COLOR_MODE_256   TERM_COLOR_256
 256-color mode (alias)
 
#define COLOR_MODE_256_COLOR   TERM_COLOR_256
 256-color mode (full name)
 
#define COLOR_MODE_TRUECOLOR   TERM_COLOR_TRUECOLOR
 24-bit truecolor mode
 
#define ASCIICHAT_BINARY_OPTIONS_STRUCT
 Binary-level options (parsed before mode selection)
 
#define ASCIICHAT_COMMON_OPTIONS_STRUCT
 Common options (all modes after binary parsing)
 
#define ASCIICHAT_SERVER_OPTIONS_STRUCT
 Server mode options.
 
#define ASCIICHAT_CLIENT_OPTIONS_STRUCT
 Client mode options.
 
#define ASCIICHAT_MIRROR_OPTIONS_STRUCT
 Mirror mode options.
 
#define ASCIICHAT_ACDS_OPTIONS_STRUCT
 ACDS mode options.
 
#define GET_OPTION(field)
 Safely get a specific option field (lock-free read)
 
Configuration Constants
#define OPTIONS_BUFF_SIZE   256
 Buffer size for option string values.
 
#define OPT_WIDTH_DEFAULT   110
 Default terminal width in characters.
 
#define OPT_HEIGHT_DEFAULT   70
 Default terminal height in characters.
 
#define SNAPSHOT_DELAY_DEFAULT   3.0f
 Default snapshot delay in seconds.
 
#define OPT_PORT_DEFAULT   "27224"
 Default TCP port for client/server communication.
 
#define OPT_ADDRESS_DEFAULT   "localhost"
 Default server address for client connections.
 
#define OPT_ADDRESS6_DEFAULT   "::1"
 Default IPv6 server address.
 
#define OPT_MAX_CLIENTS_DEFAULT   9
 Default maximum concurrent clients (server only)
 
#define OPT_COMPRESSION_LEVEL_DEFAULT   1
 Default compression level (1-9)
 
#define OPT_FPS_DEFAULT   60
 Default FPS (frames per second)
 
#define OPT_WEBCAM_INDEX_DEFAULT   0
 Default webcam device index.
 
#define OPT_MICROPHONE_INDEX_DEFAULT   (-1)
 Default microphone device index (-1 means system default)
 
#define OPT_SPEAKERS_INDEX_DEFAULT   (-1)
 Default speakers device index (-1 means system default)
 
#define OPT_RECONNECT_ATTEMPTS_DEFAULT   (-1)
 Default reconnect attempts (-1 means auto/infinite)
 
#define OPT_WEBCAM_FLIP_DEFAULT   true
 Default webcam flip state (true = horizontally flipped)
 
#define OPT_COLOR_MODE_DEFAULT   COLOR_MODE_AUTO
 Default color mode (auto-detect terminal capabilities)
 
#define OPT_RENDER_MODE_DEFAULT   RENDER_MODE_FOREGROUND
 Default render mode (foreground characters only)
 
#define OPT_ENCODE_AUDIO_DEFAULT   true
 Default audio encoding state (true = Opus encoding enabled)
 

Typedefs

typedef struct options_state options_t
 Consolidated options structure.
 

Enumerations

enum  asciichat_mode_t { MODE_SERVER , MODE_CLIENT , MODE_MIRROR , MODE_ACDS }
 Mode type for options parsing. More...
 

Functions

const options_toptions_get (void)
 Get current options (lock-free read)
 
asciichat_error_t options_update (void(*updater)(options_t *, void *), void *context)
 Update options using copy-on-write (thread-safe)
 
asciichat_error_t options_set_dimensions (unsigned short int width, unsigned short int height)
 Update terminal dimensions.
 
asciichat_error_t options_set_color_mode (terminal_color_mode_t mode)
 Update color mode.
 
asciichat_error_t options_set_render_mode (render_mode_t mode)
 Update render mode.
 
asciichat_error_t options_set_log_level (log_level_t level)
 Update log level.
 
Utility Functions
int strtoint_safe (const char *str)
 Safely parse string to integer with validation.
 
Option Parsing Functions
asciichat_error_t options_init (int argc, char **argv)
 Initialize options by parsing command-line arguments.
 
void usage (FILE *desc, asciichat_mode_t mode)
 Print usage information for client, server, or mirror mode.
 
void usage_client (FILE *desc)
 Print client usage information.
 
void usage_server (FILE *desc)
 Print server usage information.
 
void usage_mirror (FILE *desc)
 Print mirror usage information.
 
void usage_acds (FILE *desc)
 Print ACDS usage information.
 
Dimension Update Functions
void update_dimensions_for_full_height (options_t *opts)
 Update dimensions for full height display.
 
void update_dimensions_to_terminal_size (options_t *opts)
 Update dimensions to match terminal size.
 

Variables

const float weight_red
 
const float weight_green
 Green weight for luminance calculation.
 
const float weight_blue
 Blue weight for luminance calculation.
 
unsigned short int RED []
 Red channel lookup table.
 
unsigned short int GREEN []
 Green channel lookup table.
 
unsigned short int BLUE []
 Blue channel lookup table.
 
unsigned short int GRAY []
 Grayscale lookup table.
 

Detailed Description

⚙️ Command-line options parsing and configuration management for ascii-chat

Definition in file options.h.