BB FlashBack SDK: Base Classes

Recording Movie Player Applications

Movie/Media player-type applications usually use 'overlays' to improve performance. This feature of DirectX allows them to write more directly to the screen, but images drawn in this way cannot be captured by the SDK, whichever record mode is used.

"Hardware acceleration" needs to be disabled during recording, to force the movie player application to use an alternative method of writing to the screen which can be captured successfully. This can be done via the Windows user interface or an API call.

To disable it via the Windows user interface: Go to the Control Panel, open Display, select the Settings tab, click the Advanced button, select the Troubleshoot tab and set Hardware Acceleration to None.

Disabling it via the Windows API requires that you set a registry value "acceleration.level" for the used display device, and use ChangeDisplaySettingsEx to force the change to be applied to the display. The location of this value in the registry varies, but the code below is an example of how it can be found and set:

 

 

// Set the acceleration level to 'none' to disable h/w acceleration
SetCurrentVideoAccelerationLevel(5);

// Now refresh the display device - this may cause brief screen blanking

DEVMODE devMode;

if (EnumDisplaySettings(NULL,  ENUM_CURRENT_SETTINGS, &devMode))
ChangeDisplaySettingsEx(NULL, &devMode, NULL, CDS_RESET, 0);


//----------------------------------------------------------------

bool SetCurrentVideoAccelerationLevel(DWORD dwValue)
{
bool res = false;
AnsiString sPath = FindVideoAccelerationKey();

  if (!sPath.IsEmpty())
{
HKEY hKey;

    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, sPath.c_str(), REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS)
 {
  res = true;

      if (dwValue == 0)
    RegDeleteValue(hKey, "Acceleration.Level";
  else
     RegSetValueEx(hKey, "Acceleration.Level", 0, REG_DWORD, (LPBYTE)&dwValue, sizeof(dwValue));

      RegCloseKey(hKey);
 }
}

  return res;
}

//---------------------------------------------------------------

AnsiString FindVideoAccelerationKey()
{
AnsiString sResult = "";
HKEY hKey;

  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "HARDWARE\\DEVICEMAP\\VIDEO", REG_OPTION_NON_VOLATILE, KEY_READ, &hKey) == ERROR_SUCCESS)
{
char sTmp[1024];
DWORD dwDummy = sizeof(sTmp);

    sTmp[0] = 0;

    if (RegQueryValueEx(hKey, "\\Device\\Video0", 0, NULL, (LPBYTE)sTmp, &dwDummy) == ERROR_SUCCESS)
 {
  sResult = sTmp;

      if (sResult.LowerCase().Pos("\\registry\\machine\\") == 1)
     sResult.Delete(1, AnsiString("\\registry\\machine\\").Length());

    }
 RegCloseKey(hKey);
}

  return sResult;
}