[Android] [PATCH 4/4] android: add native AudioTrack aout module
某因幡
tewilove at gmail.com
Fri Mar 9 04:27:09 CET 2012
Inline.
2012/3/8 Jean-Baptiste Kempf <jb at videolan.org>:
> 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 ?
>
What's wrong?
>> + 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?
>
I should have seen such lines in Android source tree and did some test
about a year ago...
Now I see it seems to depends on hardware.
>> + // 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?
>
Not sure, but actually it works. I had a X10i with firmware Android
1.6/2.1/2.3, unofficial 2.2 and CM 7.2. :p
> Best regards,
>
> --
> Jean-Baptiste Kempf
> http://www.jbkempf.com/ - +33 672 704 734
> Sent from my Electronic Device
> _______________________________________________
> Android mailing list
> Android at videolan.org
> http://mailman.videolan.org/listinfo/android
--
language: Chinese, Japanese, English
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-android-add-native-AudioTrack-aout-module.patch
Type: text/x-patch
Size: 13191 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/android/attachments/20120309/cf071fd9/attachment-0001.bin>
More information about the Android
mailing list