Add an encoder method for encoding the SPS/PPS without encoding a frame
This is useful if using a muxer that requires the SPS/PPS to be available before the first frame is encoded.
This commit is contained in:
parent
f02d0aa667
commit
2766215545
@ -52,6 +52,11 @@ class ISVCEncoder {
|
||||
virtual int EncodeFrame (const unsigned char* kpSrc, SFrameBSInfo* pBsInfo) = 0;
|
||||
virtual int EncodeFrame (const SSourcePicture** kppSrcPicList, int nSrcPicNum, SFrameBSInfo* pBsInfo) = 0;
|
||||
|
||||
/*
|
||||
* return: 0 - success; otherwise - failed;
|
||||
*/
|
||||
virtual int EncodeParameterSets (SFrameBSInfo* pBsInfo) = 0;
|
||||
|
||||
/*
|
||||
* return: 0 - success; otherwise - failed;
|
||||
*/
|
||||
|
@ -98,6 +98,8 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx);
|
||||
int32_t WelsEncoderEncodeExt (sWelsEncCtx*, void* pDst, const SSourcePicture** kppSrcList,
|
||||
const int32_t kiConfiguredLayerNum);
|
||||
|
||||
int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst);
|
||||
|
||||
/*
|
||||
* Force coding IDR as follows
|
||||
*/
|
||||
|
@ -3093,6 +3093,37 @@ int32_t ForceCodingIDR (sWelsEncCtx* pCtx) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst) {
|
||||
SFrameBSInfo* pFbi = (SFrameBSInfo*)pDst;
|
||||
SLayerBSInfo* pLayerBsInfo = &pFbi->sLayerInfo[0];
|
||||
int32_t iNalLen[128] = {0};
|
||||
int32_t iCountNal = 0;
|
||||
|
||||
pLayerBsInfo->pBsBuf = pCtx->pFrameBs;
|
||||
InitBits (&pCtx->pOut->sBsWrite, pCtx->pOut->pBsBuffer, pCtx->pOut->uiSize);
|
||||
|
||||
WelsWriteParameterSets (pCtx, &iNalLen[0], &iCountNal);
|
||||
|
||||
pLayerBsInfo->uiPriorityId = 0;
|
||||
pLayerBsInfo->uiSpatialId = 0;
|
||||
pLayerBsInfo->uiTemporalId = 0;
|
||||
pLayerBsInfo->uiQualityId = 0;
|
||||
pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
|
||||
pLayerBsInfo->iNalCount = iCountNal;
|
||||
for (int32_t iNalIndex = 0; iNalIndex < iCountNal; ++ iNalIndex) {
|
||||
pLayerBsInfo->iNalLengthInByte[iNalIndex] = iNalLen[iNalIndex];
|
||||
}
|
||||
|
||||
pCtx->eLastNalPriority = NRI_PRI_HIGHEST;
|
||||
pFbi->iLayerNum = 1;
|
||||
|
||||
#if defined(X86_ASM)
|
||||
WelsEmms();
|
||||
#endif //X86_ASM
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief core svc encoding process
|
||||
*
|
||||
|
@ -76,6 +76,11 @@ class CWelsH264SVCEncoder : public ISVCEncoder {
|
||||
virtual int EncodeFrame (const unsigned char* kpSrc, SFrameBSInfo* pBsInfo);
|
||||
virtual int EncodeFrame (const SSourcePicture** kppSrcPicList, int nSrcPicNum, SFrameBSInfo* pBsInfo);
|
||||
|
||||
/*
|
||||
* return: 0 - success; otherwise - failed;
|
||||
*/
|
||||
virtual int EncodeParameterSets (SFrameBSInfo* pBsInfo);
|
||||
|
||||
/*
|
||||
* return: 0 - success; otherwise - failed;
|
||||
*/
|
||||
|
@ -730,6 +730,10 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture** pSrcPicList, int
|
||||
|
||||
}
|
||||
|
||||
int CWelsH264SVCEncoder::EncodeParameterSets (SFrameBSInfo* pBsInfo) {
|
||||
return WelsEncoderEncodeParameterSets (m_pEncContext, pBsInfo);
|
||||
}
|
||||
|
||||
/*
|
||||
* return: 0 - success; otherwise - failed;
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user