Exemple #1
0
void WindowGrabber::grab()
{
    const int result = screen_read_window(m_window, m_screenPixmapBuffer, 0, 0, 0);
    if (result != 0)
        return;

    const QImage frame((unsigned char*)m_screenBuffer, m_screenBufferWidth, m_screenBufferHeight,
                       m_screenBufferStride, QImage::Format_ARGB32);

    emit frameGrabbed(frame);
}
Exemple #2
0
BbCameraSession::BbCameraSession(QObject *parent)
    : QObject(parent)
    , m_nativeCameraOrientation(0)
    , m_orientationHandler(new BbCameraOrientationHandler(this))
    , m_status(QCamera::UnloadedStatus)
    , m_state(QCamera::UnloadedState)
    , m_captureMode(QCamera::CaptureStillImage)
    , m_device("bb:RearCamera")
    , m_previewIsVideo(true)
    , m_surface(0)
    , m_captureImageDriveMode(QCameraImageCapture::SingleImageCapture)
    , m_lastImageCaptureId(0)
    , m_captureDestination(QCameraImageCapture::CaptureToFile)
    , m_videoState(QMediaRecorder::StoppedState)
    , m_videoStatus(QMediaRecorder::LoadedStatus)
    , m_handle(CAMERA_HANDLE_INVALID)
    , m_windowGrabber(new WindowGrabber(this))
{
    connect(this, SIGNAL(statusChanged(QCamera::Status)), SLOT(updateReadyForCapture()));
    connect(this, SIGNAL(captureModeChanged(QCamera::CaptureModes)), SLOT(updateReadyForCapture()));
    connect(m_orientationHandler, SIGNAL(orientationChanged(int)), SLOT(deviceOrientationChanged(int)));

    connect(m_windowGrabber, SIGNAL(frameGrabbed(QImage)), SLOT(viewfinderFrameGrabbed(QImage)));
}