Sound redirection in android client now allows selecting server side sound.

This commit is contained in:
Armin Novak 2013-09-27 13:45:41 +02:00
parent e7f941c419
commit 84610f02e7
12 changed files with 79 additions and 29 deletions

View File

@ -668,15 +668,20 @@ JNIEXPORT void JNICALL jni_freerdp_set_drive_redirection(JNIEnv *env, jclass cls
} }
JNIEXPORT void JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env, JNIEXPORT void JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env,
jclass cls, jint instance, jboolean enable) jclass cls, jint instance, jint redirect)
{ {
char** p; char** p;
int count = 1; int count = 1;
freerdp* inst = (freerdp*)instance; freerdp* inst = (freerdp*)instance;
rdpSettings * settings = inst->settings; rdpSettings * settings = inst->settings;
DEBUG_ANDROID("sound redirect: %s", enable ? "TRUE" : "FALSE"); DEBUG_ANDROID("sound: %s",
redirect ? ((redirect == 1) ? "Server" : "Redirect") : "None");
settings->AudioPlayback = (redirect == 2) ? TRUE : FALSE;
settings->RemoteConsoleAudio = (redirect == 1) ? TRUE : FALSE;
if (settings->AudioPlayback)
{
p = malloc(sizeof(char*)); p = malloc(sizeof(char*));
p[0] = "rdpsnd"; p[0] = "rdpsnd";
@ -684,6 +689,7 @@ JNIEXPORT void JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env,
free(p); free(p);
} }
}
JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env, JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env,
jclass cls, jint instance, jboolean enable) jclass cls, jint instance, jboolean enable)
@ -695,6 +701,9 @@ JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env,
DEBUG_ANDROID("microphone redirect: %s", enable ? "TRUE" : "FALSE"); DEBUG_ANDROID("microphone redirect: %s", enable ? "TRUE" : "FALSE");
settings->AudioCapture = enable;
if (enable)
{
p = malloc(sizeof(char*)); p = malloc(sizeof(char*));
p[0] = "audin"; p[0] = "audin";
@ -702,6 +711,7 @@ JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env,
free(p); free(p);
} }
}
JNIEXPORT void JNICALL jni_freerdp_set_clipboard_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable) JNIEXPORT void JNICALL jni_freerdp_set_clipboard_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable)
{ {

View File

@ -45,7 +45,7 @@ JNIEXPORT void JNICALL jni_freerdp_set_performance_flags(JNIEnv *env, jclass cls
jboolean disableMenuAnimations, jboolean disableTheming, jboolean enableFontSmoothing, jboolean enableDesktopComposition); jboolean disableMenuAnimations, jboolean disableTheming, jboolean enableFontSmoothing, jboolean enableDesktopComposition);
JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls, jint instance, jstring jRemoteProgram, jstring jWorkDir); JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls, jint instance, jstring jRemoteProgram, jstring jWorkDir);
JNIEXPORT void JNICALL jni_freerdp_set_drive_redirection(JNIEnv *env, jclass cls, jint instance, jstring jpath); JNIEXPORT void JNICALL jni_freerdp_set_drive_redirection(JNIEnv *env, jclass cls, jint instance, jstring jpath);
JNIEXPORT void JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable); JNIEXPORT void JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env, jclass cls, jint instance, jint redirect);
JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable); JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable);
JNIEXPORT void JNICALL jni_freerdp_set_clipboard_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable); JNIEXPORT void JNICALL jni_freerdp_set_clipboard_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable);
JNIEXPORT void JNICALL jni_freerdp_set_gateway_info(JNIEnv *env, jclass cls, jint instance, jstring jgatewayhostname, jint port, jstring jgatewayusername, jstring jgatewaypassword, jstring jgatewaydomain); JNIEXPORT void JNICALL jni_freerdp_set_gateway_info(JNIEnv *env, jclass cls, jint instance, jstring jgatewayhostname, jint port, jstring jgatewayusername, jstring jgatewaypassword, jstring jgatewaydomain);

View File

@ -77,7 +77,7 @@ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_
} }
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1sound_1redirection JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1sound_1redirection
(JNIEnv *env, jclass cls, jint inst, jboolean redirect) (JNIEnv *env, jclass cls, jint inst, jint redirect)
{ {
jni_freerdp_set_sound_redirection(env, cls, inst, redirect); jni_freerdp_set_sound_redirection(env, cls, inst, redirect);
} }

View File

@ -93,7 +93,7 @@ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_
* Signature: (IZ)V * Signature: (IZ)V
*/ */
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1sound_1redirection JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1sound_1redirection
(JNIEnv *, jclass, jint, jboolean); (JNIEnv *, jclass, jint, jint);
/* /*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP * Class: com_freerdp_freerdpcore_services_LibFreeRDP

View File

@ -116,6 +116,16 @@
<string name="settings_gateway_settings">Gateway Settings</string> <string name="settings_gateway_settings">Gateway Settings</string>
<string name="settings_redirect_sdcard">Redirect SDCard</string> <string name="settings_redirect_sdcard">Redirect SDCard</string>
<string name="settings_redirect_sound">Redirect Sound</string> <string name="settings_redirect_sound">Redirect Sound</string>
<string-array name="redirect_sound_array">
<item>None</item>
<item>Server</item>
<item>Client</item>
</string-array>
<string-array name="redirect_sound_values_array">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string name="settings_redirect_microphone">Redirect Microphone</string> <string name="settings_redirect_microphone">Redirect Microphone</string>
<string name="settings_security">Seguridad</string> <string name="settings_security">Seguridad</string>
<string-array name="security_array"> <string-array name="security_array">

View File

@ -115,6 +115,16 @@
<string name="settings_gateway_settings">Gateway Settings</string> <string name="settings_gateway_settings">Gateway Settings</string>
<string name="settings_redirect_sdcard">"Redirect SDCard"</string> <string name="settings_redirect_sdcard">"Redirect SDCard"</string>
<string name="settings_redirect_sound">Redirect Sound</string> <string name="settings_redirect_sound">Redirect Sound</string>
<string-array name="redirect_sound_array">
<item>None</item>
<item>Server</item>
<item>Client</item>
</string-array>
<string-array name="redirect_sound_values_array">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string name="settings_redirect_microphone">Redirect Microphone</string> <string name="settings_redirect_microphone">Redirect Microphone</string>
<string name="settings_security">"Securité"</string> <string name="settings_security">"Securité"</string>
<string-array name="security_array"> <string-array name="security_array">

View File

@ -116,6 +116,16 @@
<string name="settings_gateway_settings">Gateway instellingen</string> <string name="settings_gateway_settings">Gateway instellingen</string>
<string name="settings_redirect_sdcard">SDCard aankoppelen</string> <string name="settings_redirect_sdcard">SDCard aankoppelen</string>
<string name="settings_redirect_sound">Redirect Sound</string> <string name="settings_redirect_sound">Redirect Sound</string>
<string-array name="redirect_sound_array">
<item>None</item>
<item>Server</item>
<item>Client</item>
</string-array>
<string-array name="redirect_sound_values_array">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string name="settings_redirect_microphone">Redirect Microphone</string> <string name="settings_redirect_microphone">Redirect Microphone</string>
<string name="settings_security">Beveiliging</string> <string name="settings_security">Beveiliging</string>
<string-array name="security_array"> <string-array name="security_array">

View File

@ -113,6 +113,16 @@
<string name="settings_gateway_settings">Gateway Settings</string> <string name="settings_gateway_settings">Gateway Settings</string>
<string name="settings_redirect_sdcard">Redirect SDCard</string> <string name="settings_redirect_sdcard">Redirect SDCard</string>
<string name="settings_redirect_sound">Redirect Sound</string> <string name="settings_redirect_sound">Redirect Sound</string>
<string-array name="redirect_sound_array">
<item>None</item>
<item>Server</item>
<item>Client</item>
</string-array>
<string-array name="redirect_sound_values_array">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string name="settings_redirect_microphone">Redirect Microphone</string> <string name="settings_redirect_microphone">Redirect Microphone</string>
<string name="settings_security">Security</string> <string name="settings_security">Security</string>
<string-array name="security_array"> <string-array name="security_array">

View File

@ -36,7 +36,7 @@
</PreferenceScreen> </PreferenceScreen>
<CheckBoxPreference android:key="bookmark.redirect_sdcard" android:title="@string/settings_redirect_sdcard"/> <CheckBoxPreference android:key="bookmark.redirect_sdcard" android:title="@string/settings_redirect_sdcard"/>
<CheckBoxPreference android:key="bookmark.redirect_sound" android:title="@string/settings_redirect_sound"/> <com.freerdp.freerdpcore.utils.IntListPreference android:key="bookmark.redirect_sound" android:title="@string/settings_redirect_sound" android:entries="@array/redirect_sound_array" android:entryValues="@array/redirect_sound_values_array" />
<CheckBoxPreference android:key="bookmark.redirect_microphone" android:title="@string/settings_redirect_microphone"/> <CheckBoxPreference android:key="bookmark.redirect_microphone" android:title="@string/settings_redirect_microphone"/>
<com.freerdp.freerdpcore.utils.IntListPreference android:key="bookmark.security" android:title="@string/settings_security" android:entries="@array/security_array" android:entryValues="@array/security_values_array" /> <com.freerdp.freerdpcore.utils.IntListPreference android:key="bookmark.security" android:title="@string/settings_security" android:entries="@array/security_array" android:entryValues="@array/security_values_array" />
<EditTextPreference android:key="bookmark.remote_program" android:title="@string/settings_remote_program" android:summary="notepad.exe"/> <EditTextPreference android:key="bookmark.remote_program" android:title="@string/settings_remote_program" android:summary="notepad.exe"/>

View File

@ -295,7 +295,7 @@ public class BookmarkBase implements Parcelable, Cloneable
private ScreenSettings screen3G; private ScreenSettings screen3G;
private PerformanceFlags performance3G; private PerformanceFlags performance3G;
private boolean redirectSDCard; private boolean redirectSDCard;
private boolean redirectSound; private int redirectSound;
private boolean redirectMicrophone; private boolean redirectMicrophone;
private int security; private int security;
private boolean consoleMode; private boolean consoleMode;
@ -311,7 +311,7 @@ public class BookmarkBase implements Parcelable, Cloneable
screen3G = parcel.readParcelable(ScreenSettings.class.getClassLoader()); screen3G = parcel.readParcelable(ScreenSettings.class.getClassLoader());
performance3G = parcel.readParcelable(PerformanceFlags.class.getClassLoader()); performance3G = parcel.readParcelable(PerformanceFlags.class.getClassLoader());
redirectSDCard = (parcel.readInt() == 1) ? true : false; redirectSDCard = (parcel.readInt() == 1) ? true : false;
redirectSound = (parcel.readInt() == 1) ? true : false; redirectSound = parcel.readInt();
redirectMicrophone = (parcel.readInt() == 1) ? true : false; redirectMicrophone = (parcel.readInt() == 1) ? true : false;
security = parcel.readInt(); security = parcel.readInt();
consoleMode = (parcel.readInt() == 1) ? true : false; consoleMode = (parcel.readInt() == 1) ? true : false;
@ -324,7 +324,7 @@ public class BookmarkBase implements Parcelable, Cloneable
screen3G = new ScreenSettings(); screen3G = new ScreenSettings();
performance3G = new PerformanceFlags(); performance3G = new PerformanceFlags();
redirectSDCard = false; redirectSDCard = false;
redirectSound = false; redirectSound = 0;
redirectMicrophone = false; redirectMicrophone = false;
security = 0; security = 0;
consoleMode = false; consoleMode = false;
@ -364,11 +364,11 @@ public class BookmarkBase implements Parcelable, Cloneable
return redirectSDCard; return redirectSDCard;
} }
public void setRedirectSound(boolean redirect) { public void setRedirectSound(int redirect) {
this.redirectSound = redirect; this.redirectSound = redirect;
} }
public boolean getRedirectSound() { public int getRedirectSound() {
return redirectSound; return redirectSound;
} }
@ -440,7 +440,7 @@ public class BookmarkBase implements Parcelable, Cloneable
out.writeParcelable(screen3G, flags); out.writeParcelable(screen3G, flags);
out.writeParcelable(performance3G, flags); out.writeParcelable(performance3G, flags);
out.writeInt(redirectSDCard ? 1 : 0); out.writeInt(redirectSDCard ? 1 : 0);
out.writeInt(redirectSound ? 1 : 0); out.writeInt(redirectSound);
out.writeInt(redirectMicrophone ? 1 : 0); out.writeInt(redirectMicrophone ? 1 : 0);
out.writeInt(security); out.writeInt(security);
out.writeInt(consoleMode ? 1 : 0); out.writeInt(consoleMode ? 1 : 0);
@ -644,7 +644,7 @@ public class BookmarkBase implements Parcelable, Cloneable
editor.putBoolean("bookmark.perf_themes_3g", advancedSettings.getPerformance3G().getTheming()); editor.putBoolean("bookmark.perf_themes_3g", advancedSettings.getPerformance3G().getTheming());
editor.putBoolean("bookmark.redirect_sdcard", advancedSettings.getRedirectSDCard()); editor.putBoolean("bookmark.redirect_sdcard", advancedSettings.getRedirectSDCard());
editor.putBoolean("bookmark.redirect_sound", advancedSettings.getRedirectSound()); editor.putInt("bookmark.redirect_sound", advancedSettings.getRedirectSound());
editor.putBoolean("bookmark.redirect_microphone", advancedSettings.getRedirectMicrophone()); editor.putBoolean("bookmark.redirect_microphone", advancedSettings.getRedirectMicrophone());
editor.putInt("bookmark.security", advancedSettings.getSecurity()); editor.putInt("bookmark.security", advancedSettings.getSecurity());
editor.putString("bookmark.remote_program", advancedSettings.getRemoteProgram()); editor.putString("bookmark.remote_program", advancedSettings.getRemoteProgram());
@ -688,7 +688,7 @@ public class BookmarkBase implements Parcelable, Cloneable
advancedSettings.getPerformance3G().setTheming(sharedPrefs.getBoolean("bookmark.perf_themes_3g", false)); advancedSettings.getPerformance3G().setTheming(sharedPrefs.getBoolean("bookmark.perf_themes_3g", false));
advancedSettings.setRedirectSDCard(sharedPrefs.getBoolean("bookmark.redirect_sdcard", false)); advancedSettings.setRedirectSDCard(sharedPrefs.getBoolean("bookmark.redirect_sdcard", false));
advancedSettings.setRedirectSound(sharedPrefs.getBoolean("bookmark.redirect_sound", false)); advancedSettings.setRedirectSound(sharedPrefs.getInt("bookmark.redirect_sound", 0));
advancedSettings.setRedirectMicrophone(sharedPrefs.getBoolean("bookmark.redirect_microphone", false)); advancedSettings.setRedirectMicrophone(sharedPrefs.getBoolean("bookmark.redirect_microphone", false));
advancedSettings.setSecurity(sharedPrefs.getInt("bookmark.security", 0)); advancedSettings.setSecurity(sharedPrefs.getInt("bookmark.security", 0));
advancedSettings.setRemoteProgram(sharedPrefs.getString("bookmark.remote_program", "")); advancedSettings.setRemoteProgram(sharedPrefs.getString("bookmark.remote_program", ""));

View File

@ -283,7 +283,7 @@ public abstract class BookmarkBaseGateway
readScreenSettings3G(bookmark, cursor); readScreenSettings3G(bookmark, cursor);
readPerformanceFlags3G(bookmark, cursor); readPerformanceFlags3G(bookmark, cursor);
bookmark.getAdvancedSettings().setRedirectSDCard(cursor.getInt(cursor.getColumnIndex("redirect_sdcard")) == 0 ? false : true); bookmark.getAdvancedSettings().setRedirectSDCard(cursor.getInt(cursor.getColumnIndex("redirect_sdcard")) == 0 ? false : true);
bookmark.getAdvancedSettings().setRedirectSound(cursor.getInt(cursor.getColumnIndex("redirect_sound")) == 0 ? false : true); bookmark.getAdvancedSettings().setRedirectSound(cursor.getInt(cursor.getColumnIndex("redirect_sound")));
bookmark.getAdvancedSettings().setRedirectMicrophone(cursor.getInt(cursor.getColumnIndex("redirect_microphone")) == 0 ? false : true); bookmark.getAdvancedSettings().setRedirectMicrophone(cursor.getInt(cursor.getColumnIndex("redirect_microphone")) == 0 ? false : true);
bookmark.getAdvancedSettings().setSecurity(cursor.getInt(cursor.getColumnIndex("security"))); bookmark.getAdvancedSettings().setSecurity(cursor.getInt(cursor.getColumnIndex("security")));
bookmark.getAdvancedSettings().setConsoleMode(cursor.getInt(cursor.getColumnIndex("console_mode")) == 0 ? false : true); bookmark.getAdvancedSettings().setConsoleMode(cursor.getInt(cursor.getColumnIndex("console_mode")) == 0 ? false : true);

View File

@ -40,7 +40,7 @@ public class LibFreeRDP
private static native void freerdp_set_data_directory(int inst, String directory); private static native void freerdp_set_data_directory(int inst, String directory);
private static native void freerdp_set_clipboard_redirection(int inst, boolean enable); private static native void freerdp_set_clipboard_redirection(int inst, boolean enable);
private static native void freerdp_set_sound_redirection(int inst, boolean enable); private static native void freerdp_set_sound_redirection(int inst, int redirect);
private static native void freerdp_set_microphone_redirection(int inst, boolean enable); private static native void freerdp_set_microphone_redirection(int inst, boolean enable);
private static native void freerdp_set_drive_redirection(int inst, String path); private static native void freerdp_set_drive_redirection(int inst, String path);
@ -169,12 +169,12 @@ public class LibFreeRDP
} }
// Sound redirection // Sound redirection
if (advancedSettings.getRedirectSound()) freerdp_set_sound_redirection(inst,
freerdp_set_sound_redirection(inst, true); advancedSettings.getRedirectSound());
// Microphone redirection // Microphone redirection
if (advancedSettings.getRedirectMicrophone()) freerdp_set_microphone_redirection(inst,
freerdp_set_microphone_redirection(inst, true); advancedSettings.getRedirectMicrophone());
return true; return true;
} }