Open Broadcaster Software
Free, open source software for live streaming and recording
platform.h File Reference

Go to the source code of this file.

Data Structures

struct  os_dirent
 
struct  os_globent
 
struct  os_glob_info
 

Macros

#define os_stat   stat
 
#define MKDIR_EXISTS   1
 
#define MKDIR_SUCCESS   0
 
#define MKDIR_ERROR   -1
 
#define ARCH_BITS   32
 

Typedefs

typedef struct os_cpu_usage_info os_cpu_usage_info_t
 
typedef const void os_performance_token_t
 
typedef struct os_dir os_dir_t
 
typedef struct os_glob_info os_glob_t
 
typedef struct os_inhibit_info os_inhibit_t
 

Functions

EXPORT FILE * os_wfopen (const wchar_t *path, const char *mode)
 
EXPORT FILE * os_fopen (const char *path, const char *mode)
 
EXPORT int64_t os_fgetsize (FILE *file)
 
EXPORT int os_fseeki64 (FILE *file, int64_t offset, int origin)
 
EXPORT int64_t os_ftelli64 (FILE *file)
 
EXPORT size_t os_fread_mbs (FILE *file, char **pstr)
 
EXPORT size_t os_fread_utf8 (FILE *file, char **pstr)
 
EXPORT char * os_quick_read_utf8_file (const char *path)
 
EXPORT bool os_quick_write_utf8_file (const char *path, const char *str, size_t len, bool marker)
 
EXPORT bool os_quick_write_utf8_file_safe (const char *path, const char *str, size_t len, bool marker, const char *temp_ext, const char *backup_ext)
 
EXPORT char * os_quick_read_mbs_file (const char *path)
 
EXPORT bool os_quick_write_mbs_file (const char *path, const char *str, size_t len)
 
EXPORT int64_t os_get_file_size (const char *path)
 
EXPORT int64_t os_get_free_space (const char *path)
 
EXPORT size_t os_mbs_to_wcs (const char *str, size_t str_len, wchar_t *dst, size_t dst_size)
 
EXPORT size_t os_utf8_to_wcs (const char *str, size_t len, wchar_t *dst, size_t dst_size)
 
EXPORT size_t os_wcs_to_mbs (const wchar_t *str, size_t len, char *dst, size_t dst_size)
 
EXPORT size_t os_wcs_to_utf8 (const wchar_t *str, size_t len, char *dst, size_t dst_size)
 
EXPORT size_t os_mbs_to_wcs_ptr (const char *str, size_t len, wchar_t **pstr)
 
EXPORT size_t os_utf8_to_wcs_ptr (const char *str, size_t len, wchar_t **pstr)
 
EXPORT size_t os_wcs_to_mbs_ptr (const wchar_t *str, size_t len, char **pstr)
 
EXPORT size_t os_wcs_to_utf8_ptr (const wchar_t *str, size_t len, char **pstr)
 
EXPORT size_t os_utf8_to_mbs_ptr (const char *str, size_t len, char **pstr)
 
EXPORT size_t os_mbs_to_utf8_ptr (const char *str, size_t len, char **pstr)
 
EXPORT double os_strtod (const char *str)
 
EXPORT int os_dtostr (double value, char *dst, size_t size)
 
EXPORT void * os_dlopen (const char *path)
 
EXPORT void * os_dlsym (void *module, const char *func)
 
EXPORT void os_dlclose (void *module)
 
EXPORT os_cpu_usage_info_tos_cpu_usage_info_start (void)
 
EXPORT double os_cpu_usage_info_query (os_cpu_usage_info_t *info)
 
EXPORT void os_cpu_usage_info_destroy (os_cpu_usage_info_t *info)
 
EXPORT os_performance_token_tos_request_high_performance (const char *reason)
 
EXPORT void os_end_high_performance (os_performance_token_t *)
 
EXPORT bool os_sleepto_ns (uint64_t time_target)
 
EXPORT void os_sleep_ms (uint32_t duration)
 
EXPORT uint64_t os_gettime_ns (void)
 
EXPORT int os_get_config_path (char *dst, size_t size, const char *name)
 
EXPORT char * os_get_config_path_ptr (const char *name)
 
EXPORT int os_get_program_data_path (char *dst, size_t size, const char *name)
 
EXPORT char * os_get_program_data_path_ptr (const char *name)
 
EXPORT bool os_file_exists (const char *path)
 
EXPORT size_t os_get_abs_path (const char *path, char *abspath, size_t size)
 
EXPORT char * os_get_abs_path_ptr (const char *path)
 
EXPORT const char * os_get_path_extension (const char *path)
 
EXPORT os_dir_tos_opendir (const char *path)
 
EXPORT struct os_direntos_readdir (os_dir_t *dir)
 
EXPORT void os_closedir (os_dir_t *dir)
 
EXPORT int os_glob (const char *pattern, int flags, os_glob_t **pglob)
 
EXPORT void os_globfree (os_glob_t *pglob)
 
EXPORT int os_unlink (const char *path)
 
EXPORT int os_rmdir (const char *path)
 
EXPORT char * os_getcwd (char *path, size_t size)
 
EXPORT int os_chdir (const char *path)
 
EXPORT uint64_t os_get_free_disk_space (const char *dir)
 
EXPORT int os_mkdir (const char *path)
 
EXPORT int os_mkdirs (const char *path)
 
EXPORT int os_rename (const char *old_path, const char *new_path)
 
EXPORT int os_copyfile (const char *file_in, const char *file_out)
 
EXPORT int os_safe_replace (const char *target_path, const char *from_path, const char *backup_path)
 
EXPORT char * os_generate_formatted_filename (const char *extension, bool space, const char *format)
 
EXPORT os_inhibit_tos_inhibit_sleep_create (const char *reason)
 
EXPORT bool os_inhibit_sleep_set_active (os_inhibit_t *info, bool active)
 
EXPORT void os_inhibit_sleep_destroy (os_inhibit_t *info)
 
EXPORT void os_breakpoint (void)
 
EXPORT int os_get_physical_cores (void)
 
EXPORT int os_get_logical_cores (void)
 

Macro Definition Documentation

#define ARCH_BITS   32
#define MKDIR_ERROR   -1
#define MKDIR_EXISTS   1
#define MKDIR_SUCCESS   0
#define os_stat   stat

Typedef Documentation

typedef struct os_cpu_usage_info os_cpu_usage_info_t
typedef struct os_dir os_dir_t
typedef struct os_glob_info os_glob_t
typedef struct os_inhibit_info os_inhibit_t
typedef const void os_performance_token_t

Function Documentation

EXPORT void os_breakpoint ( void  )
EXPORT int os_chdir ( const char *  path)
EXPORT void os_closedir ( os_dir_t dir)
EXPORT int os_copyfile ( const char *  file_in,
const char *  file_out 
)
EXPORT void os_cpu_usage_info_destroy ( os_cpu_usage_info_t info)
EXPORT double os_cpu_usage_info_query ( os_cpu_usage_info_t info)
EXPORT os_cpu_usage_info_t* os_cpu_usage_info_start ( void  )
EXPORT void os_dlclose ( void *  module)
EXPORT void* os_dlopen ( const char *  path)
EXPORT void* os_dlsym ( void *  module,
const char *  func 
)
EXPORT int os_dtostr ( double  value,
char *  dst,
size_t  size 
)
EXPORT void os_end_high_performance ( os_performance_token_t )
EXPORT int64_t os_fgetsize ( FILE *  file)
EXPORT bool os_file_exists ( const char *  path)
EXPORT FILE* os_fopen ( const char *  path,
const char *  mode 
)
EXPORT size_t os_fread_mbs ( FILE *  file,
char **  pstr 
)
EXPORT size_t os_fread_utf8 ( FILE *  file,
char **  pstr 
)
EXPORT int os_fseeki64 ( FILE *  file,
int64_t  offset,
int  origin 
)
EXPORT int64_t os_ftelli64 ( FILE *  file)
EXPORT char* os_generate_formatted_filename ( const char *  extension,
bool  space,
const char *  format 
)
EXPORT size_t os_get_abs_path ( const char *  path,
char *  abspath,
size_t  size 
)
EXPORT char* os_get_abs_path_ptr ( const char *  path)
EXPORT int os_get_config_path ( char *  dst,
size_t  size,
const char *  name 
)
EXPORT char* os_get_config_path_ptr ( const char *  name)
EXPORT int64_t os_get_file_size ( const char *  path)
EXPORT uint64_t os_get_free_disk_space ( const char *  dir)
EXPORT int64_t os_get_free_space ( const char *  path)
EXPORT int os_get_logical_cores ( void  )
EXPORT const char* os_get_path_extension ( const char *  path)
EXPORT int os_get_physical_cores ( void  )
EXPORT int os_get_program_data_path ( char *  dst,
size_t  size,
const char *  name 
)
EXPORT char* os_get_program_data_path_ptr ( const char *  name)
EXPORT char* os_getcwd ( char *  path,
size_t  size 
)
EXPORT uint64_t os_gettime_ns ( void  )
EXPORT int os_glob ( const char *  pattern,
int  flags,
os_glob_t **  pglob 
)
EXPORT void os_globfree ( os_glob_t pglob)
EXPORT os_inhibit_t* os_inhibit_sleep_create ( const char *  reason)
EXPORT void os_inhibit_sleep_destroy ( os_inhibit_t info)
EXPORT bool os_inhibit_sleep_set_active ( os_inhibit_t info,
bool  active 
)
EXPORT size_t os_mbs_to_utf8_ptr ( const char *  str,
size_t  len,
char **  pstr 
)
EXPORT size_t os_mbs_to_wcs ( const char *  str,
size_t  str_len,
wchar_t *  dst,
size_t  dst_size 
)
EXPORT size_t os_mbs_to_wcs_ptr ( const char *  str,
size_t  len,
wchar_t **  pstr 
)
EXPORT int os_mkdir ( const char *  path)
EXPORT int os_mkdirs ( const char *  path)
EXPORT os_dir_t* os_opendir ( const char *  path)
EXPORT char* os_quick_read_mbs_file ( const char *  path)
EXPORT char* os_quick_read_utf8_file ( const char *  path)
EXPORT bool os_quick_write_mbs_file ( const char *  path,
const char *  str,
size_t  len 
)
EXPORT bool os_quick_write_utf8_file ( const char *  path,
const char *  str,
size_t  len,
bool  marker 
)
EXPORT bool os_quick_write_utf8_file_safe ( const char *  path,
const char *  str,
size_t  len,
bool  marker,
const char *  temp_ext,
const char *  backup_ext 
)
EXPORT struct os_dirent* os_readdir ( os_dir_t dir)
EXPORT int os_rename ( const char *  old_path,
const char *  new_path 
)
EXPORT os_performance_token_t* os_request_high_performance ( const char *  reason)
EXPORT int os_rmdir ( const char *  path)
EXPORT int os_safe_replace ( const char *  target_path,
const char *  from_path,
const char *  backup_path 
)
EXPORT void os_sleep_ms ( uint32_t  duration)
EXPORT bool os_sleepto_ns ( uint64_t  time_target)

Sleeps to a specific time (in nanoseconds). Doesn't have to be super accurate in terms of actual slept time because the target time is ensured. Returns false if already at or past target time.

EXPORT double os_strtod ( const char *  str)
EXPORT int os_unlink ( const char *  path)
EXPORT size_t os_utf8_to_mbs_ptr ( const char *  str,
size_t  len,
char **  pstr 
)
EXPORT size_t os_utf8_to_wcs ( const char *  str,
size_t  len,
wchar_t *  dst,
size_t  dst_size 
)
EXPORT size_t os_utf8_to_wcs_ptr ( const char *  str,
size_t  len,
wchar_t **  pstr 
)
EXPORT size_t os_wcs_to_mbs ( const wchar_t *  str,
size_t  len,
char *  dst,
size_t  dst_size 
)
EXPORT size_t os_wcs_to_mbs_ptr ( const wchar_t *  str,
size_t  len,
char **  pstr 
)
EXPORT size_t os_wcs_to_utf8 ( const wchar_t *  str,
size_t  len,
char *  dst,
size_t  dst_size 
)
EXPORT size_t os_wcs_to_utf8_ptr ( const wchar_t *  str,
size_t  len,
char **  pstr 
)
EXPORT FILE* os_wfopen ( const wchar_t *  path,
const char *  mode 
)