Exemplo n.º 1
0
void CameraBinLocks::searchAndLock(QCamera::LockTypes locks)
{
    m_pendingLocks &= ~locks;

    if (locks & QCamera::LockFocus) {
        m_pendingLocks |= QCamera::LockFocus;
        m_focus->_q_startFocusing();
    }
#if GST_CHECK_VERSION(1, 2, 0)
    if (!m_pendingLocks)
        m_lockTimer.stop();

    if (locks & QCamera::LockExposure) {
        if (isExposureLocked()) {
            unlockExposure(QCamera::Searching, QCamera::UserRequest);
            m_pendingLocks |= QCamera::LockExposure;
            m_lockTimer.start(1000, this);
        } else {
            lockExposure(QCamera::UserRequest);
        }
    }
    if (locks & QCamera::LockWhiteBalance) {
        if (isWhiteBalanceLocked()) {
            unlockWhiteBalance(QCamera::Searching, QCamera::UserRequest);
            m_pendingLocks |= QCamera::LockWhiteBalance;
            m_lockTimer.start(1000, this);
        } else {
            lockWhiteBalance(QCamera::UserRequest);
        }
    }
#endif

}
QT_BEGIN_NAMESPACE

CameraBinImageProcessing::CameraBinImageProcessing(CameraBinSession *session)
    : QCameraImageProcessingControl(session)
    , m_session(session)
    , m_whiteBalanceMode(QCameraImageProcessing::WhiteBalanceAuto)
#ifdef USE_V4L
    , m_v4lImageControl(Q_NULLPTR)
#endif
{
#ifdef HAVE_GST_PHOTOGRAPHY
    if (m_session->photography()) {
        m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_AUTO] = QCameraImageProcessing::WhiteBalanceAuto;
        m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT] = QCameraImageProcessing::WhiteBalanceSunlight;
        m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_CLOUDY] = QCameraImageProcessing::WhiteBalanceCloudy;
        m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_SUNSET] = QCameraImageProcessing::WhiteBalanceSunset;
        m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN] = QCameraImageProcessing::WhiteBalanceTungsten;
        m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT] = QCameraImageProcessing::WhiteBalanceFluorescent;
        unlockWhiteBalance();
    }

#if GST_CHECK_VERSION(1, 0, 0)
      m_filterMap.insert(QCameraImageProcessing::ColorFilterNone, GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL);
      if (m_session->photography()) {
          m_filterMap.insert(QCameraImageProcessing::ColorFilterSepia, GST_PHOTOGRAPHY_COLOR_TONE_MODE_SEPIA);
          m_filterMap.insert(QCameraImageProcessing::ColorFilterGrayscale, GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRAYSCALE);
          m_filterMap.insert(QCameraImageProcessing::ColorFilterNegative, GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEGATIVE);
          m_filterMap.insert(QCameraImageProcessing::ColorFilterSolarize, GST_PHOTOGRAPHY_COLOR_TONE_MODE_SOLARIZE);
#if GST_CHECK_VERSION(1, 2, 0)
          m_filterMap.insert(QCameraImageProcessing::ColorFilterPosterize, GST_PHOTOGRAPHY_COLOR_TONE_MODE_POSTERIZE);
          m_filterMap.insert(QCameraImageProcessing::ColorFilterWhiteboard, GST_PHOTOGRAPHY_COLOR_TONE_MODE_WHITEBOARD);
          m_filterMap.insert(QCameraImageProcessing::ColorFilterBlackboard, GST_PHOTOGRAPHY_COLOR_TONE_MODE_BLACKBOARD);
          m_filterMap.insert(QCameraImageProcessing::ColorFilterAqua, GST_PHOTOGRAPHY_COLOR_TONE_MODE_AQUA);
#endif
      }
#else
      m_filterMap.insert(QCameraImageProcessing::ColorFilterNone, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL);
      if (m_session->photography()) {
          m_filterMap.insert(QCameraImageProcessing::ColorFilterSepia, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SEPIA);
          m_filterMap.insert(QCameraImageProcessing::ColorFilterGrayscale, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_GRAYSCALE);
          m_filterMap.insert(QCameraImageProcessing::ColorFilterNegative, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NEGATIVE);
          m_filterMap.insert(QCameraImageProcessing::ColorFilterSolarize, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SOLARIZE);
      }
#endif
#endif

#ifdef USE_V4L
      m_v4lImageControl = new CameraBinV4LImageProcessing(m_session);
      connect(m_session, &CameraBinSession::statusChanged,
              m_v4lImageControl, &CameraBinV4LImageProcessing::updateParametersInfo);
#endif

    updateColorBalanceValues();
}
Exemplo n.º 3
0
void CameraBinLocks::unlock(QCamera::LockTypes locks)
{
    m_pendingLocks &= ~locks;

    if (locks & QCamera::LockFocus)
        m_focus->_q_stopFocusing();

#if GST_CHECK_VERSION(1, 2, 0)
    if (!m_pendingLocks)
        m_lockTimer.stop();

    if (locks & QCamera::LockExposure)
        unlockExposure(QCamera::Unlocked, QCamera::UserRequest);
    if (locks & QCamera::LockWhiteBalance)
        unlockWhiteBalance(QCamera::Unlocked, QCamera::UserRequest);
#endif
}
void CameraBinImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode)
{
#ifdef HAVE_GST_PHOTOGRAPHY
    if (isWhiteBalanceModeSupported(mode)) {
        m_whiteBalanceMode = mode;
#if GST_CHECK_VERSION(1, 2, 0)
        GstPhotographyWhiteBalanceMode currentMode;
        if (gst_photography_get_white_balance_mode(m_session->photography(), &currentMode)
                && currentMode != GST_PHOTOGRAPHY_WB_MODE_MANUAL)
#endif
        {
            unlockWhiteBalance();
        }
    }
#else
    Q_UNUSED(mode);
#endif
}