Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

BOOL PVideoInputDevice_VideoForWindows::SetFrameSize ( unsigned  width,
unsigned  height 
) [virtual]

Set the frame size to be used.

Note that devices may not be able to produce the requested size, and this function will fail. See SetFrameSizeConverter().

Default behaviour sets the frameWidth and frameHeight variables and returns TRUE.

Parameters:
heightNew width of frame New height of frame

Reimplemented from PVideoDevice.

Definition at line 810 of file vfw.cxx.

References PVideoDevice::GetLastError(), IsCapturing(), PVideoDevice::SetFrameSize(), Start(), Stop(), and VerifyHardwareFrameSize().

{
  BOOL running = IsCapturing();
  if (running)
    Stop();

  PVideoDeviceBitmap bi(hCaptureWindow); 
  PTRACE(5, "PVidInp\tChanging frame size from "
         << bi->bmiHeader.biWidth << 'x' << bi->bmiHeader.biHeight << " to " << width << 'x' << height);

  PINDEX i = 0;
  while (FormatTable[i].colourFormat != NULL && !(colourFormat *= FormatTable[i].colourFormat))
    i++;

  bi->bmiHeader.biWidth = width;
  bi->bmiHeader.biHeight = height;
  if (!bi.ApplyFormat(hCaptureWindow, FormatTable[i])) {
    lastError = ::GetLastError();
    return FALSE;
  }

  // Didn't do top down, tell everything we are up side down
  nativeVerticalFlip = FormatTable[i].negHeight && bi->bmiHeader.biHeight > 0;

  // verify that the driver really took the frame size
  if (!VerifyHardwareFrameSize(width, height)) 
    return FALSE; 

  // frameHeight must be positive regardlesss of what the driver says
  if (0 > (int)height) 
    height = (unsigned)-(int)height;

  if (!PVideoDevice::SetFrameSize(width, height))
    return FALSE;

  if (running)
    return Start();

  return TRUE;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index