Previous | Contents | Next

2.2 SDK »ç¿ë ¹æ¹ý

BCLÀÌ ÀÚ½ÅÀÇ Á¦Ç°¿¡ ÀûÇÕÇÑ Á¦Ç°ÀÎÁö °£´ÜÇÑ Å×½ºÆ®¸¦ Çغ¸±â À§Çؼ­´Â ´ÙÀ½ ¼ø¼­¸¦ µû¶óÁÖ½Ã¸é µË´Ï´Ù. »ç¿ë ¹æ¹ýÀº ¸Å¿ì °£´ÜÇϸç 10ºÐÁ¤µµ ½Ã°£À» ÅõÀÚÇÏ½Ã¸é ¼Õ½±°Ô ±âÁ¸ ÇÁ·Î±×·¥¿¡ µ¿¿µ»ó ĸó ±â´ÉÀ» Ãß°¡ÇÏ¿© Å×½ºÆ® Çغ¸½Ç ¼ö ÀÖ½À´Ï´Ù.

´Ü, ÀÌ ¼³¸íÀº DirectX9 ¿¡ ±âÃʸ¦ µÎ°í Á¦ÀÛµÈ °ÍÀ¸·Î¼­ DirectX8/10 ¹× OpenGL°ú´Â ¾à°£ÀÇ Â÷ÀÌÁ¡ÀÌ ÀÖ½À´Ï´Ù. °¢ ±×·¡ÇÈ ÇÁ·Î±×·¡¹Ö ÀÎÅÍÆäÀ̽º¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ »ç¿ë ¹æ¹ýÀº API ¼³¸í(section 3.2)°ú »ùÇà Äڵ带 Âü°íÇϽñ⠹ٶø´Ï´Ù.

  1. Çì´õÆÄÀÏ ¹× DLL ÆÄÀÏ º¹»ç

    SDK ÀÇ include Æú´õ¿¡ ÀÖ´Â BandiCap.h ÆÄÀÏÀ» º¹»çÇؼ­ ÀÚ½ÅÀÇ ÇÁ·ÎÁ§Æ®¿¡ Ãß°¡ÇÏ°í, BIN Æú´õ¿¡ ÀÖ´Â bdcap32.dll ÆÄÀÏÀ» ÀÚ½ÅÀÇ ÇÁ·ÎÁ§Æ®ÀÇ ½ÇÇàÆÄÀÏÀÌ À§Ä¡ÇÑ Æú´õ¿¡ º¹»ç¸¦ ÇÕ´Ï´Ù. BCLÀº ·±Å¸ÀÓ¿¡ ·ÎµåÇÏ¿© »ç¿ëÇϵµ·Ï ¼³°èµÇ¾ú±â ¶§¹®¿¡ º°µµÀÇ .LIB ÆÄÀÏÀº Á¦°øµÇÁö ¾Ê½À´Ï´Ù.

  2. º¯¼ö ¼±¾ð

    BandiCap.h ÆÄÀÏ¿¡´Â bdcap32.dll ÆÄÀÏÀÇ ·Îµå¸¦ ¼Õ½±°Ô µµ¿ÍÁÖ´Â À¯Æ¿¸®Æ¼ Ŭ·¡½º¿Í È­¸é ĸó ÀÎÅÍÆ佺°¡ Á¤ÀǵǾî ÀÖ½À´Ï´Ù. À̸¦ »ç¿ëÇϱâ À§Çؼ­´Â ¾Æ·¡¿Í °°ÀÌ Å¬·¡½º¸¦ ¸â¹ö º¯¼ö³ª Àü¿ª º¯¼ö·Î ¼±¾ðÇÕ´Ï´Ù.

    #include "bandicap.h"
    // ..
    CBandiCaptureLibrary	 m_bandiCaptureLibrary;
    
  3. ĸó ½ÃÀÛ, ĸó ÁßÁö

    »ç¿ëÀÚ°¡ ĸó ½ÃÀÛ ¹öÆ°À» ´©¸£¸é ĸó¸¦ ½ÃÀÛÇÕ´Ï´Ù. ½ÃÀÛÇϱâÀü¿¡ ¾î¶² Æ÷¸ËÀ¸·Î, ¾î¶² ¹æ½ÄÀ¸·Î ĸóÇÒ °ÍÀÎÁö¸¦ ¼³Á¤ÇÑ ÈÄ, ĸó¸¦ ½ÃÀÛÇÕ´Ï´Ù. ±ÇÀåµÇ´Â µ¿¿µ»ó ĸó ´ÜÃàÅ°´Â Scroll Lock Å°¿Í F11Å° ÀÔ´Ï´Ù.

    // ...
    case VK_SCROLL :
    case VK_F11 :
     ToggleVideoCapture();
     break;
    // ...
    
    
    void ToggleVideoCapture()
    {
      IDirect3DDevice9* pd3d9Device = GetD3DDevice();
    
      // ĸó¸¦ ½ÃÀÛÇÕ´Ï´Ù.
      if(m_bandiCaptureLibrary.IsCapturing()==FALSE)
      {
        // ÃÖÃÊ ½ÇÇà½Ã DLL À» ·ÎµåÇÏ°í ³»ºÎ ÀνºÅϽº¸¦ »ý¼ºÇÕ´Ï´Ù. 
        if(m_bandiCaptureLibrary.IsCreated()==FALSE)
        {
          // ½ÇÆнà DLL°ú .HÆÄÀÏÀÇ ¹öÀüÀÌ µ¿ÀÏÇÑÁö ¿©ºÎµîÀ» È®ÀÎÇØ º¸½Ã±â ¹Ù¶ø´Ï´Ù.
          if(FAILED(m_bandiCaptureLibrary.Create(BANDICAP_RELEASE_DLL_FILE_NAME)))
            ASSERT(0);
    
          // ÀÎÁõÀ» ¹ÞÁö ¾ÊÀ¸¸é ÀÎÄÚµùµÈ µ¿¿µ»ó »ó´Ü¿¡ ·Î°í°¡ Ç¥½ÃµË´Ï´Ù. 
          // Á¤½Ä±¸¸ÅÈÄ ¹ß±Þ¹ÞÀº Å°¸¦ »ç¿ëÇϰųª, ȨÆäÀÌÁö¿¡¼­ µ¥¸ð¿ëÀ¸·Î °ø°³µÈ Å°¸¦ »ç¿ëÇؼ­ ÀÎÁõÀ» ¹Þ½À´Ï´Ù. 
          if(FAILED(m_bandiCaptureLibrary.Verify("BCL-SDK-TRIAL", "f5b0b287")))
            ASSERT(0);
         }
    
        if(m_bandiCaptureLibrary.IsCreated())
        {
          BCAP_CONFIG cfg;
    
          // ÇÁ¸®¼ÂÀ» ÅëÇؼ­ ¼Õ½±°Ô ¼³Á¤ÀÌ °¡´ÉÇϸç, Á÷Á¢ ÆĶó¹ÌÅÍ ¼³Á¤À» ¹Ù²Ü ¼öµµ ÀÖ½À´Ï´Ù.
          BCapConfigPreset(&cfg, BCAP_PRESET_DEFAULT); 
          m_bandiCaptureLibrary.CheckConfig(&cfg);       // À߸øµÈ ¼³Á¤ ¹Ù·Î Àâ±â
          m_bandiCaptureLibrary.SetConfig(&cfg);         // ¼³Á¤ Àû¿ë
    
          m_bandiCaptureLibrary.SetMinMaxFPS(30, 60);    // ÃÖ¼Ò, ÃÖ´ë ÇÁ·¹ÀÓ ¼³Á¤
    
          // ÇöÀç½Ã°£À» ÀÌ¿ëÇؼ­ ÆÄÀϸíÀ» ¸¸µì´Ï´Ù. 
          TCHAR pathName[MAX_PATH];
          m_bandiCaptureLibrary.MakePathnameByDate(_T("c:\\"), _T("Capture"), 
                                                   _T("avi"), pathName, MAX_PATH);
    
          // ĸó¸¦ ½ÃÀÛÇÕ´Ï´Ù.
          HRESULT hr = m_bandiCaptureLibrary.Start(pathName, NULL, BCAP_MODE_D3D9_SCALE, (LONG_PTR)pd3d9Device);
          
          if(FAILED(hr))
            ASSERT(0);
        }
      }
      // ĸó¸¦ ÁßÁöÇÕ´Ï´Ù.
      else
      {
        m_bandiCaptureLibrary.Stop();
      }
    }
    

    ĸó¸¦ Á¾·áÇÒ ¶§´Â Stop() ÇÔ¼ö¸¦ È£ÃâÇØ ÁÖ¸é µË´Ï´Ù. ĸó°¡ ¿Ï·áµÈ µ¿¿µ»ó ÆÄÀÏÀº ´ÙÀ½ÆÌÇ÷¹À̾î¿Í °°Àº µ¿¿µ»ó Àç»ý ÇÁ·Î±×·¥À» ÀÌ¿ëÇؼ­ Àç»ýÀÌ °¡´ÉÇÏ¸ç º°µµÀÇ ÆíÁýÀ̳ª ÀÎÄÚµù ÀÛ¾÷À» °ÅÄ¡Áö ¾Ê°í YouTube, ³×À̹ö ºí·Î±×, MNCast¿Í °°Àº µ¿¿µ»ó UCC ¼­ºñ½º¿¡ ¹Ù·Î ¿Ã¸± ¼ö ÀÖ½À´Ï´Ù.

  4. ĸó ÁøÇà

    È­¸é¿¡ ¿µ»óÀ» ·»´õ¸µ ÇÏ´Â ·çÇÁ¿¡¼­ ´ÙÀ½°ú °°ÀÌ ¿µ»ó ĸó ·çƾÀ» È£ÃâÇØ ÁÝ´Ï´Ù. À½¼ºÀ» ĸóÇϱâ À§Çؼ­ µû·Î ÇÔ¼ö¸¦ È£ÃâÇØÁÙ ÇÊ¿ä´Â ¾ø½À´Ï´Ù.

    // È­¸é Ãâ·Â
    m_pd3d9Device->BeginScene();
    ...
    ...
    ...
    m_pd3d9Device->EndScene();
    
    if(m_bandiCaptureLibrary.IsCapturing())
    {
      m_bandiCaptureLibrary.Work((LONG_PTR)m_pd3d9Device);
      // ĸóÁßÀÓÀ» ¾Ë¸®´Â ¸Þ½ÃÁö Ãâ·Â
      DrawCaptureNotify();	// <- Á÷Á¢ ±¸ÇöÇÏ¿© ÁÖ¼¼¿ä
    }
    m_pd3dDevice->Present(...);
    

    µ¿¿µ»ó ĸó´Â CPU¿Í Çϵåµð½ºÅ© ÀÚ¿øÀ» ¸Å¿ì ¸¹ÀÌ »ç¿ëÇÏ´Â ÀÛ¾÷ÀÔ´Ï´Ù. »ç¿ëÀÚ°¡ ½Ç¼ö·Î µ¿¿µ»ó ĸó±â´ÉÀ» »ç¿ëÇÏ¿´°Å³ª, ÀÚ½ÅÀÌ µ¿¿µ»ó ĸóÁßÀÓÀ» Àؾî¹ö·ÈÀ» °æ¿ì ÀÚÄ© À߸øÇÏ¸é °ï¶õÇÑ ¹®Á¦°¡ ¹ß»ýÇÒ ¼ö ÀÖ½À´Ï´Ù.

    ÀÌ·± ¹®Á¦¸¦ ¸·±â À§Çؼ­ »ç¿ëÀÚ°¡ µ¿¿µ»ó ĸóÁßÀÏ °æ¿ì´Â ¹Ýµå½Ã È­¸é¿¡ µ¿¿µ»ó ĸóÁßÀÓÀ» ³ªÅ¸³»´Â ¸Þ½ÃÁö¸¦ Å­Áö¸·ÇÏ°Ô Ãâ·ÂÇØ ÁÖ´Â °ÍÀÌ ÁÁ½À´Ï´Ù. ĸóÁß ¸Þ½ÃÁö°¡ ĸóµÈ µ¿¿µ»ó¿¡ Ç¥½ÃµÇÁö ¾Ê°Ô Çϱâ À§Çؼ­´Â À§ ÄÚµå¿Í °°ÀÌ Ä¸Ã³ÀÛ¾÷ ÈÄ¿¡ È­¸é¿¡ ĸó ¸Þ½ÃÁö¸¦ Ãâ·ÂÇÏ¸é µË´Ï´Ù.

  5. ÀνºÅϽº ÇØÁ¦ ¹× DLL ¾ð·Îµå

    ĸó ¶óÀ̺귯¸®¸¦ ´õÀÌ»ó »ç¿ëÇÏÁö ¾ÊÀ» °æ¿ì Destroy() ÇÔ¼ö¸¦ ÅëÇؼ­ ¶óÀ̺귯¸®¸¦ ÇØÁ¦ÇØ ÁÝ´Ï´Ù. ¸í½ÃÀûÀ¸·Î ÇØÁ¦ÇÏÁö ¾Ê¾Æµµ ÇÁ·Î±×·¥ Á¾·á½Ã ¼Ò¸êÀÚ¿¡¼­ ÀÚµ¿À¸·Î È£ÃâÇØ ÁÝ´Ï´Ù.

    m_bandiCaptureLibrary.Destroy();
    

Copyright(C) 2008-2017 Bandicam.com, https://www.bandicam.com
Bandi Capture Library 2.5.0.250 created : 2017-02-03 ¿ÀÈÄ 3:34:51