summaryrefslogtreecommitdiff
Diffstat
-rw-r--r--Android.mk1
-rwxr-xr-xamadec/Android.mk282
-rw-r--r--amadec/acodec_lib_50/libstagefright_soft_dcvdec.so80
-rw-r--r--amadec/acodec_lib_50/libstagefright_soft_dtshd.so85
-rw-r--r--amadec/acodec_lib_50/libstagefright_soft_truehddec.so41
-rw-r--r--amadec/acodec_lib_android_n/libstagefright_soft_dcvdec.so109
-rw-r--r--amadec/acodec_lib_android_n/libstagefright_soft_dtshd.so272
-rw-r--r--amadec/acodec_lib_android_n/libstagefright_soft_truehddec.so87
-rwxr-xr-xamadec/acodec_lib_mx/libstagefright_soft_ddpdec.so113
-rwxr-xr-xamadec/acodec_lib_mx/libstagefright_soft_dtshd.so121
-rw-r--r--amadec/adec-armdec-mgt.h57
-rw-r--r--amadec/adec-external-ctrl.c899
-rw-r--r--amadec/adec-ffmpeg-mgt.c1550
-rw-r--r--amadec/adec-internal-mgt.c772
-rw-r--r--amadec/adec-message.c156
-rw-r--r--amadec/adec-message.h61
-rwxr-xr-xamadec/adec-pts-mgt.c1107
-rw-r--r--amadec/adec-pts-mgt.h82
-rw-r--r--amadec/adec-wfd-out.cpp361
-rw-r--r--amadec/adec-wfd.c811
-rw-r--r--amadec/adec_omx_brige.c284
-rw-r--r--amadec/adec_omx_brige.h56
-rw-r--r--amadec/adec_read.c200
-rw-r--r--amadec/adec_reg.h76
-rw-r--r--amadec/adec_write.c189
-rw-r--r--amadec/adec_write.h42
-rw-r--r--amadec/audio-dec.h314
-rw-r--r--amadec/audio_out/alsa-out.c1082
-rw-r--r--amadec/audio_out/aml_resample.c708
-rw-r--r--amadec/audio_out/aml_resample.h86
-rwxr-xr-xamadec/audio_out/android-out.cpp1640
-rw-r--r--amadec/audiodsp_update_format.c188
-rw-r--r--amadec/dsp/audiodsp-ctl.c471
-rw-r--r--amadec/dts_enc.c209
-rw-r--r--amadec/dts_enc.h11
-rw-r--r--amadec/dts_transenc_api.c143
-rw-r--r--amadec/dts_transenc_api.h19
-rw-r--r--amadec/feeder.c231
-rw-r--r--amadec/feeder.h26
-rw-r--r--amadec/include/adec-external-ctrl.h63
-rwxr-xr-xamadec/include/adec-macros.h41
-rw-r--r--amadec/include/adec-types.h53
-rwxr-xr-xamadec/include/alsa-out.h26
-rw-r--r--amadec/include/audio-out.h41
-rw-r--r--amadec/include/audiodsp.h142
-rw-r--r--amadec/include/audiodsp_update_format.h25
-rw-r--r--amadec/include/log-print.h26
-rwxr-xr-xamadec/omx_audio/ALAC_mediasource.cpp205
-rw-r--r--amadec/omx_audio/ALAC_mediasource.h62
-rwxr-xr-xamadec/omx_audio/ASF_mediasource.cpp184
-rw-r--r--amadec/omx_audio/ASF_mediasource.h127
-rwxr-xr-xamadec/omx_audio/Android.mk34
-rwxr-xr-xamadec/omx_audio/DDP_mediasource.cpp528
-rw-r--r--amadec/omx_audio/DDP_mediasource.h141
-rw-r--r--amadec/omx_audio/DTSHD_mediasource.cpp316
-rw-r--r--amadec/omx_audio/DTSHD_mediasource.h74
-rwxr-xr-xamadec/omx_audio/MP3_mediasource.cpp579
-rw-r--r--amadec/omx_audio/MP3_mediasource.h80
-rw-r--r--amadec/omx_audio/THD_mediasource.cpp229
-rw-r--r--amadec/omx_audio/THD_mediasource.h74
-rwxr-xr-xamadec/omx_audio/Vorbis_mediasource.cpp245
-rw-r--r--amadec/omx_audio/Vorbis_mediasource.h58
-rw-r--r--amadec/omx_audio/adec_omx.cpp421
-rw-r--r--amadec/omx_audio/adec_omx.h71
-rwxr-xr-xamadec/omx_audio/audio_mediasource.cpp37
-rw-r--r--amadec/omx_audio/audio_mediasource.h46
-rw-r--r--amadec/omx_audio/audio_medissource.h137
-rw-r--r--amadec/pcmenc_api.c147
-rw-r--r--amadec/pcmenc_api.h25
-rw-r--r--amadec/spdif_api.c306
-rw-r--r--amadec/spdif_api.h26
-rwxr-xr-xaudio_codec/Android.mk1
-rw-r--r--audio_codec/config.mk10
-rwxr-xr-xaudio_codec/libadpcm/Android.mk12
-rw-r--r--audio_codec/libadpcm/adpcm.h346
-rw-r--r--audio_codec/libadpcm/adpcm_decode.c841
-rwxr-xr-xaudio_codec/libamr/Android.mk25
-rwxr-xr-xaudio_codec/libamr/Makefile5
-rw-r--r--audio_codec/libamr/amr_decode.c186
-rw-r--r--audio_codec/libamr/amr_decode.h8
-rwxr-xr-xaudio_codec/libamr/dec.h18
-rw-r--r--audio_codec/libamr/dec_acelp.c620
-rwxr-xr-xaudio_codec/libamr/dec_acelp.h17
-rw-r--r--audio_codec/libamr/dec_dtx.c683
-rw-r--r--audio_codec/libamr/dec_dtx.h49
-rw-r--r--audio_codec/libamr/dec_gain.c853
-rw-r--r--audio_codec/libamr/dec_gain.h28
-rw-r--r--audio_codec/libamr/dec_if.c834
-rwxr-xr-xaudio_codec/libamr/dec_if.h23
-rw-r--r--audio_codec/libamr/dec_lpc.c789
-rw-r--r--audio_codec/libamr/dec_lpc.h25
-rw-r--r--audio_codec/libamr/dec_main.c842
-rw-r--r--audio_codec/libamr/dec_main.h57
-rw-r--r--audio_codec/libamr/dec_rom.c2114
-rw-r--r--audio_codec/libamr/dec_util.c1304
-rw-r--r--audio_codec/libamr/dec_util.h33
-rw-r--r--audio_codec/libamr/if_rom.c1030
-rwxr-xr-xaudio_codec/libamr/if_rom.h70
-rw-r--r--audio_codec/libamr/interf_dec.c906
-rw-r--r--audio_codec/libamr/interf_dec.h56
-rw-r--r--audio_codec/libamr/interf_rom.h1788
-rw-r--r--audio_codec/libamr/rom_dec.h13274
-rw-r--r--audio_codec/libamr/sp_dec.c6078
-rw-r--r--audio_codec/libamr/sp_dec.h83
-rwxr-xr-xaudio_codec/libamr/typedef.h17
-rwxr-xr-xaudio_codec/libape/Android.mk28
-rw-r--r--audio_codec/libape/Ape_decoder.h216
-rw-r--r--audio_codec/libape/amlogic_r30813_audio_ape_lib.c1
-rw-r--r--audio_codec/libape/apedec.c1120
-rw-r--r--audio_codec/libcook/Android.mk28
-rw-r--r--audio_codec/libcook/aac_bitstream.h133
-rw-r--r--audio_codec/libcook/aac_decode.h148
-rw-r--r--audio_codec/libcook/aac_reorder.h53
-rw-r--r--audio_codec/libcook/assembly.h119
-rw-r--r--audio_codec/libcook/challenge.h132
-rw-r--r--audio_codec/libcook/codec_defines.h93
-rw-r--r--audio_codec/libcook/coder.h287
-rw-r--r--audio_codec/libcook/cook_codec.h30
-rw-r--r--audio_codec/libcook/cook_decode.c624
-rw-r--r--audio_codec/libcook/cook_decode.h35
-rw-r--r--audio_codec/libcook/ga_config.h86
-rw-r--r--audio_codec/libcook/gecko2codec.c833
-rw-r--r--audio_codec/libcook/gecko2codec.h60
-rw-r--r--audio_codec/libcook/helix_config.h92
-rw-r--r--audio_codec/libcook/helix_mime_types.h56
-rw-r--r--audio_codec/libcook/helix_result.h107
-rw-r--r--audio_codec/libcook/helix_types.h305
-rw-r--r--audio_codec/libcook/helix_utils.h106
-rw-r--r--audio_codec/libcook/md5.h113
-rw-r--r--audio_codec/libcook/memory_utils.c100
-rw-r--r--audio_codec/libcook/memory_utils.h58
-rw-r--r--audio_codec/libcook/pack_utils.c306
-rw-r--r--audio_codec/libcook/pack_utils.h93
-rw-r--r--audio_codec/libcook/packet_defines.h48
-rw-r--r--audio_codec/libcook/ra8lbr_decode.c378
-rw-r--r--audio_codec/libcook/ra8lbr_decode.h161
-rw-r--r--audio_codec/libcook/ra_backend.h94
-rw-r--r--audio_codec/libcook/ra_bitpack.c197
-rw-r--r--audio_codec/libcook/ra_buffers.c127
-rw-r--r--audio_codec/libcook/ra_category.c298
-rw-r--r--audio_codec/libcook/ra_couple.c224
-rw-r--r--audio_codec/libcook/ra_decode.c321
-rw-r--r--audio_codec/libcook/ra_decode.h183
-rw-r--r--audio_codec/libcook/ra_depack.c230
-rw-r--r--audio_codec/libcook/ra_depack.h177
-rw-r--r--audio_codec/libcook/ra_depack_internal.c1710
-rw-r--r--audio_codec/libcook/ra_depack_internal.h232
-rw-r--r--audio_codec/libcook/ra_envelope.c123
-rw-r--r--audio_codec/libcook/ra_fft.c368
-rw-r--r--audio_codec/libcook/ra_format_info.h60
-rw-r--r--audio_codec/libcook/ra_gainctrl.c584
-rw-r--r--audio_codec/libcook/ra_huffman.c86
-rw-r--r--audio_codec/libcook/ra_hufftabs.c244
-rw-r--r--audio_codec/libcook/ra_mlt.c357
-rw-r--r--audio_codec/libcook/ra_sqvh.c431
-rw-r--r--audio_codec/libcook/ra_trigtabs.c932
-rw-r--r--audio_codec/libcook/rasl.c376
-rw-r--r--audio_codec/libcook/rasl.h71
-rw-r--r--audio_codec/libcook/rdtpck.h153
-rw-r--r--audio_codec/libcook/rm_error.h54
-rw-r--r--audio_codec/libcook/rm_error_default.c58
-rw-r--r--audio_codec/libcook/rm_error_default.h53
-rw-r--r--audio_codec/libcook/rm_io_default.c101
-rw-r--r--audio_codec/libcook/rm_io_default.h49
-rw-r--r--audio_codec/libcook/rm_memory.h54
-rw-r--r--audio_codec/libcook/rm_memory_default.c54
-rw-r--r--audio_codec/libcook/rm_memory_default.h46
-rw-r--r--audio_codec/libcook/rm_packet.c117
-rw-r--r--audio_codec/libcook/rm_packet.h80
-rw-r--r--audio_codec/libcook/rm_parse.h302
-rw-r--r--audio_codec/libcook/rm_parser.c649
-rw-r--r--audio_codec/libcook/rm_parser_internal.c3342
-rw-r--r--audio_codec/libcook/rm_parser_internal.h420
-rw-r--r--audio_codec/libcook/rm_property.c105
-rw-r--r--audio_codec/libcook/rm_property.h107
-rw-r--r--audio_codec/libcook/rm_stream.c356
-rw-r--r--audio_codec/libcook/rm_stream.h115
-rw-r--r--audio_codec/libcook/rm_stream_internal.h77
-rw-r--r--audio_codec/libcook/rv20backend.h69
-rw-r--r--audio_codec/libcook/rv30backend.h68
-rw-r--r--audio_codec/libcook/rv_backend.h84
-rw-r--r--audio_codec/libcook/rv_backend_types.h198
-rw-r--r--audio_codec/libcook/rv_decode.h208
-rw-r--r--audio_codec/libcook/rv_decode_message.h492
-rw-r--r--audio_codec/libcook/rv_depack.c271
-rw-r--r--audio_codec/libcook/rv_depack.h162
-rw-r--r--audio_codec/libcook/rv_depack_internal.c1071
-rw-r--r--audio_codec/libcook/rv_depack_internal.h171
-rw-r--r--audio_codec/libcook/rv_format_info.h91
-rw-r--r--audio_codec/libcook/statname.h118
-rw-r--r--audio_codec/libcook/stream_hdr_structs.h66
-rw-r--r--audio_codec/libcook/stream_hdr_utils.c136
-rw-r--r--audio_codec/libcook/stream_hdr_utils.h77
-rw-r--r--audio_codec/libcook/string_utils.c87
-rw-r--r--audio_codec/libcook/string_utils.h62
-rw-r--r--audio_codec/libcook/tngpkt.h400
-rwxr-xr-xaudio_codec/libfaad/Android.mk101
-rwxr-xr-xaudio_codec/libfaad/Makefile130
-rw-r--r--audio_codec/libfaad/analysis.h52
-rwxr-xr-xaudio_codec/libfaad/audio.d3
-rw-r--r--audio_codec/libfaad/bits.c261
-rwxr-xr-xaudio_codec/libfaad/bits.d18
-rw-r--r--audio_codec/libfaad/bits.h446
-rw-r--r--audio_codec/libfaad/cfft.c988
-rw-r--r--audio_codec/libfaad/cfft.h55
-rw-r--r--audio_codec/libfaad/cfft_tab.h1816
-rw-r--r--audio_codec/libfaad/codebook/hcb.h140
-rw-r--r--audio_codec/libfaad/codebook/hcb_1.h186
-rw-r--r--audio_codec/libfaad/codebook/hcb_10.h312
-rw-r--r--audio_codec/libfaad/codebook/hcb_11.h415
-rw-r--r--audio_codec/libfaad/codebook/hcb_2.h185
-rw-r--r--audio_codec/libfaad/codebook/hcb_3.h196
-rw-r--r--audio_codec/libfaad/codebook/hcb_4.h199
-rw-r--r--audio_codec/libfaad/codebook/hcb_5.h196
-rw-r--r--audio_codec/libfaad/codebook/hcb_6.h182
-rw-r--r--audio_codec/libfaad/codebook/hcb_7.h162
-rw-r--r--audio_codec/libfaad/codebook/hcb_8.h173
-rw-r--r--audio_codec/libfaad/codebook/hcb_9.h372
-rw-r--r--audio_codec/libfaad/codebook/hcb_sf.h276
-rw-r--r--audio_codec/libfaad/common.c558
-rw-r--r--audio_codec/libfaad/common.h453
-rw-r--r--audio_codec/libfaad/decoder.c2266
-rw-r--r--audio_codec/libfaad/drc.c173
-rw-r--r--audio_codec/libfaad/drc.h49
-rw-r--r--audio_codec/libfaad/drm_dec.c912
-rw-r--r--audio_codec/libfaad/drm_dec.h99
-rw-r--r--audio_codec/libfaad/error.c72
-rw-r--r--audio_codec/libfaad/error.h44
-rw-r--r--audio_codec/libfaad/filtbank.c408
-rw-r--r--audio_codec/libfaad/filtbank.h61
-rw-r--r--audio_codec/libfaad/fixed.h287
-rw-r--r--audio_codec/libfaad/hcr.c422
-rw-r--r--audio_codec/libfaad/helixaac/aaccommon.h210
-rw-r--r--audio_codec/libfaad/helixaac/aacdec.c508
-rw-r--r--audio_codec/libfaad/helixaac/aacdec.h206
-rw-r--r--audio_codec/libfaad/helixaac/aactabs.c157
-rw-r--r--audio_codec/libfaad/helixaac/assembly.h631
-rw-r--r--audio_codec/libfaad/helixaac/assembly_mw.h743
-rw-r--r--audio_codec/libfaad/helixaac/bitstream.c261
-rw-r--r--audio_codec/libfaad/helixaac/bitstream.h74
-rw-r--r--audio_codec/libfaad/helixaac/buffers.c140
-rw-r--r--audio_codec/libfaad/helixaac/coder.h369
-rw-r--r--audio_codec/libfaad/helixaac/dct4.c337
-rw-r--r--audio_codec/libfaad/helixaac/decelmnt.c445
-rw-r--r--audio_codec/libfaad/helixaac/dequant.c379
-rw-r--r--audio_codec/libfaad/helixaac/fft.c391
-rw-r--r--audio_codec/libfaad/helixaac/filefmt.c539
-rw-r--r--audio_codec/libfaad/helixaac/huffman_helix.c450
-rw-r--r--audio_codec/libfaad/helixaac/hufftabs.c177
-rw-r--r--audio_codec/libfaad/helixaac/imdct.c596
-rw-r--r--audio_codec/libfaad/helixaac/noiseless.c513
-rw-r--r--audio_codec/libfaad/helixaac/pns_helix.c371
-rw-r--r--audio_codec/libfaad/helixaac/sbr.c433
-rw-r--r--audio_codec/libfaad/helixaac/sbr.h380
-rw-r--r--audio_codec/libfaad/helixaac/sbrfft.c368
-rw-r--r--audio_codec/libfaad/helixaac/sbrfreq.c673
-rw-r--r--audio_codec/libfaad/helixaac/sbrhfadj.c882
-rw-r--r--audio_codec/libfaad/helixaac/sbrhfgen.c655
-rw-r--r--audio_codec/libfaad/helixaac/sbrhuff.c494
-rw-r--r--audio_codec/libfaad/helixaac/sbrimdct.c447
-rw-r--r--audio_codec/libfaad/helixaac/sbrmath.c198
-rw-r--r--audio_codec/libfaad/helixaac/sbrqmf.c648
-rw-r--r--audio_codec/libfaad/helixaac/sbrside.c634
-rw-r--r--audio_codec/libfaad/helixaac/sbrtabs.c400
-rw-r--r--audio_codec/libfaad/helixaac/statname.h115
-rw-r--r--audio_codec/libfaad/helixaac/stproc.c251
-rw-r--r--audio_codec/libfaad/helixaac/tns_helix.c307
-rw-r--r--audio_codec/libfaad/helixaac/trigtabs.c1000
-rw-r--r--audio_codec/libfaad/helixaac/trigtabs_fltgen.c357
-rw-r--r--audio_codec/libfaad/huffman.c582
-rw-r--r--audio_codec/libfaad/huffman.h47
-rw-r--r--audio_codec/libfaad/ic_predict.c258
-rw-r--r--audio_codec/libfaad/ic_predict.h252
-rw-r--r--audio_codec/libfaad/iq_table.h16456
-rw-r--r--audio_codec/libfaad/is.c106
-rw-r--r--audio_codec/libfaad/is.h67
-rw-r--r--audio_codec/libfaad/kbd_win.h2294
-rw-r--r--audio_codec/libfaad/libaacdec.c544
-rw-r--r--audio_codec/libfaad/libaacdec.h64
-rwxr-xr-xaudio_codec/libfaad/libfaad2.def14
-rw-r--r--audio_codec/libfaad/lt_predict.c205
-rw-r--r--audio_codec/libfaad/lt_predict.h66
-rw-r--r--audio_codec/libfaad/mdct.c307
-rw-r--r--audio_codec/libfaad/mdct.h48
-rw-r--r--audio_codec/libfaad/mdct_tab.h3639
-rw-r--r--audio_codec/libfaad/mp4.c307
-rw-r--r--audio_codec/libfaad/mp4.h52
-rw-r--r--audio_codec/libfaad/ms.c71
-rw-r--r--audio_codec/libfaad/ms.h44
-rw-r--r--audio_codec/libfaad/neaacdec.h257
-rw-r--r--audio_codec/libfaad/output.c583
-rw-r--r--audio_codec/libfaad/output.h48
-rw-r--r--audio_codec/libfaad/pns.c273
-rw-r--r--audio_codec/libfaad/pns.h58
-rw-r--r--audio_codec/libfaad/ps_dec.c1905
-rw-r--r--audio_codec/libfaad/ps_dec.h151
-rw-r--r--audio_codec/libfaad/ps_syntax.c532
-rw-r--r--audio_codec/libfaad/ps_tables.h547
-rw-r--r--audio_codec/libfaad/pulse.c59
-rw-r--r--audio_codec/libfaad/pulse.h43
-rw-r--r--audio_codec/libfaad/rvlc.c524
-rw-r--r--audio_codec/libfaad/rvlc.h55
-rw-r--r--audio_codec/libfaad/sbr_dct.c2267
-rw-r--r--audio_codec/libfaad/sbr_dct.h52
-rw-r--r--audio_codec/libfaad/sbr_dec.c679
-rw-r--r--audio_codec/libfaad/sbr_dec.h253
-rw-r--r--audio_codec/libfaad/sbr_e_nf.c475
-rw-r--r--audio_codec/libfaad/sbr_e_nf.h50
-rw-r--r--audio_codec/libfaad/sbr_fbt.c737
-rw-r--r--audio_codec/libfaad/sbr_fbt.h55
-rw-r--r--audio_codec/libfaad/sbr_hfadj.c1644
-rw-r--r--audio_codec/libfaad/sbr_hfadj.h56
-rw-r--r--audio_codec/libfaad/sbr_hfgen.c647
-rw-r--r--audio_codec/libfaad/sbr_hfgen.h49
-rw-r--r--audio_codec/libfaad/sbr_huff.c344
-rw-r--r--audio_codec/libfaad/sbr_huff.h46
-rw-r--r--audio_codec/libfaad/sbr_noise.h564
-rw-r--r--audio_codec/libfaad/sbr_qmf.c614
-rw-r--r--audio_codec/libfaad/sbr_qmf.h55
-rw-r--r--audio_codec/libfaad/sbr_qmf_c.h368
-rw-r--r--audio_codec/libfaad/sbr_syntax.c893
-rw-r--r--audio_codec/libfaad/sbr_syntax.h68
-rw-r--r--audio_codec/libfaad/sbr_tf_grid.c247
-rw-r--r--audio_codec/libfaad/sbr_tf_grid.h47
-rw-r--r--audio_codec/libfaad/sine_win.h4296
-rw-r--r--audio_codec/libfaad/specrec.c1249
-rw-r--r--audio_codec/libfaad/specrec.h49
-rw-r--r--audio_codec/libfaad/ssr.c170
-rw-r--r--audio_codec/libfaad/ssr.h59
-rw-r--r--audio_codec/libfaad/ssr_fb.c191
-rw-r--r--audio_codec/libfaad/ssr_fb.h53
-rw-r--r--audio_codec/libfaad/ssr_ipqf.c171
-rw-r--r--audio_codec/libfaad/ssr_ipqf.h46
-rw-r--r--audio_codec/libfaad/ssr_win.h635
-rw-r--r--audio_codec/libfaad/structs.h513
-rw-r--r--audio_codec/libfaad/syntax.c2539
-rw-r--r--audio_codec/libfaad/syntax.h129
-rw-r--r--audio_codec/libfaad/tns.c304
-rw-r--r--audio_codec/libfaad/tns.h51
-rwxr-xr-xaudio_codec/libflac/Android.mk22
-rw-r--r--audio_codec/libflac/avcodec.h337
-rw-r--r--audio_codec/libflac/bswap.h94
-rw-r--r--audio_codec/libflac/codec.h36
-rw-r--r--audio_codec/libflac/codec_message.h109
-rw-r--r--audio_codec/libflac/common.h356
-rw-r--r--audio_codec/libflac/crc.c146
-rw-r--r--audio_codec/libflac/crc.h46
-rw-r--r--audio_codec/libflac/flac.c43
-rw-r--r--audio_codec/libflac/flac.h124
-rw-r--r--audio_codec/libflac/flac_decode.c943
-rw-r--r--audio_codec/libflac/flacdata.c38
-rw-r--r--audio_codec/libflac/flacdata.h29
-rw-r--r--audio_codec/libflac/get_bits.h564
-rw-r--r--audio_codec/libflac/golomb.h585
-rw-r--r--audio_codec/libflac/internal.h195
-rw-r--r--audio_codec/libflac/intreadwrite.h390
-rw-r--r--audio_codec/libflac/mathops.h78
-rw-r--r--audio_codec/libflac/types.h49
-rwxr-xr-xaudio_codec/liblpcm/Android.mk13
-rw-r--r--audio_codec/liblpcm/lpcm_decode.c437
-rwxr-xr-xaudio_codec/libmad/Android.mk13
-rwxr-xr-xaudio_codec/libmad/D.dat607
-rw-r--r--audio_codec/libmad/bit.c244
-rw-r--r--audio_codec/libmad/bit.h47
-rw-r--r--audio_codec/libmad/config.h133
-rw-r--r--audio_codec/libmad/decoder.c1102
-rw-r--r--audio_codec/libmad/decoder.h91
-rw-r--r--audio_codec/libmad/fixed.c85
-rw-r--r--audio_codec/libmad/fixed.h499
-rw-r--r--audio_codec/libmad/frame.c525
-rw-r--r--audio_codec/libmad/frame.h118
-rw-r--r--audio_codec/libmad/global.h58
-rw-r--r--audio_codec/libmad/huffman.c3109
-rw-r--r--audio_codec/libmad/huffman.h66
-rwxr-xr-xaudio_codec/libmad/imdct_l_arm.S1000
-rwxr-xr-xaudio_codec/libmad/imdct_s.dat62
-rw-r--r--audio_codec/libmad/layer12.c552
-rwxr-xr-xaudio_codec/libmad/layer12.h31
-rw-r--r--audio_codec/libmad/layer3.c2742
-rwxr-xr-xaudio_codec/libmad/layer3.h30
-rw-r--r--audio_codec/libmad/mad.h966
-rwxr-xr-xaudio_codec/libmad/qc_table.dat77
-rwxr-xr-xaudio_codec/libmad/rq_table.dat8747
-rwxr-xr-xaudio_codec/libmad/sf_table.dat106
-rw-r--r--audio_codec/libmad/stream.c185
-rw-r--r--audio_codec/libmad/stream.h111
-rw-r--r--audio_codec/libmad/synth.c921
-rw-r--r--audio_codec/libmad/synth.h69
-rw-r--r--audio_codec/libmad/timer.c493
-rw-r--r--audio_codec/libmad/timer.h100
-rw-r--r--audio_codec/libmad/version.c91
-rw-r--r--audio_codec/libmad/version.h47
-rwxr-xr-xaudio_codec/libpcm/Android.mk11
-rw-r--r--audio_codec/libpcm/intreadwrite.h390
-rw-r--r--audio_codec/libpcm/pcm_decode.c780
-rw-r--r--audio_codec/libraac/Android.mk51
-rw-r--r--audio_codec/libraac/aac_bitstream.c200
-rw-r--r--audio_codec/libraac/aac_bitstream.h133
-rw-r--r--audio_codec/libraac/aac_decode.h148
-rw-r--r--audio_codec/libraac/aac_decode_main.c396
-rw-r--r--audio_codec/libraac/aac_reorder.c85
-rw-r--r--audio_codec/libraac/aac_reorder.h53
-rw-r--r--audio_codec/libraac/aaccommon.h200
-rw-r--r--audio_codec/libraac/aacdec.c607
-rw-r--r--audio_codec/libraac/aacdec.h200
-rw-r--r--audio_codec/libraac/aactabs.c157
-rw-r--r--audio_codec/libraac/assembly.h147
-rw-r--r--audio_codec/libraac/bitstream.c451
-rw-r--r--audio_codec/libraac/bitstream.h76
-rw-r--r--audio_codec/libraac/buffers.c132
-rw-r--r--audio_codec/libraac/coder.h370
-rw-r--r--audio_codec/libraac/dct4.c339
-rw-r--r--audio_codec/libraac/decelmnt.c451
-rw-r--r--audio_codec/libraac/dequant.c382
-rw-r--r--audio_codec/libraac/fft.c393
-rw-r--r--audio_codec/libraac/filefmt.c531
-rw-r--r--audio_codec/libraac/ga_config.c209
-rw-r--r--audio_codec/libraac/ga_config.h86
-rw-r--r--audio_codec/libraac/huffman.c449
-rw-r--r--audio_codec/libraac/hufftabs.c177
-rw-r--r--audio_codec/libraac/imdct.c598
-rw-r--r--audio_codec/libraac/include/challenge.h132
-rw-r--r--audio_codec/libraac/include/codec_defines.h93
-rw-r--r--audio_codec/libraac/include/gecko2codec.h60
-rw-r--r--audio_codec/libraac/include/helix_config.h92
-rw-r--r--audio_codec/libraac/include/helix_mime_types.h56
-rw-r--r--audio_codec/libraac/include/helix_result.h107
-rw-r--r--audio_codec/libraac/include/helix_types.h305
-rw-r--r--audio_codec/libraac/include/helix_utils.h106
-rw-r--r--audio_codec/libraac/include/md5.h113
-rw-r--r--audio_codec/libraac/include/memory_utils.h58
-rw-r--r--audio_codec/libraac/include/pack_utils.h93
-rw-r--r--audio_codec/libraac/include/packet_defines.h48
-rw-r--r--audio_codec/libraac/include/ra8lbr_decode.h161
-rw-r--r--audio_codec/libraac/include/ra_backend.h94
-rw-r--r--audio_codec/libraac/include/ra_decode.h183
-rw-r--r--audio_codec/libraac/include/ra_depack.h177
-rw-r--r--audio_codec/libraac/include/ra_format_info.h60
-rw-r--r--audio_codec/libraac/include/rasl.h71
-rw-r--r--audio_codec/libraac/include/rdtpck.h153
-rw-r--r--audio_codec/libraac/include/rm_error.h54
-rw-r--r--audio_codec/libraac/include/rm_error_default.h53
-rw-r--r--audio_codec/libraac/include/rm_io_default.h49
-rw-r--r--audio_codec/libraac/include/rm_memory.h54
-rw-r--r--audio_codec/libraac/include/rm_memory_default.h46
-rw-r--r--audio_codec/libraac/include/rm_packet.h80
-rw-r--r--audio_codec/libraac/include/rm_parse.h302
-rw-r--r--audio_codec/libraac/include/rm_property.h107
-rw-r--r--audio_codec/libraac/include/rm_stream.h115
-rw-r--r--audio_codec/libraac/include/rm_stream_internal.h77
-rw-r--r--audio_codec/libraac/include/rv20backend.h69
-rw-r--r--audio_codec/libraac/include/rv30backend.h68
-rw-r--r--audio_codec/libraac/include/rv_backend.h84
-rw-r--r--audio_codec/libraac/include/rv_backend_types.h198
-rw-r--r--audio_codec/libraac/include/rv_decode.h208
-rw-r--r--audio_codec/libraac/include/rv_decode_message.h492
-rw-r--r--audio_codec/libraac/include/rv_depack.h162
-rw-r--r--audio_codec/libraac/include/rv_format_info.h91
-rw-r--r--audio_codec/libraac/include/statname.h118
-rw-r--r--audio_codec/libraac/include/stream_hdr_structs.h66
-rw-r--r--audio_codec/libraac/include/stream_hdr_utils.h77
-rw-r--r--audio_codec/libraac/include/string_utils.h62
-rw-r--r--audio_codec/libraac/include/tngpkt.h400
-rw-r--r--audio_codec/libraac/memory_utils.c100
-rw-r--r--audio_codec/libraac/noiseless.c503
-rw-r--r--audio_codec/libraac/pack_utils.c306
-rw-r--r--audio_codec/libraac/pns.c369
-rw-r--r--audio_codec/libraac/ra_depack.c230
-rw-r--r--audio_codec/libraac/ra_depack_internal.c1713
-rw-r--r--audio_codec/libraac/ra_depack_internal.h232
-rw-r--r--audio_codec/libraac/raac_decode.c854
-rw-r--r--audio_codec/libraac/raac_decode.h37
-rw-r--r--audio_codec/libraac/rm_error_default.c60
-rw-r--r--audio_codec/libraac/rm_io_default.c101
-rw-r--r--audio_codec/libraac/rm_memory_default.c54
-rw-r--r--audio_codec/libraac/rm_packet.c117
-rw-r--r--audio_codec/libraac/rm_parser.c649
-rw-r--r--audio_codec/libraac/rm_parser_internal.c3342
-rw-r--r--audio_codec/libraac/rm_parser_internal.h420
-rw-r--r--audio_codec/libraac/rm_property.c105
-rw-r--r--audio_codec/libraac/rm_stream.c356
-rw-r--r--audio_codec/libraac/rv_depack.c271
-rw-r--r--audio_codec/libraac/rv_depack_internal.c1071
-rw-r--r--audio_codec/libraac/rv_depack_internal.h171
-rw-r--r--audio_codec/libraac/sbr.c431
-rw-r--r--audio_codec/libraac/sbr.h381
-rwxr-xr-xaudio_codec/libraac/sbrcov.s164
-rw-r--r--audio_codec/libraac/sbrfft.c368
-rw-r--r--audio_codec/libraac/sbrfreq.c667
-rw-r--r--audio_codec/libraac/sbrhfadj.c877
-rw-r--r--audio_codec/libraac/sbrhfgen.c646
-rw-r--r--audio_codec/libraac/sbrhuff.c492
-rw-r--r--audio_codec/libraac/sbrimdct.c447
-rw-r--r--audio_codec/libraac/sbrmath.c198
-rw-r--r--audio_codec/libraac/sbrqmf.c643
-rwxr-xr-xaudio_codec/libraac/sbrqmfak.s182
-rwxr-xr-xaudio_codec/libraac/sbrqmfsk.s130
-rw-r--r--audio_codec/libraac/sbrside.c615
-rw-r--r--audio_codec/libraac/sbrtabs.c400
-rw-r--r--audio_codec/libraac/statname.h115
-rw-r--r--audio_codec/libraac/stproc.c252
-rw-r--r--audio_codec/libraac/stream_hdr_utils.c136
-rw-r--r--audio_codec/libraac/string_utils.c87
-rw-r--r--audio_codec/libraac/tns.c307
-rw-r--r--audio_codec/libraac/trigtabs.c1000
-rw-r--r--audio_codec/libraac/trigtabs_fltgen.c357
-rwxr-xr-xaudio_codec/wfd_aac_decoder/Android.mk23
-rw-r--r--audio_codec/wfd_aac_decoder/aaccommon.h210
-rw-r--r--audio_codec/wfd_aac_decoder/aacdec.c508
-rw-r--r--audio_codec/wfd_aac_decoder/aacdec.h206
-rw-r--r--audio_codec/wfd_aac_decoder/aactabs.c157
-rw-r--r--audio_codec/wfd_aac_decoder/assembly.h640
-rw-r--r--audio_codec/wfd_aac_decoder/assembly_mw.h743
-rw-r--r--audio_codec/wfd_aac_decoder/bitstream.c261
-rw-r--r--audio_codec/wfd_aac_decoder/bitstream.h74
-rw-r--r--audio_codec/wfd_aac_decoder/buffers.c140
-rw-r--r--audio_codec/wfd_aac_decoder/coder.h369
-rw-r--r--audio_codec/wfd_aac_decoder/dct4.c337
-rw-r--r--audio_codec/wfd_aac_decoder/decelmnt.c445
-rw-r--r--audio_codec/wfd_aac_decoder/dequant.c379
-rw-r--r--audio_codec/wfd_aac_decoder/fft.c391
-rw-r--r--audio_codec/wfd_aac_decoder/filefmt.c539
-rw-r--r--audio_codec/wfd_aac_decoder/helix_aac_decode.c548
-rw-r--r--audio_codec/wfd_aac_decoder/huffman.c450
-rw-r--r--audio_codec/wfd_aac_decoder/hufftabs.c177
-rw-r--r--audio_codec/wfd_aac_decoder/imdct.c596
-rw-r--r--audio_codec/wfd_aac_decoder/noiseless.c513
-rw-r--r--audio_codec/wfd_aac_decoder/pns.c371
-rw-r--r--audio_codec/wfd_aac_decoder/sbr.c434
-rw-r--r--audio_codec/wfd_aac_decoder/sbr.h380
-rw-r--r--audio_codec/wfd_aac_decoder/sbrfft.c368
-rw-r--r--audio_codec/wfd_aac_decoder/sbrfreq.c673
-rw-r--r--audio_codec/wfd_aac_decoder/sbrhfadj.c882
-rw-r--r--audio_codec/wfd_aac_decoder/sbrhfgen.c655
-rw-r--r--audio_codec/wfd_aac_decoder/sbrhuff.c494
-rw-r--r--audio_codec/wfd_aac_decoder/sbrimdct.c447
-rw-r--r--audio_codec/wfd_aac_decoder/sbrmath.c198
-rw-r--r--audio_codec/wfd_aac_decoder/sbrqmf.c648
-rw-r--r--audio_codec/wfd_aac_decoder/sbrside.c634
-rw-r--r--audio_codec/wfd_aac_decoder/sbrtabs.c400
-rw-r--r--audio_codec/wfd_aac_decoder/statname.h115
-rw-r--r--audio_codec/wfd_aac_decoder/stproc.c251
-rw-r--r--audio_codec/wfd_aac_decoder/tns.c307
-rw-r--r--audio_codec/wfd_aac_decoder/trigtabs.c1000
-rw-r--r--audio_codec/wfd_aac_decoder/trigtabs_fltgen.c357
545 files changed, 230976 insertions, 0 deletions
diff --git a/amadec/adec-wfd.c b/amadec/adec-wfd.c
new file mode 100644
index 0000000..c1faf4d
--- a/dev/null
+++ b/amadec/adec-wfd.c
@@ -0,0 +1,811 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <sys/ioctl.h>
+#include <dlfcn.h>
+
+#include <adec-pts-mgt.h>
+#include <adec_write.h>
+#include <adec_omx_brige.h>
+#include <Amsysfsutils.h>
+#include <audio-dec.h>
+#include <cutils/properties.h>
+#include <amthreadpool.h>
+#include "audiodsp_update_format.h"
+
+typedef struct {
+ int codec_id;
+ char name[64];
+} audio_lib_t;
+
+typedef int (*fn_pcm_output_init)(int sr, int ch);
+typedef int (*fn_pcm_output_write)(char *buf, unsigned size);
+typedef int (*fn_pcm_output_uninit)();
+typedef int (*fn_pcm_output_latency)();
+
+
+typedef void (*fn_audio_set_exit_flag)();
+
+
+static audio_lib_t wfd_audio_lib_list[] = {
+ {ACODEC_FMT_WIFIDISPLAY, "libpcm_wfd.so"},
+ {ACODEC_FMT_AAC, "libaac_helix.so"},
+ 0
+} ;
+static audio_decoder_operations_t WFDAudioDecoder = {
+ "WFDDecoder",
+ AUDIO_ARM_DECODER,
+ 0,
+};
+
+static fn_pcm_output_init wfd_out_init = NULL;
+static fn_pcm_output_write wfd_out_write = NULL;
+static fn_pcm_output_uninit wfd_out_uninit = NULL;
+static fn_pcm_output_latency wfd_out_latency = NULL;
+
+
+static fn_audio_set_exit_flag wfd_adec_exit = NULL;
+static void *dec_mLibHandle = NULL;
+static void *out_mLibHandle = NULL;
+static void *audio_wfd_decode_loop(void *args);
+static void stop_wfd_decode_thread(aml_audio_dec_t *audec);
+static int wfd_register_audio_lib(aml_audio_dec_t *audec)
+{
+ int i;
+ int num;
+ audio_lib_t *f;
+ adec_print("wfd audec->format %d,audec->codec_id %x", audec->format, audec->codec_id);
+ num = ARRAY_SIZE(wfd_audio_lib_list);
+ audio_decoder_operations_t *adec_ops = audec->adec_ops;
+ for (i = 0; i < num; i++) {
+ f = &wfd_audio_lib_list[i];
+ if (f->codec_id == audec->format) {
+ dec_mLibHandle = dlopen(wfd_audio_lib_list[i].name, RTLD_NOW);
+ if (dec_mLibHandle) {
+ adec_ops->init = dlsym(dec_mLibHandle, "audio_dec_init");
+ adec_ops->decode = dlsym(dec_mLibHandle, "audio_dec_decode");
+ adec_ops->release = dlsym(dec_mLibHandle, "audio_dec_release");
+ adec_ops->getinfo = dlsym(dec_mLibHandle, "audio_dec_getinfo");
+ wfd_adec_exit = dlsym(dec_mLibHandle, "audio_set_exit_flag");
+ if (!adec_ops->init || !adec_ops->decode || !adec_ops->release || !adec_ops->getinfo || !wfd_adec_exit) {
+ adec_print("in %s,decode func not implemented %p %p %p %p \n", wfd_audio_lib_list[i].name, \
+ adec_ops->init, adec_ops->decode, adec_ops->release, adec_ops->getinfo);
+ goto error;
+ }
+ } else {
+ adec_print("wfd cant find decoder lib\n");
+ goto error;
+ }
+ return 0;
+ }
+ }
+error:
+ if (dec_mLibHandle) {
+ dlclose(dec_mLibHandle);
+ }
+ dec_mLibHandle = NULL;
+ return -1;
+}
+static int wfd_register_output_lib(aml_audio_dec_t *audec)
+{
+ out_mLibHandle = dlopen("libamadec_wfd_out.so", RTLD_NOW);
+ if (out_mLibHandle) {
+ wfd_out_init = dlsym(out_mLibHandle, "pcm_output_init");
+ wfd_out_write = dlsym(out_mLibHandle, "pcm_output_write");
+ wfd_out_uninit = dlsym(out_mLibHandle, "pcm_output_uninit");
+ wfd_out_latency = dlsym(out_mLibHandle, "pcm_output_latency");
+
+ if (!wfd_out_init || !wfd_out_write || !wfd_out_uninit || !wfd_out_latency) {
+ adec_print("wfd load output lib api failed\n");
+ goto error;
+ }
+ } else {
+ goto error;
+ }
+ return 0;
+error:
+ if (out_mLibHandle) {
+ dlclose(out_mLibHandle);
+ }
+ out_mLibHandle = NULL;
+ return -1;
+
+
+}
+static void wfd_unregister_lib()
+{
+ if (out_mLibHandle) {
+ dlclose(out_mLibHandle);
+ }
+ out_mLibHandle = NULL;
+ if (dec_mLibHandle) {
+ dlclose(dec_mLibHandle);
+ }
+ dec_mLibHandle = NULL;
+}
+extern int read_buffer(unsigned char *buffer, int size);
+
+
+static int wfd_dec_pcm_read(dsp_operations_t *dsp_ops, char *buffer, int len)
+{
+ return 0;
+}
+static unsigned long wfd_dec_get_pts(dsp_operations_t *dsp_ops)
+{
+ unsigned long val, offset;
+ unsigned long pts;
+ int data_width, channels, samplerate;
+ unsigned long long frame_nums ;
+ unsigned long delay_pts;
+ samplerate = 48000;
+ aml_audio_dec_t *audec = (aml_audio_dec_t *)dsp_ops->audec;
+ offset = audec->decode_offset;
+
+ if (dsp_ops->dsp_file_fd >= 0) {
+ ioctl(dsp_ops->dsp_file_fd, AMSTREAM_IOC_APTS_LOOKUP, &offset);
+ } else {
+ adec_print("====abuf have not open!\n", val);
+ }
+ pts = offset;
+ if (pts == 0) {
+ if (audec->last_valid_pts) {
+ pts = audec->last_valid_pts;
+ }
+ frame_nums = (audec->out_len_after_last_valid_pts * 8 / (16 * 2));
+ adec_print("decode_offset:%d out_pcm:%d pts:%d \n", audec->decode_offset, audec->out_len_after_last_valid_pts, pts);
+ pts += (frame_nums * 90000 / samplerate);
+ return pts;
+ }
+ audec->last_valid_pts = pts;
+ audec->out_len_after_last_valid_pts = 0;
+ return pts;
+}
+
+static unsigned long wfd_dec_get_pcrscr(dsp_operations_t *dsp_ops)
+{
+ unsigned long val;
+ if (dsp_ops->dsp_file_fd < 0) {
+ adec_print("read error!! audiodsp have not opened\n");
+ return -1;
+ }
+ ioctl(dsp_ops->dsp_file_fd, AMSTREAM_IOC_PCRSCR, &val);
+ return val;
+}
+unsigned long wfd_dec_set_pts(dsp_operations_t *dsp_ops, unsigned long apts)
+{
+ if (dsp_ops->dsp_file_fd < 0) {
+ adec_print("armdec_set_apts err!\n");
+ return -1;
+ }
+ ioctl(dsp_ops->dsp_file_fd, AMSTREAM_IOC_SET_APTS, &apts);
+ return 0;
+}
+static int wfd_dec_set_skip_bytes(dsp_operations_t* dsp_ops, unsigned int bytes)
+{
+ return 0;
+}
+static int set_sysfs_int(const char *path, int val)
+{
+ return amsysfs_set_sysfs_int(path, val);
+}
+
+
+static int wfd_audio_codec_release(aml_audio_dec_t *audec)
+{
+ if (wfd_adec_exit) {
+ wfd_adec_exit();
+ }
+ stop_wfd_decode_thread(audec);
+ if (wfd_out_uninit) {
+ wfd_out_uninit();
+ }
+ audec->adec_ops->release(audec->adec_ops);
+ wfd_unregister_lib();
+ adec_print("wfd audio_codec_release done\n");
+ return 0;
+}
+
+
+static int get_first_apts_flag(dsp_operations_t *dsp_ops)
+{
+ int val;
+ if (dsp_ops->dsp_file_fd < 0) {
+ adec_print("[%s %d]read error!! audiodsp have not opened\n", __FUNCTION__, __LINE__);
+ return -1;
+ }
+ ioctl(dsp_ops->dsp_file_fd, GET_FIRST_APTS_FLAG, &val);
+ return val;
+}
+
+
+/**
+ * \brief start audio dec when receive START command.
+ * \param audec pointer to audec
+ */
+static void start_adec(aml_audio_dec_t *audec)
+{
+ int ret;
+ audio_out_operations_t *aout_ops = &audec->aout_ops;
+ dsp_operations_t *dsp_ops = &audec->adsp_ops;
+ unsigned long vpts, apts;
+ int times = 0;
+ char buf[32];
+ apts = vpts = 0;
+ audec->no_first_apts = 0;
+
+ if (audec->state == INITTED) {
+ audec->state = ACTIVE;
+ //get info from the audiodsp == can get from amstreamer
+ while ((!get_first_apts_flag(dsp_ops)) && (!audec->need_stop) && (!audec->no_first_apts)) {
+ adec_print("wait first pts checkin complete !");
+ times++;
+ if (times >= 5) {
+ amsysfs_get_sysfs_str(TSYNC_VPTS, buf, sizeof(buf));// read vpts
+ if (sscanf(buf, "0x%lx", &vpts) < 1) {
+ adec_print("unable to get vpts from: %s", buf);
+ return;
+ }
+ // save vpts to apts
+ adec_print("## can't get first apts, save vpts to apts,vpts=%lx, \n", vpts);
+ sprintf(buf, "0x%lx", vpts);
+ amsysfs_set_sysfs_str(TSYNC_APTS, buf);
+ audec->no_first_apts = 1;
+ }
+ amthreadpool_thread_usleep(100000);
+ }
+
+ /*start the the pts scr,...*/
+ ret = adec_pts_start(audec);
+ if (audec->auto_mute) {
+ avsync_en(0);
+ adec_pts_pause();
+ while ((!audec->need_stop) && track_switch_pts(audec)) {
+ amthreadpool_thread_usleep(1000);
+ }
+ avsync_en(1);
+ adec_pts_resume();
+ audec->auto_mute = 0;
+ }
+#ifdef OUT_USE_AUDIOTRACK
+ aout_ops->start(audec);
+#endif
+ }
+}
+
+/**
+ * \brief pause audio dec when receive PAUSE command.
+ * \param audec pointer to audec
+ */
+static void pause_adec(aml_audio_dec_t *audec)
+{
+ audio_out_operations_t *aout_ops = &audec->aout_ops;
+ if (audec->state == ACTIVE) {
+ audec->state = PAUSED;
+ adec_pts_pause();
+#ifdef OUT_USE_AUDIOTRACK
+ aout_ops->pause(audec);
+#endif
+ }
+}
+
+/**
+ * \brief resume audio dec when receive RESUME command.
+ * \param audec pointer to audec
+ */
+static void resume_adec(aml_audio_dec_t *audec)
+{
+ audio_out_operations_t *aout_ops = &audec->aout_ops;
+ if (audec->state == PAUSED) {
+ audec->state = ACTIVE;
+#ifdef OUT_USE_AUDIOTRACK
+ aout_ops->resume(audec);
+#endif
+ adec_pts_resume();
+ }
+}
+
+/**
+ * \brief stop audio dec when receive STOP command.
+ * \param audec pointer to audec
+ */
+static void stop_adec(aml_audio_dec_t *audec)
+{
+ audio_out_operations_t *aout_ops = &audec->aout_ops;
+ adec_print("[%s %d]audec->state/%d\n", __FUNCTION__, __LINE__, audec->state);
+ if (audec->state > INITING) {
+ audec->state = STOPPED;
+#ifdef OUT_USE_AUDIOTRACK
+ aout_ops->mute(audec, 1); //mute output, some repeat sound in audioflinger after stop
+ aout_ops->stop(audec);
+#endif
+ wfd_audio_codec_release(audec);
+ }
+}
+
+/**
+ * \brief release audio dec when receive RELEASE command.
+ * \param audec pointer to audec
+ */
+static void release_adec(aml_audio_dec_t *audec)
+{
+ audec->state = TERMINATED;
+}
+
+/**
+ * \brief mute audio dec when receive MUTE command.
+ * \param audec pointer to audec
+ * \param en 1 = mute, 0 = unmute
+ */
+static void mute_adec(aml_audio_dec_t *audec, int en)
+{
+#ifdef OUT_USE_AUDIOTRACK
+ audio_out_operations_t *aout_ops = &audec->aout_ops;
+ if (aout_ops->mute) {
+ adec_print("%s the output !\n", (en ? "mute" : "unmute"));
+ aout_ops->mute(audec, en);
+ audec->muted = en;
+ }
+#endif
+}
+
+/**
+ * \brief set volume to audio dec when receive SET_VOL command.
+ * \param audec pointer to audec
+ * \param vol volume value
+ */
+static void adec_set_volume(aml_audio_dec_t *audec, float vol)
+{
+#ifdef OUT_USE_AUDIOTRACK
+ audio_out_operations_t *aout_ops = &audec->aout_ops;
+ if (aout_ops->set_volume) {
+ adec_print("set audio volume! vol = %f\n", vol);
+ aout_ops->set_volume(audec, vol);
+ }
+#endif
+}
+
+/**
+ * \brief set volume to audio dec when receive SET_LRVOL command.
+ * \param audec pointer to audec
+ * \param lvol left channel volume value
+ * \param rvol right channel volume value
+ */
+static void adec_set_lrvolume(aml_audio_dec_t *audec, float lvol, float rvol)
+{
+#ifdef OUT_USE_AUDIOTRACK
+ audio_out_operations_t *aout_ops = &audec->aout_ops;
+ if (aout_ops->set_lrvolume) {
+ adec_print("set audio volume! left vol = %f,right vol:%f\n", lvol, rvol);
+ aout_ops->set_lrvolume(audec, lvol, rvol);
+ }
+#endif
+}
+static void adec_flag_check(aml_audio_dec_t *audec)
+{
+ audio_out_operations_t *aout_ops = &audec->aout_ops;
+ if (audec->auto_mute && (audec->state > INITTED)) {
+ aout_ops->pause(audec);
+ amthreadpool_thread_usleep(10000);
+ while ((!audec->need_stop) && track_switch_pts(audec)) {
+ amthreadpool_thread_usleep(1000);
+ }
+#ifdef OUT_USE_AUDIOTRACK
+ aout_ops->resume(audec);
+#endif
+ audec->auto_mute = 0;
+ }
+}
+
+
+static void start_wfd_decode_thread(aml_audio_dec_t *audec)
+{
+ int ret = -1;
+ if (audec->state != INITTED) {
+ adec_print("decode not inited quit \n");
+ return;
+ }
+ pthread_t tid;
+ ret = amthreadpool_pthread_create(&tid, NULL, (void *)audio_wfd_decode_loop, (void *)audec);
+ if (ret != 0) {
+ adec_print("[%s]Create ffmpeg decode thread failed!\n", __FUNCTION__);
+ return;
+ }
+ audec->sn_threadid = tid;
+ pthread_setname_np(tid, "AmadecDecodeWFD");
+ adec_print("[%s]Create WFD audio decode thread success! tid = %d\n", __FUNCTION__, tid);
+}
+static void stop_wfd_decode_thread(aml_audio_dec_t *audec)
+{
+ adec_print("enter stop_wfd_decode_thread \n");
+ audec->exit_decode_thread = 1;
+ int ret = amthreadpool_pthread_join(audec->sn_threadid, NULL);
+ adec_print("[%s]wfd decode thread exit success\n", __FUNCTION__);
+ audec->exit_decode_thread = 0;
+ audec->sn_threadid = -1;
+
+}
+
+static int wfd_audio_codec_init(aml_audio_dec_t *audec)
+{
+ int ret = 0;
+ audec->exit_decode_thread = 0;
+ audec->fd_uio = -1;
+ audec->sn_threadid = -1;
+ audec->adsp_ops.dsp_on = 1;
+ //TODO : get the actual sample rate /channel num
+ audec->data_width = AV_SAMPLE_FMT_S16;
+ audec->channels = 2;
+ audec->samplerate = 48000;
+
+ audec->adsp_ops.dsp_read = wfd_dec_pcm_read;
+ audec->adsp_ops.get_cur_pts = wfd_dec_get_pts;
+ audec->adsp_ops.get_cur_pcrscr = wfd_dec_get_pcrscr;
+ audec->adsp_ops.set_cur_apts = wfd_dec_set_pts;
+ audec->adsp_ops.set_skip_bytes = wfd_dec_set_skip_bytes;
+ audec->adsp_ops.dsp_read_raw = NULL;
+ while (0 != set_sysfs_int(DECODE_ERR_PATH, DECODE_NONE_ERR)) {
+ adec_print("[%s %d]set codec fatal failed ! \n", __FUNCTION__, __LINE__);
+ amthreadpool_thread_usleep(100000);
+ }
+ /*
+ //enable uio interface
+ ret = uio_init(audec);
+ if (ret < 0) {
+ adec_print("wfd uio init error! \n");
+ return -1;
+ }
+ */
+ // register decoder lib
+ memset(&WFDAudioDecoder, 0, sizeof(audio_decoder_operations_t));
+ audec->adec_ops = &WFDAudioDecoder;
+ audec->adec_ops->priv_data = audec;
+ if (wfd_register_audio_lib(audec)) {
+ adec_print("wfd register decoder failed \n");
+ return -1;
+ }
+ if (wfd_register_output_lib(audec)) {
+ adec_print("wfd register output failed \n");
+ return -1;
+ }
+ // output init,not init here as we should get the sr/ch info when decode one frame
+#if 0
+ if (wfd_out_init()) {
+ adec_print("wfd init pcm output device failed\n");
+ return -1;
+ }
+#endif
+ ret = audec->adec_ops->init(audec->adec_ops);
+ if (ret) {
+ adec_print("wfd audio decoder init failed \n");
+ goto error1;
+ }
+
+
+ adec_print("wfd audio_codec_init ok \n");
+ return 0;
+error1:
+ wfd_out_uninit();
+ return -1;
+
+}
+#define RESAMPLE_FRAMES 128
+static short date_temp[1024 * 4 * 2];
+
+static void audio_resample_api(char* buffer, unsigned int *size, int Chnum, int enable, int delta)
+{
+ short *pbuf;
+ int resample_enable;
+ int resample_type;
+ int resample_delta;
+ int frame_read;
+ int num_sample = 0;
+ int i, j, k, h;
+ int request = *size;
+ int dsp_read = 0;
+ static int last_resample_enable = 0;
+ pbuf = (short*)date_temp;
+ unsigned index = 0;
+ float mPhaseFraction;
+ float phaseIncrement ;
+ float mPhaseFraction1;
+ unsigned in_sr;
+ unsigned out_sr;
+ short *input;
+ short *output;
+ unsigned frames = 0;
+ in_sr = (RESAMPLE_FRAMES - 1);
+ out_sr = (RESAMPLE_FRAMES - delta - 1);
+ phaseIncrement = (float)in_sr / out_sr;
+ resample_enable = enable;
+ resample_delta = delta;
+
+ if (last_resample_enable != resample_enable) {
+ adec_print("resample changed: %s\n", resample_enable ? "Enabled" : "Disabled");
+ last_resample_enable = resample_enable;
+ }
+
+ if (resample_enable && resample_delta && *size >= RESAMPLE_FRAMES * sizeof(short)*Chnum) {
+ //adec_print("resample start ... %d, step=%d\n", *size, resample_delta);
+ if (resample_delta < 0) {
+ // *size = *size*RESAMPLE_FRAMES/(RESAMPLE_FRAMES-resample_delta);
+ }
+ memcpy(pbuf, buffer, *size);
+ frame_read = *size / (sizeof(short) * Chnum); //dsp_pcm_read(audec, pbuf, *size); // return mono sample number
+ dsp_read += frame_read;
+ k = 0;
+ while (frame_read >= RESAMPLE_FRAMES) {
+ mPhaseFraction = 0;
+ mPhaseFraction1 = 0;
+ index = 0;
+ input = (short*)pbuf + frames * Chnum;
+ output = (short*)buffer + k * Chnum;
+ for (j = 0; j < RESAMPLE_FRAMES - resample_delta; j++) {
+ output[2 * j] = input[index * 2] + (short)((input[(index + 1) * 2] - input[index * 2]) * mPhaseFraction1);
+ output[2 * j + 1] = input[index * 2 + 1] + (short)((input[(index + 1) * 2 + 1] - input[index * 2 + 1]) * mPhaseFraction1);
+ mPhaseFraction += phaseIncrement;
+ index = mPhaseFraction;
+ mPhaseFraction1 = mPhaseFraction - index;
+ k++;
+ }
+ frames += RESAMPLE_FRAMES;
+ frame_read -= RESAMPLE_FRAMES;
+ }
+ if (frame_read > 0) {
+ memcpy((short*)buffer + k * Chnum, (short*)pbuf + frames * Chnum, frame_read * sizeof(short)* Chnum);
+ k += frame_read;
+ }
+
+
+ num_sample = k * sizeof(short) * Chnum;
+ *size = k * sizeof(short) * Chnum;
+ }
+ // adec_print("resample size from %d to %d, original %d\n", request, *size, dsp_read);
+}
+
+static int skip_thred = 400;
+static int up_thred = 100;
+static int dn_thred = 200;
+static int dn_resample_delta = 2;
+static int up_resample_delta = -4;
+static void set_wfd_pcm_thredhold()
+{
+
+ char value[PROPERTY_VALUE_MAX];
+ if (property_get("media.wfd.skip", value, NULL) > 0) {
+ skip_thred = atoi(value);
+ }
+ if (property_get("media.wfd.up", value, NULL) > 0) {
+ up_thred = atoi(value);
+ }
+ if (property_get("media.wfd.dn", value, NULL) > 0) {
+ dn_thred = atoi(value);
+ }
+ if (property_get("media.wfd.dn_delta", value, NULL) > 0) {
+ dn_resample_delta = atoi(value);
+ }
+ if (property_get("media.wfd.up_delta", value, NULL) > 0) {
+ up_resample_delta = atoi(value);
+ }
+}
+void *audio_wfd_decode_loop(void *args)
+{
+ int ret;
+ aml_audio_dec_t *audec;
+ audio_out_operations_t *aout_ops;
+ audio_decoder_operations_t *adec_ops;
+ short outbuf[2048];
+ int outlen = 0;
+ int write_size = 0;
+ int in_latency = 0;
+ int out_latency = 0;
+ int total_latency = 0;
+ int out_init_flag = 0;
+ char value[PROPERTY_VALUE_MAX];
+ unsigned char debug_latency = 0;
+ adec_print("audio_wfd_decode_loop start!\n");
+ audec = (aml_audio_dec_t *)args;
+ aout_ops = &audec->aout_ops;
+ adec_ops = audec->adec_ops;
+ if (property_get("media.wfd.debug_latency", value, NULL) > 0) {
+ debug_latency = atoi(value);
+ }
+ while (!audec->exit_decode_thread) {
+ outlen = 0;
+ // adec_refresh_pts(audec);
+ set_wfd_pcm_thredhold();
+ audec->decode_offset = adec_ops->decode(adec_ops, outbuf, &outlen, (char*)&in_latency, 0);
+
+ if (outlen > 0) {
+ if (!out_init_flag) {
+ if (wfd_out_init(adec_ops->samplerate, adec_ops->channels)) {
+ adec_print("wfd init pcm output device failed\n");
+ continue;
+ }
+ out_init_flag = 1;
+ }
+ out_latency = wfd_out_latency();
+ if (out_latency < 0) {
+ out_latency = 0;
+ }
+ total_latency = in_latency + out_latency;
+ audec->out_len_after_last_valid_pts += outlen;
+ if (debug_latency) {
+ adec_print("latency in %d ms,out %d ms.total %d ms\n", in_latency, out_latency, total_latency);
+ if (total_latency < 150) {
+ if (property_get("sys.pkginfo", value, NULL) > 0) {
+ adec_print("latency pkg info %s \n", value);
+ }
+ }
+ }
+ if (total_latency > skip_thred) {
+ if (debug_latency) {
+ adec_print(" total latency %d ms ,skip bytes %d \n", total_latency, outlen);
+ }
+ outlen = 0;
+ } else if (total_latency > dn_thred) {
+ audio_resample_api(outbuf, &outlen, 2, 1, dn_resample_delta);
+ } else if (total_latency < up_thred) {
+ audio_resample_api(outbuf, &outlen, 2, 1, up_resample_delta);
+ }
+ if (debug_latency) {
+ adec_print("wfd dec out %d byts pcm \n", outlen);
+ }
+ write_size = wfd_out_write(outbuf, outlen);
+ }
+ //TODO decode function
+ }
+ adec_print("exit audio_wfd_decode_loop Thread finished!\n");
+ pthread_exit(NULL);
+error:
+ pthread_exit(NULL);
+ return NULL;
+}
+
+
+/*
+ WFD audio decoder control thread
+*/
+void *adec_wfddec_msg_loop(void *args)
+{
+ int ret;
+ aml_audio_dec_t *audec;
+ audio_out_operations_t *aout_ops;
+ adec_cmd_t *msg = NULL;
+ audec = (aml_audio_dec_t *)args;
+ aout_ops = &audec->aout_ops;
+ adec_print("adec_wfddec_loop in \n");
+ while (!audec->need_stop) {
+ audec->state = INITING;
+ ret = wfd_audio_codec_init(audec);
+ if (ret == 0) {
+ {
+#ifdef OUT_USE_AUDIOTRACK
+ ret = aout_ops->init(audec);
+ if (ret) {
+ adec_print("WFD Audio out device init failed!\n");
+ wfd_audio_codec_release(audec);
+ continue;
+ }
+#endif
+ audec->state = INITTED;
+ start_wfd_decode_thread(audec);
+ start_adec(audec);
+ }
+ break;
+ }
+
+ if (!audec->need_stop) {
+ amthreadpool_thread_usleep(100000);
+ }
+ }
+
+ do {
+
+ adec_reset_track(audec);
+ adec_flag_check(audec);
+ msg = adec_get_message(audec);
+ if (!msg) {
+ amthreadpool_thread_usleep(100000);
+ continue;
+ }
+
+ switch (msg->ctrl_cmd) {
+ case CMD_START:
+
+ adec_print("Receive START Command!\n");
+ start_wfd_decode_thread(audec);
+ start_adec(audec);
+ break;
+
+ case CMD_PAUSE:
+
+ adec_print("Receive PAUSE Command!");
+ pause_adec(audec);
+ break;
+
+ case CMD_RESUME:
+
+ adec_print("Receive RESUME Command!");
+ resume_adec(audec);
+ break;
+
+ case CMD_STOP:
+
+ adec_print("Receive STOP Command!");
+ stop_adec(audec);
+ break;
+
+ case CMD_MUTE:
+
+ adec_print("Receive Mute Command!");
+ if (msg->has_arg) {
+ mute_adec(audec, msg->value.en);
+ }
+ break;
+
+ case CMD_SET_VOL:
+
+ adec_print("Receive Set Vol Command!");
+ if (msg->has_arg) {
+ adec_set_volume(audec, msg->value.volume);
+ }
+ break;
+ case CMD_SET_LRVOL:
+
+ adec_print("Receive Set LRVol Command!");
+ if (msg->has_arg) {
+ adec_set_lrvolume(audec, msg->value.volume, msg->value_ext.volume);
+ }
+ break;
+#if 0
+ case CMD_CHANL_SWAP:
+
+ adec_print("Receive Channels Swap Command!");
+ audio_hardware_ctrl(HW_CHANNELS_SWAP);
+ break;
+
+ case CMD_LEFT_MONO:
+
+ adec_print("Receive Left Mono Command!");
+ audio_hardware_ctrl(HW_LEFT_CHANNEL_MONO);
+ break;
+
+ case CMD_RIGHT_MONO:
+
+ adec_print("Receive Right Mono Command!");
+ audio_hardware_ctrl(HW_RIGHT_CHANNEL_MONO);
+ break;
+
+ case CMD_STEREO:
+
+ adec_print("Receive Stereo Command!");
+ audio_hardware_ctrl(HW_STEREO_MODE);
+ break;
+#endif
+ case CMD_RELEASE:
+
+ adec_print("Receive RELEASE Command!");
+ release_adec(audec);
+ break;
+
+ default:
+ adec_print("Unknow Command!");
+ break;
+
+ }
+
+ if (msg) {
+ adec_message_free(msg);
+ msg = NULL;
+ }
+ } while (audec->state != TERMINATED);
+
+ adec_print("Exit adec_wfddec_msg_loop!");
+ pthread_exit(NULL);
+ return NULL;
+}
+
+
+