/* SPDX-License-Identifier: GPL-3.0-or-later */ /* * vfetch - neofetch but the ascii part is a video * * Copyright (C) 2026 Doan Luu Duc Tai * */ #ifndef SRC__STATE_H #define SRC__STATE_H #include #include #include #include #include #include "audio_defs.h" #include "config.h" typedef struct AppState { VfetchArgs *args; gchar *video_specific_cache_root; gchar *current_args_cache_dir; gchar *live_fetch_output; gchar *fetch_command; AudioState audio_state; struct termios original_termios; gint64 media_sync_start_time; pthread_mutex_t audio_state_mutex; pthread_mutex_t fetch_mutex; pthread_mutex_t stdout_mutex; pthread_t signal_monitor_thread_id; pthread_t fetch_thread_id; _Atomic size_t ascii_frames_completed; _Atomic size_t last_fetch_lines; _Atomic size_t previous_fetch_lines; _Atomic bool terminal_resized; _Atomic bool exit_requested; _Atomic bool animation_has_started; _Atomic bool termios_saved; _Atomic bool cursor_visible; _Atomic bool processing_finished; _Atomic bool paused; } AppState; typedef struct ProgressThreadArgs { AppState *state; size_t total_frames; } ProgressThreadArgs; typedef struct FetchUpdaterArgs { AppState *state; VfetchArgs *args; bool verbose_flag; bool debug_flag; } FetchUpdaterArgs; /* Required for the POSIX signal handler, which has a fixed signature and cannot * be passed user context. This global is the standard mechanism for the handler * to access application state. * NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) */ extern AppState *global_signal_handler_state_ptr; /* Required for the self-pipe mechanism, which allows the signal handler to * safely communicate with the main application thread. * NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) */ extern int global_signal_pipe[2]; #endif /* SRC__STATE_H */