Lines Matching refs:hTp
262 TRANSPORTDEC_ERROR transportDec_OutOfBandConfig(HANDLE_TRANSPORTDEC hTp, in transportDec_OutOfBandConfig() argument
291 switch (hTp->transportFmt) { in transportDec_OutOfBandConfig()
298 CLatmDemux *pLatmDemux = &hTp->parser.latm; in transportDec_OutOfBandConfig()
299 err = CLatmDemux_ReadStreamMuxConfig(hBs, pLatmDemux, &hTp->callbacks, in transportDec_OutOfBandConfig()
300 hTp->asc, &fConfigFound, in transportDec_OutOfBandConfig()
308 err = AudioSpecificConfig_Parse(&hTp->asc[(1 * 1)], hBs, 1, in transportDec_OutOfBandConfig()
309 &hTp->callbacks, configMode, in transportDec_OutOfBandConfig()
314 hTp->asc[layer] = hTp->asc[(1 * 1)]; in transportDec_OutOfBandConfig()
315 errC = hTp->callbacks.cbUpdateConfig( in transportDec_OutOfBandConfig()
316 hTp->callbacks.cbUpdateConfigData, &hTp->asc[layer], in transportDec_OutOfBandConfig()
317 hTp->asc[layer].configMode, &hTp->asc[layer].AacConfigChanged); in transportDec_OutOfBandConfig()
325 err = DrmRawSdcAudioConfig_Parse(&hTp->asc[layer], hBs, &hTp->callbacks, in transportDec_OutOfBandConfig()
330 errC = hTp->callbacks.cbUpdateConfig( in transportDec_OutOfBandConfig()
331 hTp->callbacks.cbUpdateConfigData, &hTp->asc[layer], in transportDec_OutOfBandConfig()
332 hTp->asc[layer].configMode, &hTp->asc[layer].AacConfigChanged); in transportDec_OutOfBandConfig()
341 if ((i == 0) && (hTp->asc[layer].AacConfigChanged || in transportDec_OutOfBandConfig()
342 hTp->asc[layer].SbrConfigChanged || in transportDec_OutOfBandConfig()
343 hTp->asc[layer].SacConfigChanged)) { in transportDec_OutOfBandConfig()
347 errC = hTp->callbacks.cbFreeMem(hTp->callbacks.cbFreeMemData, in transportDec_OutOfBandConfig()
348 &hTp->asc[layer]); in transportDec_OutOfBandConfig()
357 hTp->flags |= TPDEC_CONFIG_FOUND; in transportDec_OutOfBandConfig()
363 TRANSPORTDEC_ERROR transportDec_InBandConfig(HANDLE_TRANSPORTDEC hTp, in transportDec_InBandConfig() argument
377 FDK_ASSERT(hTp->asc->m_aot == AOT_USAC); in transportDec_InBandConfig()
382 if ((hTp->ctrlCFGChange[layer].flushStatus == TPDEC_FLUSH_OFF) && in transportDec_InBandConfig()
383 (hTp->ctrlCFGChange[layer].buildUpStatus != in transportDec_InBandConfig()
385 if (hTp->asc->m_aot == AOT_USAC) { in transportDec_InBandConfig()
386 if ((UINT)(hTp->asc->m_sc.m_usacConfig.UsacConfigBits + 7) >> 3 == in transportDec_InBandConfig()
388 if (0 == FDKmemcmp(newConfig, hTp->asc->m_sc.m_usacConfig.UsacConfig, in transportDec_InBandConfig()
390 if (hTp->parser.latm.usacExplicitCfgChanged) { /* configChange from in transportDec_InBandConfig()
392 hTp->parser.latm.usacExplicitCfgChanged = 0; in transportDec_InBandConfig()
393 hTp->ctrlCFGChange[layer].flushCnt = 0; in transportDec_InBandConfig()
394 hTp->ctrlCFGChange[layer].flushStatus = in transportDec_InBandConfig()
396 hTp->ctrlCFGChange[layer].buildUpCnt = 0; in transportDec_InBandConfig()
397 hTp->ctrlCFGChange[layer].buildUpStatus = TPDEC_BUILD_UP_OFF; in transportDec_InBandConfig()
411 switch (hTp->transportFmt) { in transportDec_InBandConfig()
417 hTp->callbacks.cbFreeMem(hTp->callbacks.cbFreeMemData, in transportDec_InBandConfig()
418 &hTp->asc[layer]); in transportDec_InBandConfig()
419 hTp->parser.latm.usacExplicitCfgChanged = 0; in transportDec_InBandConfig()
420 hTp->parser.latm.applyAsc = 1; in transportDec_InBandConfig()
431 if ((hTp->ctrlCFGChange[layer].flushStatus == TPDEC_FLUSH_OFF) && in transportDec_InBandConfig()
432 (hTp->ctrlCFGChange[layer].buildUpStatus != in transportDec_InBandConfig()
434 hTp->ctrlCFGChange[layer].flushCnt = 0; in transportDec_InBandConfig()
435 hTp->ctrlCFGChange[layer].buildUpCnt = 0; in transportDec_InBandConfig()
436 hTp->ctrlCFGChange[layer].buildUpStatus = TPDEC_BUILD_UP_OFF; in transportDec_InBandConfig()
437 if (hTp->asc->m_aot == AOT_USAC) { in transportDec_InBandConfig()
438 hTp->ctrlCFGChange[layer].flushStatus = TPDEC_USAC_DASH_IPF_FLUSH_ON; in transportDec_InBandConfig()
442 if ((hTp->ctrlCFGChange[layer].flushStatus == in transportDec_InBandConfig()
444 (hTp->ctrlCFGChange[layer].flushStatus == in transportDec_InBandConfig()
447 if (hTp->asc->m_aot == AOT_USAC) { in transportDec_InBandConfig()
450 if (hTp->ctrlCFGChange[layer].flushCnt >= counter) { in transportDec_InBandConfig()
451 hTp->ctrlCFGChange[layer].flushCnt = 0; in transportDec_InBandConfig()
452 hTp->ctrlCFGChange[layer].flushStatus = TPDEC_FLUSH_OFF; in transportDec_InBandConfig()
453 hTp->ctrlCFGChange[layer].forceCfgChange = 0; in transportDec_InBandConfig()
454 if (hTp->asc->m_aot == AOT_USAC) { in transportDec_InBandConfig()
455 hTp->ctrlCFGChange[layer].buildUpCnt = in transportDec_InBandConfig()
457 hTp->ctrlCFGChange[layer].buildUpStatus = TPDEC_USAC_BUILD_UP_ON; in transportDec_InBandConfig()
462 if (hTp->callbacks.cbCtrlCFGChange(hTp->callbacks.cbCtrlCFGChangeData, in transportDec_InBandConfig()
463 &hTp->ctrlCFGChange[layer]) != 0) { in transportDec_InBandConfig()
467 if ((hTp->ctrlCFGChange[layer].flushStatus == in transportDec_InBandConfig()
469 (hTp->ctrlCFGChange[layer].flushStatus == in transportDec_InBandConfig()
471 hTp->ctrlCFGChange[layer].flushCnt++; in transportDec_InBandConfig()
476 if (hTp->asc->m_aot == AOT_USAC) { in transportDec_InBandConfig()
490 &hTp->asc[(1 * 1)], hBs, 0, &hTp->callbacks, configMode, in transportDec_InBandConfig()
491 *configChanged, hTp->asc[layer].m_aot); in transportDec_InBandConfig()
493 hTp->asc[layer] = hTp->asc[(1 * 1)]; in transportDec_InBandConfig()
494 errC = hTp->callbacks.cbUpdateConfig( in transportDec_InBandConfig()
495 hTp->callbacks.cbUpdateConfigData, &hTp->asc[layer], in transportDec_InBandConfig()
496 hTp->asc[layer].configMode, &hTp->asc[layer].AacConfigChanged); in transportDec_InBandConfig()
503 if ((i == 0) && (hTp->asc[layer].AacConfigChanged || in transportDec_InBandConfig()
504 hTp->asc[layer].SbrConfigChanged || in transportDec_InBandConfig()
505 hTp->asc[layer].SacConfigChanged)) { in transportDec_InBandConfig()
507 errC = hTp->callbacks.cbFreeMem(hTp->callbacks.cbFreeMemData, in transportDec_InBandConfig()
508 &hTp->asc[layer]); in transportDec_InBandConfig()
527 if (hTp->asc->m_aot == AOT_USAC) { in transportDec_InBandConfig()
528 hTp->asc->m_sc.m_usacConfig.UsacConfigBits = newConfigLength << 3; in transportDec_InBandConfig()
529 FDKmemcpy(hTp->asc->m_sc.m_usacConfig.UsacConfig, newConfig, in transportDec_InBandConfig()
533 hTp->ctrlCFGChange[layer].flushCnt = 0; in transportDec_InBandConfig()
534 hTp->ctrlCFGChange[layer].flushStatus = TPDEC_FLUSH_OFF; in transportDec_InBandConfig()
535 hTp->ctrlCFGChange[layer].buildUpCnt = 0; in transportDec_InBandConfig()
536 hTp->ctrlCFGChange[layer].buildUpStatus = TPDEC_BUILD_UP_OFF; in transportDec_InBandConfig()
539 hTp->numberOfRawDataBlocks = 0; in transportDec_InBandConfig()
542 hTp->ctrlCFGChange[layer].flushCnt = 0; in transportDec_InBandConfig()
543 hTp->ctrlCFGChange[layer].flushStatus = TPDEC_FLUSH_OFF; in transportDec_InBandConfig()
544 hTp->ctrlCFGChange[layer].buildUpCnt = 0; in transportDec_InBandConfig()
545 hTp->ctrlCFGChange[layer].buildUpStatus = TPDEC_BUILD_UP_OFF; in transportDec_InBandConfig()
546 hTp->ctrlCFGChange[layer].cfgChanged = 0; in transportDec_InBandConfig()
547 hTp->ctrlCFGChange[layer].contentChanged = 0; in transportDec_InBandConfig()
548 hTp->ctrlCFGChange[layer].forceCfgChange = 0; in transportDec_InBandConfig()
550 hTp->callbacks.cbCtrlCFGChange(hTp->callbacks.cbCtrlCFGChangeData, in transportDec_InBandConfig()
551 &hTp->ctrlCFGChange[layer]); in transportDec_InBandConfig()
556 hTp->flags |= TPDEC_CONFIG_FOUND; in transportDec_InBandConfig()
640 TRANSPORTDEC_ERROR transportDec_FillData(const HANDLE_TRANSPORTDEC hTp, in transportDec_FillData() argument
645 if ((hTp == NULL) || (layer >= 1)) { in transportDec_FillData()
650 hBs = &hTp->bitStream[layer]; in transportDec_FillData()
652 if (TT_IS_PACKET(hTp->transportFmt)) { in transportDec_FillData()
653 if (hTp->numberOfRawDataBlocks == 0) { in transportDec_FillData()
668 if (hTp->numberOfRawDataBlocks <= 0) { in transportDec_FillData()
676 HANDLE_FDK_BITSTREAM transportDec_GetBitstream(const HANDLE_TRANSPORTDEC hTp, in transportDec_GetBitstream() argument
678 return &hTp->bitStream[layer]; in transportDec_GetBitstream()
681 TRANSPORT_TYPE transportDec_GetFormat(const HANDLE_TRANSPORTDEC hTp) { in transportDec_GetFormat() argument
682 return hTp->transportFmt; in transportDec_GetFormat()
685 INT transportDec_GetBufferFullness(const HANDLE_TRANSPORTDEC hTp) { in transportDec_GetBufferFullness() argument
688 switch (hTp->transportFmt) { in transportDec_GetBufferFullness()
690 if (hTp->parser.adts.bs.adts_fullness != 0x7ff) { in transportDec_GetBufferFullness()
691 bufferFullness = hTp->parser.adts.bs.frame_length * 8 + in transportDec_GetBufferFullness()
692 hTp->parser.adts.bs.adts_fullness * 32 * in transportDec_GetBufferFullness()
694 hTp->parser.adts.bs.channel_config); in transportDec_GetBufferFullness()
700 if (hTp->parser.latm.m_linfo[0][0].m_bufferFullness != 0xff) { in transportDec_GetBufferFullness()
701 bufferFullness = hTp->parser.latm.m_linfo[0][0].m_bufferFullness; in transportDec_GetBufferFullness()
717 HANDLE_TRANSPORTDEC hTp) { in transportDec_AdjustEndOfAccessUnit() argument
718 HANDLE_FDK_BITSTREAM hBs = &hTp->bitStream[0]; in transportDec_AdjustEndOfAccessUnit()
721 switch (hTp->transportFmt) { in transportDec_AdjustEndOfAccessUnit()
725 FDKbyteAlign(hBs, hTp->accessUnitAnchor[0]); in transportDec_AdjustEndOfAccessUnit()
730 if (hTp->numberOfRawDataBlocks == 0) { in transportDec_AdjustEndOfAccessUnit()
732 FDKbyteAlign(hBs, hTp->globalFramePos); in transportDec_AdjustEndOfAccessUnit()
735 if (hTp->transportFmt == TT_MP4_LOAS && in transportDec_AdjustEndOfAccessUnit()
736 hTp->parser.latm.m_audioMuxLengthBytes > 0) { in transportDec_AdjustEndOfAccessUnit()
739 loasOffset = ((INT)hTp->parser.latm.m_audioMuxLengthBytes * 8 + in transportDec_AdjustEndOfAccessUnit()
741 (INT)hTp->globalFramePos; in transportDec_AdjustEndOfAccessUnit()
756 if (hTp->parser.adts.bs.protection_absent == 0) { in transportDec_AdjustEndOfAccessUnit()
760 offset = hTp->parser.adts in transportDec_AdjustEndOfAccessUnit()
761 .rawDataBlockDist[hTp->parser.adts.bs.num_raw_blocks - in transportDec_AdjustEndOfAccessUnit()
762 hTp->numberOfRawDataBlocks] in transportDec_AdjustEndOfAccessUnit()
766 offset -= (INT)hTp->accessUnitAnchor[0] - (INT)FDKgetValidBits(hBs) + in transportDec_AdjustEndOfAccessUnit()
767 16 + hTp->parser.adts.bs.num_pce_bits; in transportDec_AdjustEndOfAccessUnit()
770 if (hTp->parser.adts.bs.num_raw_blocks > 0 && in transportDec_AdjustEndOfAccessUnit()
771 hTp->parser.adts.bs.protection_absent == 0) { in transportDec_AdjustEndOfAccessUnit()
774 hTp->parser.adts.crcReadValue = FDKreadBits(hBs, 16); in transportDec_AdjustEndOfAccessUnit()
776 if (hTp->numberOfRawDataBlocks == 0) { in transportDec_AdjustEndOfAccessUnit()
778 if (hTp->parser.adts.bs.protection_absent == 0) { in transportDec_AdjustEndOfAccessUnit()
781 offset = (hTp->parser.adts.bs.frame_length * 8 - ADTS_SYNCLENGTH + in transportDec_AdjustEndOfAccessUnit()
783 (INT)hTp->globalFramePos; in transportDec_AdjustEndOfAccessUnit()
809 static TRANSPORTDEC_ERROR additionalHoldOffNeeded(HANDLE_TRANSPORTDEC hTp, in additionalHoldOffNeeded() argument
814 INT samplesPerFrame = hTp->asc->m_samplesPerFrame; in additionalHoldOffNeeded()
815 INT samplingFrequency = (INT)hTp->asc->m_samplingFrequency; in additionalHoldOffNeeded()
817 if ((hTp->avgBitRate == 0) || (hTp->burstPeriod == 0)) { in additionalHoldOffNeeded()
825 maxAU = hTp->burstPeriod * samplingFrequency + (samplesPerFrame * 1000 - 1); in additionalHoldOffNeeded()
828 maxAU -= hTp->holdOffFrames; in additionalHoldOffNeeded()
830 avgBitsPerFrame = hTp->avgBitRate * samplesPerFrame + (samplingFrequency - 1); in additionalHoldOffNeeded()
834 switch (hTp->transportFmt) { in additionalHoldOffNeeded()
861 HANDLE_TRANSPORTDEC hTp, HANDLE_FDK_BITSTREAM hBs, int syncLength, in transportDec_readHeader() argument
876 switch (hTp->transportFmt) { in transportDec_readHeader()
878 if (hTp->numberOfRawDataBlocks <= 0) { in transportDec_readHeader()
881 hTp->globalFramePos = FDKgetValidBits(hBs); in transportDec_readHeader()
889 (INT)hTp->globalFramePos - (INT)FDKgetValidBits(hBs)); in transportDec_readHeader()
894 err = adtsRead_DecodeHeader(&hTp->parser.adts, &hTp->asc[0], hBs, in transportDec_readHeader()
901 errC = hTp->callbacks.cbUpdateConfig( in transportDec_readHeader()
902 hTp->callbacks.cbUpdateConfigData, &hTp->asc[0], configMode, in transportDec_readHeader()
913 hTp->numberOfRawDataBlocks = in transportDec_readHeader()
914 hTp->parser.adts.bs.num_raw_blocks + 1; in transportDec_readHeader()
920 errC = hTp->callbacks.cbFreeMem(hTp->callbacks.cbFreeMemData, in transportDec_readHeader()
921 &hTp->asc[0]); in transportDec_readHeader()
931 FDKcrcReset(&hTp->parser.adts.crcInfo); in transportDec_readHeader()
932 hTp->parser.adts.bs.num_pce_bits = 0; in transportDec_readHeader()
935 hTp->numberOfRawDataBlocks--; in transportDec_readHeader()
937 &hTp->parser.adts, in transportDec_readHeader()
938 (hTp->parser.adts.bs.num_raw_blocks - hTp->numberOfRawDataBlocks)); in transportDec_readHeader()
943 syncLayerFrameBits = (hTp->parser.adts.bs.frame_length << 3) - in transportDec_readHeader()
950 hTp->numberOfRawDataBlocks = 0; in transportDec_readHeader()
954 if (hTp->numberOfRawDataBlocks <= 0) { in transportDec_readHeader()
956 hTp->parser.latm.m_audioMuxLengthBytes = syncLayerFrameBits; in transportDec_readHeader()
962 if (hTp->numberOfRawDataBlocks <= 0) { in transportDec_readHeader()
963 hTp->globalFramePos = FDKgetValidBits(hBs); in transportDec_readHeader()
965 err = CLatmDemux_Read(hBs, &hTp->parser.latm, hTp->transportFmt, in transportDec_readHeader()
966 &hTp->callbacks, hTp->asc, &fConfigFound, in transportDec_readHeader()
975 hTp->numberOfRawDataBlocks = in transportDec_readHeader()
976 CLatmDemux_GetNrOfSubFrames(&hTp->parser.latm); in transportDec_readHeader()
977 if (hTp->transportFmt == TT_MP4_LOAS) { in transportDec_readHeader()
982 err = CLatmDemux_ReadPayloadLengthInfo(hBs, &hTp->parser.latm); in transportDec_readHeader()
991 layer < (int)CLatmDemux_GetNrOfLayers(&hTp->parser.latm, 0); in transportDec_readHeader()
994 CLatmDemux_GetFrameLengthInBits(&hTp->parser.latm, 0, layer); in transportDec_readHeader()
996 hTp->numberOfRawDataBlocks--; in transportDec_readHeader()
998 hTp->numberOfRawDataBlocks = 0; in transportDec_readHeader()
1014 if (hTp->ctrlCFGChange[i].cfgChanged && err != TRANSPORTDEC_OK) { in transportDec_readHeader()
1015 hTp->numberOfRawDataBlocks = 0; in transportDec_readHeader()
1016 hTp->ctrlCFGChange[i].flushCnt = 0; in transportDec_readHeader()
1017 hTp->ctrlCFGChange[i].flushStatus = TPDEC_FLUSH_OFF; in transportDec_readHeader()
1018 hTp->ctrlCFGChange[i].buildUpCnt = 0; in transportDec_readHeader()
1019 hTp->ctrlCFGChange[i].buildUpStatus = TPDEC_BUILD_UP_OFF; in transportDec_readHeader()
1020 hTp->ctrlCFGChange[i].cfgChanged = 0; in transportDec_readHeader()
1021 hTp->ctrlCFGChange[i].contentChanged = 0; in transportDec_readHeader()
1022 hTp->ctrlCFGChange[i].forceCfgChange = 0; in transportDec_readHeader()
1024 hTp->callbacks.cbCtrlCFGChange(hTp->callbacks.cbCtrlCFGChangeData, in transportDec_readHeader()
1025 &hTp->ctrlCFGChange[i]); in transportDec_readHeader()
1046 static TRANSPORTDEC_ERROR synchronization(HANDLE_TRANSPORTDEC hTp, in synchronization() argument
1049 HANDLE_FDK_BITSTREAM hBs = &hTp->bitStream[0]; in synchronization()
1056 fConfigFound = (hTp->flags & TPDEC_CONFIG_FOUND), startPosFirstFrame = -1; in synchronization()
1060 hTp->flags & in synchronization()
1079 (hTp->flags & (TPDEC_MINIMIZE_DELAY | TPDEC_EARLY_CONFIG)) && in synchronization()
1080 !(hTp->flags & TPDEC_SYNCOK); in synchronization()
1083 switch (hTp->transportFmt) { in synchronization()
1110 if (hTp->numberOfRawDataBlocks == 0) { in synchronization()
1121 if (!(hTp->flags & TPDEC_SYNCOK)) { in synchronization()
1145 numRawDataBlocksPrevious = hTp->numberOfRawDataBlocks; in synchronization()
1150 err = transportDec_readHeader(hTp, hBs, syncLength, ignoreBufferFullness, in synchronization()
1185 hTp->numberOfRawDataBlocks = 0; in synchronization()
1193 hTp->numberOfRawDataBlocks = 0; in synchronization()
1206 if ((hTp->flags & TPDEC_EARLY_CONFIG) && in synchronization()
1207 !(hTp->flags & TPDEC_MINIMIZE_DELAY)) { in synchronization()
1215 numRawDataBlocksFirstFrame = hTp->numberOfRawDataBlocks; in synchronization()
1216 globalFramePosFirstFrame = hTp->globalFramePos; in synchronization()
1220 FDKmemcpy(contextFirstFrame, &hTp->parser, in synchronization()
1243 transportDec_AdjustEndOfAccessUnit(hTp); in synchronization()
1248 (err == TRANSPORTDEC_SYNC_ERROR && !(hTp->flags & TPDEC_SYNCOK))); in synchronization()
1253 FDKmemcpy(&hTp->parser, contextFirstFrame, sizeof(transportdec_parser_t)); in synchronization()
1254 hTp->numberOfRawDataBlocks = numRawDataBlocksFirstFrame; in synchronization()
1255 hTp->globalFramePos = globalFramePosFirstFrame; in synchronization()
1263 if (!(hTp->flags & (TPDEC_LOST_FRAMES_PENDING | TPDEC_IGNORE_BUFFERFULLNESS | in synchronization()
1266 err = additionalHoldOffNeeded(hTp, transportDec_GetBufferFullness(hTp), in synchronization()
1269 hTp->holdOffFrames++; in synchronization()
1279 hTp->holdOffFrames = 0; in synchronization()
1286 hTp->numberOfRawDataBlocks = numRawDataBlocksPrevious; in synchronization()
1294 hTp->auLength[0] = rawDataBlockLength; in synchronization()
1301 (((8192 * 4) * 8 - ((hTp->avgBitRate * hTp->burstPeriod) / 1000)) - in synchronization()
1308 hTp->flags |= TPDEC_SYNCOK; in synchronization()
1312 hTp->flags |= TPDEC_CONFIG_FOUND; in synchronization()
1320 hTp->flags &= ~TPDEC_SYNCOK; in synchronization()
1332 static TRANSPORTDEC_ERROR transportDec_readStream(HANDLE_TRANSPORTDEC hTp, in transportDec_readStream() argument
1335 HANDLE_FDK_BITSTREAM hBs = &hTp->bitStream[layer]; in transportDec_readStream()
1342 error = synchronization(hTp, &headerBits); in transportDec_readStream()
1350 (hTp->flags & TPDEC_LOST_FRAMES_PENDING)) { in transportDec_readStream()
1352 if (hTp->avgBitRate > 0 && hTp->asc[0].m_samplesPerFrame > 0 && in transportDec_readStream()
1353 hTp->asc[0].m_samplingFrequency > 0) { in transportDec_readStream()
1357 aj = transportDec_GetBufferFullness(hTp); in transportDec_readStream()
1364 hTp->flags &= ~TPDEC_LOST_FRAMES_PENDING; in transportDec_readStream()
1369 bitDistance += hTp->auLength[0]; in transportDec_readStream()
1371 if (!(hTp->flags & TPDEC_LOST_FRAMES_PENDING)) { in transportDec_readStream()
1373 hTp->flags |= TPDEC_LOST_FRAMES_PENDING; in transportDec_readStream()
1374 bfDelta = -(INT)hTp->lastValidBufferFullness; in transportDec_readStream()
1384 num = (INT)hTp->asc[0].m_samplingFrequency * (bfDelta + bitDistance) + in transportDec_readStream()
1385 hTp->remainder; in transportDec_readStream()
1386 denom = hTp->avgBitRate * hTp->asc[0].m_samplesPerFrame; in transportDec_readStream()
1389 hTp->remainder = num % denom; in transportDec_readStream()
1391 hTp->remainder = num; in transportDec_readStream()
1398 if ((denom - hTp->remainder) >= hTp->remainder) { in transportDec_readStream()
1405 transportDec_EndAccessUnit(hTp); in transportDec_readStream()
1406 error = synchronization(hTp, &headerBits); in transportDec_readStream()
1409 hTp->remainder = 0; in transportDec_readStream()
1427 hTp->missingAccessUnits = nAU; in transportDec_readStream()
1433 TRANSPORTDEC_ERROR transportDec_ReadAccessUnit(const HANDLE_TRANSPORTDEC hTp, in transportDec_ReadAccessUnit() argument
1438 if (!hTp) { in transportDec_ReadAccessUnit()
1442 hBs = &hTp->bitStream[layer]; in transportDec_ReadAccessUnit()
1448 hTp->numberOfRawDataBlocks = 0; in transportDec_ReadAccessUnit()
1451 switch (hTp->transportFmt) { in transportDec_ReadAccessUnit()
1454 if (!(hTp->flags & TPDEC_CONFIG_FOUND)) { in transportDec_ReadAccessUnit()
1467 AudioSpecificConfig_Init(&hTp->asc[0]); in transportDec_ReadAccessUnit()
1468 pce = &hTp->asc[0].m_progrConfigElement; in transportDec_ReadAccessUnit()
1469 err = adifRead_DecodeHeader(&hTp->parser.adif, pce, hBs); in transportDec_ReadAccessUnit()
1473 hTp->asc[0].m_aot = (AUDIO_OBJECT_TYPE)(pce->Profile + 1); in transportDec_ReadAccessUnit()
1474 hTp->asc[0].m_samplingFrequencyIndex = pce->SamplingFrequencyIndex; in transportDec_ReadAccessUnit()
1475 hTp->asc[0].m_samplingFrequency = in transportDec_ReadAccessUnit()
1477 hTp->asc[0].m_channelConfiguration = 0; in transportDec_ReadAccessUnit()
1478 hTp->asc[0].m_samplesPerFrame = 1024; in transportDec_ReadAccessUnit()
1479 hTp->avgBitRate = hTp->parser.adif.BitRate; in transportDec_ReadAccessUnit()
1485 errC = hTp->callbacks.cbUpdateConfig( in transportDec_ReadAccessUnit()
1486 hTp->callbacks.cbUpdateConfigData, &hTp->asc[0], configMode, in transportDec_ReadAccessUnit()
1489 hTp->flags |= TPDEC_CONFIG_FOUND; in transportDec_ReadAccessUnit()
1499 errC = hTp->callbacks.cbFreeMem(hTp->callbacks.cbFreeMemData, in transportDec_ReadAccessUnit()
1500 &hTp->asc[0]); in transportDec_ReadAccessUnit()
1508 hTp->auLength[layer] = -1; /* Access Unit data length is unknown. */ in transportDec_ReadAccessUnit()
1515 hTp->auLength[layer] = FDKgetValidBits(hBs); in transportDec_ReadAccessUnit()
1516 hTp->flags |= TPDEC_SYNCOK; in transportDec_ReadAccessUnit()
1522 int fConfigFound = hTp->flags & TPDEC_CONFIG_FOUND; in transportDec_ReadAccessUnit()
1523 err = transportDec_readHeader(hTp, hBs, 0, 1, &hTp->auLength[layer], in transportDec_ReadAccessUnit()
1526 hTp->flags |= TPDEC_CONFIG_FOUND; in transportDec_ReadAccessUnit()
1533 err = transportDec_readStream(hTp, layer); in transportDec_ReadAccessUnit()
1542 hTp->accessUnitAnchor[layer] = FDKgetValidBits(hBs); in transportDec_ReadAccessUnit()
1544 hTp->accessUnitAnchor[layer] = 0; in transportDec_ReadAccessUnit()
1551 TRANSPORTDEC_ERROR transportDec_GetAsc(const HANDLE_TRANSPORTDEC hTp, in transportDec_GetAsc() argument
1556 if (hTp != NULL) { in transportDec_GetAsc()
1557 *asc = hTp->asc[layer]; in transportDec_GetAsc()
1565 INT transportDec_GetAuBitsRemaining(const HANDLE_TRANSPORTDEC hTp, in transportDec_GetAuBitsRemaining() argument
1569 if (hTp->accessUnitAnchor[layer] > 0 && hTp->auLength[layer] > 0) { in transportDec_GetAuBitsRemaining()
1570 bits = (INT)FDKgetValidBits(&hTp->bitStream[layer]); in transportDec_GetAuBitsRemaining()
1572 bits = hTp->auLength[layer] - ((INT)hTp->accessUnitAnchor[layer] - bits); in transportDec_GetAuBitsRemaining()
1575 bits = FDKgetValidBits(&hTp->bitStream[layer]); in transportDec_GetAuBitsRemaining()
1581 INT transportDec_GetAuBitsTotal(const HANDLE_TRANSPORTDEC hTp, in transportDec_GetAuBitsTotal() argument
1583 return hTp->auLength[layer]; in transportDec_GetAuBitsTotal()
1587 INT *pNAccessUnits, HANDLE_TRANSPORTDEC hTp) { in transportDec_GetMissingAccessUnitCount() argument
1588 *pNAccessUnits = hTp->missingAccessUnits; in transportDec_GetMissingAccessUnitCount()
1594 TRANSPORTDEC_ERROR transportDec_EndAccessUnit(HANDLE_TRANSPORTDEC hTp) { in transportDec_EndAccessUnit() argument
1597 switch (hTp->transportFmt) { in transportDec_EndAccessUnit()
1601 HANDLE_FDK_BITSTREAM hBs = &hTp->bitStream[0]; in transportDec_EndAccessUnit()
1602 if (hTp->numberOfRawDataBlocks == 0) { in transportDec_EndAccessUnit()
1604 if (CLatmDemux_GetOtherDataPresentFlag(&hTp->parser.latm)) { in transportDec_EndAccessUnit()
1605 int otherDataLen = CLatmDemux_GetOtherDataLength(&hTp->parser.latm); in transportDec_EndAccessUnit()
1611 if (hTp->numberOfRawDataBlocks == 0) { in transportDec_EndAccessUnit()
1612 FDKbyteAlign(hBs, hTp->globalFramePos); in transportDec_EndAccessUnit()
1623 hTp->numberOfRawDataBlocks = 0; in transportDec_EndAccessUnit()
1631 err = transportDec_AdjustEndOfAccessUnit(hTp); in transportDec_EndAccessUnit()
1633 switch (hTp->transportFmt) { in transportDec_EndAccessUnit()
1641 TRANSPORTDEC_ERROR transportDec_SetParam(const HANDLE_TRANSPORTDEC hTp, in transportDec_SetParam() argument
1646 if (hTp == NULL) { in transportDec_SetParam()
1653 hTp->flags |= TPDEC_MINIMIZE_DELAY; in transportDec_SetParam()
1655 hTp->flags &= ~TPDEC_MINIMIZE_DELAY; in transportDec_SetParam()
1660 hTp->flags |= TPDEC_EARLY_CONFIG; in transportDec_SetParam()
1662 hTp->flags &= ~TPDEC_EARLY_CONFIG; in transportDec_SetParam()
1667 hTp->flags |= TPDEC_IGNORE_BUFFERFULLNESS; in transportDec_SetParam()
1669 hTp->flags &= ~TPDEC_IGNORE_BUFFERFULLNESS; in transportDec_SetParam()
1673 hTp->avgBitRate = value; in transportDec_SetParam()
1676 hTp->burstPeriod = value; in transportDec_SetParam()
1682 FDKresetBitbuffer(&hTp->bitStream[i]); in transportDec_SetParam()
1683 hTp->auLength[i] = 0; in transportDec_SetParam()
1684 hTp->accessUnitAnchor[i] = 0; in transportDec_SetParam()
1686 hTp->flags &= ~(TPDEC_SYNCOK | TPDEC_LOST_FRAMES_PENDING); in transportDec_SetParam()
1687 if (hTp->transportFmt != TT_MP4_ADIF) { in transportDec_SetParam()
1688 hTp->flags &= ~TPDEC_CONFIG_FOUND; in transportDec_SetParam()
1690 hTp->remainder = 0; in transportDec_SetParam()
1691 hTp->avgBitRate = 0; in transportDec_SetParam()
1692 hTp->missingAccessUnits = 0; in transportDec_SetParam()
1693 hTp->numberOfRawDataBlocks = 0; in transportDec_SetParam()
1694 hTp->globalFramePos = 0; in transportDec_SetParam()
1695 hTp->holdOffFrames = 0; in transportDec_SetParam()
1698 hTp->targetLayout = value; in transportDec_SetParam()
1701 hTp->ctrlCFGChange[value].forceCfgChange = TPDEC_FORCE_CONFIG_CHANGE; in transportDec_SetParam()
1705 hTp->flags |= TPDEC_USE_ELEM_SKIPPING; in transportDec_SetParam()
1707 hTp->flags &= ~TPDEC_USE_ELEM_SKIPPING; in transportDec_SetParam()
1715 UINT transportDec_GetNrOfSubFrames(HANDLE_TRANSPORTDEC hTp) { in transportDec_GetNrOfSubFrames() argument
1718 if (hTp == NULL) return 0; in transportDec_GetNrOfSubFrames()
1720 if (hTp->transportFmt == TT_MP4_LATM_MCP1 || in transportDec_GetNrOfSubFrames()
1721 hTp->transportFmt == TT_MP4_LATM_MCP0 || hTp->transportFmt == TT_MP4_LOAS) in transportDec_GetNrOfSubFrames()
1722 nSubFrames = CLatmDemux_GetNrOfSubFrames(&hTp->parser.latm); in transportDec_GetNrOfSubFrames()
1723 else if (hTp->transportFmt == TT_MP4_ADTS) in transportDec_GetNrOfSubFrames()
1724 nSubFrames = hTp->parser.adts.bs.num_raw_blocks; in transportDec_GetNrOfSubFrames()