1 /* 2 * Copyright © 2024 Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 */ 23 24 #ifndef SCREENSHOT_PARAMS_H 25 #define SCREENSHOT_PARAMS_H 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 #include <stdio.h> 32 #include <stdint.h> 33 #include <stdbool.h> 34 35 #define SCREENSHOT_PARAMS \ 36 SCREENSHOT_PARAM_BOOL(comms) \ 37 SCREENSHOT_PARAM_CUSTOM(control) \ 38 SCREENSHOT_PARAM_CUSTOM(frames) \ 39 SCREENSHOT_PARAM_CUSTOM(log_type) \ 40 SCREENSHOT_PARAM_CUSTOM(output_dir) \ 41 SCREENSHOT_PARAM_CUSTOM(help) 42 43 enum screenshot_param_enabled { 44 #define SCREENSHOT_PARAM_BOOL(name) SCREENSHOT_PARAM_ENABLED_##name, 45 #define SCREENSHOT_PARAM_CUSTOM(name) 46 SCREENSHOT_PARAMS 47 #undef SCREENSHOT_PARAM_BOOL 48 #undef SCREENSHOT_PARAM_CUSTOM 49 SCREENSHOT_PARAM_ENABLED_MAX 50 }; 51 52 enum LogType { 53 DEBUG, 54 ERROR, 55 INFO, 56 NO_PREFIX, // Don't prefix the log with text 57 REQUIRED, // Non-error logs that must be printed for user 58 WARN 59 }; 60 61 extern enum LogType LOG_TYPE; 62 63 struct frame_node { 64 uint32_t frame_num; 65 struct frame_node *next; 66 }; 67 68 /* List should be sorted into ascending order, in terms of frame_node data */ 69 struct frame_list { 70 uint32_t size; 71 bool all_frames; 72 struct frame_node *head; 73 }; 74 75 void remove_node(struct frame_list *, struct frame_node *, struct frame_node *); 76 void destroy_frame_list(struct frame_list *); 77 78 void LOG(enum LogType, const char *, ...); 79 80 struct screenshot_params { 81 bool enabled[SCREENSHOT_PARAM_ENABLED_MAX]; 82 struct frame_list *frames; 83 const char *control; 84 enum LogType log_type; 85 const char *output_dir; 86 bool help; 87 }; 88 89 const extern char *screenshot_param_names[]; 90 91 void parse_screenshot_env(struct screenshot_params *params, 92 const char *env); 93 94 #ifdef __cplusplus 95 } 96 #endif 97 98 #endif /* SCREENSHOT_PARAMS_H */ 99