Commit 1a87ff2b authored by Alexandre Janniaux's avatar Alexandre Janniaux Committed by Thomas Guillem

audiotrack: add support for audio session id

Add a module variable to store an audio session id and use it when creating new
AudioTrack. This session id is generated by AudioManager.getAudioSessionId() in
the Android-side. This allows LibVLC users to broadcast intent allowing
external application to plug on the audio output and apply effect, for instance
an external equalizer.

See also android.media.audiofx.AudioEffect.
Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
(cherry picked from commit 2717d570)
Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent 93473efb
......@@ -179,12 +179,17 @@ struct aout_sys_t {
* will be done by VLC */
#define AUDIOTRACK_NATIVE_SAMPLERATE
#define AUDIOTRACK_SESSION_ID_TEXT " Id of audio session the AudioTrack must be attached to"
vlc_module_begin ()
set_shortname( "AudioTrack" )
set_description( "Android AudioTrack audio output" )
set_capability( "audio output", 180 )
set_category( CAT_AUDIO )
set_subcategory( SUBCAT_AUDIO_AOUT )
add_integer( "audiotrack-session-id", 0,
AUDIOTRACK_SESSION_ID_TEXT, NULL, true )
change_private()
add_sw_gain()
add_shortcut( "audiotrack" )
set_callbacks( Open, Close )
......@@ -320,7 +325,7 @@ InitJNIFields( audio_output_t *p_aout, JNIEnv* env )
jfields.AudioTrack.clazz = (jclass) (*env)->NewGlobalRef( env, clazz );
CHECK_EXCEPTION( "NewGlobalRef", true );
GET_ID( GetMethodID, AudioTrack.ctor, "<init>", "(IIIIII)V", true );
GET_ID( GetMethodID, AudioTrack.ctor, "<init>", "(IIIIIII)V", true );
GET_ID( GetMethodID, AudioTrack.release, "release", "()V", true );
GET_ID( GetMethodID, AudioTrack.getState, "getState", "()I", true );
GET_ID( GetMethodID, AudioTrack.play, "play", "()V", true );
......@@ -815,9 +820,11 @@ AudioTrack_New( JNIEnv *env, audio_output_t *p_aout, unsigned int i_rate,
int i_channel_config, int i_format, int i_size )
{
aout_sys_t *p_sys = p_aout->sys;
jint session_id = var_InheritInteger( p_aout, "audiotrack-session-id" );
jobject p_audiotrack = JNI_AT_NEW( jfields.AudioManager.STREAM_MUSIC,
i_rate, i_channel_config, i_format,
i_size, jfields.AudioTrack.MODE_STREAM );
i_size, jfields.AudioTrack.MODE_STREAM,
session_id );
if( CHECK_AT_EXCEPTION( "AudioTrack<init>" ) || !p_audiotrack )
{
msg_Warn( p_aout, "AudioTrack Init failed" ) ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment