00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __BG_UTILS_H_
00023 #define __BG_UTILS_H_
00024
00025 #include <gavl/gavl.h>
00026
00048
00049
00050 char * bg_fix_path(char * path);
00051
00059 int bg_ensure_directory(const char * dir);
00060
00061
00073 char * bg_search_file_read(const char * directory, const char * file);
00074
00087 char * bg_search_file_write(const char * directory, const char * file);
00088
00098 int bg_search_file_exec(const char * file, char ** path);
00099
00108 char * bg_find_url_launcher();
00109
00117 void bg_display_html_help(const char * path);
00118
00126 char * bg_create_unique_filename(char * format);
00127
00128
00147 char * bg_strdup(char * old_string, const char * new_string);
00148
00159 char * bg_strndup(char * old_string,
00160 const char * new_start,
00161 const char * new_end);
00162
00169 char * bg_strcat(char * old_string, const char * tail);
00170
00178 char * bg_strncat(char * old_string, const char * start, const char * end);
00179
00185 char * bg_toupper(const char * str);
00186
00187
00196 int bg_string_is_url(const char * str);
00197
00213 int bg_url_split(const char * url,
00214 char ** protocol,
00215 char ** user,
00216 char ** password,
00217 char ** hostname,
00218 int * port,
00219 char ** path);
00220
00230 void bg_get_filename_hash(const char * gml, char ret[33]);
00231
00240 char * bg_sprintf(const char * format,...) __attribute__ ((format (printf, 1, 2)));
00241
00250 char ** bg_strbreak(const char * str, char delim);
00251
00258 void bg_strbreak_free(char ** retval);
00259
00270 char * bg_scramble_string(const char * str);
00271
00282 char * bg_descramble_string(const char * str);
00283
00291 char * bg_string_to_uri(const char * pos1, int len);
00292
00300 char * bg_uri_to_string(const char * pos1, int len);
00301
00312 char ** bg_urilist_decode(const char * str, int len);
00313
00318 void bg_urilist_free(char ** uri_list);
00319
00328 char * bg_system_to_utf8(const char * str, int len);
00329
00338 char * bg_utf8_to_system(const char * str, int len);
00339
00345 const char * bg_get_language_name(const char * iso);
00346
00353 int bg_string_match(const char * str, const char * key_list);
00354
00355
00356
00372 void bg_hexdump(uint8_t * data, int len, int linebreak);
00373
00380 char * bg_audio_format_to_string(gavl_audio_format_t * format, int use_tabs);
00381
00382
00389 char * bg_video_format_to_string(gavl_video_format_t * format, int use_tabs);
00390
00395 void bg_dprintf(const char * format, ...) __attribute__ ((format (printf, 1, 2)));
00396
00402 void bg_diprintf(int indent, const char * format, ...) __attribute__ ((format (printf, 2, 3)));
00403
00404
00405
00406 extern char const * const bg_language_codes[];
00407 extern char const * const bg_language_labels[];
00408
00409 #ifdef DEBUG
00410 #define bg_debug(f,...) fprintf(stderr, f, __VA_ARGS__)
00411 #else
00412 #define bg_debug(f,...)
00413 #endif
00414
00415
00416
00417 #endif // __BG_UTILS_H_