xine-lib: xine-lib-1.2.13/src/xine-utils/utils.c File Reference

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Enumerations | Functions | Variables
utils.c File Reference
`#include <xine/xineutils.h>`
`#include <xine/xineintl.h>`
`#include "xine_private.h"`
`#include "../xine-engine/bswap.h"`
`#include <errno.h>`
`#include <sys/types.h>`
`#include <sys/time.h>`
`#include <time.h>`
`#include <unistd.h>`
`#include <fcntl.h>`
`#include <ctype.h>`

## Data Structures
struct | lang_locale_t
struct | xine_fast_text_s
struct | _xine_ref_string_head_t
struct | xine_pts_queue_s

## Macros
#define | _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */
#define | O_CLOEXEC 0
#define | BUFSIZ 256
#define | XINE_MEM_ALIGN 32
#define | XINE_MEM_ADD (sizeof (size_t) + XINE_MEM_ALIGN)
#define | XINE_MEM_MASK ((uintptr_t)XINE_MEM_ALIGN - 1)
#define | rr 128 /* repeat */
#define | ss 64 /* stop */
#define | rev32(n) (((n) << 24) | (((n) << 8) & 0xff0000) | (((n) >> 8) & 0xff00) | ((n) >> 24))
#define | rev16(n) ((((n) << 8) | ((n) >> 8)) & 0xffff)
#define | XFST_ALIGN (16)
#define | XFST_MIN_SIZE ((XFST_ALIGN + 2 + XFST_ALIGN - 1) & ~(XFST_ALIGN - 1))
#define | XPQ_BACKLOG_LD 3
#define | XPQ_BACKLOG_SIZE (1 << XPQ_BACKLOG_LD)
#define | XPQ_BACKLOG_MASK (XPQ_BACKLOG_SIZE - 1)
#define | _DC_DIGIT 1
#define | _DC_SPACE 2
#define | _DC_Tt 4
#define | _DC_Zz 8
#define | _DC_PLUS 16
#define | _DC_MINUS 32
#define | _DC_DOT 64
#define | _DC_END 128
#define | _DV_HAVE_DATE 1
#define | _DV_HAVE_TIME 2
#define | _DV_HAVE_ZONE 4
#define | _DV_HAVE_JTIME 16

## Enumerations
enum | xine_pts_queue_action_t { XPQ_A_NONE = 0 , XPQ_A_STALL , XPQ_A_PUT , XPQ_A_READY , XPQ_A_GET }

## Functions
void * | xine_xmalloc (size_t size)
| Allocate and clean memory size_t 'size', then return the pointer to the allocated memory.
void * | xine_xcalloc (size_t nmemb, size_t size)
| Wrapper around calloc() function.
void * | xine_memdup (const void *src, size_t length)
void * | xine_memdup0 (const void *src, size_t length)
const char * | xine_get_homedir (void)
char * | xine_chomp (char *str)
void | xine_usec_sleep (unsigned usec)
void | xine_hexdump (const void *buf_gen, int length)
static const lang_locale_t * | _get_first_lang_locale (const char *lcal)
static char * | _get_lang (void)
char * | xine_get_system_encoding (void)
const char * | xine_guess_spu_encoding (void)
int | xine_monotonic_clock (struct timeval *tv, struct timezone *tz)
char * | xine_strcat_realloc (char **dest, const char *append)
char * | _x_asprintf (const char *format,...)
int | _x_set_file_close_on_exec (int fd)
| Make file descriptors and sockets uninheritable.
int | _x_set_socket_close_on_exec (int s)
int | xine_open_cloexec (const char *name, int flags)
int | xine_create_cloexec (const char *name, int flags, mode_t mode)
int | xine_socket_cloexec (int domain, int type, int protocol)
void * | xine_mallocz_aligned (size_t size)
void * | xine_malloc_aligned (size_t size)
void | xine_free_aligned (void *ptr)
void * | xine_realloc_aligned (void *ptr, size_t size)
size_t | xine_base64_encode (uint8_t *from, char *to, size_t size)
size_t | xine_base64_decode (const char *from, uint8_t *to)
uint32_t | xine_crc32_ieee (uint32_t crc, const uint8_t *data, size_t len)
uint32_t | xine_crc16_ansi (uint32_t crc, const uint8_t *data, size_t len)
size_t | xine_fast_string_need (size_t max_strlen)
char * | xine_fast_string_init (char *buf, size_t bsize)
size_t | xine_fast_string_max (char *fast_string)
char * | xine_fast_string_set (char *fast_string, const char *text, size_t tsize)
int | xine_fast_string_cmp (char *fast_string1, char *fast_string2)
void | xine_fast_string_free (char **fast_string)
xine_fast_text_t * | xine_fast_text_load (const char *filename, size_t max_size)
char * | xine_fast_text_line (xine_fast_text_t *xft, size_t *linesize)
void | xine_fast_text_unload (xine_fast_text_t **xft)
static _xine_ref_string_head_t * | _xine_ref_string_head (char *s)
char * | xine_ref_string_ref (const char *s, int len)
size_t | xine_ref_string_len (const char *s)
int | xine_ref_string_unref (char **s)
xine_pts_queue_t * | xine_pts_queue_new (void)
void | xine_pts_queue_reset (xine_pts_queue_t *q)
void | xine_pts_queue_put (xine_pts_queue_t *q, size_t bytes, int64_t pts)
int64_t | xine_pts_queue_get (xine_pts_queue_t *q, size_t bytes)
void | xine_pts_queue_delete (xine_pts_queue_t **q)
int | xine_ts_from_string (struct timespec *ts, const char *s)
void | xine_ts_add (struct timespec *a, const struct timespec *b)
void | xine_ts_sub (struct timespec *a, const struct timespec *b)
int64_t | xine_ts_to_timebase (const struct timespec *ts, uint32_t timebase)
void | xine_rats_shorten (xine_rats_t *value)

## Variables
static const lang_locale_t | lang_locales []
static uint32_t | tab_crc32_ieee [1280] = {0, 0,}
static uint16_t | tab_crc16_ansi [768] = {0, 0,}
union { |
uint8_t z [4] |
uint32_t v |
} | _xine_fast_string_mask [8] |

## Macro Definition Documentation

## ◆ _DC_DIGIT

#define _DC_DIGIT 1

Referenced by xine_ts_from_string().

## ◆ _DC_DOT

#define _DC_DOT 64

Referenced by xine_ts_from_string().

## ◆ _DC_END

#define _DC_END 128

Referenced by xine_ts_from_string().

## ◆ _DC_MINUS

#define _DC_MINUS 32

Referenced by xine_ts_from_string().

## ◆ _DC_PLUS

#define _DC_PLUS 16

Referenced by xine_ts_from_string().

## ◆ _DC_SPACE

#define _DC_SPACE 2

Referenced by xine_ts_from_string().

## ◆ _DC_Tt

#define _DC_Tt 4

Referenced by xine_ts_from_string().

## ◆ _DC_Zz

#define _DC_Zz 8

Referenced by xine_ts_from_string().

## ◆ _DV_HAVE_DATE

#define _DV_HAVE_DATE 1

Referenced by xine_ts_from_string().

## ◆ _DV_HAVE_JTIME

#define _DV_HAVE_JTIME 16

Referenced by xine_ts_from_string().

## ◆ _DV_HAVE_TIME

#define _DV_HAVE_TIME 2

Referenced by xine_ts_from_string().

## ◆ _DV_HAVE_ZONE

#define _DV_HAVE_ZONE 4

Referenced by xine_ts_from_string().

## ◆ _POSIX_PTHREAD_SEMANTICS

#define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */

## ◆ BUFSIZ

#define BUFSIZ 256

Referenced by xine_get_homedir().

## ◆ O_CLOEXEC

#define O_CLOEXEC 0

Referenced by xine_create_cloexec(), and xine_open_cloexec().

## ◆ rev16

#define rev16 | ( |  | n | ) | ((((n) << 8) | ((n) >> 8)) & 0xffff)

Referenced by xine_crc16_ansi().

## ◆ rev32

#define rev32 | ( |  | n | ) | (((n) << 24) | (((n) << 8) & 0xff0000) | (((n) >> 8) & 0xff00) | ((n) >> 24))

Referenced by xine_crc32_ieee().

## ◆ rr

#define rr 128 /* repeat */

Referenced by rgb2yuy2_alloc(), and xine_base64_decode().

## ◆ ss

#define ss 64 /* stop */

Referenced by ao_pulse_open(), and xine_base64_decode().

## ◆ XFST_ALIGN

#define XFST_ALIGN (16)

Referenced by xine_fast_string_init(), xine_fast_string_need(), and xine_fast_string_set().

## ◆ XFST_MIN_SIZE

#define XFST_MIN_SIZE ((XFST_ALIGN + 2 + XFST_ALIGN - 1) & ~(XFST_ALIGN - 1))

Referenced by xine_fast_string_init().

## ◆ XINE_MEM_ADD

#define XINE_MEM_ADD (sizeof (size_t) + XINE_MEM_ALIGN)

Referenced by xine_malloc_aligned(), xine_mallocz_aligned(), and xine_realloc_aligned().

## ◆ XINE_MEM_ALIGN

#define XINE_MEM_ALIGN 32

## ◆ XINE_MEM_MASK

#define XINE_MEM_MASK ((uintptr_t)XINE_MEM_ALIGN - 1)

Referenced by xine_malloc_aligned(), xine_mallocz_aligned(), and xine_realloc_aligned().

## ◆ XPQ_BACKLOG_LD

#define XPQ_BACKLOG_LD 3

## ◆ XPQ_BACKLOG_MASK

#define XPQ_BACKLOG_MASK (XPQ_BACKLOG_SIZE - 1)

Referenced by xine_pts_queue_get(), and xine_pts_queue_put().

## ◆ XPQ_BACKLOG_SIZE

#define XPQ_BACKLOG_SIZE (1 << XPQ_BACKLOG_LD)

Referenced by xine_pts_queue_get().

## Enumeration Type Documentation

## ◆ xine_pts_queue_action_t

enum xine_pts_queue_action_t

Enumerator
XPQ_A_NONE |
XPQ_A_STALL |
XPQ_A_PUT |
XPQ_A_READY |
XPQ_A_GET |

## Function Documentation

## ◆ _get_first_lang_locale()

static const lang_locale_t * _get_first_lang_locale | ( | const char * | lcal | ) |
| static

References lang_locales, lang_locale_t::modifier, and NULL.

Referenced by xine_get_system_encoding(), and xine_guess_spu_encoding().

## ◆ _get_lang()

static char * _get_lang | ( | void |  | ) |
| static

Referenced by xine_get_system_encoding(), and xine_guess_spu_encoding().

## ◆ _x_asprintf()

char * _x_asprintf | ( | const char * | format,
|  |  | ... )

References NULL.

Referenced by _cdda_parse_cddb_info(), _connect_data(), _cwd(), _ftp_size(), _get_exports(), _get_files(), _get_files(), _get_servers(), _login(), _read_dir(), _rest(), _retr(), _ssh_connect(), _x_canonicalise_url(), _x_real_codec_open(), bluray_class_get_dir(), dvb_class_get_autoplay_list(), file_input_class_get_dir(), get_help(), getdladdr(), make_base_save_name(), make_save_name(), make_temp_name(), mosaico_open_plugin(), rtsp_class_get_instance(), rtsp_connect(), rtsp_read_data(), rtsp_request_describe(), rtsp_request_options(), rtsp_request_play(), rtsp_request_setparameter(), rtsp_schedule_standard(), rtsp_send_request(), smb_class_get_dir(), test_make(), tuner_init(), vcd_class_get_autoplay_list(), vcd_class_get_dir(), and vdr_plugin_open_fifo_mrl().

## ◆ _x_set_file_close_on_exec()

int _x_set_file_close_on_exec | ( | int | fd | ) |

Make file descriptors and sockets uninheritable.

Referenced by xine_create_cloexec(), and xine_open_cloexec().

## ◆ _x_set_socket_close_on_exec()

int _x_set_socket_close_on_exec | ( | int | s | ) |

Referenced by manager_loop(), and xine_socket_cloexec().

## ◆ _xine_ref_string_head()

static _xine_ref_string_head_t * _xine_ref_string_head | ( | char * | s | ) |
| static

References _xine_ref_string_head_t::magic, NULL, and v.

Referenced by xine_ref_string_len(), xine_ref_string_ref(), and xine_ref_string_unref().

## ◆ xine_base64_decode()

size_t xine_base64_decode | ( | const char * | from,
|  | uint8_t * | to )

Base64 decoder. from: pointer to input string or line formatted / indented, null terminated text. to: pointer to output buffer. ret: length of output in bytes.

References rr, ss, and v.

Referenced by config_register_serialized_entry(), sdpplin_parse(), and sdpplin_parse_stream().

## ◆ xine_base64_encode()

size_t xine_base64_encode | ( | uint8_t * | from,
|  | char * | to,
|  | size_t | size )

Base64 encoder. from: pointer to binary input. to: pointer to output string buffer. size: byte length of input. ret: length of output string (without \0). Note that both buffers need 4 writable padding bytes.

References _X_BE_24, and v.

Referenced by _cdda_cdindex(), config_get_serialized_entry(), http_plugin_basicauth(), and rtsp_basicauth().

## ◆ xine_chomp()

char * xine_chomp | ( | char * | str | ) |

## ◆ xine_crc16_ansi()

uint32_t xine_crc16_ansi | ( | uint32_t | crc,
|  | const uint8_t * | data,
|  | size_t | len )

References rev16, tab_crc16_ansi, and v.

Referenced by xine_a52_parse_data().

## ◆ xine_crc32_ieee()

uint32_t xine_crc32_ieee | ( | uint32_t | crc,
|  | const uint8_t * | data,
|  | size_t | len )

Checksum calculator.

References rev32, tab_crc32_ieee, and v.

Referenced by demux_ts_parse_pat(), demux_ts_parse_pmt(), and ts_rewrite_packets().

## ◆ xine_create_cloexec()

int xine_create_cloexec | ( | const char * | name,
|  | int | flags,
|  | mode_t | mode )

creates a file, ensuring that the descriptor will be closed automatically after a fork/execute.

References _x_set_file_close_on_exec(), mode(), name, and O_CLOEXEC.

Referenced by ao_file_open(), do_record(), open_plugin(), and pvr_break_rec_page().

## ◆ xine_fast_string_cmp()

int xine_fast_string_cmp | ( | char * | fast_string1,
|  | char * | fast_string2 )

fast strcmp (). BTW: XINE_PROTECTED does not link on some systems when doing xine_sarray_new (size, (xine_sarray_comparator_t)xine_fast_string_cmp);.

References _xine_fast_string_mask, and v.

Referenced by _config_fat_entry_cmp(), and _fat_node_file_cmp().

## ◆ xine_fast_string_free()

void xine_fast_string_free | ( | char ** | fast_string | ) |

free a fast string if it is not application supplied.

References NULL.

## ◆ xine_fast_string_init()

char * xine_fast_string_init | ( | char * | buf,
|  | size_t | bsize )

set up a fast string inside an application supplied buffer.

References NULL, XFST_ALIGN, and XFST_MIN_SIZE.

Referenced by _config_fat_entry_cmp(), _x_scan_plugins(), config_insert(), and load_plugin_list().

## ◆ xine_fast_string_max()

size_t xine_fast_string_max | ( | char * | fast_string | ) |

return the actual max strlen.

## ◆ xine_fast_string_need()

size_t xine_fast_string_need | ( | size_t | max_strlen | ) |

return the byte size needed for an application supplied buffer.

References XFST_ALIGN.

## ◆ xine_fast_string_set()

char * xine_fast_string_set | ( | char * | fast_string,
|  | const char * | text,
|  | size_t | tsize )

set or change the contents of a fast string. fast_text may be NULL, to allocate a new one. you can even edit the string manually, then apply the new size with text == NULL.

References _xine_fast_string_mask, NULL, v, and XFST_ALIGN.

Referenced by _config_fat_entry_cmp(), collect_plugins(), config_insert(), and load_plugin_list().

## ◆ xine_fast_text_line()

char * xine_fast_text_line | ( | xine_fast_text_t * | xft,
|  | size_t * | linesize )

get next line. you may modify return[0] ... return[filesize]. it all stays valid until xine_fast_text_unload ().

References xine_fast_text_s::dummy, xine_fast_text_s::flags, xine_fast_text_s::line_start, NULL, xine_fast_text_s::scan_here, xine_fast_text_s::text_len, and v.

Referenced by load_plugin_list(), and xine_config_load().

## ◆ xine_fast_text_load()

xine_fast_text_t * xine_fast_text_load | ( | const char * | filename,
|  | size_t | max_size )

load fast text from file.

References xine_fast_text_s::dummy, xine_fast_text_s::flags, xine_fast_text_s::line_start, NULL, xine_fast_text_s::scan_here, and xine_fast_text_s::text_len.

Referenced by load_plugin_list(), and xine_config_load().

## ◆ xine_fast_text_unload()

void xine_fast_text_unload | ( | xine_fast_text_t ** | xft | ) |

free the text.

References NULL.

Referenced by load_plugin_list(), and xine_config_load().

## ◆ xine_free_aligned()

void xine_free_aligned | ( | void * | ptr | ) |

Referenced by _x_ao_new_port(), _x_yv12_to_nv12(), aa_dispose_frame(), caca_dispose_frame(), dispose_ximage(), ff_audio_dispose(), ff_audio_open_plugin(), fifo_buffer_dispose(), opengl_frame_dispose(), raw_frame_dispose(), raw_update_frame_format(), rgb2yv12_slice(), vdpau_dispose(), vdpau_overlay_end(), vdpau_process_overlays(), xshm_frame_dispose(), xshm_frame_dispose(), xv_frame_dispose(), xv_rem_yuy2_emu(), xv_rem_yuy2_emu(), and yuv2rgb_dispose().

## ◆ xine_get_homedir()

const char * xine_get_homedir | ( | void |  | ) |

References BUFSIZ, and NULL.

Referenced by _ssh_connect(), _x_scan_plugins(), config_save_cb(), do_record(), file_input_class_get_dir(), and xine_init().

## ◆ xine_get_system_encoding()

char * xine_get_system_encoding | ( | void |  | ) |

get encoding of current locale

References _get_first_lang_locale(), _get_lang(), lang_locale_t::encoding, and NULL.

Referenced by _meta_info_set_encoding(), and osd_set_encoding().

## ◆ xine_guess_spu_encoding()

const char * xine_guess_spu_encoding | ( | void |  | ) |

References _get_first_lang_locale(), _get_lang(), and lang_locale_t::spu_encoding.

Referenced by init_spu_decoder_plugin().

## ◆ xine_hexdump()

void xine_hexdump | ( | const void * | buf_gen,
|  | int | length )

Referenced by atom_scan(), decode_audio_header(), decode_dshow_header(), decode_flac_header(), decode_video_header(), hash(), init_codec(), init_codec(), pnm_get_chunk(), pnm_get_stream_chunk(), real_get_rdt_chunk(), real_parse_mdpr(), realdec_decode_data(), select_mlti_data(), send_header(), and vorbis_decode_data().

## ◆ xine_malloc_aligned()

void * xine_malloc_aligned | ( | size_t | size | ) |

References NULL, XINE_MEM_ADD, and XINE_MEM_MASK.

Referenced by _x_yv12_to_nv12(), create_ximage(), ff_audio_open_plugin(), mem_frame_update_frame_format(), rgb2yv12_slice(), vdpau_duplicate_frame_data(), vdpau_update_frame_format(), xshm_update_frame_format(), xshm_update_frame_format(), xv_add_yuy2_emu(), xv_add_yuy2_emu(), and yuv2rgb_configure().

## ◆ xine_mallocz_aligned()

void * xine_mallocz_aligned | ( | size_t | size | ) |

References NULL, XINE_MEM_ADD, and XINE_MEM_MASK.

Referenced by _x_ao_new_port(), _x_fifo_buffer_new(), _x_vo_new_port(), aa_update_frame_format(), caca_update_frame_format(), frame_reallocate(), init_yuv_planes(), initNoise(), mpeg2_init(), opengl_update_frame_format(), raw_update_frame_format(), vdpau_overlay_end(), and vdpau_process_overlays().

## ◆ xine_memdup()

void * xine_memdup | ( | const void * | src,
|  | size_t | length )

References NULL, and xine_fast_memcpy.

Referenced by rmff_new_mdpr().

## ◆ xine_memdup0()

void * xine_memdup0 | ( | const void * | src,
|  | size_t | length )

References NULL, and xine_fast_memcpy.

## ◆ xine_monotonic_clock()

int xine_monotonic_clock | ( | struct timeval * | tv,
|  | struct timezone * | tz )

References lprintf.

Referenced by ao_file_delay(), ao_file_open(), ao_oss_delay(), ao_oss_write(), get_time(), open_plugin(), pvrscr_adjust(), pvrscr_adjust(), pvrscr_get_current(), pvrscr_get_current(), pvrscr_set_pivot(), pvrscr_set_pivot(), pvrscr_start(), pvrscr_start(), rip_plugin_seek(), stretchscr_adjust(), stretchscr_get_current(), stretchscr_set_pivot(), stretchscr_start(), unixscr_adjust(), unixscr_get_current(), unixscr_set_pivot(), unixscr_start(), and v4l2_input_read_block().

## ◆ xine_open_cloexec()

int xine_open_cloexec | ( | const char * | name,
|  | int | flags )

opens a file, ensuring that the descriptor will be closed automatically after a fork/execute.

References _x_set_file_close_on_exec(), name, and O_CLOEXEC.

Referenced by ao_oss_open(), ao_sun_open(), ao_sun_open_plugin(), cdda_open(), dvb_plugin_open(), dxr3_decode_data(), dxr3_open_plugin(), dxr3_overlay_end(), dxr3_scr_init(), dxr3_spudec_open_plugin(), dxr3_update_frame_format(), dxr3_vo_open_plugin(), file_input_open(), media_eject_media(), open_fb_device(), open_plugin(), open_radio_capture_device(), open_video_capture_device(), pvr_event_handler(), pvr_play_file(), pvr_plugin_open(), realtime_samplecounter_available(), setup_dga(), stdin_plugin_open(), switch_channel(), tuner_init(), v4l_class_get_radio_instance(), v4l_class_get_video_instance(), vcd_class_get_autoplay_list(), vcd_class_get_dir(), vcd_plugin_open(), and vdr_plugin_open_fifo_mrl().

## ◆ xine_pts_queue_delete()

void xine_pts_queue_delete | ( | xine_pts_queue_t ** | queue | ) |

you no longer need the queue.

References NULL.

Referenced by ff_audio_dispose().

## ◆ xine_pts_queue_get()

int64_t xine_pts_queue_get | ( | xine_pts_queue_t * | queue,
|  | size_t | bytes )

tell what the parser has delivered, and get the filtered pts or 0.

References xine_pts_queue_s::backlog, xine_pts_queue_s::bytes, xine_pts_queue_s::get, xine_pts_queue_s::last_action, xine_pts_queue_s::num, xine_pts_queue_s::pos, xine_pts_queue_s::pts, xine_pts_queue_s::put, xine_pts_queue_s::ring_pos, XPQ_A_GET, XPQ_BACKLOG_MASK, and XPQ_BACKLOG_SIZE.

Referenced by ff_audio_decode_data().

## ◆ xine_pts_queue_new()

xine_pts_queue_t * xine_pts_queue_new | ( | void |  | ) |

create a new instance.

Referenced by ff_audio_open_plugin().

## ◆ xine_pts_queue_put()

void xine_pts_queue_put | ( | xine_pts_queue_t * | queue,
|  | size_t | bytes,
|  | int64_t | pts )

tell what the parser has consumed. pts == 0 if unknown.

References xine_pts_queue_s::backlog, xine_pts_queue_s::get, xine_pts_queue_s::last_action, xine_pts_queue_s::last_pts, xine_pts_queue_s::pos, xine_pts_queue_s::pts, xine_pts_queue_s::put, xine_pts_queue_s::ring_pos, XPQ_A_PUT, XPQ_A_READY, XPQ_A_STALL, and XPQ_BACKLOG_MASK.

Referenced by ff_audio_decode_data().

## ◆ xine_pts_queue_reset()

void xine_pts_queue_reset | ( | xine_pts_queue_t * | queue | ) |

reset after a stream seek.

Referenced by ff_audio_open_codec(), and ff_audio_reset().

## ◆ xine_rats_shorten()

void xine_rats_shorten | ( | xine_rats_t * | value | ) |

xine rational numbers, taken from TJtools.

References xine_rats_t::den, and xine_rats_t::num.

Referenced by mpd_set_start_time().

## ◆ xine_realloc_aligned()

void * xine_realloc_aligned | ( | void * | ptr,
|  | size_t | size )

References NULL, xine_fast_memcpy, XINE_MEM_ADD, and XINE_MEM_MASK.

Referenced by ff_audio_ensure_buffer_size().

## ◆ xine_ref_string_len()

size_t xine_ref_string_len | ( | const char * | s | ) |

fast if s is a xine reference counted string.

References _xine_ref_string_head(), and _xine_ref_string_head_t::len.

Referenced by config_get_serialized_entry().

## ◆ xine_ref_string_ref()

char * xine_ref_string_ref | ( | const char * | s,
|  | int | len )

create or reuse a xine reference counted string, whose contents shall remain unchanged. use len == -1 if not kown.

References _xine_ref_string_head(), _xine_ref_string_head_t::len, _xine_ref_string_head_t::magic, NULL, _xine_ref_string_head_t::refs, and v.

Referenced by _x_scan_plugins(), config_register_key(), and config_register_serialized_entry().

## ◆ xine_ref_string_unref()

int xine_ref_string_unref | ( | char ** | s | ) |

same as x_freep if s is _not a xine reference counted string.

References _xine_ref_string_head(), NULL, and _xine_ref_string_head_t::refs.

Referenced by _x_dispose_plugins(), and config_reset_value().

## ◆ xine_socket_cloexec()

int xine_socket_cloexec | ( | int | domain,
|  | int | type,
|  | int | protocol )

creates a socket, ensuring that the descriptor will be closed automatically after a fork/execute.

References _x_set_socket_close_on_exec(), and type.

Referenced by _x_init_broadcaster(), _x_io_tcp_handshake_connect(), host_connect_attempt(), and vdr_plugin_open_socket().

## ◆ xine_strcat_realloc()

char * xine_strcat_realloc | ( | char ** | dest,
|  | const char * | append )

append to a string, reallocating normally, updates & returns *dest on error, *dest is unchanged & NULL is returned.

## ◆ xine_ts_add()

void xine_ts_add | ( | struct timespec * | a,
|  | const struct timespec * | b )

XINE_TS >= 1: a += b.

Referenced by mpd_set_frag_index().

## ◆ xine_ts_from_string()

int xine_ts_from_string | ( | struct timespec * | ts,
|  | const char * | s )

xine timespec magic, taken from TJtools.

References _DC_DIGIT, _DC_DOT, _DC_END, _DC_MINUS, _DC_PLUS, _DC_SPACE, _DC_Tt, _DC_Zz, _DV_HAVE_DATE, _DV_HAVE_JTIME, _DV_HAVE_TIME, _DV_HAVE_ZONE, type, v, and z.

Referenced by mpd_input_load_manifest(), and mpd_set_start_time().

## ◆ xine_ts_sub()

void xine_ts_sub | ( | struct timespec * | a,
|  | const struct timespec * | b )

XINE_TS >= 1: a -= b.

Referenced by mpd_set_frag_index(), and mpd_set_start_time().

## ◆ xine_ts_to_timebase()

int64_t xine_ts_to_timebase | ( | const struct timespec * | ts,
|  | uint32_t | timebase )

XINE_TS >= 1: ts * timebase.

Referenced by mpd_set_frag_index(), and mpd_set_start_time().

## ◆ xine_usec_sleep()

void xine_usec_sleep | ( | unsigned | usec | ) |

Referenced by _opensles_write(), _x_spu_decoder_sleep(), ao_dx2_write(), ao_file_delay(), ao_jack_write(), ao_none_write(), audio_decoder_loop(), bitplane_decode_data(), buffer_service(), dvb_parse_si(), dvb_plugin_read(), dvd_plugin_read_block(), dxr3_display_frame(), fifos_wait(), handle_libbluray_event(), metronom_handle_discontinuity(), pvr_plugin_read_block(), spudec_decode_data(), vaapi_x11_wait_event(), vdpau_h264_alter_frame_ready(), vdr_execute_rpc_command(), video_decoder_loop(), wait_secs(), xine_dvd_send_button_update(), xine_exit(), xine_profiler_print_results(), and xxmc_display_frame().

## ◆ xine_xcalloc()

void * xine_xcalloc | ( | size_t | nmemb,
|  | size_t | size )

Wrapper around calloc() function.

Parameters

  nmemb | Number of elements to allocate
  size | Size of each element to allocate

This is a simple wrapper around calloc(), the only thing it does more than calloc() is outputting an error if the calloc fails (returning NULL).

References __XINE_FUNCTION__, and NULL.

Referenced by open_film_file(), open_mve_file(), open_tta_file(), and parse_vbri_header().

## ◆ xine_xmalloc()

void * xine_xmalloc | ( | size_t | size | ) |

Allocate and clean memory size_t 'size', then return the pointer to the allocated memory.

Parameters

  size | Size of the memory area to allocate.

Returns
  A pointer to the allocated memory area, or NULL in case of error.

The behaviour of this function differs from standard malloc() as xine_xmalloc(0) will not return a NULL pointer, but rather a pointer to a memory area of size 1 byte.

The NULL value is only ever returned in case of an error in malloc(), and is reported to stderr stream.

Deprecated
  This function has been deprecated, as the behaviour of allocating a 1 byte memory area on zero size is almost never desired, and the function is thus mostly misused.

References __XINE_FUNCTION__, and NULL.

Referenced by fooviz_init_plugin().

## Variable Documentation

## ◆ [union]

const union { ... } _xine_fast_string_mask[8]

Initial value:
= {
{{0xff, 0xff, 0xff, 0xff}},
{{0x00, 0xff, 0xff, 0xff}},
{{0x00, 0x00, 0xff, 0xff}},
{{0x00, 0x00, 0x00, 0xff}},
{{0x00, 0x00, 0x00, 0x00}},
{{0xff, 0x00, 0x00, 0x00}},
{{0xff, 0xff, 0x00, 0x00}},
{{0xff, 0xff, 0xff, 0x00}}
}

Referenced by xine_fast_string_cmp(), and xine_fast_string_set().

## ◆ lang_locales

const lang_locale_t lang_locales[]
| static

Referenced by _get_first_lang_locale().

## ◆ tab_crc16_ansi

uint16_t tab_crc16_ansi[768] = {0, 0,}
| static

Referenced by xine_crc16_ansi().

## ◆ tab_crc32_ieee

uint32_t tab_crc32_ieee[1280] = {0, 0,}
| static

Referenced by xine_crc32_ieee().

## ◆ v

uint32_t v

Referenced by _get_hex(), _mad_fixed_2_db(), _mad_scale(), _ogl2_fmt2str(), _ogl2_str2hex(), _vdec_hw_h264_unescape(), _video_overlay_clip_trans(), _vovl_event_free_get(), _x_clut_yuv2rgb(), _x_spu_dvb_opacity(), _x_url_parse2(), _xine_ref_string_head(), _xine_str2secs(), _xine_stree_load_json(), _xine_stree_load_xml(), XineOpenGLView::acceptsFirstResponder, ao_esd_set_property(), ao_oss_get_property(), ao_oss_set_property(), asmrp_set_id(), audio_filter_equalize(), bebf_get(), bebf_skip(), bebf_sniff(), bebf_sync(), bits_read(), bits_set_buf(), bits_valid_left(), build_frame_table(), clut_to_argb(), config_update_string_e(), convert_yv12(), create_lut(), demux_qt_load_fragment_index(), demux_ts_parse_pat(), demux_ts_parse_pes_header(), demux_ts_parse_pmt(), detect_ts(), downmix_lfe_2(), draw_ifs(), dvd_parse_mrl(), faad_decode_audio(), fade(), fade_out_yuv(), ff_aac_mode_parse(), ff_audio_decode(), ff_audio_decode_data(), find_embedded_atoms(), flac_get_frame(), flac_init_frame_head(), flac_parse_frame_head(), flac_test_frame_head(), float_to_int(), frametype_h264(), frametype_h265(), frametype_mpeg(), frametype_vc1(), hexstr2uint32(), hls_bump_find(), hscale_chroma_line(), http_plugin_open(), iatan(), ifs_update(), init_plugin(), isqr(), lineNoise_C(), load_plugin_list(), mad_decode_data(), mpd_input_open(), mpeg1_read_pts(), mpeg2_read_pts(), mpeg_get_pts(), opengl2_open_plugin(), pgx64_overlay_key_blend(), process_alt_CLUT_segment(), process_CLUT_definition_segment(), put32le(), recalculate_trans(), rgb2yuy2_palette(), rgb2yuy2_slice(), saturate(), scale_int_do(), sha160_final(), simplify(), str2uint32(), str2uint32(), str2uint32(), str2uint64(), str2uint64(), str2usec(), tdaan_downmix16_4(), tdaan_levels_get(), test_make(), uint64_2str(), uint_sqrt(), unescape(), unixscr_adjust(), unixscr_get_current(), unixscr_init(), unixscr_set_pivot(), unixscr_set_speed(), unixscr_start(), vdec_hw_h264_put_frame(), vo_get_property(), vo_set_property(), vo_update_max_frame_rate(), vobsub_parse_palette(), w32v_decode_data(), x11osd_blend(), xcbosd_blend(), xine_base64_decode(), xine_base64_encode(), xine_crc16_ansi(), xine_crc32_ieee(), xine_fast_string_cmp(), xine_fast_string_set(), xine_fast_text_line(), xine_find_byte(), xine_gl_extensions_load(), xine_init(), xine_int32_2str(), xine_ref_string_ref(), xine_refs_add(), xine_refs_get(), xine_refs_sub(), xine_str2int32(), xine_str2uint32(), xine_str2uint64(), xine_stree_find(), xine_string_unampersand(), xine_string_unbackslash(), xine_string_unpercent(), xine_ts_from_string(), xine_uint32_2str(), xine_uint64_2str(), xml_parser_get_property_bool(), xml_parser_get_property_int(), yuv2rgb_single_pixel_16(), yuv2rgb_single_pixel_24_bgr(), yuv2rgb_single_pixel_24_rgb(), yuv2rgb_single_pixel_32(), yuv2rgb_single_pixel_8(), yuv2rgb_single_pixel_gray(), yuv2rgb_single_pixel_palette(), and yuv444_to_yuy2_c().

## ◆ z

uint8_t z[4]

Referenced by _x_mrl_unescape(), _x_tag32_me2str(), _x_url_parse2(), _xine_str2secs(), _xine_stree_load_json(), _xine_stree_load_url(), _xine_stree_load_xml(), cdda_class_get_instance(), COutputPin_SetFramePointer(), COutputPin_SetFrameSizePointer(), dvd_parse_mrl(), grid3d_draw(), hexstr2uint32(), hls_bump_find(), hls_bump_guess(), hls_bump_inc(), iconv_internal(), mpd_strcasestr(), open_internal(), render_setup_torus(), str2uint32(), str2uint32(), str2uint32(), str2uint64(), str2uint64(), str2usec(), tdaan_draw_text(), tentacle_new(), unsharp(), unsharp_draw(), v3d_to_v2d(), xine_init(), xine_str2int32(), xine_str2uint32(), xine_str2uint64(), xine_stree_find(), xine_string_unampersand(), xine_string_unbackslash(), xine_string_unpercent(), and xine_ts_from_string().