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/audio_codec/libcook/rv_depack_internal.c b/audio_codec/libcook/rv_depack_internal.c
new file mode 100644
index 0000000..951d7db
--- a/dev/null
+++ b/audio_codec/libcook/rv_depack_internal.c
@@ -0,0 +1,1071 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Source last modified: $Id: rv_depack_internal.c,v 1.1.1.1.2.1 2005/05/04 18:21:20 hubbe Exp $
+ *
+ * REALNETWORKS CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM
+ * Portions Copyright (c) 1995-2005 RealNetworks, Inc.
+ * All Rights Reserved.
+ *
+ * The contents of this file, and the files included with this file,
+ * are subject to the current version of the Real Format Source Code
+ * Porting and Optimization License, available at
+ * https://helixcommunity.org/2005/license/realformatsource (unless
+ * RealNetworks otherwise expressly agrees in writing that you are
+ * subject to a different license). You may also obtain the license
+ * terms directly from RealNetworks. You may not use this file except
+ * in compliance with the Real Format Source Code Porting and
+ * Optimization License. There are no redistribution rights for the
+ * source code of this file. Please see the Real Format Source Code
+ * Porting and Optimization License for the rights, obligations and
+ * limitations governing use of the contents of the file.
+ *
+ * RealNetworks is the developer of the Original Code and owns the
+ * copyrights in the portions it created.
+ *
+ * This file, and the files included with this file, is distributed and
+ * made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND,
+ * EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL
+ * SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT
+ * OR NON-INFRINGEMENT.
+ *
+ * Technology Compatibility Kit Test Suite(s) Location:
+ * https://rarvcode-tck.helixcommunity.org
+ *
+ * Contributor(s):
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <stdio.h>
+#include <string.h>
+#include <memory.h>
+//#include "includes.h"
+#include "helix_types.h"
+#include "helix_result.h"
+#include "pack_utils.h"
+#include "string_utils.h"
+#include "memory_utils.h"
+#include "packet_defines.h"
+#include "codec_defines.h"
+#include "stream_hdr_structs.h"
+#include "stream_hdr_utils.h"
+#include "rv_depack_internal.h"
+
+#define RM_MAX_UINT14 0x00003FFF
+#define RM_MAX_UINT30 0x3FFFFFFF
+#define MAX_INTERNAL_TIMESTAMP_DELTA 60000
+
+void* rv_depacki_malloc(rv_depack_internal* pInt, UINT32 ulSize)
+{
+ void* pRet = HXNULL;
+
+ if (pInt && pInt->fpMalloc) {
+ pRet = pInt->fpMalloc(pInt->pUserMem, ulSize);
+ }
+
+ return pRet;
+}
+
+void rv_depacki_free(rv_depack_internal* pInt, void* pMem)
+{
+ if (pInt && pInt->fpFree) {
+ pInt->fpFree(pInt->pUserMem, pMem);
+ }
+}
+
+HX_RESULT rv_depacki_init(rv_depack_internal* pInt, rm_stream_header* hdr)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt && hdr) {
+ /* Initialize local variables */
+ UINT32 ulTmp = 0;
+ BYTE* pTmp = HXNULL;
+ UINT32 i = 0;
+ /* Check if we have a "HasRelativeTS" property - OK if we don't */
+ if (HX_SUCCEEDED(rm_stream_get_property_int(hdr, "HasRelativeTS", &ulTmp))) {
+ pInt->bHasRelativeTimeStamps = (ulTmp ? TRUE : FALSE);
+ }
+ /* Check if we have a "ZeroTimeOffset" property - OK if we don't */
+ if (HX_SUCCEEDED(rm_stream_get_property_int(hdr, "ZeroTimeOffset", &ulTmp))) {
+ pInt->ulZeroTimeOffset = ulTmp;
+ }
+ /* Check if we have a "RMFF 1.0 Flags" property */
+ retVal = rm_stream_get_property_buf(hdr, "RMFF 1.0 Flags", &pTmp, &ulTmp);
+ if (retVal == HXR_OK) {
+ /* Unpack the rule2Flag map */
+ rv_depacki_unpack_rule_map(pInt, &pInt->rule2Flag, &pTmp, &ulTmp);
+ /* Check if we have an "OpaqueData" property */
+ retVal = rm_stream_get_property_buf(hdr, "OpaqueData", &pTmp, &ulTmp);
+ if (retVal == HXR_OK) {
+ /* Unpack the opaque data */
+ retVal = rv_depacki_unpack_opaque_data(pInt, pTmp, ulTmp);
+ if (retVal == HXR_OK) {
+ /*
+ * Now that we've parsed all the headers, we need
+ * to see if there are any that need to be ignored.
+ * To do this, we parse the rules in the ASMRuleBook,
+ * and any rules that have "$OldPNMPlayer" as an expression,
+ * we will ignore.
+ */
+ retVal = rv_depacki_check_rule_book(pInt, hdr);
+ if (retVal == HXR_OK) {
+ /*
+ * Now select the first non-ignored substream. If
+ * we are not surestream, this of course will be zero.
+ */
+ pInt->ulActiveSubStream = 0;
+ if (pInt->bStreamSwitchable) {
+ for (i = 0; i < pInt->multiStreamHdr.ulNumSubStreams; i++) {
+ if (!pInt->bIgnoreSubStream[i]) {
+ pInt->ulActiveSubStream = i;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return retVal;
+}
+
+HX_RESULT rv_depacki_unpack_rule_map(rv_depack_internal* pInt,
+ rm_rule_map* pMap,
+ BYTE** ppBuf,
+ UINT32* pulLen)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt) {
+ retVal = rm_unpack_rule_map(ppBuf, pulLen,
+ pInt->fpMalloc,
+ pInt->fpFree,
+ pInt->pUserMem,
+ pMap);
+ }
+
+ return retVal;
+}
+
+HX_RESULT rv_depacki_unpack_multistream_hdr(rv_depack_internal* pInt,
+ BYTE** ppBuf,
+ UINT32* pulLen)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt) {
+ retVal = rm_unpack_multistream_hdr(ppBuf, pulLen,
+ pInt->fpMalloc,
+ pInt->fpFree,
+ pInt->pUserMem,
+ &pInt->multiStreamHdr);
+ }
+
+ return retVal;
+}
+
+HX_RESULT rv_depacki_unpack_opaque_data(rv_depack_internal* pInt,
+ BYTE* pBuf,
+ UINT32 ulLen)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt && pBuf && ulLen >= 4) {
+ /* Initialize local variables */
+ UINT32 ulSize = 0;
+ UINT32 ulID = 0;
+ UINT32 i = 0;
+ /*
+ * If the first four bytes are MLTI, then we
+ * know the opaque data contains a multistream header
+ * followed by several normal headers. So first we
+ * need to check the first four bytes.
+ */
+ ulID = rm_unpack32(&pBuf, &ulLen);
+ /* Now back up 4 bytes */
+ pBuf -= 4;
+ ulLen += 4;
+ /* Is this a multistream header? */
+ if (ulID == RM_MULTIHEADER_OBJECT) {
+ /* Unpack the multistream header */
+ retVal = rv_depacki_unpack_multistream_hdr(pInt, &pBuf, &ulLen);
+ if (retVal == HXR_OK) {
+ pInt->bStreamSwitchable = TRUE;
+ }
+ } else {
+ /* Single-rate stream */
+ pInt->multiStreamHdr.ulNumSubStreams = 1;
+ /* Clear the stream switchable flag */
+ pInt->bStreamSwitchable = FALSE;
+ /* Clear the return value */
+ retVal = HXR_OK;
+ }
+ /* Clean up any existing substream header array */
+ rv_depacki_cleanup_format_info_array(pInt);
+ /* Set the return value */
+ retVal = HXR_FAIL;
+ /* Allocate space for substream header array */
+ ulSize = pInt->multiStreamHdr.ulNumSubStreams * sizeof(rv_format_info);
+ pInt->pSubStreamHdr = (rv_format_info*) rv_depacki_malloc(pInt, ulSize);
+ if (pInt->pSubStreamHdr) {
+ /* NULL out the memory */
+ memset(pInt->pSubStreamHdr, 0, ulSize);
+ /* Clear the return value */
+ retVal = HXR_OK;
+ /* Loop through and unpack each substream header */
+ for (i = 0; i < pInt->multiStreamHdr.ulNumSubStreams && retVal == HXR_OK; i++) {
+ /* Is this a multiheader? */
+ if (pInt->bStreamSwitchable) {
+ /*
+ * If this is a multistream header, then there
+ * is a 4-byte length in front of every substream header
+ */
+ if (ulLen >= 4) {
+ ulSize = rm_unpack32(&pBuf, &ulLen);
+ } else {
+ retVal = HXR_FAIL;
+ }
+ }
+ /* Now unpack an substream header */
+ retVal = rv_depacki_unpack_format_info(pInt,
+ &pInt->pSubStreamHdr[i],
+ &pBuf, &ulLen);
+ }
+ }
+ }
+
+ return retVal;
+}
+
+void rv_depacki_cleanup_format_info(rv_depack_internal* pInt,
+ rv_format_info* pInfo)
+{
+ if (pInt && pInfo && pInfo->pOpaqueData) {
+ rv_depacki_free(pInt, pInfo->pOpaqueData);
+ pInfo->pOpaqueData = HXNULL;
+ pInfo->ulOpaqueDataSize = 0;
+ }
+}
+
+void rv_depacki_cleanup_format_info_array(rv_depack_internal* pInt)
+{
+ if (pInt && pInt->pSubStreamHdr) {
+ /* Clean up each individual rv_format_info */
+ UINT32 i = 0;
+ for (i = 0; i < pInt->multiStreamHdr.ulNumSubStreams; i++) {
+ rv_depacki_cleanup_format_info(pInt, &pInt->pSubStreamHdr[i]);
+ }
+ /* Clean up the array */
+ rv_depacki_free(pInt, pInt->pSubStreamHdr);
+ pInt->pSubStreamHdr = HXNULL;
+ }
+}
+
+HX_RESULT rv_depacki_unpack_format_info(rv_depack_internal* pInt,
+ rv_format_info* pInfo,
+ BYTE** ppBuf,
+ UINT32* pulLen)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt && pInfo && ppBuf && *ppBuf && pulLen && *pulLen >= 26) {
+ /* Clean up any existing opaque data */
+ rv_depacki_cleanup_format_info(pInt, pInfo);
+ /* Unpack the format info struct */
+ pInfo->ulLength = rm_unpack32(ppBuf, pulLen);
+ pInfo->ulMOFTag = rm_unpack32(ppBuf, pulLen);
+ pInfo->ulSubMOFTag = rm_unpack32(ppBuf, pulLen);
+ pInfo->usWidth = rm_unpack16(ppBuf, pulLen);
+ pInfo->usHeight = rm_unpack16(ppBuf, pulLen);
+ pInfo->usBitCount = rm_unpack16(ppBuf, pulLen);
+ pInfo->usPadWidth = rm_unpack16(ppBuf, pulLen);
+ pInfo->usPadHeight = rm_unpack16(ppBuf, pulLen);
+ pInfo->ufFramesPerSecond = rm_unpack32(ppBuf, pulLen);
+ /* Fix up the subMOF tag */
+ if (pInfo->ulSubMOFTag == HX_RVTRVIDEO_ID) {
+ pInfo->ulSubMOFTag = HX_RV20VIDEO_ID;
+ } else if (pInfo->ulSubMOFTag == HX_RVTR_RV30_ID) {
+ pInfo->ulSubMOFTag = HX_RV30VIDEO_ID;
+ }
+ /* Compute the size of the opaque data */
+ pInfo->ulOpaqueDataSize = pInfo->ulLength - 26;
+ /* Make sure we have enough left in the parsing buffer */
+ if (*pulLen >= pInfo->ulOpaqueDataSize) {
+ /* Allocate a buffer of this size */
+ pInfo->pOpaqueData = (BYTE*) rv_depacki_malloc(pInt, pInfo->ulOpaqueDataSize);
+ if (pInfo->pOpaqueData) {
+ /* Copy the buffer */
+ memcpy(pInfo->pOpaqueData, *ppBuf, pInfo->ulOpaqueDataSize);
+ /* Advance the buffer */
+ *ppBuf += pInfo->ulOpaqueDataSize;
+ *pulLen -= pInfo->ulOpaqueDataSize;
+ /* Clear the return value */
+ retVal = HXR_OK;
+ }
+ }
+ }
+
+ return retVal;
+}
+
+HX_RESULT rv_depacki_check_rule_book(rv_depack_internal* pInt, rm_stream_header* hdr)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt && hdr) {
+ UINT32 ulSize = 0;
+ HXBOOL* pTmp = HXNULL;
+ char* pszRuleBook = HXNULL;
+ char* pStr = HXNULL;
+ char* pStrLimit = HXNULL;
+ UINT32 ulRule = 0;
+ UINT32 ulSubStream = 0;
+ const char* pszPNMStr = "$OldPNMPlayer";
+ UINT32 ulPNMStrLen = strlen(pszPNMStr);
+ UINT32 ulNumRules = pInt->multiStreamHdr.rule2SubStream.ulNumRules;
+ UINT32 ulNumSubStreams = pInt->multiStreamHdr.ulNumSubStreams;
+ /* Is this SureStream? */
+ if (pInt->bStreamSwitchable) {
+ /* Get the ASM Rule book */
+ retVal = rm_stream_get_property_str(hdr, "ASMRuleBook", &pszRuleBook);
+ if (retVal == HXR_OK) {
+ /* Allocate space for the ignore header flags */
+ ulSize = ulNumSubStreams * sizeof(HXBOOL);
+ pInt->bIgnoreSubStream = (HXBOOL*) rv_depacki_malloc(pInt, ulSize);
+ if (pInt->bIgnoreSubStream) {
+ /* NULL out the memory */
+ memset(pInt->bIgnoreSubStream, 0, ulSize);
+ /* Allocate space for temporary boolean array */
+ ulSize = ulNumRules * sizeof(HXBOOL);
+ pTmp = (HXBOOL*) rv_depacki_malloc(pInt, ulSize);
+ if (pTmp) {
+ /* NULL out the array */
+ memset(pTmp, 0, ulSize);
+ /* Parse the string */
+ pStr = pszRuleBook;
+ pStrLimit = pszRuleBook + strlen(pszRuleBook);
+ ulRule = 0;
+ while (pStr < pStrLimit && *pStr) {
+ while (pStr < pStrLimit && *pStr != ';') {
+ /* ignore quoted strings */
+ if (*pStr == '"') {
+ /* step past open quote */
+ pStr++;
+ /* ignore the string */
+ while (pStr < pStrLimit && *pStr != '"') {
+ pStr++;
+ }
+ /* step past end quote occurs at bottom of while !';' loop. */
+ }
+
+ if (pStr + ulPNMStrLen < pStrLimit && *pStr == '$') {
+ /* check to see if we have a $OldPNMPlayer variable */
+ if (!strncasecmp(pszPNMStr, pStr, ulPNMStrLen)) {
+ pStr += ulPNMStrLen;
+ pTmp[ulRule] = TRUE;
+ }
+ }
+ pStr++;
+ }
+ /* step past the ';' */
+ pStr++;
+ /* next rule */
+ ulRule++;
+ }
+ /*
+ * Now if pTmp[i] == TRUE, then we should ignore the
+ * substreams which correspond to rule i
+ */
+ for (ulRule = 0; ulRule < ulNumRules; ulRule++) {
+ ulSubStream = rv_depacki_rule_to_substream(pInt, ulRule);
+ if (ulSubStream < ulNumSubStreams) {
+ pInt->bIgnoreSubStream[ulSubStream] = pTmp[ulRule];
+ }
+ }
+ }
+ }
+ }
+ } else {
+ /* Not an error */
+ retVal = HXR_OK;
+ }
+ }
+
+ return retVal;
+}
+
+HX_RESULT rv_depacki_copy_format_info(rv_depack_internal* pInt,
+ rv_format_info* pSrc,
+ rv_format_info* pDst)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt && pSrc && pDst) {
+ /* Clean up any existing format info */
+ rv_depacki_cleanup_format_info(pInt, pDst);
+ /* Copy the members */
+ pDst->ulLength = pSrc->ulLength;
+ pDst->ulMOFTag = pSrc->ulMOFTag;
+ pDst->ulSubMOFTag = pSrc->ulSubMOFTag;
+ pDst->usWidth = pSrc->usWidth;
+ pDst->usHeight = pSrc->usHeight;
+ pDst->usBitCount = pSrc->usBitCount;
+ pDst->usPadWidth = pSrc->usPadWidth;
+ pDst->usPadHeight = pSrc->usPadHeight;
+ pDst->ufFramesPerSecond = pSrc->ufFramesPerSecond;
+ pDst->ulOpaqueDataSize = pSrc->ulOpaqueDataSize;
+ /* Copy the opaque data buffer */
+ pDst->pOpaqueData = copy_buffer(pInt->pUserMem,
+ pInt->fpMalloc,
+ pSrc->pOpaqueData,
+ pSrc->ulOpaqueDataSize);
+ if (pDst->pOpaqueData) {
+ /* Clear the return value */
+ retVal = HXR_OK;
+ }
+ }
+
+ return retVal;
+}
+
+HX_RESULT rv_depacki_add_packet(rv_depack_internal* pInt,
+ rm_packet* pPacket)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt && pPacket) {
+ /* Init local variables */
+ BYTE* pBuf = pPacket->pData;
+ UINT32 ulLen = (UINT32) pPacket->usDataLen;
+ UINT32 ulSubStream = 0;
+ rv_frame_hdr hdr;
+ /* Clear the return value */
+ retVal = HXR_OK;
+ /* Make sure we are not ignoring this substream */
+ ulSubStream = rv_depacki_rule_to_substream(pInt, pPacket->ucASMRule);
+ if (!pInt->bStreamSwitchable ||
+ !pInt->bIgnoreSubStream[ulSubStream]) {
+ /* Loop through the packet buffer */
+ while (ulLen && retVal == HXR_OK) {
+ /* Parse the current point in the packet buffer */
+ retVal = rv_depacki_parse_frame_header(pInt, &pBuf, &ulLen, pPacket, &hdr);
+ if (retVal == HXR_OK) {
+ /* Switch based on frame header type */
+ switch (hdr.eType) {
+ case RVFrameTypePartial:
+ case RVFrameTypeLastPartial:
+ retVal = rv_depacki_handle_partial(pInt, &pBuf, &ulLen, pPacket, &hdr);
+ break;
+ case RVFrameTypeMultiple:
+ case RVFrameTypeWhole:
+ retVal = rv_depacki_handle_one_frame(pInt, &pBuf, &ulLen, pPacket, &hdr);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return retVal;
+}
+
+UINT32 rv_depacki_rule_to_flags(rv_depack_internal* pInt, UINT32 ulRule)
+{
+ UINT32 ulRet = 0;
+
+ if (pInt &&
+ pInt->rule2Flag.pulMap &&
+ ulRule < pInt->rule2Flag.ulNumRules) {
+ ulRet = pInt->rule2Flag.pulMap[ulRule];
+ }
+
+ return ulRet;
+}
+
+UINT32 rv_depacki_rule_to_substream(rv_depack_internal* pInt, UINT32 ulRule)
+{
+ UINT32 ulRet = 0;
+
+ if (pInt &&
+ pInt->multiStreamHdr.rule2SubStream.pulMap &&
+ ulRule < pInt->multiStreamHdr.rule2SubStream.ulNumRules) {
+ ulRet = pInt->multiStreamHdr.rule2SubStream.pulMap[ulRule];
+ }
+
+ return ulRet;
+}
+
+HX_RESULT rv_depacki_parse_frame_header(rv_depack_internal* pInt,
+ BYTE** ppBuf,
+ UINT32* pulLen,
+ rm_packet* pPacket,
+ rv_frame_hdr* pFrameHdr)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt && ppBuf && pulLen && pFrameHdr && *pulLen >= 2 &&
+ *ppBuf >= pPacket->pData &&
+ *ppBuf < pPacket->pData + pPacket->usDataLen) {
+ /* Initialize local variables */
+ UINT32 ulTmp = 0;
+ HXBOOL bTmp = FALSE;
+ UINT32 ulOrigPacketTimeStamp = 0;
+ UINT32 ulClippedPacketTS = 0;
+ UINT32 ulDelta = 0;
+ BYTE* pBufAtStart = *ppBuf;
+ /* Set the offset of the header in the packet */
+ pFrameHdr->ulHeaderOffset = pBufAtStart - pPacket->pData;
+ /* Parse the RVFrameType */
+ pFrameHdr->eType = (RVFrameType)((pBufAtStart[0] & 0xC0) >> 6);
+ /* Switch based on frame type */
+ switch (pFrameHdr->eType) {
+ case RVFrameTypePartial:
+ case RVFrameTypeLastPartial:
+ /* Unpack the bit field */
+ ulTmp = rm_unpack16(ppBuf, pulLen);
+ pFrameHdr->ulNumPackets = ((ulTmp & 0x00003F80) >> 7);
+ pFrameHdr->ulPacketNum = (ulTmp & 0x0000007F);
+ /* Read the frame size */
+ retVal = rv_depacki_read_14_or_30(ppBuf, pulLen,
+ &pFrameHdr->bBrokenUpByUs,
+ &pFrameHdr->ulFrameSize);
+ if (retVal == HXR_OK) {
+ /* Read the partial size or offset */
+ ulTmp = 0;
+ retVal = rv_depacki_read_14_or_30(ppBuf, pulLen, &bTmp, &ulTmp);
+ if (retVal == HXR_OK) {
+ /* Make sure we have one byte */
+ if (*pulLen >= 1) {
+ /* Get the sequence number */
+ pFrameHdr->ulSeqNum = rm_unpack8(ppBuf, pulLen);
+ /* Assign the timestamp */
+ pFrameHdr->ulTimestamp = pPacket->ulTime;
+ /* Compute the header size */
+ pFrameHdr->ulHeaderSize = *ppBuf - pBufAtStart;
+ /* Assign the partial frame size and the partial frame offset. */
+ if (pFrameHdr->eType == RVFrameTypePartial) {
+ /*
+ * For partial frames the partial_size_or_offset
+ * member contains the offset into the frame. The size
+ * of the partial frame is just the amount of data
+ * in the packet minus the header size.
+ */
+ pFrameHdr->ulPartialFrameOffset = ulTmp;
+ pFrameHdr->ulPartialFrameSize = ((UINT32) pPacket->usDataLen) -
+ pFrameHdr->ulHeaderSize;
+ } else {
+ /*
+ * For last-partial frames, there could be other frame
+ * data after this, so the partial_size_or_offset field
+ * contains the partial frame size, not offset. We then
+ * compute the offset by subtracting the overall frame
+ * size from the partial frame size.
+ */
+ pFrameHdr->ulPartialFrameSize = ulTmp;
+ pFrameHdr->ulPartialFrameOffset = pFrameHdr->ulFrameSize - ulTmp;
+ }
+ } else {
+ retVal = HXR_FAIL;
+ }
+ }
+ }
+ break;
+ case RVFrameTypeWhole:
+ /* Skip the one-byte frame type */
+ rm_unpack8(ppBuf, pulLen);
+ /* Unpack the sequence number */
+ pFrameHdr->ulSeqNum = rm_unpack8(ppBuf, pulLen);
+ /* Compute the header size */
+ pFrameHdr->ulHeaderSize = *ppBuf - pBufAtStart;
+ /* Assign the frame header members */
+ pFrameHdr->ulNumPackets = 1;
+ pFrameHdr->ulPacketNum = 1;
+ pFrameHdr->ulFrameSize = ((UINT32) pPacket->usDataLen) -
+ pFrameHdr->ulHeaderSize;
+ pFrameHdr->ulTimestamp = pPacket->ulTime;
+ pFrameHdr->bBrokenUpByUs = FALSE;
+ pFrameHdr->ulPartialFrameOffset = 0;
+ pFrameHdr->ulPartialFrameSize = 0;
+ /* Clear return value */
+ retVal = HXR_OK;
+ break;
+ case RVFrameTypeMultiple:
+ /*
+ * For multiple frames, we still set ulNumPackets
+ * and ulPacketNum to 1, even though we know
+ * there are multiple packets.
+ */
+ pFrameHdr->ulNumPackets = 1;
+ pFrameHdr->ulPacketNum = 1;
+ /* Skip the frame type */
+ rm_unpack8(ppBuf, pulLen);
+ /* Unpack the frame size */
+ retVal = rv_depacki_read_14_or_30(ppBuf, pulLen, &bTmp,
+ &pFrameHdr->ulFrameSize);
+ if (retVal == HXR_OK) {
+ /* For multiple frames, there is no partial size or offset */
+ pFrameHdr->ulPartialFrameOffset = 0;
+ pFrameHdr->ulPartialFrameSize = 0;
+ /* Unpack the timestamp */
+ retVal = rv_depacki_read_14_or_30(ppBuf, pulLen, &bTmp,
+ &pFrameHdr->ulTimestamp);
+ if (retVal == HXR_OK) {
+ /* Does this stream have relative timestamps? */
+ if (pInt->bHasRelativeTimeStamps) {
+ /*
+ * Yes, we have relative timestamps so offset
+ * the timestamp in the frame header by the
+ * packet timestamp.
+ */
+ pFrameHdr->ulTimestamp += pPacket->ulTime;
+ } else {
+ /* No relative timestamps */
+ ulOrigPacketTimeStamp = pPacket->ulTime + pInt->ulZeroTimeOffset;
+ /*
+ * Because of a bug in the original Write14or30() which didn't mask
+ * the high bytes of the timestamp before |ing them with the flags,
+ * it's possible to read frame headers that are screwed up. If the
+ * application using this class sets the timestamp of the network packet
+ * before unpacking the header, we can determine if this header is
+ * screwed up and fix it.
+ */
+ /*
+ * If the time stamp returned is less than the packet timestamp
+ * something is screwed up. If the packet timestamp is > 14 bits,
+ * the frame timestamp is < the packet timestamp and the packet
+ * timestamp is < 14 bits then the Write14or30 bug described above
+ * may have occured. It's possible for rollover to occur and trigger
+ * this so we check for that too. If the bug occured, we want to read 30 bits.
+ */
+ if (ulOrigPacketTimeStamp > RM_MAX_UINT14 &&
+ ulOrigPacketTimeStamp > pFrameHdr->ulTimestamp &&
+ pFrameHdr->ulTimestamp < RM_MAX_UINT14 &&
+ /*
+ * check for rollover. If we assume ulOrigPacketTimeStamp is from before
+ * rollover and m_ulTimeStamp is from after, the left hand expression below
+ * should be a small number because m_ulPacketTimeSamp will be close to
+ * MAX_UINT30 and m_ulTimeStamp will be close to 0. I chose 60 seconds
+ * since two frames 60 seconds appart shouldn't be in the same packet
+ * due to latency considerations in the encoder. JEFFA 4/28/99
+ */
+ !(((RM_MAX_UINT30 - ulOrigPacketTimeStamp) + pFrameHdr->ulTimestamp) <= 60000UL)) {
+ /* We should have read 14 bits, so back up 2 bytes */
+ *ppBuf -= 2;
+ *pulLen += 2;
+ /* Now read 32 bits instead */
+ pFrameHdr->ulTimestamp = rm_unpack32(ppBuf, pulLen);
+ }
+
+ /* Clip the timestamp at 30 bits */
+ ulClippedPacketTS = (ulOrigPacketTimeStamp & RM_MAX_UINT30);
+ /*
+ * Much code in the system assumes full 32 bit typestamps; reconstruct
+ * them here. We assume child timestamps are no more than 2^30 - 1 away
+ */
+ ulDelta = (pFrameHdr->ulTimestamp >= ulClippedPacketTS ?
+ pFrameHdr->ulTimestamp - ulClippedPacketTS :
+ RM_MAX_UINT30 - ulClippedPacketTS + pFrameHdr->ulTimestamp);
+ pFrameHdr->ulTimestamp = ulOrigPacketTimeStamp + ulDelta;
+ /* If we have a zero time offset, we need to offset this timestamp */
+ pFrameHdr->ulTimestamp -= pInt->ulZeroTimeOffset;
+
+ /*
+ * Ensure that we have not caused the timestamp to fall behind
+ * the packet timestamp when we have subtracted zero time offset
+ */
+ if (pInt->ulZeroTimeOffset &&
+ (((INT32) pFrameHdr->ulTimestamp) - ((INT32) pPacket->ulTime) < 0)) {
+ pFrameHdr->ulTimestamp = pPacket->ulTime;
+ }
+
+ /*
+ * If older rmffplin is serving this slta stream and internal
+ * frame timestamp is much larger than pkt timestamp, then
+ * we are dealing with un-translated-for-slta-live internal
+ * frame timestamps (the above calculation w/ ulDelta made
+ * super-small timestamps into super-large ones). Here, we
+ * adjust and make the internal timestamp equal to the pkt timestamp
+ */
+ if (pFrameHdr->ulTimestamp - pPacket->ulTime > MAX_INTERNAL_TIMESTAMP_DELTA) {
+ pFrameHdr->ulTimestamp = pPacket->ulTime;
+ }
+ }
+ /* Read the sequence number */
+ pFrameHdr->ulSeqNum = rm_unpack8(ppBuf, pulLen);
+ }
+ }
+ break;
+ }
+ if (retVal == HXR_OK) {
+ /* Compute the number of bytes in the frame header we just parsed. */
+ pFrameHdr->ulHeaderSize = *ppBuf - pBufAtStart;
+ }
+ }
+
+ return retVal;
+}
+
+HX_RESULT rv_depacki_read_14_or_30(BYTE** ppBuf,
+ UINT32* pulLen,
+ HXBOOL* pbHiBit,
+ UINT32* pulValue)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (ppBuf && pulLen && pbHiBit && pulValue && *ppBuf && *pulLen >= 2) {
+ /* Init local variables */
+ UINT32 ulTmp = (*ppBuf)[0];
+ /* Assign the high bit */
+ *pbHiBit = ((ulTmp & 0x80) ? TRUE : FALSE);
+ /*
+ * Check the length bit. If it's 1, then
+ * this is a 14-bit value. If it's 0, then
+ * this is a 30-bit value.
+ */
+ if (ulTmp & 0x40) {
+ /*
+ * This is a 14-bit value, so unpack 16 bits.
+ * We don't need to check the buffer size, since
+ * we already checked for a minimum of 2 bytes above.
+ */
+ ulTmp = rm_unpack16(ppBuf, pulLen);
+ /* Mask out the upper two bits */
+ *pulValue = (ulTmp & 0x00003FFF);
+ /* Clear the return value */
+ retVal = HXR_OK;
+ } else {
+ /* This is a 30-bit value, so check size */
+ if (*pulLen >= 4) {
+ /* Unpack 32 bits */
+ ulTmp = rm_unpack32(ppBuf, pulLen);
+ /* Mask out the upper 2 bits */
+ *pulValue = (ulTmp & 0x3FFFFFFF);
+ /* Clear the return value */
+ retVal = HXR_OK;
+ }
+ }
+ }
+
+ return retVal;
+}
+
+HX_RESULT rv_depacki_handle_partial(rv_depack_internal* pInt,
+ BYTE** ppBuf,
+ UINT32* pulLen,
+ rm_packet* pPacket,
+ rv_frame_hdr* pFrameHdr)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt && ppBuf && pulLen && pPacket && pFrameHdr && *ppBuf) {
+ /* Init local variables */
+ UINT32 i = 0;
+ UINT32 ulOffset = 0;
+ HXBOOL bAllThere = FALSE;
+ /* Clear the reutrn value */
+ retVal = HXR_OK;
+ /*
+ * If we have a current frame and its timestamp
+ * is different from the packet timestamp,
+ * then we will send it.
+ */
+ if (pInt->pCurFrame &&
+ pInt->pCurFrame->ulTimestamp != pPacket->ulTime) {
+ /* Send the current frame */
+ retVal = rv_depacki_send_current_frame(pInt);
+ }
+ /* Do we have a current frame? */
+ if (retVal == HXR_OK && !pInt->pCurFrame) {
+ /* We don't have a current frame, so create one */
+ retVal = rv_depacki_create_frame(pInt, pPacket, pFrameHdr,
+ &pInt->pCurFrame);
+ }
+ if (retVal == HXR_OK) {
+ /* Set the return value */
+ retVal = HXR_FAIL;
+ /* Sanity check */
+ ulOffset = pFrameHdr->ulPartialFrameOffset + pFrameHdr->ulPartialFrameSize;
+ if (ulOffset <= pInt->pCurFrame->ulDataLen &&
+ *pulLen >= pFrameHdr->ulPartialFrameSize &&
+ pFrameHdr->ulPacketNum - 1 < pInt->pCurFrame->ulNumSegments) {
+ /* Copy the data into the frame data buffer */
+ memcpy(pInt->pCurFrame->pData + pFrameHdr->ulPartialFrameOffset,
+ *ppBuf,
+ pFrameHdr->ulPartialFrameSize);
+ /* The segment indices in the frame header are 1-based */
+ i = pFrameHdr->ulPacketNum - 1;
+ /* Update the segment information */
+ pInt->pCurFrame->pSegment[i].bIsValid = TRUE;
+ pInt->pCurFrame->pSegment[i].ulOffset = pFrameHdr->ulPartialFrameOffset;
+ /*
+ * Set the offset for the segment after this one and all other
+ * segments until we find a valid one or we run out of segments.
+ * This allows a codec to know where missing data would go for
+ * single loss. For multiple loss in a row the offset is set
+ * to the same offset since the size of the missing segments
+ * isn't known.
+ */
+ for (i = pFrameHdr->ulPacketNum;
+ i < pInt->pCurFrame->ulNumSegments &&
+ !pInt->pCurFrame->pSegment[i].bIsValid;
+ i++) {
+ pInt->pCurFrame->pSegment[i].ulOffset = ulOffset;
+ }
+ /* Check to see if all segments are present */
+ bAllThere = TRUE;
+ for (i = 0; i < pInt->pCurFrame->ulNumSegments && bAllThere; i++) {
+ bAllThere = pInt->pCurFrame->pSegment[i].bIsValid;
+ }
+ /* Clear the return value */
+ retVal = HXR_OK;
+ /* Are all segments present? */
+ if (bAllThere) {
+ /* We've got the entire packet, so send it */
+ retVal = rv_depacki_send_current_frame(pInt);
+ }
+ if (retVal == HXR_OK) {
+ /* Advance the buffer */
+ *ppBuf += pFrameHdr->ulPartialFrameSize;
+ *pulLen -= pFrameHdr->ulPartialFrameSize;
+ }
+ }
+ }
+ }
+
+ return retVal;
+}
+
+HX_RESULT rv_depacki_handle_one_frame(rv_depack_internal* pInt,
+ BYTE** ppBuf,
+ UINT32* pulLen,
+ rm_packet* pPacket,
+ rv_frame_hdr* pFrameHdr)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt && ppBuf && pulLen && pPacket && pFrameHdr && *ppBuf) {
+ /* If we have a current frame, send it */
+ retVal = rv_depacki_send_current_frame(pInt);
+ if (retVal == HXR_OK) {
+ /* Create a current frame */
+ retVal = rv_depacki_create_frame(pInt, pPacket, pFrameHdr,
+ &pInt->pCurFrame);
+ if (retVal == HXR_OK) {
+ /* Set the return value */
+ retVal = HXR_FAIL;
+ /* Sanity check on parsed values */
+ if (*pulLen >= pInt->pCurFrame->ulDataLen) {
+ /* Copy the data */
+ memcpy(pInt->pCurFrame->pData, *ppBuf,
+ pInt->pCurFrame->ulDataLen);
+ /* Set the one and only segment */
+ pInt->pCurFrame->pSegment[0].bIsValid = TRUE;
+ pInt->pCurFrame->pSegment[0].ulOffset = 0;
+ /* Send the frame we just created */
+ retVal = rv_depacki_send_current_frame(pInt);
+ if (retVal == HXR_OK) {
+ /* Advance the buffer */
+ *ppBuf += pFrameHdr->ulFrameSize;
+ *pulLen -= pFrameHdr->ulFrameSize;
+ }
+ }
+ }
+ }
+ }
+
+ return retVal;
+}
+
+HX_RESULT rv_depacki_send_current_frame(rv_depack_internal* pInt)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt && pInt->fpAvail) {
+ /* Init local variables */
+ HXBOOL bDoSend = TRUE;
+ UINT32 i = 0;
+ /* Clear the return value */
+ retVal = HXR_OK;
+ /* Do we have a current frame? Not an error if we don't. */
+ if (pInt->pCurFrame) {
+ /* Was the packet broken up by us? */
+ if (pInt->bBrokenUpByUs) {
+ /*
+ * Make sure all the segments are there;
+ * otherwise, don't send it. After leaving
+ * the for loop below, bDoSend will only
+ * be TRUE if all the segments are valid.
+ */
+ for (i = 0; i < pInt->pCurFrame->ulNumSegments && bDoSend; i++) {
+ bDoSend = pInt->pCurFrame->pSegment[i].bIsValid;
+ }
+ /* Are we going to send this frame? */
+ if (bDoSend && pInt->pCurFrame->ulNumSegments) {
+ /* Collapse all the segment info into 1 segment */
+ pInt->pCurFrame->pSegment[0].bIsValid = TRUE;
+ pInt->pCurFrame->pSegment[0].ulOffset = 0;
+ /* Reset the number of segments to 1 */
+ pInt->pCurFrame->ulNumSegments = 1;
+ }
+ }
+ /* Are we going to send this frame? */
+ if (bDoSend) {
+ /* Call the frame available function pointer */
+ retVal = pInt->fpAvail(pInt->pAvail,
+ pInt->ulActiveSubStream,
+ pInt->pCurFrame);
+
+ } else {
+ /* Free the frame */
+ rv_depacki_cleanup_frame(pInt, &pInt->pCurFrame);
+ }
+ /* NULL out the pointer */
+ pInt->pCurFrame = HXNULL;
+ }
+ }
+
+ return retVal;
+}
+
+void rv_depacki_cleanup_frame(rv_depack_internal* pInt,
+ rv_frame** ppFrame)
+{
+ if (pInt && ppFrame && *ppFrame) {
+ /* Free the encoded frame buffer */
+ if ((*ppFrame)->pData) {
+ rv_depacki_free(pInt, (*ppFrame)->pData);
+ (*ppFrame)->pData = HXNULL;
+ }
+ /* Free the segment array */
+ if ((*ppFrame)->pSegment) {
+ rv_depacki_free(pInt, (*ppFrame)->pSegment);
+ (*ppFrame)->pSegment = HXNULL;
+ }
+ /* NULL out the frame */
+ memset(*ppFrame, 0, sizeof(rv_frame));
+ /* Delete the space for the frame struct itself */
+ rv_depacki_free(pInt, *ppFrame);
+ /* NULL out the pointer */
+ *ppFrame = HXNULL;
+ }
+}
+
+HX_RESULT rv_depacki_create_frame(rv_depack_internal* pInt,
+ rm_packet* pPacket,
+ rv_frame_hdr* pFrameHdr,
+ rv_frame** ppFrame)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt && pPacket && pFrameHdr && ppFrame &&
+ pFrameHdr->ulFrameSize && pFrameHdr->ulNumPackets) {
+ /* Init local variables */
+ rv_frame* pFrame = HXNULL;
+ UINT32 ulSize = 0;
+ UINT32 ulSeqNum = 0;
+ UINT32 ulFlags = 0;
+ /* Clean out any existing frame */
+ rv_depacki_cleanup_frame(pInt, ppFrame);
+ /* Allocate space rv_frame struct */
+ pFrame = rv_depacki_malloc(pInt, sizeof(rv_frame));
+ if (pFrame) {
+ /* NULL out the memory */
+ memset(pFrame, 0, sizeof(rv_frame));
+ /* Allocate enough space for the data */
+ pFrame->pData = rv_depacki_malloc(pInt, pFrameHdr->ulFrameSize);
+ if (pFrame->pData) {
+ /* NULL out the memory */
+ memset(pFrame->pData, 0, pFrameHdr->ulFrameSize);
+ /* Assign the data size */
+ pFrame->ulDataLen = pFrameHdr->ulFrameSize;
+ /* Allocate space for segment array */
+ ulSize = pFrameHdr->ulNumPackets * sizeof(rv_segment);
+ pFrame->pSegment = rv_depacki_malloc(pInt, ulSize);
+ if (pFrame->pSegment) {
+ /*
+ * NULL out the memory. This effectively sets
+ * all the bIsValid flags to FALSE and ulOffset
+ * values to zero.
+ */
+ memset(pFrame->pSegment, 0, ulSize);
+ /* Assign the rest of the members of the frame struct */
+ pFrame->ulNumSegments = pFrameHdr->ulNumPackets;
+ pFrame->ulTimestamp = pFrameHdr->ulTimestamp;
+ pFrame->bLastPacket = FALSE;
+ /* Look up the flags from the packet ASM rule */
+ ulFlags = rv_depacki_rule_to_flags(pInt, pPacket->ucASMRule);
+ /*
+ * If this is a packet with only multiple frames and the
+ * packet is a keyframe packet, then we only want the FIRST frame
+ * to be labelled as a keyframe. If this packet has a
+ * last-partial frame followed by multiple frames, then
+ * we don't want ANY of the multiple frames to be labelled
+ * as a keyframe. To implement this logic, we can do
+ * the following check: if this is a multiple frames header
+ * AND that header did not start at the beginning of the packet,
+ * then we need to clear the keyframe flag.
+ */
+ if (pFrameHdr->eType == RVFrameTypeMultiple &&
+ pFrameHdr->ulHeaderOffset) {
+ ulFlags &= ~HX_KEYFRAME_FLAG;
+ }
+ /* Assign the frame flags */
+ pFrame->usFlags = (UINT16) ulFlags;
+ /* Compute the output sequence number */
+ if (pInt->bCreatedFirstFrame) {
+ /*
+ * The sequence number in the RV frame is only
+ * one byte, so every 256 frames, it rolls over
+ * from 255 back to 0. Check to see if we've
+ * rolled over with this frame.
+ */
+ if (pFrameHdr->ulSeqNum < pInt->ulLastSeqNumIn) {
+ /* We rolled over */
+ pInt->ulLastSeqNumOut += pFrameHdr->ulSeqNum + 256 - pInt->ulLastSeqNumIn;
+ } else {
+ pInt->ulLastSeqNumOut += pFrameHdr->ulSeqNum - pInt->ulLastSeqNumIn;
+ }
+ /* Save the last input sequence number */
+ pInt->ulLastSeqNumIn = pFrameHdr->ulSeqNum;
+ } else {
+ /*
+ * Always start the output sequence number at 0, even
+ * if we lost a few packets and the actual input sequence
+ * number in the RV frame my not be 0.
+ */
+ pInt->ulLastSeqNumOut = 0;
+ pInt->ulLastSeqNumIn = pFrameHdr->ulSeqNum;
+ pInt->bCreatedFirstFrame = TRUE;
+ }
+ /* Assign the sequence number */
+ pFrame->usSequenceNum = (UINT16)(pInt->ulLastSeqNumOut & 0x0000FFFF);
+ /* Assign the broken-up-by-us flag */
+ pInt->bBrokenUpByUs = pFrameHdr->bBrokenUpByUs;
+ /* Assign the out parameter */
+ *ppFrame = pFrame;
+ /* Clear the return value */
+ retVal = HXR_OK;
+ }
+ }
+ }
+ }
+
+ return retVal;
+}
+
+HX_RESULT rv_depacki_seek(rv_depack_internal* pInt, UINT32 ulTime)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pInt) {
+ /* Clean up any existing partial frame */
+ rv_depacki_cleanup_frame(pInt, &pInt->pCurFrame);
+ /* Clear the return value */
+ retVal = HXR_OK;
+ }
+
+ return retVal;
+}
+