diff options
author | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-07-13 13:11:48 +1000 |
---|---|---|
committer | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-07-13 13:11:48 +1000 |
commit | ac55a6488b5473ad74a2a4ef821cc5821b5b3fd5 (patch) | |
tree | a9a5a15e4166550b41a9b380db1f38edbaa4dc78 /plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp | |
parent | bd5e097370bfdcf36458ff26b24397ed54ca043b (diff) |
Gst Camera: dropped v4l query for supported resolutions,
use gst caps instead.
Diffstat (limited to 'plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp')
-rw-r--r-- | plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp | 181 |
1 files changed, 0 insertions, 181 deletions
diff --git a/plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp b/plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp index 3f87fba526..dcb0bac5d3 100644 --- a/plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp +++ b/plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp @@ -98,184 +98,3 @@ void CameraBinControl::updateState() emit stateChanged(m_state); } - -/*void CameraBinControl::updateSupportedResolutions(const QString &device) -{ - m_frameRates.clear(); - m_resolutions.clear(); - m_ratesByResolution.clear(); - - QSet<QSize> allResolutions; - QSet<int> allFrameRates; - - QFile f(device); - - if (!f.open(QFile::ReadOnly)) - return; - - int fd = f.handle(); - - //get the list of formats: - QList<quint32> supportedFormats; - - { - v4l2_fmtdesc fmt; - memset(&fmt, 0, sizeof(v4l2_fmtdesc)); - - fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - int sanity = 0; - - for (fmt.index = 0;; fmt.index++) { - if (sanity++ > 8) - break; - if( ::ioctl(fd, VIDIOC_ENUM_FMT, &fmt) == -1) { - if(errno == EINVAL) - break; - } - supportedFormats.append(fmt.pixelformat); - } - } - - QList<QSize> commonSizes; - commonSizes << QSize(128, 96) - <<QSize(160,120) - <<QSize(176, 144) - <<QSize(320, 240) - <<QSize(352, 288) - <<QSize(640, 480) - <<QSize(720, 576) - <<QSize(852, 480) - <<QSize(1024, 768) - <<QSize(1280, 1024) - <<QSize(1280, 720) - <<QSize(1600, 1200) - <<QSize(1920, 1080) - <<QSize(1920, 1200) - <<QSize(2048, 1536) - <<QSize(2560, 1600) - <<QSize(2580, 1936); - - QList<int> commonRates; - commonRates << 05*1000 << 75*1000 << 10*1000 << 15*1000 << 20*1000 - << 24*1000 << 25*1000 << 30*1000 << 50*1000 << 60*1000; - - - //get the list of resolutions: - - foreach (quint32 format, supportedFormats) { - struct v4l2_frmsizeenum formatSize; - memset(&formatSize, 0, sizeof(formatSize)); - formatSize.pixel_format = format; - - QList<QSize> sizeList; - - if (0) { - char formatStr[5]; - memcpy(formatStr, &format, 4); - formatStr[4] = 0; - //qDebug() << "trying format" << formatStr; - } - - for (int i=0;;i++) { - formatSize.index = i; - if (ioctl (fd, VIDIOC_ENUM_FRAMESIZES, &formatSize) < 0) - break; - - if (formatSize.type == V4L2_FRMSIZE_TYPE_DISCRETE) { - sizeList.append(QSize(formatSize.discrete.width, formatSize.discrete.height)); - } else { - - foreach (const QSize& candidate, commonSizes) { - if (candidate.width() <= (int)formatSize.stepwise.max_width && - candidate.height() >= (int)formatSize.stepwise.min_width && - candidate.width() % formatSize.stepwise.step_width == 0 && - candidate.height() <= (int)formatSize.stepwise.max_height && - candidate.height() >= (int)formatSize.stepwise.min_height && - candidate.height() % formatSize.stepwise.step_height == 0) { - sizeList.append(candidate); - } - } - - if (!sizeList.contains(QSize(formatSize.stepwise.min_width, formatSize.stepwise.min_height))) - sizeList.prepend(QSize(formatSize.stepwise.min_width, formatSize.stepwise.min_height)); - - if (!sizeList.contains(QSize(formatSize.stepwise.max_width, formatSize.stepwise.max_height))) - sizeList.append(QSize(formatSize.stepwise.max_width, formatSize.stepwise.max_height)); - - break; //stepwise values are returned only for index 0 - } - - } - - //and frameRates for each resolution. - - foreach (const QSize &s, sizeList) { - allResolutions.insert(s); - - struct v4l2_frmivalenum formatInterval; - memset(&formatInterval, 0, sizeof(formatInterval)); - formatInterval.pixel_format = format; - formatInterval.width = s.width(); - formatInterval.height = s.height(); - - QList<int> frameRates; //in 1/1000 of fps - - for (int i=0; ; i++) { - formatInterval.index = i; - - if (ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &formatInterval) < 0) - break; - - if (formatInterval.type == V4L2_FRMIVAL_TYPE_DISCRETE) { - //converts seconds to fps*1000 - if (formatInterval.discrete.numerator) - frameRates.append(qRound(formatInterval.discrete.denominator*1000.0 / formatInterval.discrete.numerator)); - } else { - if (formatInterval.stepwise.min.numerator == 0 || - formatInterval.stepwise.max.numerator == 0) { - qWarning() << "received invalid frame interval"; - break; - } - - - int minRate = qRound(formatInterval.stepwise.min.denominator*1000.0 / - formatInterval.stepwise.min.numerator); - - int maxRate = qRound(formatInterval.stepwise.max.denominator*1000.0 / - formatInterval.stepwise.max.numerator); - - - foreach (int candidate, commonRates) { - if (candidate >= minRate && candidate <= maxRate) - frameRates.append(candidate); - } - - if (!frameRates.contains(minRate)) - frameRates.prepend(minRate); - - if (!frameRates.contains(maxRate)) - frameRates.append(maxRate); - - break; //stepwise values are returned only for index 0 - } - } - allFrameRates.unite(frameRates.toSet()); - m_ratesByResolution[s].unite(frameRates.toSet()); - } - } - - f.close(); - - foreach(int rate, allFrameRates) { - m_frameRates.append(rate/1000.0); - } - - qSort(m_frameRates); - - m_resolutions = allResolutions.toList(); - qSort(m_resolutions); - - //qDebug() << "frame rates:" << m_frameRates; - //qDebug() << "resolutions:" << m_resolutions; -} -*/ |