182 session_display_config_t config = {
184 .palette_type = GET_OPTION(palette_type),
185 .custom_palette = GET_OPTION(palette_custom_set) ? GET_OPTION(palette_custom) : NULL,
186 .color_mode = TERM_COLOR_AUTO
191 if (!g_display_ctx) {
192 SET_ERRNO(ERROR_DISPLAY,
"Failed to initialize display");
197 const char *media_url = GET_OPTION(media_url);
198 const char *media_file = GET_OPTION(media_file);
200 if ((media_url && strlen(media_url) > 0) || (media_file && strlen(media_file) > 0)) {
202 session_capture_config_t capture_config = {0};
203 capture_config.target_fps = 60;
204 capture_config.resize_for_network =
false;
205 capture_config.should_exit_callback = NULL;
206 capture_config.callback_data = NULL;
208 if (media_url && strlen(media_url) > 0) {
209 capture_config.type = MEDIA_SOURCE_FILE;
210 capture_config.path = media_url;
212 if (strcmp(media_file,
"-") == 0) {
213 capture_config.type = MEDIA_SOURCE_STDIN;
214 capture_config.path = NULL;
216 capture_config.type = MEDIA_SOURCE_FILE;
217 capture_config.path = media_file;
221 capture_config.loop = GET_OPTION(media_loop);
222 capture_config.initial_seek_timestamp = GET_OPTION(media_seek_timestamp);
225 if (!g_display_capture_ctx) {
226 log_warn(
"Failed to create capture context for local media - keyboard seek/pause disabled");
227 g_display_capture_ctx = NULL;
234 asciichat_error_t kb_result = keyboard_init();
235 if (kb_result == ASCIICHAT_OK) {
236 g_keyboard_enabled =
true;
239 log_warn(
"Failed to initialize keyboard input: %s", asciichat_error_string(kb_result));
240 g_keyboard_enabled =
false;
317 SET_ERRNO(ERROR_INVALID_PARAM,
"Attempted to render NULL frame data");
330 if (g_keyboard_enabled) {
331 keyboard_key_t key = keyboard_read_nonblocking();
332 if (key != KEY_NONE) {
346 if (g_keyboard_enabled) {
347 keyboard_key_t key = keyboard_read_nonblocking();
348 if (key != KEY_NONE) {
ascii-chat Server Mode Entry Point Header