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,21 +668,27 @@ JNIEXPORT void JNICALL jni_freerdp_set_drive_redirection(JNIEnv *env, jclass cls
}
JNIEXPORT void JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env,
jclass cls, jint instance, jboolean enable)
jclass cls, jint instance, jint redirect)
{
char** p;
int count = 1;
freerdp* inst = (freerdp*)instance;
rdpSettings * settings = inst->settings;
DEBUG_ANDROID("sound redirect: %s", enable ? "TRUE" : "FALSE");
DEBUG_ANDROID("sound: %s",
redirect ? ((redirect == 1) ? "Server" : "Redirect") : "None");
p = malloc(sizeof(char*));
p[0] = "rdpsnd";
settings->AudioPlayback = (redirect == 2) ? TRUE : FALSE;
settings->RemoteConsoleAudio = (redirect == 1) ? TRUE : FALSE;
if (settings->AudioPlayback)
{
p = malloc(sizeof(char*));
p[0] = "rdpsnd";
freerdp_client_add_static_channel(settings, count, p);
freerdp_client_add_static_channel(settings, count, p);
free(p);
free(p);
}
}
JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env,
@ -695,12 +701,16 @@ JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env,
DEBUG_ANDROID("microphone redirect: %s", enable ? "TRUE" : "FALSE");
p = malloc(sizeof(char*));
p[0] = "audin";
settings->AudioCapture = enable;
if (enable)
{
p = malloc(sizeof(char*));
p[0] = "audin";
freerdp_client_add_dynamic_channel(settings, count, p);
freerdp_client_add_dynamic_channel(settings, count, p);
free(p);
free(p);
}
}
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);
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_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_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);

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
(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);
}

View File

@ -93,7 +93,7 @@ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_
* Signature: (IZ)V
*/
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

View File

@ -116,6 +116,16 @@
<string name="settings_gateway_settings">Gateway Settings</string>
<string name="settings_redirect_sdcard">Redirect SDCard</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_security">Seguridad</string>
<string-array name="security_array">

View File

@ -115,6 +115,16 @@
<string name="settings_gateway_settings">Gateway Settings</string>
<string name="settings_redirect_sdcard">"Redirect SDCard"</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_security">"Securité"</string>
<string-array name="security_array">

View File

@ -116,6 +116,16 @@
<string name="settings_gateway_settings">Gateway instellingen</string>
<string name="settings_redirect_sdcard">SDCard aankoppelen</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_security">Beveiliging</string>
<string-array name="security_array">

View File

@ -112,7 +112,17 @@
<string name="settings_enable_gateway_settings">Enable Gateway</string>
<string name="settings_gateway_settings">Gateway Settings</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_security">Security</string>
<string-array name="security_array">

View File

@ -36,7 +36,7 @@
</PreferenceScreen>
<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"/>
<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"/>

View File

@ -295,7 +295,7 @@ public class BookmarkBase implements Parcelable, Cloneable
private ScreenSettings screen3G;
private PerformanceFlags performance3G;
private boolean redirectSDCard;
private boolean redirectSound;
private int redirectSound;
private boolean redirectMicrophone;
private int security;
private boolean consoleMode;
@ -311,7 +311,7 @@ public class BookmarkBase implements Parcelable, Cloneable
screen3G = parcel.readParcelable(ScreenSettings.class.getClassLoader());
performance3G = parcel.readParcelable(PerformanceFlags.class.getClassLoader());
redirectSDCard = (parcel.readInt() == 1) ? true : false;
redirectSound = (parcel.readInt() == 1) ? true : false;
redirectSound = parcel.readInt();
redirectMicrophone = (parcel.readInt() == 1) ? true : false;
security = parcel.readInt();
consoleMode = (parcel.readInt() == 1) ? true : false;
@ -324,7 +324,7 @@ public class BookmarkBase implements Parcelable, Cloneable
screen3G = new ScreenSettings();
performance3G = new PerformanceFlags();
redirectSDCard = false;
redirectSound = false;
redirectSound = 0;
redirectMicrophone = false;
security = 0;
consoleMode = false;
@ -364,11 +364,11 @@ public class BookmarkBase implements Parcelable, Cloneable
return redirectSDCard;
}
public void setRedirectSound(boolean redirect) {
public void setRedirectSound(int redirect) {
this.redirectSound = redirect;
}
public boolean getRedirectSound() {
public int getRedirectSound() {
return redirectSound;
}
@ -440,7 +440,7 @@ public class BookmarkBase implements Parcelable, Cloneable
out.writeParcelable(screen3G, flags);
out.writeParcelable(performance3G, flags);
out.writeInt(redirectSDCard ? 1 : 0);
out.writeInt(redirectSound ? 1 : 0);
out.writeInt(redirectSound);
out.writeInt(redirectMicrophone ? 1 : 0);
out.writeInt(security);
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.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.putInt("bookmark.security", advancedSettings.getSecurity());
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.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.setSecurity(sharedPrefs.getInt("bookmark.security", 0));
advancedSettings.setRemoteProgram(sharedPrefs.getString("bookmark.remote_program", ""));

View File

@ -283,7 +283,7 @@ public abstract class BookmarkBaseGateway
readScreenSettings3G(bookmark, cursor);
readPerformanceFlags3G(bookmark, cursor);
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().setSecurity(cursor.getInt(cursor.getColumnIndex("security")));
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_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_drive_redirection(int inst, String path);
@ -169,12 +169,12 @@ public class LibFreeRDP
}
// Sound redirection
if (advancedSettings.getRedirectSound())
freerdp_set_sound_redirection(inst, true);
freerdp_set_sound_redirection(inst,
advancedSettings.getRedirectSound());
// Microphone redirection
if (advancedSettings.getRedirectMicrophone())
freerdp_set_microphone_redirection(inst, true);
freerdp_set_microphone_redirection(inst,
advancedSettings.getRedirectMicrophone());
return true;
}