MCPcopy Create free account
hub / github.com/cisco/openh264 / DecodeParser

Method DecodeParser

codec/decoder/plus/src/welsDecoderExt.cpp:1159–1239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1157}
1158
1159DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc, const int kiSrcLen, SParserBsInfo* pDstInfo) {
1160 PWelsDecoderContext pDecContext = m_pDecThrCtx[0].pCtx;
1161
1162 if (pDecContext == NULL || pDecContext->pParam == NULL) {
1163 if (m_pWelsTrace != NULL) {
1164 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "Call DecodeParser without Initialize.\n");
1165 }
1166 return dsInitialOptExpected;
1167 }
1168
1169 if (!pDecContext->pParam->bParseOnly) {
1170 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "bParseOnly should be true for this API calling! \n");
1171 pDecContext->iErrorCode |= dsInvalidArgument;
1172 return dsInvalidArgument;
1173 }
1174 int64_t iEnd, iStart = WelsTime();
1175 if (CheckBsBuffer (pDecContext, kiSrcLen)) {
1176 if (ResetDecoder (pDecContext))
1177 return dsOutOfMemory;
1178
1179 return dsErrorFree;
1180 }
1181 if (kiSrcLen > 0 && kpSrc != NULL) {
1182#ifdef OUTPUT_BITSTREAM
1183 if (m_pFBS) {
1184 WelsFwrite (kpSrc, sizeof (unsigned char), kiSrcLen, m_pFBS);
1185 WelsFflush (m_pFBS);
1186 }
1187#endif//OUTPUT_BIT_STREAM
1188 pDecContext->bEndOfStreamFlag = false;
1189 } else {
1190 //For application MODE, the error detection should be added for safe.
1191 //But for CONSOLE MODE, when decoding LAST AU, kiSrcLen==0 && kpSrc==NULL.
1192 pDecContext->bEndOfStreamFlag = true;
1193 pDecContext->bInstantDecFlag = true;
1194 }
1195
1196 pDecContext->iErrorCode = dsErrorFree; //initialize at the starting of AU decoding.
1197 pDecContext->pParam->eEcActiveIdc = ERROR_CON_DISABLE; //add protection to disable EC here.
1198 pDecContext->iFeedbackNalRefIdc = -1; //initialize
1199 if (!pDecContext->bFramePending) { //frame complete
1200 pDecContext->pParserBsInfo->iNalNum = 0;
1201 memset (pDecContext->pParserBsInfo->pNalLenInByte, 0, MAX_NAL_UNITS_IN_LAYER);
1202 }
1203 pDstInfo->iNalNum = 0;
1204 pDstInfo->iSpsWidthInPixel = pDstInfo->iSpsHeightInPixel = 0;
1205 if (pDstInfo) {
1206 pDecContext->uiTimeStamp = pDstInfo->uiInBsTimeStamp;
1207 pDstInfo->uiOutBsTimeStamp = 0;
1208 } else {
1209 pDecContext->uiTimeStamp = 0;
1210 }
1211 WelsDecodeBs (pDecContext, kpSrc, kiSrcLen, NULL, NULL, pDstInfo);
1212 if (pDecContext->iErrorCode & dsOutOfMemory) {
1213 if (ResetDecoder (pDecContext))
1214 return dsOutOfMemory;
1215 return dsErrorFree;
1216 }

Callers

nothing calls this directly

Calls 7

WelsLogFunction · 0.85
WelsTimeFunction · 0.85
CheckBsBufferFunction · 0.85
WelsFwriteFunction · 0.85
WelsFflushFunction · 0.85
WelsDecodeBsFunction · 0.85
ResetDecStatNumsFunction · 0.85

Tested by

no test coverage detected