gmerlin
Functions
Misc stuff

Functions

void bg_hexdump (uint8_t *data, int len, int linebreak)
 Do a hexdump of binary data. More...
 
char * bg_audio_format_to_string (gavl_audio_format_t *format, int use_tabs)
 Convert an audio format to a string. More...
 
char * bg_video_format_to_string (gavl_video_format_t *format, int use_tabs)
 Convert a video format to a string. More...
 
char * bg_get_stream_label (int index, const gavl_metadata_t *m)
 Create a stream label. More...
 
void bg_dprintf (const char *format,...) __attribute__((format(printf
 Dump to stderr. More...
 
void void bg_diprintf (int indent, const char *format,...) __attribute__((format(printf
 Dump to stderr with intendation. More...
 
void void void * bg_read_file (const char *filename, int *len)
 Read an entire file into a buffer. More...
 
int bg_write_file (const char *filename, void *data, int len)
 Write an entire file into a buffer. More...
 
int bg_lock_file (FILE *f, int wr)
 Lock a file for exclusive access. More...
 
int bg_unlock_file (FILE *f)
 Unlock a file for exclusive access. More...
 
size_t bg_file_size (FILE *f)
 Get the size of an open file. More...
 
const char * bg_iso639_b_to_t (const char *code)
 Convert a ISO 639-2/B language code to a ISO 639-2/T code. More...
 
const char * bg_iso639_t_to_b (const char *code)
 Convert a ISO 639-2/T language code to a ISO 639-2/B code. More...
 
void bg_metadata_date_now (gavl_metadata_t *m, const char *key)
 Set a date and time field of the metadata from the lcoal time. More...
 
void bg_daemonize ()
 Make the current process become a daemon. More...
 

Detailed Description

Function Documentation

◆ bg_hexdump()

void bg_hexdump ( uint8_t *  data,
int  len,
int  linebreak 
)

Do a hexdump of binary data.

Parameters
dataData
lenLength
linebreakHow many bytes to print in each line before a linebreak

This is mostly for debugging

◆ bg_audio_format_to_string()

char* bg_audio_format_to_string ( gavl_audio_format_t format,
int  use_tabs 
)

Convert an audio format to a string.

Parameters
formatAn audio format
use_tabs1 to use tabs for separating field names and values
Returns
A newly allocated string

◆ bg_video_format_to_string()

char* bg_video_format_to_string ( gavl_video_format_t format,
int  use_tabs 
)

Convert a video format to a string.

Parameters
formatA video format
use_tabs1 to use tabs for separating field names and values
Returns
A newly allocated string

◆ bg_get_stream_label()

char* bg_get_stream_label ( int  index,
const gavl_metadata_t *  m 
)

Create a stream label.

Parameters
indexIndex of the stream (starting with 0)
mMetadata
Returns
A newly allocated string

◆ bg_dprintf()

void bg_dprintf ( const char *  format,
  ... 
)

Dump to stderr.

Parameters
formatFormat (printf compatible)

◆ bg_diprintf()

void void bg_diprintf ( int  indent,
const char *  format,
  ... 
)

Dump to stderr with intendation.

Parameters
indentHow many spaces to prepend
formatFormat (printf compatible)

◆ bg_read_file()

void void void* bg_read_file ( const char *  filename,
int *  len 
)

Read an entire file into a buffer.

Parameters
filenameName of the file
lenReturns the length in bytes
Returns
A buffer containing the entire file

◆ bg_write_file()

int bg_write_file ( const char *  filename,
void *  data,
int  len 
)

Write an entire file into a buffer.

Parameters
filenameName of the file
dataData to write
lenLength in bytes
Returns
1 on success, 0 on failure

◆ bg_lock_file()

int bg_lock_file ( FILE *  f,
int  wr 
)

Lock a file for exclusive access.

Parameters
fAn open file
wrAn open file
Returns
1 on success, 0 on failure

◆ bg_unlock_file()

int bg_unlock_file ( FILE *  f)

Unlock a file for exclusive access.

Parameters
fAn open file
Returns
1 on success, 0 on failure

◆ bg_file_size()

size_t bg_file_size ( FILE *  f)

Get the size of an open file.

Parameters
fA file opened for reading
Returns
File size in bytes

◆ bg_iso639_b_to_t()

const char* bg_iso639_b_to_t ( const char *  code)

Convert a ISO 639-2/B language code to a ISO 639-2/T code.

Parameters
codeISO 639-2/B
Returns
ISO 639-2/T code

◆ bg_iso639_t_to_b()

const char* bg_iso639_t_to_b ( const char *  code)

Convert a ISO 639-2/T language code to a ISO 639-2/B code.

Parameters
codeISO 639-2/T
Returns
ISO 639-2/B code

◆ bg_metadata_date_now()

void bg_metadata_date_now ( gavl_metadata_t *  m,
const char *  key 
)

Set a date and time field of the metadata from the lcoal time.

Parameters
mMetadata
fieldField to set

◆ bg_daemonize()

void bg_daemonize ( )

Make the current process become a daemon.