LiVES  1.6.4-svn
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Functions
utils.c File Reference
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <dirent.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/file.h>
#include "main.h"
#include "support.h"
#include "audio.h"
#include "resample.h"

Macros

#define ASPECT_ALLOWANCE   0.005
#define rand_a   1073741789L
#define rand_c   32749L

Functions

char * filename_from_fd (char *val, int fd)
LIVES_INLINE void lives_srandom (unsigned int seed)
LIVES_INLINE uint64_t lives_random (void)
LIVES_INLINE pid_t lives_getpid (void)
LIVES_INLINE int lives_getuid (void)
LIVES_INLINE int lives_getgid (void)
LIVES_INLINE ssize_t lives_readlink (const char *path, char *buf, size_t bufsiz)
LIVES_INLINE boolean lives_fsync (int fd)
LIVES_INLINE void lives_sync (void)
LIVES_INLINE boolean lives_setenv (const char *name, const char *value)
int lives_system (const char *com, gboolean allow_error)
lives_pid_t lives_fork (const char *com)
ssize_t lives_write (int fd, const void *buf, size_t count, gboolean allow_fail)
ssize_t lives_write_le (int fd, const void *buf, size_t count, gboolean allow_fail)
int lives_fputs (const char *s, FILE *stream)
char * lives_fgets (char *s, int size, FILE *stream)
ssize_t lives_read (int fd, void *buf, size_t count, gboolean allow_less)
ssize_t lives_read_le (int fd, void *buf, size_t count, gboolean allow_less)
gchar * lives_format_storage_space_string (guint64 space)
lives_storage_status_t get_storage_status (const char *dir, guint64 warn_level, guint64 *dsval)
int lives_chdir (const char *path, gboolean allow_fail)
LIVES_INLINE void lives_freep (void **ptr)
LIVES_INLINE int lives_kill (lives_pid_t pid, int sig)
LIVES_INLINE int lives_killpg (lives_pgid_t pgrp, int sig)
LIVES_INLINE gint myround (gdouble n)
LIVES_INLINE void clear_mainw_msg (void)
LIVES_INLINE uint64_t lives_10pow (int pow)
LIVES_INLINE int get_approx_ln (guint x)
int64_t lives_get_current_ticks (void)
int lives_alarm_set (int64_t ticks)
gboolean lives_alarm_get (int alarm_handle)
void lives_alarm_clear (int alarm_handle)
LIVES_INLINE gchar * g_strappend (gchar *string, gint len, const gchar *xnew)
LIVES_INLINE GList * g_list_append_unique (GList *xlist, const gchar *add)
LIVES_INLINE float LEFloat_to_BEFloat (float f)
LIVES_INLINE gdouble calc_time_from_frame (gint clip, gint frame)
LIVES_INLINE gint calc_frame_from_time (gint filenum, gdouble time)
 nearest frame start
LIVES_INLINE gint calc_frame_from_time2 (gint filenum, gdouble time)
 nearest frame end
LIVES_INLINE gint calc_frame_from_time3 (gint filenum, gdouble time)
 nearest frame mid
void calc_aframeno (gint fileno)
gint calc_new_playback_position (gint fileno, gint64 otc, gint64 *ntc)
void calc_maxspect (gint rwidth, gint rheight, gint *cwidth, gint *cheight)
void init_clipboard (void)
void d_print (const gchar *text)
gboolean add_lmap_error (lives_lmap_error_t lerror, const gchar *name, gpointer user_data, gint clipno, gint frameno, gdouble atime, gboolean affects_current)
void clear_lmap_errors (void)
gboolean check_for_lock_file (const gchar *set_name, gint type)
gboolean is_legal_set_name (const gchar *set_name, gboolean allow_dupes)
gboolean check_frame_count (gint idx)
void get_frame_count (gint idx)
void get_next_free_file (void)
void get_dirname (gchar *filename)
gchar * get_dir (const gchar *filename)
void get_basename (gchar *filename)
void get_filename (gchar *filename, gboolean strip_dir)
gchar * get_extension (const gchar *filename)
gchar * ensure_extension (const gchar *fname, const gchar *ext)
gboolean ensure_isdir (gchar *fname)
void get_location (const gchar *exe, gchar *val, gint maxlen)
guint64 get_version_hash (const gchar *exe, const gchar *sep, int piece)
gchar * repl_tmpdir (const gchar *entry, gboolean fwd)
void remove_layout_files (GList *map)
void get_play_times (void)
void draw_little_bars (gdouble ptrtime)
void get_total_time (file *file)
void find_when_to_stop (void)
void minimise_aspect_delta (gdouble aspect, gint hblock, gint vblock, gint hsize, gint vsize, gint *width, gint *height)
void zero_spinbuttons (void)
gboolean switch_aud_to_jack (void)
gboolean switch_aud_to_pulse (void)
void switch_aud_to_sox (gboolean set_in_prefs)
void switch_aud_to_mplayer (gboolean set_in_prefs)
void prepare_to_play_foreign (void)
gboolean after_foreign_play (void)
void set_menu_text (GtkWidget *menuitem, const gchar *text, gboolean use_mnemonic)
void get_menu_text (GtkWidget *menuitem, gchar *text)
void get_menu_text_long (GtkWidget *menuitem, gchar *text)
LIVES_INLINE gboolean int_array_contains_value (int *array, int num_elems, int value)
void reset_clip_menu (void)
gboolean check_file (const gchar *file_name, gboolean check_existing)
 check if file exists
gboolean check_dir_access (const gchar *dir)
gboolean check_dev_busy (gchar *devstr)
void activate_url_inner (const gchar *link)
void activate_url (GtkAboutDialog *about, const gchar *link, gpointer data)
void show_manual_section (const gchar *lang, const gchar *section)
uint64_t get_file_size (int fd)
uint64_t sget_file_size (const gchar *name)
void reget_afilesize (int fileno)
void colour_equal (GdkColor *c1, const GdkColor *c2)
gboolean create_event_space (gint length)
gint lives_list_index (GList *list, const gchar *data)
void add_to_recent (const gchar *filename, gdouble start, gint frames, const gchar *extra_params)
gint verhash (gchar *version)
void set_undoable (const gchar *what, gboolean sensitive)
void set_redoable (const gchar *what, gboolean sensitive)
void set_sel_label (GtkWidget *sel_label)
LIVES_INLINE void g_list_free_strings (GList *slist)
gboolean cache_file_contents (const gchar *filename)
gchar * get_val_from_cached_list (const gchar *key, size_t maxlen)
gchar * clip_detail_to_string (lives_clip_details_t what, size_t *maxlenp)
gboolean get_clip_value (int which, lives_clip_details_t what, void *retval, size_t maxlen)
void save_clip_value (int which, lives_clip_details_t what, void *val)
GList * get_set_list (const gchar *dir)
gboolean check_for_ratio_fps (gdouble fps)
gdouble get_ratio_fps (const gchar *string)
gchar * remove_trailing_zeroes (gdouble val)
guint get_signed_endian (gboolean is_signed, gboolean little_endian)
gint get_token_count (const gchar *string, int delim)
gchar * subst (const gchar *string, const gchar *from, const gchar *to)
gchar * insert_newlines (const gchar *text, int maxwidth)
gint hextodec (const gchar *string)
gint get_hex_digit (const gchar *c)
LIVES_INLINE guint32 fastrand (void)
void fastsrand (guint32 seed)
gboolean is_writeable_dir (const gchar *dir)
uint64_t get_fs_free (const char *dir)
LIVES_INLINE LiVESInterpType get_interp_value (gshort quality)
LIVES_INLINE GList * g_list_move_to_first (GList *list, GList *item)
GList * g_list_delete_string (GList *list, char *string)
GList * g_list_copy_strings (GList *list)
gboolean string_lists_differ (GList *alist, GList *blist)
lives_cancel_t check_for_bad_ffmpeg (void)

Macro Definition Documentation

#define ASPECT_ALLOWANCE   0.005
#define rand_a   1073741789L
#define rand_c   32749L

Function Documentation

void activate_url ( GtkAboutDialog *  about,
const gchar *  link,
gpointer  data 
)
void activate_url_inner ( const gchar *  link)
gboolean add_lmap_error ( lives_lmap_error_t  lerror,
const gchar *  name,
gpointer  user_data,
gint  clipno,
gint  frameno,
gdouble  atime,
gboolean  affects_current 
)
void add_to_recent ( const gchar *  filename,
gdouble  start,
gint  frames,
const gchar *  extra_params 
)
gboolean after_foreign_play ( void  )
gboolean cache_file_contents ( const gchar *  filename)
void calc_aframeno ( gint  fileno)
LIVES_INLINE gint calc_frame_from_time ( gint  filenum,
gdouble  time 
)

nearest frame start

LIVES_INLINE gint calc_frame_from_time2 ( gint  filenum,
gdouble  time 
)

nearest frame end

LIVES_INLINE gint calc_frame_from_time3 ( gint  filenum,
gdouble  time 
)

nearest frame mid

void calc_maxspect ( gint  rwidth,
gint  rheight,
gint *  cwidth,
gint *  cheight 
)
gint calc_new_playback_position ( gint  fileno,
gint64  otc,
gint64 *  ntc 
)
LIVES_INLINE gdouble calc_time_from_frame ( gint  clip,
gint  frame 
)
gboolean check_dev_busy ( gchar *  devstr)
gboolean check_dir_access ( const gchar *  dir)
gboolean check_file ( const gchar *  file_name,
gboolean  check_existing 
)

check if file exists

lives_cancel_t check_for_bad_ffmpeg ( void  )
gboolean check_for_lock_file ( const gchar *  set_name,
gint  type 
)
gboolean check_for_ratio_fps ( gdouble  fps)
gboolean check_frame_count ( gint  idx)
void clear_lmap_errors ( void  )
LIVES_INLINE void clear_mainw_msg ( void  )
gchar* clip_detail_to_string ( lives_clip_details_t  what,
size_t *  maxlenp 
)
void colour_equal ( GdkColor *  c1,
const GdkColor *  c2 
)
gboolean create_event_space ( gint  length)
void d_print ( const gchar *  text)
void draw_little_bars ( gdouble  ptrtime)
gchar* ensure_extension ( const gchar *  fname,
const gchar *  ext 
)
gboolean ensure_isdir ( gchar *  fname)
LIVES_INLINE guint32 fastrand ( void  )
void fastsrand ( guint32  seed)
char* filename_from_fd ( char *  val,
int  fd 
)
void find_when_to_stop ( void  )
LIVES_INLINE GList* g_list_append_unique ( GList *  xlist,
const gchar *  add 
)
GList* g_list_copy_strings ( GList *  list)
GList* g_list_delete_string ( GList *  list,
char *  string 
)
LIVES_INLINE void g_list_free_strings ( GList *  slist)
LIVES_INLINE GList* g_list_move_to_first ( GList *  list,
GList *  item 
)
LIVES_INLINE gchar* g_strappend ( gchar *  string,
gint  len,
const gchar *  xnew 
)
LIVES_INLINE int get_approx_ln ( guint  x)
void get_basename ( gchar *  filename)
gboolean get_clip_value ( int  which,
lives_clip_details_t  what,
void *  retval,
size_t  maxlen 
)
gchar* get_dir ( const gchar *  filename)
void get_dirname ( gchar *  filename)
gchar* get_extension ( const gchar *  filename)
uint64_t get_file_size ( int  fd)
void get_filename ( gchar *  filename,
gboolean  strip_dir 
)
void get_frame_count ( gint  idx)
uint64_t get_fs_free ( const char *  dir)
gint get_hex_digit ( const gchar *  c)
LIVES_INLINE LiVESInterpType get_interp_value ( gshort  quality)
void get_location ( const gchar *  exe,
gchar *  val,
gint  maxlen 
)
void get_menu_text ( GtkWidget *  menuitem,
gchar *  text 
)
void get_menu_text_long ( GtkWidget *  menuitem,
gchar *  text 
)
void get_next_free_file ( void  )
void get_play_times ( void  )
gdouble get_ratio_fps ( const gchar *  string)
GList* get_set_list ( const gchar *  dir)
guint get_signed_endian ( gboolean  is_signed,
gboolean  little_endian 
)
lives_storage_status_t get_storage_status ( const char *  dir,
guint64  warn_level,
guint64 *  dsval 
)
gint get_token_count ( const gchar *  string,
int  delim 
)
void get_total_time ( file file)
gchar* get_val_from_cached_list ( const gchar *  key,
size_t  maxlen 
)
guint64 get_version_hash ( const gchar *  exe,
const gchar *  sep,
int  piece 
)
gint hextodec ( const gchar *  string)
void init_clipboard ( void  )
gchar* insert_newlines ( const gchar *  text,
int  maxwidth 
)

< we will insert a nl here

LIVES_INLINE gboolean int_array_contains_value ( int *  array,
int  num_elems,
int  value 
)
gboolean is_legal_set_name ( const gchar *  set_name,
gboolean  allow_dupes 
)
gboolean is_writeable_dir ( const gchar *  dir)
LIVES_INLINE float LEFloat_to_BEFloat ( float  f)
LIVES_INLINE uint64_t lives_10pow ( int  pow)
void lives_alarm_clear ( int  alarm_handle)
gboolean lives_alarm_get ( int  alarm_handle)
int lives_alarm_set ( int64_t  ticks)

set alarm for now + delta ticks (10 nanosec) param ticks (10 nanoseconds) is the offset when we want our alarm to trigger returns int handle or -1 call lives_get_alarm(handle) to test if time arrived

int lives_chdir ( const char *  path,
gboolean  allow_fail 
)
char* lives_fgets ( char *  s,
int  size,
FILE *  stream 
)
lives_pid_t lives_fork ( const char *  com)
gchar* lives_format_storage_space_string ( guint64  space)
int lives_fputs ( const char *  s,
FILE *  stream 
)
LIVES_INLINE void lives_freep ( void **  ptr)
LIVES_INLINE boolean lives_fsync ( int  fd)
int64_t lives_get_current_ticks ( void  )

return current (wallclock) time in ticks (units of 10 nanoseconds)

LIVES_INLINE int lives_getgid ( void  )
LIVES_INLINE pid_t lives_getpid ( void  )
LIVES_INLINE int lives_getuid ( void  )
LIVES_INLINE int lives_kill ( lives_pid_t  pid,
int  sig 
)
LIVES_INLINE int lives_killpg ( lives_pgid_t  pgrp,
int  sig 
)
gint lives_list_index ( GList *  list,
const gchar *  data 
)
LIVES_INLINE uint64_t lives_random ( void  )
ssize_t lives_read ( int  fd,
void *  buf,
size_t  count,
gboolean  allow_less 
)
ssize_t lives_read_le ( int  fd,
void *  buf,
size_t  count,
gboolean  allow_less 
)
LIVES_INLINE ssize_t lives_readlink ( const char *  path,
char *  buf,
size_t  bufsiz 
)
LIVES_INLINE boolean lives_setenv ( const char *  name,
const char *  value 
)
LIVES_INLINE void lives_srandom ( unsigned int  seed)
LIVES_INLINE void lives_sync ( void  )
int lives_system ( const char *  com,
gboolean  allow_error 
)
ssize_t lives_write ( int  fd,
const void *  buf,
size_t  count,
gboolean  allow_fail 
)
ssize_t lives_write_le ( int  fd,
const void *  buf,
size_t  count,
gboolean  allow_fail 
)
void minimise_aspect_delta ( gdouble  aspect,
gint  hblock,
gint  vblock,
gint  hsize,
gint  vsize,
gint *  width,
gint *  height 
)
LIVES_INLINE gint myround ( gdouble  n)
void prepare_to_play_foreign ( void  )
void reget_afilesize ( int  fileno)
void remove_layout_files ( GList *  map)
gchar* remove_trailing_zeroes ( gdouble  val)
gchar* repl_tmpdir ( const gchar *  entry,
gboolean  fwd 
)
void reset_clip_menu ( void  )
void save_clip_value ( int  which,
lives_clip_details_t  what,
void *  val 
)
void set_menu_text ( GtkWidget *  menuitem,
const gchar *  text,
gboolean  use_mnemonic 
)
void set_redoable ( const gchar *  what,
gboolean  sensitive 
)
void set_sel_label ( GtkWidget *  sel_label)
void set_undoable ( const gchar *  what,
gboolean  sensitive 
)
uint64_t sget_file_size ( const gchar *  name)
void show_manual_section ( const gchar *  lang,
const gchar *  section 
)
gboolean string_lists_differ ( GList *  alist,
GList *  blist 
)
gchar* subst ( const gchar *  string,
const gchar *  from,
const gchar *  to 
)
gboolean switch_aud_to_jack ( void  )
void switch_aud_to_mplayer ( gboolean  set_in_prefs)
gboolean switch_aud_to_pulse ( void  )
void switch_aud_to_sox ( gboolean  set_in_prefs)
gint verhash ( gchar *  version)
void zero_spinbuttons ( void  )