From 7ad1fe9cb694cc65bc5ea783de6cee697eed994f Mon Sep 17 00:00:00 2001 From: Nana Zhang Date: Wed, 22 Jan 2025 02:12:26 +0000 Subject: [PATCH] Add mfxExtSecureCodec Signed-off-by: Nana Zhang --- c2_components/include/mfx_c2_decoder_component.h | 1 + c2_components/src/mfx_c2_decoder_component.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/c2_components/include/mfx_c2_decoder_component.h b/c2_components/include/mfx_c2_decoder_component.h index e48941ef..bbc584da 100755 --- a/c2_components/include/mfx_c2_decoder_component.h +++ b/c2_components/include/mfx_c2_decoder_component.h @@ -198,6 +198,7 @@ class MfxC2DecoderComponent : public MfxC2Component mfxVideoParam m_mfxVideoParams {}; std::vector m_extBuffers; mfxExtVideoSignalInfo m_signalInfo; + mfxExtSecureCodec m_secureCodec; // Protects decoder initialization and m_mfxVideoParams mutable std::mutex m_initDecoderMutex; diff --git a/c2_components/src/mfx_c2_decoder_component.cpp b/c2_components/src/mfx_c2_decoder_component.cpp index a099b6ea..ca7688cb 100755 --- a/c2_components/src/mfx_c2_decoder_component.cpp +++ b/c2_components/src/mfx_c2_decoder_component.cpp @@ -693,6 +693,7 @@ MfxC2DecoderComponent::MfxC2DecoderComponent(const C2String name, const CreateCo m_hdrStaticInfo->maxFall = 0; MFX_ZERO_MEMORY(m_signalInfo); + MFX_ZERO_MEMORY(m_secureCodec); //m_paramStorage.DumpParams(); } @@ -1095,9 +1096,13 @@ mfxStatus MfxC2DecoderComponent::ResetSettings() mfxStatus res = MFX_ERR_NONE; MFX_ZERO_MEMORY(m_mfxVideoParams); MFX_ZERO_MEMORY(m_signalInfo); + MFX_ZERO_MEMORY(m_secureCodec); m_signalInfo.Header.BufferId = MFX_EXTBUFF_VIDEO_SIGNAL_INFO; m_signalInfo.Header.BufferSz = sizeof(mfxExtVideoSignalInfo); + m_secureCodec.Header.BufferId = MFX_EXTBUFF_SECURE_CODEC; + m_secureCodec.Header.BufferSz = sizeof(mfxExtSecureCodec); + m_secureCodec.on = m_secure; switch (m_decoderType) { @@ -1309,10 +1314,16 @@ mfxStatus MfxC2DecoderComponent::InitDecoder(std::shared_ptr c2_all m_allocator->SetConsumerUsage(m_consumerUsage); } + mfxVideoParam oldParams = m_mfxVideoParams; + m_extBuffers.push_back(reinterpret_cast(&m_secureCodec)); + m_mfxVideoParams.NumExtParam = m_extBuffers.size(); + m_mfxVideoParams.ExtParam = &m_extBuffers.front(); MFX_DEBUG_TRACE_MSG("Decoder initializing..."); mfx_res = m_mfxDecoder->Init(&m_mfxVideoParams); MFX_DEBUG_TRACE_PRINTF("Decoder initialized, sts = %d", mfx_res); - + m_extBuffers.pop_back(); + m_mfxVideoParams.NumExtParam = oldParams.NumExtParam; + m_mfxVideoParams.ExtParam = oldParams.ExtParam; // c2 allocator is needed to handle mfxAllocRequest coming from m_mfxDecoder->Init, // not needed after that.