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-internal-mgt.c b/amadec/adec-internal-mgt.c
new file mode 100644
index 0000000..f51a912
--- a/dev/null
+++ b/amadec/adec-internal-mgt.c
@@ -0,0 +1,772 @@
+/**
+ * \file adec-internal-mgt.c
+ * \brief Audio Dec Message Loop Thread
+ * \version 1.0.0
+ * \date 2011-03-08
+ */
+/* Copyright (C) 2007-2011, Amlogic Inc.
+ * All right reserved
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <sys/ioctl.h>
+
+#include <audio-dec.h>
+#include <adec-pts-mgt.h>
+#include <cutils/properties.h>
+#include <dts_enc.h>
+#include <Amsysfsutils.h>
+#include <amthreadpool.h>
+#include <amconfigutils.h>
+#include <unistd.h>
+#include "audiodsp_update_format.h"
+
+#define MULTICH_SUPPORT_PROPERTY "media.multich.support.info"
+#define PCM_88_96_SUPPORT "media.libplayer.88_96K"
+
+extern int RegisterDecode(aml_audio_dec_t *audec, int type);
+extern void get_output_func(struct aml_audio_dec* audec);
+
+static int64_t gettime_ms(void)
+{
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return (int64_t)tv.tv_sec * 1000 + tv.tv_usec/1000;
+}
+
+
+
+static int set_tsync_enable(int enable)
+{
+
+ char *path = "/sys/class/tsync/enable";
+ return amsysfs_set_sysfs_int(path, enable);
+}
+
+typedef struct {
+ // int no;
+ int audio_id;
+ char type[16];
+} audio_type_t;
+
+audio_type_t audio_type[] = {
+ {ACODEC_FMT_AAC, "aac"},
+ {ACODEC_FMT_AC3, "ac3"},
+ {ACODEC_FMT_DTS, "dts"},
+ {ACODEC_FMT_FLAC, "flac"},
+ {ACODEC_FMT_COOK, "cook"},
+ {ACODEC_FMT_AMR, "amr"},
+ {ACODEC_FMT_RAAC, "raac"},
+ {ACODEC_FMT_WMA, "wma"},
+ {ACODEC_FMT_WMAPRO, "wmapro"},
+ {ACODEC_FMT_ALAC, "alac"},
+ {ACODEC_FMT_VORBIS, "vorbis"},
+ {ACODEC_FMT_AAC_LATM, "aac_latm"},
+ {ACODEC_FMT_APE, "ape"},
+ {ACODEC_FMT_MPEG, "mp3"},//mp3
+ {ACODEC_FMT_MPEG2, "mp3"},//mp2
+ {ACODEC_FMT_MPEG1, "mp3"},//mp1
+ {ACODEC_FMT_EAC3, "eac3"},
+ {ACODEC_FMT_TRUEHD, "thd"},
+ {ACODEC_FMT_PCM_S16BE, "pcm"},
+ {ACODEC_FMT_PCM_S16LE, "pcm"},
+ {ACODEC_FMT_PCM_U8, "pcm"},
+ {ACODEC_FMT_PCM_BLURAY, "pcm"},
+ {ACODEC_FMT_WIFIDISPLAY, "pcm"},
+ {ACODEC_FMT_ALAW, "pcm"},
+ {ACODEC_FMT_MULAW, "pcm"},
+
+ {ACODEC_FMT_ADPCM, "adpcm"},
+ {ACODEC_FMT_WMAVOI, "wmavoi"},
+ {ACODEC_FMT_DRA, "dra"},
+ {ACODEC_FMT_NULL, "null"},
+
+};
+
+extern int match_types(const char *filetypestr, const char *typesetting);
+
+static int audio_decoder = AUDIO_ARC_DECODER;
+static int audio_hardware_ctrl(hw_command_t cmd)
+{
+ int fd;
+
+ fd = open(AUDIO_CTRL_DEVICE, O_RDONLY);
+ if (fd < 0) {
+ adec_print("Open Device %s Failed!", AUDIO_CTRL_DEVICE);
+ return -1;
+ }
+
+ switch (cmd) {
+ case HW_CHANNELS_SWAP:
+ ioctl(fd, AMAUDIO_IOC_SET_CHANNEL_SWAP, 0);
+ break;
+
+ case HW_LEFT_CHANNEL_MONO:
+ ioctl(fd, AMAUDIO_IOC_SET_LEFT_MONO, 0);
+ break;
+
+ case HW_RIGHT_CHANNEL_MONO:
+ ioctl(fd, AMAUDIO_IOC_SET_RIGHT_MONO, 0);
+ break;
+
+ case HW_STEREO_MODE:
+ ioctl(fd, AMAUDIO_IOC_SET_STEREO, 0);
+ break;
+
+ default:
+ adec_print("Unknow Command %d!", cmd);
+ break;
+
+ };
+
+ close(fd);
+
+ return 0;
+
+}
+
+/**
+ * \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;
+
+ char value[PROPERTY_VALUE_MAX] = {0};
+ int wait_count = 100;
+ if (property_get("media.amadec.wait_count", value, NULL) > 0) {
+ wait_count = atoi(value);
+ }
+ adec_print("wait first apts count :%d \n", wait_count);
+
+ audec->no_first_apts = 0;
+ if (audec->state == INITTED) {
+
+ while ((!audiodsp_get_first_pts_flag(dsp_ops)) && (!audec->need_stop) && (!audec->no_first_apts)) {
+ adec_print("wait first pts checkin complete times=%d,!\n", times);
+ times++;
+
+ if (times >= wait_count) {
+ // read vpts
+ amsysfs_get_sysfs_str(TSYNC_VPTS, buf, sizeof(buf));
+ 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);
+ }
+ /*Since audio_track->start consumed too much time
+ *for the first time after platform restart,
+ *so execute start cmd before adec_pts_start
+ */
+ aout_ops->start(audec);
+ aout_ops->pause(audec);
+ /*start the the pts scr,...*/
+ ret = adec_pts_start(audec);
+
+ //adec_pts_droppcm(audec);
+
+ if (audec->auto_mute) {
+ avsync_en(0);
+ audiodsp_automute_on(dsp_ops);
+ adec_pts_pause();
+
+ while ((!audec->need_stop) && track_switch_pts(audec)) {
+ amthreadpool_thread_usleep(1000);
+ }
+
+ audiodsp_automute_off(dsp_ops);
+ avsync_en(1);
+ adec_pts_resume();
+
+ audec->auto_mute = 0;
+ }
+
+ aout_ops->resume(audec);
+ audec->state = ACTIVE;
+
+ }
+}
+
+/**
+ * \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();
+ aout_ops->pause(audec);
+ }
+}
+
+/**
+ * \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;
+ audec->refresh_pts_readytime_ms = gettime_ms() +
+ am_getconfig_int_def("media.amadec.wait_fresh_ms", 200);
+ aout_ops->resume(audec);
+ 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;
+
+ if (audec->state > INITING) {
+ audec->state = STOPPED;
+ aout_ops->mute(audec, 1); //mute output, some repeat sound in audioflinger after stop
+ aout_ops->stop(audec);
+ feeder_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)
+{
+ 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;
+ }
+}
+
+/**
+ * \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)
+{
+ 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);
+ }
+}
+
+/**
+ * \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)
+{
+ 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);
+ }
+}
+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) && (audec->state != PAUSED)) {
+ aout_ops->pause(audec);
+ adec_print("automute, pause audio out!\n");
+ amthreadpool_thread_usleep(10000);
+ while ((!audec->need_stop) && track_switch_pts(audec)) {
+ amthreadpool_thread_usleep(1000);
+ }
+ aout_ops->resume(audec);
+ adec_print("resume audio out, automute invalid\n");
+ audec->auto_mute = 0;
+ }
+}
+
+static int write_buffer(char *outbuf, int outlen)
+{
+ return 0;
+}
+
+
+static void *adec_message_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;
+
+ while (!audec->need_stop) {
+ audec->state = INITING;
+ ret = feeder_init(audec);
+ if (ret == 0) {
+ ret = aout_ops->init(audec);
+ if (ret) {
+ adec_print("Audio out device init failed!");
+ feeder_release(audec);
+ continue;
+ }
+ audec->state = INITTED;
+ adec_print("Audio out device init ok!");
+ start_adec(audec);
+ if (dtsenc_init() != -1) {
+ dtsenc_start();
+ }
+
+ break;
+ }
+
+ if (!audec->need_stop) {
+ amthreadpool_thread_usleep(100000);
+ }
+ }
+
+ do {
+ //if(message_pool_empty(audec))
+ //{
+ //adec_print("there is no message !\n");
+ // amthreadpool_thread_usleep(100000);
+ // continue;
+ //}
+ 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_adec(audec);
+ dtsenc_start();
+ break;
+
+ case CMD_PAUSE:
+
+ adec_print("Receive PAUSE Command!");
+ pause_adec(audec);
+ dtsenc_pause();
+ break;
+
+ case CMD_RESUME:
+
+ adec_print("Receive RESUME Command!");
+ resume_adec(audec);
+ dtsenc_resume();
+ break;
+
+ case CMD_STOP:
+
+ adec_print("Receive STOP Command!");
+ adec_print("audec->state=%d (INITING/3) when Rec_STOP_CMD\n", audec->state);
+ stop_adec(audec);
+ dtsenc_stop();
+ 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;
+
+ 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;
+
+ case CMD_RELEASE:
+
+ adec_print("Receive RELEASE Command!");
+ release_adec(audec);
+ dtsenc_release();
+ break;
+
+ default:
+ adec_print("Unknow Command!");
+ break;
+
+ }
+
+ if (msg) {
+ adec_message_free(msg);
+ msg = NULL;
+ }
+ } while (audec->state != TERMINATED);
+
+ adec_print("Exit Message Loop Thread!");
+ pthread_exit(NULL);
+ return NULL;
+}
+
+/**
+ * \brief start audio dec
+ * \param audec pointer to audec
+ * \return 0 on success otherwise -1 if an error occurred
+ */
+int match_types(const char *filetypestr, const char *typesetting)
+{
+ const char * psets = typesetting;
+ const char *psetend;
+ int psetlen = 0;
+ char typestr[64] = "";
+ if (filetypestr == NULL || typesetting == NULL) {
+ return 0;
+ }
+
+ while (psets && psets[0] != '\0') {
+ psetlen = 0;
+ psetend = strchr(psets, ',');
+ if (psetend != NULL && psetend > psets && psetend - psets < 64) {
+ psetlen = psetend - psets;
+ memcpy(typestr, psets, psetlen);
+ typestr[psetlen] = '\0';
+ psets = &psetend[1]; //skip ";"
+ } else {
+ strcpy(typestr, psets);
+ psets = NULL;
+ }
+ if (strlen(typestr) > 0 && (strlen(typestr) == strlen(filetypestr))) {
+ if (strstr(filetypestr, typestr) != NULL) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+/*
+digital_raw:
+0 2ch PCM
+1 spdif passthrough ,for DTS,DD
+2 HDMI passthrough for DD,DTSHD,TrueHD
+3 Multi-channel PCM HDMI passthrough
+*/
+static void set_multichs_prop()
+{
+ char * infobuf;
+ int channel = 0;
+ int dgraw = 0;
+ dgraw = amsysfs_get_sysfs_int("/sys/class/audiodsp/digital_raw");
+ infobuf = (char *)malloc(1024 * sizeof(char));
+ property_set(PCM_88_96_SUPPORT, "0");
+ if (infobuf == NULL) {
+ adec_print("%s: malloc infobuf failed.\n", __FUNCTION__);
+ } else {
+ int fd = open("/sys/class/amhdmitx/amhdmitx0/aud_cap", O_RDONLY);
+ if (fd != -1) {
+ int nread = read(fd, infobuf, 1024);
+ int i;
+ nread = nread - 5;
+ for (i = 0; i < nread; i++) {
+ if ((infobuf[i] == 'P') && (infobuf[i + 1] == 'C') && (infobuf[i + 2] == 'M')) {
+ if (dgraw == 3) { // if configured mutli-channel output,check if the HDMI sink support multi-channel PCM output
+ if (infobuf[i + 5] == '8') {
+ property_set(MULTICH_SUPPORT_PROPERTY, "hdmi8");
+ channel = channel < 8 ? 8 : channel;
+ }
+ if (infobuf[i + 5] == '6') {
+ property_set(MULTICH_SUPPORT_PROPERTY, "hdmi6");
+ channel = channel < 6 ? 6 : channel;
+ }
+ if (infobuf[i + 5] == '2') {
+ property_set(MULTICH_SUPPORT_PROPERTY, "hdmi2");
+ channel = channel < 2 ? 2 : channel;
+ }
+ } else {
+ property_set(MULTICH_SUPPORT_PROPERTY, "hdmi2");
+ channel = channel < 2 ? 2 : channel;
+ }
+ } else if (
+ ((infobuf[i] == '8') && (infobuf[i + 1] == '8') && (infobuf[i + 2] == '.') && (infobuf[i + 3] == '2'))
+ || ((infobuf[i] == '9') && (infobuf[i + 1] == '6'))) {
+ property_set(PCM_88_96_SUPPORT, "1");
+ }
+ }
+ if (channel == 0) {
+ property_set(MULTICH_SUPPORT_PROPERTY, "speaker");
+ }
+ adec_print("%s: aud_cap support channel number: %d ch\n", __FUNCTION__, channel);
+ close(fd);
+ free(infobuf);
+ infobuf = NULL;
+ } else {
+ adec_print("%s: open hdmi driver aud_cap node failed \n", __FUNCTION__);
+ free(infobuf);
+ infobuf = NULL;
+ }
+ }
+}
+
+static int set_audio_decoder(aml_audio_dec_t *audec)
+{
+ int audio_id;
+ int i;
+ int num;
+ int ret;
+ audio_type_t *t;
+ char value[PROPERTY_VALUE_MAX];
+
+
+ audio_id = audec->format;
+
+ num = ARRAY_SIZE(audio_type);
+ for (i = 0; i < num; i++) {
+ t = &audio_type[i];
+ if (t->audio_id == audio_id) {
+ break;
+ }
+ }
+
+ if (match_types(t->type, "thd") || match_types(t->type, "wmavoi") || match_types(t->type, "dra") ) {
+ adec_print("audio format is %s, so chose AUDIO_ARM_DECODER", t->type);
+ audio_decoder = AUDIO_ARM_DECODER;
+ goto exit;
+ }
+
+
+ ret = property_get("media.arm.audio.decoder", value, NULL);
+ adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
+ if (ret > 0 && match_types(t->type, value)) {
+ char type_value[] = "ac3,eac3";
+ set_multichs_prop();
+ if (match_types(t->type, type_value)) {
+#ifdef DOLBY_USE_ARMDEC
+ adec_print("DOLBY_USE_ARMDEC=%d", DOLBY_USE_ARMDEC);
+#ifndef USE_ARM_AUDIO_DEC
+ if (access("/system/etc/firmware/audiodsp_codec_ddp_dcv.bin",0 /*F_OK*/)) {
+#endif
+ audio_decoder = AUDIO_ARM_DECODER;
+#ifndef USE_ARM_AUDIO_DEC
+ }else{
+ audio_decoder = AUDIO_ARC_DECODER;
+ }
+#endif
+#else
+ audio_decoder = AUDIO_ARC_DECODER;
+ adec_print("<DOLBY_USE_ARMDEC> is not DEFINED,use ARC_Decoder\n!");
+#endif
+ }
+#ifndef USE_ARM_AUDIO_DEC
+ else if (match_types(t->type, "dts")) {
+ if (access("/system/etc/firmware/audiodsp_codec_dtshd.bin", 0/*F_OK*/)) {
+ adec_print("using no license dts component");
+ audio_decoder = AUDIO_ARM_DECODER;
+ } else {
+ adec_print("using audiodsp dts decoder");
+ audio_decoder = AUDIO_ARC_DECODER;
+ }
+ }
+#endif
+ else {
+ audio_decoder = AUDIO_ARM_DECODER;
+ }
+ goto exit;
+ }
+
+ ret = property_get("media.arc.audio.decoder", value, NULL);
+ adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
+ if (ret > 0 && match_types(t->type, value)) {
+ if (audec->dspdec_not_supported == 0) {
+ audio_decoder = AUDIO_ARC_DECODER;
+ } else {
+ audio_decoder = AUDIO_ARM_DECODER;
+ adec_print("[%s:%d]arc decoder not support this audio yet,switch to ARM decoder \n", __FUNCTION__, __LINE__);
+ }
+ goto exit;
+ }
+
+ ret = property_get("media.ffmpeg.audio.decoder", value, NULL);
+ adec_print("media.amplayer.audiocodec = %s, t->type = %s\n", value, t->type);
+ if (ret > 0 && match_types(t->type, value)) {
+ audio_decoder = AUDIO_FFMPEG_DECODER;
+ goto exit;
+ }
+
+ audio_decoder = AUDIO_ARC_DECODER; //set arc decoder as default
+ if (audec->dspdec_not_supported == 1) {
+ audio_decoder = AUDIO_ARM_DECODER;
+ adec_print("[%s:%d]arc decoder not support this audio yet,switch to ARM decoder \n", __FUNCTION__, __LINE__);
+ }
+exit:
+ if (am_getconfig_bool("media.libplayer.wfd") && (audio_id == ACODEC_FMT_WIFIDISPLAY || audio_id == ACODEC_FMT_AAC)) {
+ adec_print("wfd use arm decoder \n");
+ audio_decoder = AUDIO_ARMWFD_DECODER;
+ }
+ return 0;
+}
+
+int get_audio_decoder(void)
+{
+ //adec_print("audio_decoder = %d\n", audio_decoder);
+ return audio_decoder;
+}
+
+int vdec_pts_pause(void)
+{
+ return amsysfs_set_sysfs_str(TSYNC_EVENT, "VIDEO_PAUSE:0x1");
+}
+
+int adec_thread_wait(aml_audio_dec_t *audec, int microseconds)
+{
+ struct timespec pthread_ts;
+ struct timeval now;
+ adec_thread_mgt_t *mgt = &audec->thread_mgt;
+ int ret;
+
+ gettimeofday(&now, NULL);
+ pthread_ts.tv_sec = now.tv_sec + (microseconds + now.tv_usec) / 1000000;
+ pthread_ts.tv_nsec = ((microseconds + now.tv_usec) * 1000) % 1000000000;
+ pthread_mutex_lock(&mgt->pthread_mutex);
+ ret = pthread_cond_timedwait(&mgt->pthread_cond, &mgt->pthread_mutex, &pthread_ts);
+ pthread_mutex_unlock(&mgt->pthread_mutex);
+ return ret;
+}
+int adec_thread_wakeup(aml_audio_dec_t *audec)
+{
+ adec_thread_mgt_t *mgt = &audec->thread_mgt;
+ int ret;
+
+ pthread_mutex_lock(&mgt->pthread_mutex);
+ ret = pthread_cond_signal(&mgt->pthread_cond);
+ pthread_mutex_unlock(&mgt->pthread_mutex);
+
+ return ret;
+}
+
+int audiodec_init(aml_audio_dec_t *audec)
+{
+ int ret = 0;
+ pthread_t tid;
+ char value[PROPERTY_VALUE_MAX] = {0};
+ unsigned wfd = 0;
+ adec_print("audiodec_init!");
+ adec_message_pool_init(audec);
+ get_output_func(audec);
+ int nCodecType = audec->format;
+ set_audio_decoder(audec);
+ audec->format_changed_flag = 0;
+ audec->audio_decoder_enabled = -1;//default set a invalid value
+ audec->mix_lr_channel_enable = -1;
+ audec->pre_gain_enable = -1;
+ audec->pre_gain = 1.0;
+ audec->pre_mute = 0;
+ audec->VersionNum = -1;
+ audec->refresh_pts_readytime_ms = 0;
+ if (am_getconfig_bool("media.libplayer.wfd")) {
+ wfd = 1;
+ }
+ if (get_audio_decoder() == AUDIO_ARC_DECODER) {
+ audec->adsp_ops.dsp_file_fd = -1;
+ ret = amthreadpool_pthread_create(&tid, NULL, (void *)adec_message_loop, (void *)audec);
+ pthread_setname_np(tid, "AmadecMsgloop");
+ } else if (wfd && (nCodecType == ACODEC_FMT_AAC || nCodecType == ACODEC_FMT_WIFIDISPLAY)) {
+ adec_print("using wfd audio decoder \n");
+ ret = amthreadpool_pthread_create(&tid, NULL, (void *)adec_wfddec_msg_loop, (void *)audec);
+ audec->audio_decoder_enabled = 0x1;
+ pthread_setname_np(tid, "AmadecWFDMsgloop");
+ } else {
+ int codec_type = get_audio_decoder();
+ RegisterDecode(audec, codec_type);
+ ret = amthreadpool_pthread_create(&tid, NULL, (void *)adec_armdec_loop, (void *)audec);
+ pthread_mutex_init(&audec->thread_mgt.pthread_mutex, NULL);
+ pthread_cond_init(&audec->thread_mgt.pthread_cond, NULL);
+ audec->thread_mgt.pthread_id = tid;
+ pthread_setname_np(tid, "AmadecArmdecLP");
+ }
+ if (ret != 0) {
+ adec_print("Create adec main thread failed!\n");
+ return ret;
+ }
+ adec_print("Create adec main thread success! tid = %d\n", tid);
+ audec->thread_pid = tid;
+ return ret;
+}