Esempio n. 1
0
int waveout_init()
{

#ifndef NO_DYN_LOAD

	static long ao_initialize_ptr=(long) &ao_initialize_stubb;
#else

	static long ao_initialize_ptr=(long) &ao_initialize;
#endif

	if (!(is_init)) {

		((FUNC_1) (get_func_addr(&aolib_handle,"libao.so","ao_initialize",ao_initialize_ptr)))();

#ifndef NO_DYN_LOAD

		if (is_no_aolib)

			return 1;
#endif
		is_init=1;
	}

	return 0;
}
Esempio n. 2
0
void
idn_stub_freeaddrinfo(struct addrinfo *aip) {
	static void (*fp)(struct addrinfo *aip);

	if (fp == NULL)
		fp = get_func_addr("freeaddrinfo");
	if (fp != NULL)
		(*fp)(aip);
}
Esempio n. 3
0
void
idn_stub_freehostent(struct hostent *hp) {
	static void (*fp)(struct hostent *hp);

	if (fp == NULL)
		fp = get_func_addr("freehostent");
	if (fp != NULL)
		(*fp)(hp);
}
Esempio n. 4
0
struct hostent *
idn_stub_gethostbyname2(const char *name, int af) {
	static struct hostent *(*fp)(const char *name, int af);

	if (fp == NULL)
		fp = get_func_addr("gethostbyname2");
	if (fp != NULL)
		return ((*fp)(name, af));
	return (NULL);
}
Esempio n. 5
0
struct hostent *
idn_stub_getipnodebyaddr(const void *src, size_t len, int af, int *errp) {
	static struct hostent *(*fp)(const void *src, size_t len, int af,
				     int *errp);

	if (fp == NULL)
		fp = get_func_addr("getipnodebyaddr");
	if (fp != NULL)
		return ((*fp)(src, len, af, errp));
	return (NULL);
}
Esempio n. 6
0
struct hostent *
idn_stub_getipnodebyname(const char *name, int af, int flags, int *errp) {
	static struct hostent *(*fp)(const char *name, int af, int flags,
				     int *errp);

	if (fp == NULL)
		fp = get_func_addr("getipnodebyname");
	if (fp != NULL)
		return ((*fp)(name, af, flags, errp));
	return (NULL);
}
Esempio n. 7
0
struct hostent *
idn_stub_gethostbyaddr(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type) {
	static struct hostent *(*fp)(GHBA_ADDR_T name,
				     GHBA_ADDRLEN_T len, int type);

	if (fp == NULL)
		fp = get_func_addr("gethostbyaddr");
	if (fp != NULL)
		return ((*fp)(addr, len, type));
	return (NULL);
}
Esempio n. 8
0
int
idn_stub_getaddrinfo(const char *nodename, const char *servname,
		     const struct addrinfo *hints, struct addrinfo **res)
{
	static int (*fp)(const char *nodename, const char *servname,
			 const struct addrinfo *hints, struct addrinfo **res);

	if (fp == NULL)
		fp = get_func_addr("getaddrinfo");
	if (fp != NULL)
		return ((*fp)(nodename, servname, hints, res));
	return (EAI_FAIL);
}
Esempio n. 9
0
struct hostent *
idn_stub_gethostbyname_r(const char *name, struct hostent *result,
			 char *buffer, int buflen, int *errp)
{
	static struct hostent *(*fp)(const char *name, struct hostent *result,
				     char *buffer, int buflen, int *errp);

	if (fp == NULL)
		fp = get_func_addr("gethostbyname_r");
	if (fp != NULL)
		return ((*fp)(name, result, buffer, buflen, errp));
	return (NULL);
}
Esempio n. 10
0
int
idn_stub_getnameinfo(const struct sockaddr *sa, GNI_SALEN_T salen,
		     char *host, GNI_HOSTLEN_T hostlen,
		     char *serv, GNI_SERVLEN_T servlen, GNI_FLAGS_T flags) {
	static int (*fp)(const struct sockaddr *sa, GNI_SALEN_T salen,
			 char *host, GNI_HOSTLEN_T hostlen,
			 char *serv, GNI_SERVLEN_T servlen,
			 GNI_FLAGS_T flags);

	if (fp == NULL)
		fp = get_func_addr("getnameinfo");
	if (fp != NULL)
		return ((*fp)(sa, salen, host, hostlen, serv, servlen, flags));
	return (EAI_FAIL);
}
Esempio n. 11
0
struct hostent *
idn_stub_gethostbyaddr_r(GHBA_ADDR_T addr, int len, int type,
			 struct hostent *result, char *buffer,
			 int buflen, int *errp)
{
	static struct hostent *(*fp)(GHBA_ADDR_T addr, int len, int type,
				     struct hostent *result, char *buffer,
				     int buflen, int *errp);

	if (fp == NULL)
		fp = get_func_addr("gethostbyaddr_r");
	if (fp != NULL)
		return ((*fp)(addr, len, type, result, buffer, buflen, errp));
	return (NULL);
}
Esempio n. 12
0
int
idn_stub_gethostbyname2_r(const char *name, int af, struct hostent *result,
			  char *buffer, size_t buflen,
			  struct hostent **rp, int *errp)
{
	static int (*fp)(const char *name, int af, struct hostent *result,
			 char *buffer, size_t buflen,
			 struct hostent **rp, int *errp);

	if (fp == NULL)
		fp = get_func_addr("gethostbyname2_r");
	if (fp != NULL)
		return ((*fp)(name, af, result, buffer, buflen, rp, errp));
	return (ENOENT);	/* ??? */
}
Esempio n. 13
0
int
idn_stub_gethostbyaddr_r(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type,
			 struct hostent *result, char *buffer,
			 size_t buflen, struct hostent **rp, int *errp)
{
	static int (*fp)(GHBA_ADDR_T addr, GHBA_ADDRLEN_T len, int type,
			 struct hostent *result, char *buffer,
			 size_t buflen, struct hostent **rp, int *errp);

	if (fp == NULL)
		fp = get_func_addr("gethostbyaddr_r");
	if (fp != NULL)
		return ((*fp)(addr, len, type, result,
			      buffer, buflen, rp, errp));
	return (ENOENT);	/* ??? */
}
Esempio n. 14
0
int waveout_shutdown()
{

#ifndef NO_DYN_LOAD

	static long ao_shutdown_ptr=(long) &ao_shutdown_stubb;
#else

	static long ao_shutdown_ptr=(long) &ao_shutdown;
#endif

	if (!(is_init))

		return 1;

	else 

		((FUNC_1) (get_func_addr(&aolib_handle,"libao.so","ao_shutdown",ao_shutdown_ptr)))();


	return 0;
}
Esempio n. 15
0
int play_wave_open_os(WAVE_PLAY *p_wave_play)
{
	ao_device			*device=NULL;
	SAMPLE_FORMAT		format;
	int					driver;
	int					bytes_read=0;
	int					is_done=0;

#ifndef NO_DYN_LOAD
	static long ao_default_driver_id_ptr=(long) &ao_default_driver_id_stubb;
	static long ao_open_live_ptr=(long) &ao_open_live_stubb;
	static long ao_play_ptr=(long) &ao_play_stubb;
	static long ao_close_ptr=(long) &ao_close_stubb;
	/*static long ao_driver_id_ptr=(long) &ao_driver_id_stubb;*/
	static long ao_driver_info_ptr=(long) &ao_driver_info_stubb;
#else
	static long ao_default_driver_id_ptr=(long) &ao_default_driver_id;
	static long ao_open_live_ptr=(long) &ao_open_live;
	static long ao_play_ptr=(long) &ao_play;
	static long ao_close_ptr=(long) &ao_close;
	/*static long ao_driver_id_ptr=(long) &ao_driver_id;*/
	static long ao_driver_info_ptr=(long) &ao_driver_info;
#endif

	memset(&format,0,sizeof(ao_sample_format)); /*adapt to this type.  SAMPLE_FORMAT inited below*/

	/*
		is_init cond/section here, needs a mutex 
		if more black box than present use
	*/

#ifndef NO_DYN_LOAD

	if (is_no_aolib)

		return 1;
#endif

	if (!(is_init)) {

		DBG_PRINTF((LOG_CRIT, "C:" MODULE_TAG "Call to play_wave_open_os before waveout_init in play_wave_open_os...\n"));

		return 1;
	}

	/* -- Setup for default driver -- */

	if ((driver=((FUNC_2) (get_func_addr(&aolib_handle,"libao.so","ao_default_driver_id",ao_default_driver_id_ptr)))())==-1) {

		DBG_PRINTF((LOG_CRIT, "C:" MODULE_TAG "ao_default_driver_id() returned NO DRIVER (%s) in play_wave_open_os...\n",libao_err_name(errno)));
	} 
	else {

		ao_info	*driver_info=NULL;

		if (!(driver_info=((FUNC_8) (get_func_addr(&aolib_handle,"libao.so","ao_driver_info",ao_driver_info_ptr)))(driver)))

			DBG_PRINTF((LOG_CRIT, "C:" MODULE_TAG "ao_driver_info returned NULL (%s) in play_wave_open_os...\n",libao_err_name(errno)));
		else

			DBG_PRINTF((LOG_INFO, "I:" MODULE_TAG "got driver, %s...\n",driver_info->short_name));

		format.bits=p_wave_play->bits_per_sample*p_wave_play->output_factor;
		format.channels=p_wave_play->channels;
		format.rate=p_wave_play->sample_rate;
		format.byte_format=AO_FMT_LITTLE;
		format.matrix="L,R";

		device=((FUNC_3) (get_func_addr(&aolib_handle,"libao.so","ao_open_live",ao_open_live_ptr)))(driver,(ao_sample_format *) &format,NULL);

		if (device==NULL) {

			DBG_PRINTF((LOG_CRIT, "C:" MODULE_TAG "device NULL (%s) in play_wave_open_os.  returning...\n",libao_err_name(errno)));	

			return 1;
		}

		while (!(is_done)) {

			if ((is_done=fill_wave_buffer(p_wave_play,p_wave_play->cur_buffer,&bytes_read)))

				is_done=(!(reset_wave(p_wave_play)));

			if (bytes_read==0) {

				if (is_done)

					break;
			}
			else {		

				if (!(((FUNC_4) (get_func_addr(&aolib_handle,"libao.so","ao_play",ao_play_ptr)))(device,p_wave_play->wave_buff[p_wave_play->cur_buffer],bytes_read))) {

					DBG_PRINTF((LOG_CRIT, "C:" MODULE_TAG "ao_play failed (%s) in play_wave_open_os...\n",libao_err_name(errno)));
				}
			}

			if (p_wave_play->cb_is_exit(p_wave_play->cbClientData)) {

				DBG_PRINTF((LOG_INFO, "I:" MODULE_TAG "Client requested quit.  Returning from play_wave_open_os...\n"));

				break;
			}
		}
	}

	if (device) {

		wait_done_playing(p_wave_play);		

		if (!(((FUNC_5) (get_func_addr(&aolib_handle,"libao.so","ao_close",ao_close_ptr)))(device))) {

			DBG_PRINTF((LOG_CRIT, "C:" MODULE_TAG "ao_close failed (%s) in play_wave_open_os...\n",libao_err_name(errno)));
		}
	}	

	return 0;
}