[Android] [PATCH 4/4] android: add native AudioTrack aout module
Jean-Baptiste Kempf
jb at videolan.org
Thu Mar 8 16:54:32 CET 2012
On Sun, Mar 04, 2012 at 06:04:59PM -0500, Rafaël Carré wrote :
> +AC_ARG_ENABLE(android-audiotrack,
> + [ --enable-android-audiotrack Android native AudioTrack audio output module (default disabled)])
> +if test "${enable_android_audiotrack}" = "yes"; then
> + if test "${HAVE_ANDROID}" = "1"; then
> + VLC_ADD_PLUGIN([android_audiotrack])
> + VLC_ADD_LDFLAGS([android_audiotrack], [-ldl])
> + fi
> +fi
Ok. I think we can name it audiotrack though.
> + --enable-android-audiotrack \
Ok.
> +++ b/modules/audio_output/audiotrack.c
Missing license.
> +static AudioSystem_getOutputFrameCount as_getOutputFrameCount = NULL;
> +static AudioSystem_getOutputLatency as_getOutputLatency = NULL;
> +static AudioSystem_getOutputSamplingRate as_getOutputSamplingRate = NULL;
> +static AudioTrack_getMinFrameCount at_getMinFrameCount = NULL;
> +static AudioTrack_ctor at_ctor = NULL;
> +static AudioTrack_ctor_legacy at_ctor_legacy = NULL;
> +static AudioTrack_dtor at_dtor = NULL;
> +static AudioTrack_initCheck at_initCheck = NULL;
> +static AudioTrack_start at_start = NULL;
> +static AudioTrack_stop at_stop = NULL;
> +static AudioTrack_write at_write = NULL;
> +static AudioTrack_flush at_flush = NULL;
Why static ?
> + audio_output_t *p_aout = (audio_output_t*)(p_this);
> + int status;
> + int afSampleRate, afFrameCount, afLatency, minBufCount, minFrameCount;
> + int type, channel, rate, format, size;
> +
> + // AudioSystem::MUSIC = 3
> + type = 3;
Please use a define for that.
> + // 4000 <= frequency <= 48000
> + if (p_aout->format.i_rate < 4000)
> + p_aout->format.i_rate = 4000;
> + if (p_aout->format.i_rate > 48000)
> + p_aout->format.i_rate = 48000;
> + rate = p_aout->format.i_rate;
> + p_sys->rate = rate;
It cannot go above 48000?
> + // AudioSystem::PCM_16_BIT = 1
> + // AudioSystem::PCM_8_BIT = 2
> + format = (p_aout->format.i_format == VLC_CODEC_S16L) ? 1 : 2;
As above.
> + p_sys->size = p_aout->format.i_bytes_per_frame;
> + // sizeof(AudioTrack) == 0x58 (not sure) on 2.2.1, this should be enough
> + p_sys->AudioTrack = malloc(256);
What does the sourcecode of Cyanogen say?
Best regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the Android
mailing list