utils.h

00001 /*****************************************************************
00002  * gmerlin - a general purpose multimedia framework and applications
00003  *
00004  * Copyright (c) 2001 - 2008 Members of the Gmerlin project
00005  * gmerlin-general@lists.sourceforge.net
00006  * http://gmerlin.sourceforge.net
00007  *
00008  * This program is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  * *****************************************************************/
00021 
00022 #ifndef __BG_UTILS_H_
00023 #define __BG_UTILS_H_
00024 
00025 #include <gavl/gavl.h>
00026 
00048 /* Append a trailing '/' if it's missing. Argument must be free()able */
00049 
00050 char * bg_fix_path(char * path);
00051 
00063 char * bg_search_file_read(const char * directory, const char * file);
00064 
00077 char * bg_search_file_write(const char * directory, const char * file);
00078 
00088 int bg_search_file_exec(const char * file, char ** path);
00089 
00098 char * bg_find_url_launcher();
00099 
00107 void bg_display_html_help(const char * path);
00108 
00116 char * bg_create_unique_filename(char * format);
00117 
00118 
00137 char * bg_strdup(char * old_string, const char * new_string);
00138 
00149 char * bg_strndup(char * old_string,
00150                   const char * new_start,
00151                   const char * new_end);
00152 
00159 char * bg_strcat(char * old_string, const char * tail);
00160 
00168 char * bg_strncat(char * old_string, const char * start, const char * end);
00169 
00175 char * bg_toupper(const char * str);
00176 
00177 
00186 int bg_string_is_url(const char * str);
00187 
00203 int bg_url_split(const char * url,
00204                  char ** protocol,
00205                  char ** user,
00206                  char ** password,
00207                  char ** hostname,
00208                  int * port,
00209                  char ** path);
00210 
00219 char * bg_get_tumbnail_file(const char * gml);
00220 
00221 
00230 char * bg_sprintf(const char * format,...) __attribute__ ((format (printf, 1, 2)));
00231 
00240 char ** bg_strbreak(const char * str, char delim);
00241 
00248 void bg_strbreak_free(char ** retval);
00249 
00260 char * bg_scramble_string(const char * str);
00261 
00272 char * bg_descramble_string(const char * str);
00273 
00281 char * bg_string_to_uri(const char * pos1, int len);
00282 
00290 char * bg_uri_to_string(const char * pos1, int len);
00291 
00302 char ** bg_urilist_decode(const char * str, int len);
00303 
00308 void bg_urilist_free(char ** uri_list);
00309 
00318 char * bg_system_to_utf8(const char * str, int len);
00319 
00328 char * bg_utf8_to_system(const char * str, int len);
00329 
00335 const char * bg_get_language_name(const char * iso);
00336 
00343 int bg_string_match(const char * str, const char * key_list);
00344 
00345 /* @} */
00346 
00362 void bg_hexdump(uint8_t * data, int len, int linebreak);
00363 
00370 char * bg_audio_format_to_string(gavl_audio_format_t * format, int use_tabs);
00371 
00372 
00379 char * bg_video_format_to_string(gavl_video_format_t * format, int use_tabs);
00380 
00381 /* @} */
00382 
00383 extern char const * const bg_language_codes[];
00384 extern char const * const bg_language_labels[];
00385 
00386 #ifdef DEBUG
00387 #define bg_debug(f,...) fprintf(stderr, f, __VA_ARGS__)
00388 #else
00389 #define bg_debug(f,...)
00390 #endif
00391 
00392 
00393 #endif // __BG_UTILS_H_

Generated on Thu Dec 18 08:24:29 2008 for gmerlin by  doxygen 1.5.7.1