Skip to content

Commit

Permalink
Add mfxExtSecureCodec
Browse files Browse the repository at this point in the history
Signed-off-by: Nana Zhang <nana.zhang@intel.com>
  • Loading branch information
nanazhan authored and kkkuangzh committed Jan 23, 2025
1 parent 03b35a3 commit 3d99864
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions c2_components/include/mfx_c2_decoder_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class MfxC2DecoderComponent : public MfxC2Component
mfxVideoParam m_mfxVideoParams {};
std::vector<mfxExtBuffer*> m_extBuffers;
mfxExtVideoSignalInfo m_signalInfo;
mfxExtSecureCodec m_secureCodec;

// Protects decoder initialization and m_mfxVideoParams
mutable std::mutex m_initDecoderMutex;
Expand Down
13 changes: 12 additions & 1 deletion c2_components/src/mfx_c2_decoder_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -1096,9 +1097,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)
{
Expand Down Expand Up @@ -1306,10 +1311,16 @@ mfxStatus MfxC2DecoderComponent::InitDecoder(std::shared_ptr<C2BlockPool> c2_all
m_allocator->SetConsumerUsage(m_consumerUsage);
}

mfxVideoParam oldParams = m_mfxVideoParams;
m_extBuffers.push_back(reinterpret_cast<mfxExtBuffer*>(&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.
Expand Down

0 comments on commit 3d99864

Please sign in to comment.