Add rudimentary sound support

ulab-next-nosound
Timothy Pearson 12 years ago committed by Timothy Pearson
parent a3c2cb3bb2
commit a2d4f91ed2

@ -23,7 +23,8 @@
#include "libraptorsmiface.h"
char *server = "localhost";
//char *server = "localhost";
char *server = "freyja.starlink.edu";
char *user = "remotelab";
char *password = "rlpass123"; /* set me first */
char *database = "remotelab_sm";
@ -349,6 +350,39 @@ char* raptor_sm_get_hostname_for_username(char* username, bool create) {
}
}
char* raptor_sm_get_hostname_for_display(int display) {
MYSQL_RES *res;
MYSQL_ROW row;
char* query;
MYSQL *conn = connect_if_needed();
if (!conn) {
return strdup("SQLERR100");
}
asprintf(&query, "SELECT servername FROM sessions WHERE display='%d'", display);
if (mysql_query_internal(conn, query)) {
// Server error
free(query);
mysql_close(conn);
return strdup("SQLERR101");
}
else {
free(query);
res = mysql_store_result(conn);
while ((row = mysql_fetch_row(res)) != NULL) {
char* ret = strdup(row[0]);
mysql_free_result(res);
mysql_close(conn);
return ret;
}
// Nothing in the DB
mysql_free_result(res);
mysql_close(conn);
return strdup("");
}
}
char* raptor_sm_get_ip_for_username(char* username, bool create) {
char* hostname = raptor_sm_get_hostname_for_username(username, create);
char err;
@ -529,7 +563,7 @@ pid_t raptor_sm_run_remote_server(char* username, char *const argv[], char* dbfi
else {
asprintf(&command_string, "ssh root@%s \"su %s -c \'export DISPLAY=:%d && %s\' &> /dev/null & echo \\$!\"", ipaddr, username, display, origstr);
}
dprint("Running command %s...\n\r", command_string);
dprint("Running command %s...\n\r", command_string);
free(origstr);
FILE *fp;

@ -23,6 +23,9 @@ enum raptor_sm_status {
#define RAPTOR_SM_SERVER_PID_FIELD "server_pid"
#define RAPTOR_SM_WM_PID_FIELD "wm_pid"
#define RAPTOR_SM_BASE_PULSEAUDIO_PORT 2000
#define RAPTOR_SM_MANAGEMENT_SERVER_IP_NETRANGE "10.0.0.0/8"
char* raptor_sm_get_ip_for_hostname(char* hostname, char* err);
char* raptor_sm_get_hostname_for_username(char* username, bool create);
@ -39,4 +42,5 @@ int raptor_sm_get_new_unique_display(int mindisplay, int maxdisplay);
bool raptor_sm_sesslimit_reached(char* username);
char raptor_sm_set_session_state(int display, int state);
void raptor_sm_run_remote_desktop(char* username, int display, char* executable);
void raptor_sm_terminate_server(char* username);
void raptor_sm_terminate_server(char* username);
char* raptor_sm_get_hostname_for_display(int display);

@ -222,6 +222,7 @@ g_is_term(void)
{
return g_is_wait_obj_set(g_term_event);
}
// #define ENABLE_CHANSERV_DEBUG_LOGGING
#if 0
#include <stdio.h>
@ -229,6 +230,7 @@ g_is_term(void)
#include <stdarg.h>
void dprint(const char *fmt, ...)
{
#ifdef ENABLE_CHANSERV_DEBUG_LOGGING
va_list argp;
va_start(argp, fmt);
char debug[1024];
@ -240,6 +242,7 @@ void dprint(const char *fmt, ...)
fclose(fp);
}
va_end(argp);
#endif
}
#undef LOG
#define LOG(_a, _params) \

@ -371,6 +371,11 @@ clipboard_init(void)
{
return 0;
}
if (!g_display)
{
// prevent crash in XInternAtom
return 3;
}
xfuse_init();
xcommon_init();

@ -30,6 +30,8 @@
#include "file_loc.h"
#include "chansrv_common.h"
#include "libraptorsmiface.h"
#if defined(XRDP_OPUS)
#include <opus/opus.h>
static OpusEncoder *g_opus_encoder = 0;
@ -215,6 +217,16 @@ static int DEFAULT_CC sound_sndsrvr_source_data_in(struct trans *trans);
static int APP_CC sound_start_source_listener();
static int APP_CC sound_start_sink_listener();
//#if 0
void dprint(const char *fmt, ...);
#undef LOG
#define LOG(_a, _params) \
{ \
dprint _params; \
dprint("\n"); \
}
//#endif
/*****************************************************************************/
static int APP_CC
sound_send_server_output_formats(void)

Loading…
Cancel
Save