This article illustrates a basic technique to migrate Intel’s IPP UMC simple_player sample into a dialog based player and enhance video overlaying. This illustration assumes utilizing Microsoft DirectX rendering.
It is common to experience some inconvenient rendering with the simple player, though, it is important to keep in mind that the simple_player is a sample that demonstrates the power of the Intel's IPP video processing, yet, it is simple and flexible.
Video overlaying is one of these common issues. The simple_player is utilizing DirectDraw which directs the video output to the GPU's memory buffer; it is the responsibility of the developer to manage the video output specifications with DirectDraw such as the rendering coordinates and the Z order. Although, this is beyond the scope of this article, fortunately the simple_player utilization of DirectDraw handles a lot of these video output specifications, and this article illustrates an alternative approach to manage some additional specifications.
Here is a simple approach to maintain video overlaying with simple_player by converting it to a windows GUI application, and utilize the windows existing mechanism in managing the display events:
1- Wrap the existing simple_player code into a single class "simple_player"
2- Add the simple_player class to an MFC Dialog application project
3- Change the simple_player entry point from
int main(Ipp32s argc, vm_char* argv)
to another convenient function name "Play()", you may even keep the former function's arguments and pass them approperiatly when calling the function
4- Add the display area to the dialog box
a) Place a static control in the dialog box and declare the “CStatic m_dispArea” object to handle it
b) Add the following to OnPaint()
RECT rect; GetClientRect(&rect); m_dispArea.SetWindowPos(&wndBottom, rect.left, rect.top, rect.right, rect.bottom, SWP_SHOWWINDOW); // get the CDC object of the CWnd object CDC * pDc = m_dispArea.GetDC(); // draw the display area with the color key of your choice HBRUSH bgColor = CreateSolidBrush(RGB(10,10,10)); pDc->SelectObject(bgColor); pDc->Rectangle(&rect);
5- Finally, modify the simple_player::Play() as follows:
//formerly the main() function //cc.ulVideoRenderFlags = 0; ////comment this line cc.ulVideoRenderFlags = UMC::FLAG_VREN_USECOLORKEY; ////add this line //Context.m_hWnd = ::WindowFromPoint(Point); ////comment this line Context.m_hWnd = m_dispArea.m_hWnd; ////add this line //Context.m_ColorKey = RGB(0,0,0); ////comment this line Context.m_ColorKey = RGB(10,10,10); //// add this line