I'm looking at extending Sample_decode and post-process decoded frame (in deliverOutput) function with decoded SEI data using MFXVideoDECODE_GetPayload. But, I'm not very clear on methods of synchronizing between encoded bistream frames and decoded frame.
I am trying to understand your question.
For SyncOp() call, it only wait for the hardware to come back when the surface get ready. Media SDK is using Intel hardware accelerated decoder, so decodeFrameAsync() just submit the request to the hardware while the SyncOp() will be blocked for the decoded frame being ready.
Does this answer your question?
Deliver output is in a separate loop thread. There is synchronization via m_pDeliverOutputSemaphore only if there is rendering.
I have some SEI data that I parsed out from encoded data. I would like to synchronized that parsed data with final output in deliverOutput step. What's the BKM to achieve that?
I'm currently using frame->Info.FrameId.DependencyId to pass frame ID, to related between decoded and encoded frames. But, I don't think it is the correct way.
Why not in the main thread, the same thread as decodeFrameAsync()? Since the call is asynced, it won't block the rendering, if the syncOp() call doesn't return the new frame, you can just render the old frame.
In sample_decode, there is "-r" argument which enable the rendering, you can look at that example for your design.