title: OpenCV edit captured ip camera
body: <p>Can I use <strong>OpenCV</strong> to edit video captured from Ip camera with <strong>Dahua SDK</strong>?
  Here are the portion of Dahua sample code:</p>
  
  <pre><code>// initialized play list
  BOOL bOpenRet = PLAY_OpenStream(g_lRealPort, 0, 0, 1024 * 500);
  if (bOpenRet)
  {
      //  start play
      BOOL bPlayRet = PLAY_Play(g_lRealPort, hMainWnd);
      if (bPlayRet)
      {
          //  monitor preview
          long lRealHandle = CLIENT_RealPlayEx(lLoginHandle, nChannelID, 0);
          if (0 != lRealHandle)
          {
              //  set recall function handling data
              CLIENT_SetRealDataCallBackEx(lRealHandle, RealDataCallBackEx, (DWORD)0, 0x1f);
          }
          else
          {
              //printf("Fail to play!\n");
              PLAY_Stop(g_lRealPort);
              PLAY_CloseStream(g_lRealPort);
          }
      }
      else
      {
          PLAY_CloseStream(g_lRealPort);
      }
  }
  </code></pre>
  
  <p>The code above is connecting to cam using TCP and the streaming the video, the call back function RealDataCallBackEx is called for streaming, I can display the video on a Window, but how can I let OpenCV library to deal with it?</p>
  
  <p>Here are the code of the <code>RealDataCallBackEx</code> function:</p>
  
  <pre><code>void __stdcall RealDataCallBackEx(LONG lRealHandle, DWORD dwDataType, BYTE *pBuffer, DWORD      dwBufSize, LONG lParam, DWORD dwUser)
      {
      BOOL bInput = FALSE;
      bInput = PLAY_InputData(g_lRealPort, pBuffer, dwBufSize);
      }
  </code></pre>