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

Method SetOption

codec/encoder/plus/src/welsEncoderExt.cpp:688–1194  ·  view source on GitHub ↗

* InDataFormat, IDRInterval, SVC Encode Param, Frame Rate, Bitrate,.. ************************************************************************/

Source from the content-addressed store, hash-verified

686* InDataFormat, IDRInterval, SVC Encode Param, Frame Rate, Bitrate,..
687************************************************************************/
688int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
689 if (NULL == pOption) {
690 return cmInitParaError;
691 }
692
693 if ((NULL == m_pEncContext || false == m_bInitialFlag) && eOptionId != ENCODER_OPTION_TRACE_LEVEL
694 && eOptionId != ENCODER_OPTION_TRACE_CALLBACK && eOptionId != ENCODER_OPTION_TRACE_CALLBACK_CONTEXT) {
695 return cmInitExpected;
696 }
697
698 switch (eOptionId) {
699 case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag
700 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
701 "ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.");
702 }
703 break;
704 case ENCODER_OPTION_DATAFORMAT: { // Input color space
705 int32_t iValue = * ((int32_t*)pOption);
706 int32_t iColorspace = iValue;
707 if (iColorspace == 0) {
708 return cmInitParaError;
709 }
710
711 m_iCspInternal = iColorspace;
712 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
713 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_DATAFORMAT, m_iCspInternal = 0x%x", m_iCspInternal);
714 }
715 break;
716 case ENCODER_OPTION_IDR_INTERVAL: { // IDR Interval
717 int32_t iValue = * ((int32_t*)pOption);
718 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
719 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_IDR_INTERVAL iValue = %d", iValue);
720 if (iValue <= -1) {
721 iValue = 0;
722 }
723 if (iValue == (int32_t)m_pEncContext->pSvcParam->uiIntraPeriod) {
724 return cmResultSuccess;
725 }
726 m_pEncContext->pSvcParam->uiIntraPeriod = (uint32_t)iValue;
727 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
728 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_IDR_INTERVAL uiIntraPeriod updated to %d",
729 m_pEncContext->pSvcParam->uiIntraPeriod);
730 }
731 break;
732 case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: { // SVC Encoding Parameter
733 SEncParamBase sEncodingParam;
734 SWelsSvcCodingParam sConfig;
735 int32_t iTargetWidth = 0;
736 int32_t iTargetHeight = 0;
737
738 memcpy (&sEncodingParam, pOption, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage
739#ifdef OUTPUT_BIT_STREAM
740 if ((sEncodingParam.iPicWidth != m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum
741 - 1].iActualWidth) ||
742 (sEncodingParam.iPicHeight != m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum -
743 1].iActualHeight)) {
744 ++m_iSwitchTimes;
745 m_bSwitch = true;

Callers 7

InitEncodeMethod · 0.45
SetRatesMethod · 0.45
InitDecodeMethod · 0.45
Reset_wMethod · 0.45
H264DecodeInstanceFunction · 0.45
mainFunction · 0.45
ProcessEncodingFunction · 0.45

Calls 15

WelsLogFunction · 0.85
WelsEncoderParamAdjustFunction · 0.85
WelsEncoderApplyBitRateFunction · 0.85
WelsRcInitFuncPointersFunction · 0.85
FilterLTRRecoveryRequestFunction · 0.85
FilterLTRMarkingFeedbackFunction · 0.85
WelsEncoderApplyLTRFunction · 0.85
WelsStrncpyFunction · 0.85
CheckProfileSettingFunction · 0.85
CheckLevelSettingFunction · 0.85
CheckReferenceNumSettingFunction · 0.85

Tested by

no test coverage detected