RetroArch
Macros | Enumerations | Functions
librsound.c File Reference
#include "drivers/rsound.h"
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <sys/poll.h>
#include <fcntl.h>
#include <unistd.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <compat/strl.h>
#include <retro_inline.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h>
#include <retro_timers.h>
Include dependency graph for librsound.c:

Macros

#define NETWORK_COMPAT_HEADERS   1
 
#define RSD_WARN(fmt, args...)
 
#define RSD_ERR(fmt, args...)
 
#define RSD_DEBUG(fmt, args...)
 
#define pollfd_fd(x)   x.fd
 
#define net_socket(a, b, c)   socket(a,b,c)
 
#define socketpoll(x, y, z)   poll(x, y, z)
 
#define net_send(a, b, c, d)   send(a,b,c,d)
 
#define net_connect(a, b, c)   connect(a,b,c)
 
#define net_shutdown(a, b)   shutdown(a,b)
 
#define net_socketclose(x)   close(x)
 
#define net_recv(a, b, c, d)   recv(a,b,c,d)
 
#define HEADER_SIZE   44
 
#define RATE   24
 
#define CHANNEL   22
 
#define FRAMESIZE   34
 
#define FORMAT   42
 
#define SET32(buf, offset, x)   (*((uint32_t*)(buf+offset)) = x)
 
#define SET16(buf, offset, x)   (*((uint16_t*)(buf+offset)) = x)
 
#define LSB16(x)   if ( !rsnd_is_little_endian() ) { rsnd_swap_endian_16(&(x)); }
 
#define LSB32(x)   if ( !rsnd_is_little_endian() ) { rsnd_swap_endian_32(&(x)); }
 
#define RSND_HEADER_SIZE   8
 
#define LATENCY   0
 
#define CHUNKSIZE   1
 
#define MAX_CHUNK_SIZE   1024
 
#define MAX_TCP_BUFSIZE   (1 << 14)
 
#define MAX_PACKET_SIZE   1024
 
#define RSD_PROTO_MAXSIZE   256
 
#define RSD_PROTO_CHUNKSIZE   8
 
#define _TEST_CANCEL()
 

Enumerations

enum  rsd_logtype { RSD_LOG_DEBUG = 0, RSD_LOG_WARN, RSD_LOG_ERR }
 
enum  rsd_conn_type { RSD_CONN_TCP = 0x0000, RSD_CONN_UNIX = 0x0001, RSD_CONN_DECNET = 0x0002, RSD_CONN_PROTO = 0x100 }
 

Functions

static ssize_t rsnd_send_chunk (int socket, const void *buf, size_t size, int blocking)
 
static ssize_t rsnd_recv_chunk (int socket, void *buf, size_t size, int blocking)
 
static int rsnd_start_thread (rsound_t *rd)
 
static int rsnd_stop_thread (rsound_t *rd)
 
static size_t rsnd_get_delay (rsound_t *rd)
 
static size_t rsnd_get_ptr (rsound_t *rd)
 
static int rsnd_reset (rsound_t *rd)
 
static int rsnd_send_identity_info (rsound_t *rd)
 
static int rsnd_close_ctl (rsound_t *rd)
 
static int rsnd_send_info_query (rsound_t *rd)
 
static int rsnd_update_server_info (rsound_t *rd)
 
static int rsnd_poll (struct pollfd *fd, int numfd, int timeout)
 
static void rsnd_cb_thread (void *thread_data)
 
static void rsnd_thread (void *thread_data)
 
static INLINE int rsnd_is_little_endian (void)
 
static INLINE void rsnd_swap_endian_16 (uint16_t *x)
 
static INLINE void rsnd_swap_endian_32 (uint32_t *x)
 
static INLINE int rsnd_format_to_samplesize (uint16_t fmt)
 
int rsd_samplesize (rsound_t *rd)
 
static int rsnd_connect_server (rsound_t *rd)
 
static int rsnd_send_header_info (rsound_t *rd)
 
static int rsnd_get_backend_info (rsound_t *rd)
 
static int rsnd_create_connection (rsound_t *rd)
 
static int64_t rsnd_get_time_usec (void)
 
static void rsnd_drain (rsound_t *rd)
 
static size_t rsnd_fill_buffer (rsound_t *rd, const char *buf, size_t size)
 
int rsd_stop (rsound_t *rd)
 
size_t rsd_write (rsound_t *rsound, const void *buf, size_t size)
 
int rsd_start (rsound_t *rsound)
 
int rsd_exec (rsound_t *rsound)
 
int rsd_set_param (rsound_t *rd, enum rsd_settings option, void *param)
 
void rsd_delay_wait (rsound_t *rd)
 
size_t rsd_pointer (rsound_t *rsound)
 
size_t rsd_get_avail (rsound_t *rd)
 
size_t rsd_delay (rsound_t *rd)
 
size_t rsd_delay_ms (rsound_t *rd)
 
int rsd_pause (rsound_t *rsound, int enable)
 
int rsd_init (rsound_t **rsound)
 
int rsd_simple_start (rsound_t **rsound, const char *host, const char *port, const char *ident, int rate, int channels, enum rsd_format format)
 
void rsd_set_callback (rsound_t *rsound, rsd_audio_callback_t audio_cb, rsd_error_callback_t err_cb, size_t max_size, void *userdata)
 
void rsd_callback_lock (rsound_t *rsound)
 
void rsd_callback_unlock (rsound_t *rsound)
 
int rsd_free (rsound_t *rsound)
 

Macro Definition Documentation

◆ _TEST_CANCEL

#define _TEST_CANCEL ( )
Value:
if ( !rd->thread_active ) \
break

◆ CHANNEL

#define CHANNEL   22

◆ CHUNKSIZE

#define CHUNKSIZE   1

◆ FORMAT

#define FORMAT   42

◆ FRAMESIZE

#define FRAMESIZE   34

◆ HEADER_SIZE

#define HEADER_SIZE   44

◆ LATENCY

#define LATENCY   0

◆ LSB16

#define LSB16 (   x)    if ( !rsnd_is_little_endian() ) { rsnd_swap_endian_16(&(x)); }

◆ LSB32

#define LSB32 (   x)    if ( !rsnd_is_little_endian() ) { rsnd_swap_endian_32(&(x)); }

◆ MAX_CHUNK_SIZE

#define MAX_CHUNK_SIZE   1024

◆ MAX_PACKET_SIZE

#define MAX_PACKET_SIZE   1024

◆ MAX_TCP_BUFSIZE

#define MAX_TCP_BUFSIZE   (1 << 14)

◆ net_connect

#define net_connect (   a,
  b,
  c 
)    connect(a,b,c)

◆ net_recv

#define net_recv (   a,
  b,
  c,
 
)    recv(a,b,c,d)

◆ net_send

#define net_send (   a,
  b,
  c,
 
)    send(a,b,c,d)

◆ net_shutdown

#define net_shutdown (   a,
  b 
)    shutdown(a,b)

◆ net_socket

#define net_socket (   a,
  b,
  c 
)    socket(a,b,c)

◆ net_socketclose

#define net_socketclose (   x)    close(x)

◆ NETWORK_COMPAT_HEADERS

#define NETWORK_COMPAT_HEADERS   1

◆ pollfd_fd

#define pollfd_fd (   x)    x.fd

◆ RATE

#define RATE   24

◆ RSD_DEBUG

#define RSD_DEBUG (   fmt,
  args... 
)

◆ RSD_ERR

#define RSD_ERR (   fmt,
  args... 
)

◆ RSD_PROTO_CHUNKSIZE

#define RSD_PROTO_CHUNKSIZE   8

◆ RSD_PROTO_MAXSIZE

#define RSD_PROTO_MAXSIZE   256

◆ RSD_WARN

#define RSD_WARN (   fmt,
  args... 
)

◆ RSND_HEADER_SIZE

#define RSND_HEADER_SIZE   8

◆ SET16

#define SET16 (   buf,
  offset,
  x 
)    (*((uint16_t*)(buf+offset)) = x)

◆ SET32

#define SET32 (   buf,
  offset,
  x 
)    (*((uint32_t*)(buf+offset)) = x)

◆ socketpoll

#define socketpoll (   x,
  y,
  z 
)    poll(x, y, z)

Enumeration Type Documentation

◆ rsd_conn_type

Enumerator
RSD_CONN_TCP 
RSD_CONN_UNIX 
RSD_CONN_DECNET 
RSD_CONN_PROTO 

◆ rsd_logtype

Enumerator
RSD_LOG_DEBUG 
RSD_LOG_WARN 
RSD_LOG_ERR 

Function Documentation

◆ rsd_callback_lock()

void rsd_callback_lock ( rsound_t rsound)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsd_callback_unlock()

void rsd_callback_unlock ( rsound_t rsound)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsd_delay()

size_t rsd_delay ( rsound_t rd)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsd_delay_ms()

size_t rsd_delay_ms ( rsound_t rd)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsd_delay_wait()

void rsd_delay_wait ( rsound_t rd)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsd_exec()

int rsd_exec ( rsound_t rsound)
Here is the call graph for this function:

◆ rsd_free()

int rsd_free ( rsound_t rsound)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsd_get_avail()

size_t rsd_get_avail ( rsound_t rd)
Here is the call graph for this function:

◆ rsd_init()

int rsd_init ( rsound_t **  rsound)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsd_pause()

int rsd_pause ( rsound_t rsound,
int  enable 
)
Here is the call graph for this function:

◆ rsd_pointer()

size_t rsd_pointer ( rsound_t rsound)
Here is the call graph for this function:

◆ rsd_samplesize()

int rsd_samplesize ( rsound_t rd)

◆ rsd_set_callback()

void rsd_set_callback ( rsound_t rsound,
rsd_audio_callback_t  audio_cb,
rsd_error_callback_t  err_cb,
size_t  max_size,
void userdata 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsd_set_param()

int rsd_set_param ( rsound_t rd,
enum rsd_settings  option,
void param 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsd_simple_start()

int rsd_simple_start ( rsound_t **  rsound,
const char *  host,
const char *  port,
const char *  ident,
int  rate,
int  channels,
enum rsd_format  format 
)
Here is the call graph for this function:

◆ rsd_start()

int rsd_start ( rsound_t rsound)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsd_stop()

int rsd_stop ( rsound_t rd)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsd_write()

size_t rsd_write ( rsound_t rsound,
const void buf,
size_t  size 
)
Here is the call graph for this function:

◆ rsnd_cb_thread()

static void rsnd_cb_thread ( void thread_data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_close_ctl()

static int rsnd_close_ctl ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_connect_server()

static int rsnd_connect_server ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_create_connection()

static int rsnd_create_connection ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_drain()

static void rsnd_drain ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_fill_buffer()

static size_t rsnd_fill_buffer ( rsound_t rd,
const char *  buf,
size_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_format_to_samplesize()

static INLINE int rsnd_format_to_samplesize ( uint16_t  fmt)
static
Here is the caller graph for this function:

◆ rsnd_get_backend_info()

static int rsnd_get_backend_info ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_get_delay()

static size_t rsnd_get_delay ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_get_ptr()

static size_t rsnd_get_ptr ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_get_time_usec()

static int64_t rsnd_get_time_usec ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_is_little_endian()

static INLINE int rsnd_is_little_endian ( void  )
static
Here is the caller graph for this function:

◆ rsnd_poll()

static int rsnd_poll ( struct pollfd *  fd,
int  numfd,
int  timeout 
)
static
Here is the caller graph for this function:

◆ rsnd_recv_chunk()

static ssize_t rsnd_recv_chunk ( int  socket,
void buf,
size_t  size,
int  blocking 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_reset()

static int rsnd_reset ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_send_chunk()

static ssize_t rsnd_send_chunk ( int  socket,
const void buf,
size_t  size,
int  blocking 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_send_header_info()

static int rsnd_send_header_info ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_send_identity_info()

static int rsnd_send_identity_info ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_send_info_query()

static int rsnd_send_info_query ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_start_thread()

static int rsnd_start_thread ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_stop_thread()

static int rsnd_stop_thread ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_swap_endian_16()

static INLINE void rsnd_swap_endian_16 ( uint16_t x)
static

◆ rsnd_swap_endian_32()

static INLINE void rsnd_swap_endian_32 ( uint32_t x)
static
Here is the caller graph for this function:

◆ rsnd_thread()

static void rsnd_thread ( void thread_data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rsnd_update_server_info()

static int rsnd_update_server_info ( rsound_t rd)
static
Here is the call graph for this function:
Here is the caller graph for this function: