![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include "utils/misc.h"#include <unistd.h>#include <cassert>#include <cctype>#include <cerrno>#include <climits>#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <sstream>#include <stdexcept>#include <string>#include "compat/strings.h"#include "debug.h"#include "utils/macros.h"#include "utils/color_out.h"
Go to the source code of this file.
Functions | |
| const char * | format_in_si_units (unsigned long long int val) |
| int | get_cpu_core_count (void) |
| int | get_framerate_d (double fps) |
| int | get_framerate_n (double fps) |
| bool | invalid_arg_is_numeric (const char *what) |
| bool | is_arm_mac () |
| bool | is_wine () |
| uint32_t | parse_uint32 (const char *value_str) noexcept(false) |
| void | print_module_usage (const char *module_name, const struct key_val *options, const struct key_val *options_full, bool print_full_help) |
| void | ug_perror (const char *s) |
| const char * | ug_strerror (int errnum) |
| long long | unit_evaluate (const char *str, const char **endptr) |
| double | unit_evaluate_dbl (const char *str, bool case_sensitive, const char **endptr) |
Definition in file misc.cpp.
| const char * format_in_si_units | ( | unsigned long long int | val | ) |
Formats number in format "ABCD.E [S]" where 'S' is an SI unit prefix.
Definition at line 154 of file misc.cpp.
References val.
Referenced by replica::replica(), configure_with(), and main().
| int get_cpu_core_count | ( | void | ) |
| number | of usable CPU cores or 1 if unknown |
Definition at line 218 of file misc.cpp.
References MIN.
Referenced by av_to_uv_convert(), configure_video(), parallel_pix_conv(), respawn_parallel(), and vidcap_screen_x11_init().
| int get_framerate_d | ( | double | fps | ) |
Definition at line 190 of file misc.cpp.
References round().
Referenced by configure_video(), display_ndi_reconfigure(), display_pw_reconfigure(), display_v4l2_reconfigure(), get_framerate_n(), get_framerate_test_2997(), get_framerate_test_3000(), get_framerate_test_free(), and vidcap_testcard_init().

| int get_framerate_n | ( | double | fps | ) |
Definition at line 184 of file misc.cpp.
References get_framerate_d(), and round().
Referenced by configure_video(), display_ndi_reconfigure(), display_pw_reconfigure(), display_v4l2_reconfigure(), get_framerate_test_2997(), get_framerate_test_3000(), get_framerate_test_free(), and vidcap_testcard_init().

| bool invalid_arg_is_numeric | ( | const char * | what | ) |
| what | value returned by std::logic_error::what() |
Definition at line 340 of file misc.cpp.
Referenced by display_decklink_init(), main(), and parse_options().
| bool is_arm_mac | ( | void | ) |
Checks whether host machine is an ARM Mac (native or running x86_64 code with Rosetta2)
Definition at line 315 of file misc.cpp.
References len.
| bool is_wine | ( | void | ) |
Definition at line 172 of file misc.cpp.
Referenced by udp_init_if().
| uint32_t parse_uint32 | ( | const char * | value_str | ) |
Definition at line 296 of file misc.cpp.
References val.
Referenced by settings_init().
| void print_module_usage | ( | const char * | module_name, |
| const struct key_val * | options, | ||
| const struct key_val * | options_full, | ||
| bool | print_full_help ) |
Prints module usage in unified format.
| module_name | module name including command-line parameter (eg. "-t syphon") |
| options | accepted options (may be NULL if no options are accepted) |
| options_full | options that are shown only if fullhelp is requested (NULL if none) |
| printf_full_help | whether to print options_full |
Definition at line 242 of file misc.cpp.
References color_printf(), first, key, key_val::key, MAX, TBOLD, TERM_BOLD, TERM_FG_RED, TERM_FG_RESET, TERM_RESET, and UNUSED.
Referenced by audio_cap_testcard_init(), display_dummy_init(), and usage().

| void ug_perror | ( | const char * | s | ) |
Definition at line 213 of file misc.cpp.
References LOG_LEVEL_ERROR, log_msg(), and ug_strerror().
Referenced by process_data_chunk(), and read_ds64().

| const char * ug_strerror | ( | int | errnum | ) |
Definition at line 203 of file misc.cpp.
References strerror_s.
Referenced by audio_export_thread(), create_implicit_dir(), display_v4l2_init(), display_v4l2_probe(), gen_sdp(), log_perror(), rtcp_udp_send(), rtp_send_data_hdr(), set_output_buffering(), show_help(), testcard_load_from_file(), and ug_perror().
| long long unit_evaluate | ( | const char * | str, |
| const char ** | endptr ) |
Converts units in format <val>[.<val>][kMG] to integral representation.
| str | string to be parsed |
| endptr | if not NULL, point to suffix after parse |
Definition at line 81 of file misc.cpp.
References unit_evaluate_dbl().
Referenced by fec_check_messages(), parse_audio_codec_params(), parse_audio_format(), and parse_bitrate().

| double unit_evaluate_dbl | ( | const char * | str, |
| bool | case_sensitive, | ||
| const char ** | endptr ) |
Converts units in format <val>[.<val>][kMG] to floating point representation.
| str | string to be parsed, suffix following SI suffix is ignored (as in 1ms or 100MB) |
| case_sensitive | if true 'm' will be considered as milli, otherwise mega |
| endptr | if not NULL, point to suffix after parse |
Definition at line 102 of file misc.cpp.
References LOG_LEVEL_ERROR, and log_msg().
Referenced by decompress_thread(), j2k_decompress_init(), and unit_evaluate().
