summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin McPherson <justin.mcpherson@nokia.com>2010-03-18 11:40:02 +1000
committerJustin McPherson <justin.mcpherson@nokia.com>2010-03-18 11:40:02 +1000
commit5f868dd9da131b7b0b292f3ba2b1df44eca3fa66 (patch)
tree16f527a406bdad87641bbb32fbce8d10c40db1a5
parent06a939876d69b7342e4a7ca9c83acad0713ee019 (diff)
Camera; Remove support from v4l plugin.
-rw-r--r--plugins/multimedia/v4l/camera/camera.pri30
-rw-r--r--plugins/multimedia/v4l/camera/cameraformatconverter.cpp479
-rw-r--r--plugins/multimedia/v4l/camera/cameraformatconverter.h107
-rw-r--r--plugins/multimedia/v4l/camera/v4lcameracontrol.cpp78
-rw-r--r--plugins/multimedia/v4l/camera/v4lcameracontrol.h86
-rw-r--r--plugins/multimedia/v4l/camera/v4lcameraservice.cpp120
-rw-r--r--plugins/multimedia/v4l/camera/v4lcameraservice.h83
-rw-r--r--plugins/multimedia/v4l/camera/v4lcamerasession.cpp769
-rw-r--r--plugins/multimedia/v4l/camera/v4lcamerasession.h167
-rw-r--r--plugins/multimedia/v4l/camera/v4limagecapturecontrol.cpp70
-rw-r--r--plugins/multimedia/v4l/camera/v4limagecapturecontrol.h69
-rw-r--r--plugins/multimedia/v4l/camera/v4lmediacontainercontrol.cpp52
-rw-r--r--plugins/multimedia/v4l/camera/v4lmediacontainercontrol.h68
-rw-r--r--plugins/multimedia/v4l/camera/v4lrecordercontrol.cpp101
-rw-r--r--plugins/multimedia/v4l/camera/v4lrecordercontrol.h81
-rw-r--r--plugins/multimedia/v4l/camera/v4lvideobuffer.cpp102
-rw-r--r--plugins/multimedia/v4l/camera/v4lvideobuffer.h76
-rw-r--r--plugins/multimedia/v4l/camera/v4lvideodevicecontrol.cpp134
-rw-r--r--plugins/multimedia/v4l/camera/v4lvideodevicecontrol.h75
-rw-r--r--plugins/multimedia/v4l/camera/v4lvideoencode.cpp126
-rw-r--r--plugins/multimedia/v4l/camera/v4lvideoencode.h88
-rw-r--r--plugins/multimedia/v4l/camera/v4lvideooutputcontrol.cpp67
-rw-r--r--plugins/multimedia/v4l/camera/v4lvideooutputcontrol.h64
-rw-r--r--plugins/multimedia/v4l/camera/v4lvideorenderer.cpp65
-rw-r--r--plugins/multimedia/v4l/camera/v4lvideorenderer.h69
-rw-r--r--plugins/multimedia/v4l/v4l.pro1
-rw-r--r--plugins/multimedia/v4l/v4lserviceplugin.cpp57
-rw-r--r--plugins/multimedia/v4l/v4lserviceplugin.h6
28 files changed, 1 insertions, 3289 deletions
diff --git a/plugins/multimedia/v4l/camera/camera.pri b/plugins/multimedia/v4l/camera/camera.pri
deleted file mode 100644
index 425e3ff692..0000000000
--- a/plugins/multimedia/v4l/camera/camera.pri
+++ /dev/null
@@ -1,30 +0,0 @@
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/v4lcameraservice.h \
- $$PWD/v4lcameracontrol.h \
- $$PWD/v4lvideorenderer.h \
- $$PWD/v4lvideooutputcontrol.h \
- $$PWD/v4lvideodevicecontrol.h \
- $$PWD/v4lvideobuffer.h \
- $$PWD/cameraformatconverter.h \
- $$PWD/v4limagecapturecontrol.h \
- $$PWD/v4lmediacontainercontrol.h \
- $$PWD/v4lvideoencode.h \
- $$PWD/v4lrecordercontrol.h \
- $$PWD/v4lcamerasession.h
-
-SOURCES += \
- $$PWD/v4lcameraservice.cpp \
- $$PWD/v4lcameracontrol.cpp \
- $$PWD/v4lvideorenderer.cpp \
- $$PWD/v4lvideooutputcontrol.cpp \
- $$PWD/v4lvideodevicecontrol.cpp \
- $$PWD/v4lvideobuffer.cpp \
- $$PWD/cameraformatconverter.cpp \
- $$PWD/v4limagecapturecontrol.cpp \
- $$PWD/v4lmediacontainercontrol.cpp \
- $$PWD/v4lvideoencode.cpp \
- $$PWD/v4lrecordercontrol.cpp \
- $$PWD/v4lcamerasession.cpp
-
diff --git a/plugins/multimedia/v4l/camera/cameraformatconverter.cpp b/plugins/multimedia/v4l/camera/cameraformatconverter.cpp
deleted file mode 100644
index e8d7957480..0000000000
--- a/plugins/multimedia/v4l/camera/cameraformatconverter.cpp
+++ /dev/null
@@ -1,479 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cameraformatconverter.h"
-
-/*
- Create a format converter
-*/
-
-CameraFormatConverter* CameraFormatConverter::createFormatConverter(QVideoFrame::PixelFormat format, int width, int height)
-{
- if(format == QVideoFrame::Format_YUYV)
- return new YUVConverter(format,width,height);
- else if(format == QVideoFrame::Format_UYVY)
- return new YUVConverter(format,width,height);
- else if(format == QVideoFrame::Format_YUV420P)
- return new YUVConverter(format,width,height);
- else
- return new NullConverter;
-}
-
-void CameraFormatConverter::releaseFormatConverter(CameraFormatConverter* converter)
-{
- delete converter;
-}
-
-
-// Null Converter
-unsigned char* NullConverter::convert(unsigned char* src, int len)
-{
- Q_UNUSED(len)
- return src;
-}
-
-QList<QVideoFrame::PixelFormat> CameraFormatConverter::supportedFormats()
-{
- QList<QVideoFrame::PixelFormat> list;
- list << QVideoFrame::Format_RGB24 << QVideoFrame::Format_YUYV << QVideoFrame::Format_RGB32
- << QVideoFrame::Format_UYVY << QVideoFrame::Format_YUV420P << QVideoFrame::Format_RGB555;
- return list;
-}
-
-// YUV
-YUVConverter::YUVConverter(QVideoFrame::PixelFormat type,int width, int height):
- m_type(type),
- m_width(width),
- m_height(height)
-{
- m_buf = new unsigned char[width * height * 2];
-
- if (m_type == QVideoFrame::Format_YUYV) {
- // For YUY2 format use these to match (Y0-U0-Y1-V0)
- m_y1i=0;
- m_ui =1;
- m_y2i=2;
- m_vi =3;
- } else if(m_type == QVideoFrame::Format_UYVY) {
- m_y1i=1;
- m_ui =0;
- m_y2i=3;
- m_vi =2;
- }
-}
-
-YUVConverter::~YUVConverter()
-{
- delete [] m_buf;
-}
-
-
-static const signed short redAdjust[] = {
--161,-160,-159,-158,-157,-156,-155,-153,
--152,-151,-150,-149,-148,-147,-145,-144,
--143,-142,-141,-140,-139,-137,-136,-135,
--134,-133,-132,-131,-129,-128,-127,-126,
--125,-124,-123,-122,-120,-119,-118,-117,
--116,-115,-114,-112,-111,-110,-109,-108,
--107,-106,-104,-103,-102,-101,-100, -99,
- -98, -96, -95, -94, -93, -92, -91, -90,
- -88, -87, -86, -85, -84, -83, -82, -80,
- -79, -78, -77, -76, -75, -74, -72, -71,
- -70, -69, -68, -67, -66, -65, -63, -62,
- -61, -60, -59, -58, -57, -55, -54, -53,
- -52, -51, -50, -49, -47, -46, -45, -44,
- -43, -42, -41, -39, -38, -37, -36, -35,
- -34, -33, -31, -30, -29, -28, -27, -26,
- -25, -23, -22, -21, -20, -19, -18, -17,
- -16, -14, -13, -12, -11, -10, -9, -8,
- -6, -5, -4, -3, -2, -1, 0, 1,
- 2, 3, 4, 5, 6, 7, 9, 10,
- 11, 12, 13, 14, 15, 17, 18, 19,
- 20, 21, 22, 23, 25, 26, 27, 28,
- 29, 30, 31, 33, 34, 35, 36, 37,
- 38, 39, 40, 42, 43, 44, 45, 46,
- 47, 48, 50, 51, 52, 53, 54, 55,
- 56, 58, 59, 60, 61, 62, 63, 64,
- 66, 67, 68, 69, 70, 71, 72, 74,
- 75, 76, 77, 78, 79, 80, 82, 83,
- 84, 85, 86, 87, 88, 90, 91, 92,
- 93, 94, 95, 96, 97, 99, 100, 101,
- 102, 103, 104, 105, 107, 108, 109, 110,
- 111, 112, 113, 115, 116, 117, 118, 119,
- 120, 121, 123, 124, 125, 126, 127, 128,
-};
-
-static const signed short greenAdjust1[] = {
- 34, 34, 33, 33, 32, 32, 32, 31,
- 31, 30, 30, 30, 29, 29, 28, 28,
- 28, 27, 27, 27, 26, 26, 25, 25,
- 25, 24, 24, 23, 23, 23, 22, 22,
- 21, 21, 21, 20, 20, 19, 19, 19,
- 18, 18, 17, 17, 17, 16, 16, 15,
- 15, 15, 14, 14, 13, 13, 13, 12,
- 12, 12, 11, 11, 10, 10, 10, 9,
- 9, 8, 8, 8, 7, 7, 6, 6,
- 6, 5, 5, 4, 4, 4, 3, 3,
- 2, 2, 2, 1, 1, 0, 0, 0,
- 0, 0, -1, -1, -1, -2, -2, -2,
- -3, -3, -4, -4, -4, -5, -5, -6,
- -6, -6, -7, -7, -8, -8, -8, -9,
- -9, -10, -10, -10, -11, -11, -12, -12,
- -12, -13, -13, -14, -14, -14, -15, -15,
- -16, -16, -16, -17, -17, -17, -18, -18,
- -19, -19, -19, -20, -20, -21, -21, -21,
- -22, -22, -23, -23, -23, -24, -24, -25,
- -25, -25, -26, -26, -27, -27, -27, -28,
- -28, -29, -29, -29, -30, -30, -30, -31,
- -31, -32, -32, -32, -33, -33, -34, -34,
- -34, -35, -35, -36, -36, -36, -37, -37,
- -38, -38, -38, -39, -39, -40, -40, -40,
- -41, -41, -42, -42, -42, -43, -43, -44,
- -44, -44, -45, -45, -45, -46, -46, -47,
- -47, -47, -48, -48, -49, -49, -49, -50,
- -50, -51, -51, -51, -52, -52, -53, -53,
- -53, -54, -54, -55, -55, -55, -56, -56,
- -57, -57, -57, -58, -58, -59, -59, -59,
- -60, -60, -60, -61, -61, -62, -62, -62,
- -63, -63, -64, -64, -64, -65, -65, -66,
-};
-
-static const signed short greenAdjust2[] = {
- 74, 73, 73, 72, 71, 71, 70, 70,
- 69, 69, 68, 67, 67, 66, 66, 65,
- 65, 64, 63, 63, 62, 62, 61, 60,
- 60, 59, 59, 58, 58, 57, 56, 56,
- 55, 55, 54, 53, 53, 52, 52, 51,
- 51, 50, 49, 49, 48, 48, 47, 47,
- 46, 45, 45, 44, 44, 43, 42, 42,
- 41, 41, 40, 40, 39, 38, 38, 37,
- 37, 36, 35, 35, 34, 34, 33, 33,
- 32, 31, 31, 30, 30, 29, 29, 28,
- 27, 27, 26, 26, 25, 24, 24, 23,
- 23, 22, 22, 21, 20, 20, 19, 19,
- 18, 17, 17, 16, 16, 15, 15, 14,
- 13, 13, 12, 12, 11, 11, 10, 9,
- 9, 8, 8, 7, 6, 6, 5, 5,
- 4, 4, 3, 2, 2, 1, 1, 0,
- 0, 0, -1, -1, -2, -2, -3, -4,
- -4, -5, -5, -6, -6, -7, -8, -8,
- -9, -9, -10, -11, -11, -12, -12, -13,
- -13, -14, -15, -15, -16, -16, -17, -17,
- -18, -19, -19, -20, -20, -21, -22, -22,
- -23, -23, -24, -24, -25, -26, -26, -27,
- -27, -28, -29, -29, -30, -30, -31, -31,
- -32, -33, -33, -34, -34, -35, -35, -36,
- -37, -37, -38, -38, -39, -40, -40, -41,
- -41, -42, -42, -43, -44, -44, -45, -45,
- -46, -47, -47, -48, -48, -49, -49, -50,
- -51, -51, -52, -52, -53, -53, -54, -55,
- -55, -56, -56, -57, -58, -58, -59, -59,
- -60, -60, -61, -62, -62, -63, -63, -64,
- -65, -65, -66, -66, -67, -67, -68, -69,
- -69, -70, -70, -71, -71, -72, -73, -73,
-};
-
-static const signed short blueAdjust[] = {
--276,-274,-272,-270,-267,-265,-263,-261,
--259,-257,-255,-253,-251,-249,-247,-245,
--243,-241,-239,-237,-235,-233,-231,-229,
--227,-225,-223,-221,-219,-217,-215,-213,
--211,-209,-207,-204,-202,-200,-198,-196,
--194,-192,-190,-188,-186,-184,-182,-180,
--178,-176,-174,-172,-170,-168,-166,-164,
--162,-160,-158,-156,-154,-152,-150,-148,
--146,-144,-141,-139,-137,-135,-133,-131,
--129,-127,-125,-123,-121,-119,-117,-115,
--113,-111,-109,-107,-105,-103,-101, -99,
- -97, -95, -93, -91, -89, -87, -85, -83,
- -81, -78, -76, -74, -72, -70, -68, -66,
- -64, -62, -60, -58, -56, -54, -52, -50,
- -48, -46, -44, -42, -40, -38, -36, -34,
- -32, -30, -28, -26, -24, -22, -20, -18,
- -16, -13, -11, -9, -7, -5, -3, -1,
- 0, 2, 4, 6, 8, 10, 12, 14,
- 16, 18, 20, 22, 24, 26, 28, 30,
- 32, 34, 36, 38, 40, 42, 44, 46,
- 49, 51, 53, 55, 57, 59, 61, 63,
- 65, 67, 69, 71, 73, 75, 77, 79,
- 81, 83, 85, 87, 89, 91, 93, 95,
- 97, 99, 101, 103, 105, 107, 109, 112,
- 114, 116, 118, 120, 122, 124, 126, 128,
- 130, 132, 134, 136, 138, 140, 142, 144,
- 146, 148, 150, 152, 154, 156, 158, 160,
- 162, 164, 166, 168, 170, 172, 175, 177,
- 179, 181, 183, 185, 187, 189, 191, 193,
- 195, 197, 199, 201, 203, 205, 207, 209,
- 211, 213, 215, 217, 219, 221, 223, 225,
- 227, 229, 231, 233, 235, 238, 240, 242,
-};
-
-
-
-#define CLAMP(x) x < 0 ? 0 : x & 0xff
-
-inline void yuv2rgb565(int y, int u, int v, quint16 *rgb)
-{
- register int r, g, b;
-
- r = y + redAdjust[v];
- g = y + greenAdjust1[u] + greenAdjust2[v];
- b = y + blueAdjust[u];
-
-#if 0
- y -= 16;
- u -= 128;
- v -= 128;
- r = y + 1.13983*v;
- g = y + 0.39465*u - 0.58060*v;
- b = y + 2.03211*u;
-#endif
-
- r = CLAMP(r);
- g = CLAMP(g);
- b = CLAMP(b);
-
- *rgb = (quint16)(((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3));
-}
-
-inline void yuv2rgb24(int y, int u, int v, quint32 *rgb)
-{
- register int r, g, b;
-
- r = y + redAdjust[v];
- g = y + greenAdjust1[u] + greenAdjust2[v];
- b = y + blueAdjust[u];
-
- r = CLAMP(r);
- g = CLAMP(g);
- b = CLAMP(b);
-
- *rgb = ((r<<24)|(g<<16) | b) | 0xff000000 ;
-}
-
-#define yuv2rgb(a,b,c,d) yuv2rgb565(a,b,c,d)
-
-unsigned char* YUVConverter::convert(unsigned char* src, int len)
-{
- quint16* dest = (quint16*)m_buf;
- unsigned char *buf = src;
- int size = (m_width * m_height) >> 1;
-
-
-#define CONV \
-{\
- register int u = buf[m_ui];\
- register int v = buf[m_vi];\
- yuv2rgb(buf[m_y1i], u, v, dest);\
- yuv2rgb(buf[m_y2i], u, v, ++dest);\
- dest++;\
- buf+= 4;\
-}
- if (m_type != QVideoFrame::Format_YUV420P) {
- register int n = (size + 7) / 8;
- switch(size & 7)
- {
- case 0: do {CONV
- case 7: CONV
- case 6: CONV
- case 5: CONV
- case 4: CONV
- case 3: CONV
- case 2: CONV
- case 1: CONV
- } while(--n);
- }
- } else {
- // for 320x240 use 353x288, only works for this res!!
- int w = m_width;
- int h = m_height;
- int Ysize = w * h;
- if(len == Ysize+Ysize/4+Ysize/4) {
- for(int y=0;y<m_height;y++) {
- for(int x=0;x<m_width;x++) {
- int yy = (int)buf[y*w+x];
- int u = (int)buf[(y/2)*(w/2)+x/2+Ysize];
- int v = (int)buf[(y/2)*(w/2)+x/2+Ysize+Ysize/4];
- yuv2rgb565(yy,u,v,dest);
- dest++;
- }
- }
- } else {
- qWarning("buffer provided doesn't match expected size!!!");
- }
- }
-
- return m_buf;
-
-}
-
-/*
- * convert ROUTINE TAKEN FROM:
- *
- * Sonix SN9C101 based webcam basic I/F routines
- * Copyright (C) 2004 Takafumi Mizuno <taka-qce@ls-a.jp>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-BayerConverter::BayerConverter(int width, int height):
- m_width(width),
- m_height(height)
-{
- m_buf = new unsigned char[width * height * 4]; // 4 = 32bpp / 8 bpb
-}
-
-BayerConverter::~BayerConverter()
-{
- delete m_buf;
-}
-
-unsigned char* BayerConverter::convert(unsigned char* src, int len)
-{
- Q_UNUSED(len)
-
- int size = m_width * m_height;
- unsigned long *dst = (unsigned long*) m_buf;
-
- register unsigned long dstVal;
-
- for (int i = 0; i < size; ++i)
- {
- dstVal = 0xFF000000;
-
- if ((i / m_width) % 2 == 0)
- {
- if (!(i & 1))
- {
- /* B */
- if ((i > m_width) && ((i % m_width) > 0) )
- {
- dstVal |= ((*(src-m_width-1)+*(src-m_width+1)+ *(src+m_width-1)+*(src+m_width + 1)) / 4) << 16 |
- ((*(src-1)+*(src+1)+*(src+m_width)+*(src-m_width))/4) << 8 |
- *src;
- }
- else
- {
- dstVal |= *(src + m_width + 1) << 16 |
- (*(src + 1) + *(src + m_width)) / 2 << 8 |
- *src;
- }
- }
- else
- {
- /* (B)G */
- if ((i > m_width) && ((i % m_width) < (m_width - 1)))
- {
- dstVal |= (*(src+m_width)+*(src-m_width))/2 << 16 |
- *src << 8 |
- (*(src-1)+*(src+1))/2;
- }
- else
- {
- dstVal |= *(src+m_width) << 16 |
- *src << 8 |
- *(src - 1);
- }
- }
- }
- else {
-
- if (!(i & 1))
- {
- /* G(R) */
- if ((i < (m_width * (m_height - 1))) && ((i % m_width) > 0) )
- {
- dstVal |= ((*(src - 1) + *(src + 1)) / 2) << 16 |
- *src << 8 |
- (*(src + m_width) + *(src - m_width)) / 2;
- }
- else
- {
- dstVal |= *(src + 1) << 16 |
- *src << 8 |
- *(src - m_width);
- }
- }
- else
- {
- /* R */
- if (i < (m_width * (m_height - 1)) && ((i % m_width) < (m_width - 1)) )
- {
- dstVal |= *src << 16 |
- (*(src-1)+*(src+1)+ *(src-m_width)+*(src+m_width))/4 << 8 |
- (*(src-m_width-1)+*(src-m_width+1)+ *(src+m_width-1)+*(src+m_width+1))/4;
- }
- else
- {
- dstVal |= *src << 16 |
- (*(src-1)+*(src-m_width))/2 << 8 |
- *(src-m_width-1);
- }
- }
- }
-
- *dst++ = dstVal;
- ++src;
- }
-
- return m_buf;
-}
-
-
diff --git a/plugins/multimedia/v4l/camera/cameraformatconverter.h b/plugins/multimedia/v4l/camera/cameraformatconverter.h
deleted file mode 100644
index ec1c09eb1c..0000000000
--- a/plugins/multimedia/v4l/camera/cameraformatconverter.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERAFORMATCONVERTER_H
-#define CAMERAFORMATCONVERTER_H
-
-#include <QtCore/qlist.h>
-#include <QtMultimedia/qvideoframe.h>
-
-/*
- * convert something to RGB32 / RGB16
- *
- */
-class CameraFormatConverter
-{
-public:
-
- virtual ~CameraFormatConverter() {}
-
- virtual unsigned char* convert(unsigned char* src, int len) = 0;
-
- static CameraFormatConverter* createFormatConverter(QVideoFrame::PixelFormat format, int width, int height);
- static void releaseFormatConverter(CameraFormatConverter* converter);
- static QList<QVideoFrame::PixelFormat> supportedFormats();
-};
-
-
-class NullConverter : public CameraFormatConverter
-{
-public:
-
- virtual unsigned char* convert(unsigned char* src, int len);
-};
-
-
-class YUVConverter : public CameraFormatConverter
-{
-public:
- YUVConverter(QVideoFrame::PixelFormat type, int width, int height);
- virtual ~YUVConverter();
-
- virtual unsigned char* convert(unsigned char* src, int len);
-
-private:
-
- QVideoFrame::PixelFormat m_type;
- int m_width;
- int m_height;
- unsigned char* m_buf;
- int m_ui,m_vi,m_y1i,m_y2i;
-
-};
-
-class BayerConverter : public CameraFormatConverter
-{
-public:
- BayerConverter(int width, int height);
- virtual ~BayerConverter();
-
- virtual unsigned char* convert(unsigned char* src, int len);
-
-private:
-
- int m_width;
- int m_height;
- unsigned char* m_buf;
-};
-
-#endif
diff --git a/plugins/multimedia/v4l/camera/v4lcameracontrol.cpp b/plugins/multimedia/v4l/camera/v4lcameracontrol.cpp
deleted file mode 100644
index 55192161e2..0000000000
--- a/plugins/multimedia/v4l/camera/v4lcameracontrol.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "v4lcameracontrol.h"
-#include "v4lcameraservice.h"
-#include "v4lcamerasession.h"
-
-
-V4LCameraControl::V4LCameraControl(QObject *parent)
- :QCameraControl(parent),m_captureMode(QCamera::CaptureStillImage)
-{
- m_session = qobject_cast<V4LCameraSession*>(parent);
- connect(m_session, SIGNAL(cameraStateChanged(QCamera::State)),this, SIGNAL(stateChanged(QCamera::State)));
-}
-
-V4LCameraControl::~V4LCameraControl()
-{
-}
-
-void V4LCameraControl::start()
-{
- m_session->previewMode(true);
- m_session->captureToFile(false);
- m_session->record();
-}
-
-void V4LCameraControl::stop()
-{
- m_session->previewMode(false);
- m_session->captureToFile(false);
- m_session->stop();
-}
-
-QCamera::State V4LCameraControl::state() const
-{
- if(m_session->state() == QMediaRecorder::RecordingState)
- return QCamera::ActiveState;
-
- return QCamera::StoppedState;
-}
diff --git a/plugins/multimedia/v4l/camera/v4lcameracontrol.h b/plugins/multimedia/v4l/camera/v4lcameracontrol.h
deleted file mode 100644
index 6e67f02e1d..0000000000
--- a/plugins/multimedia/v4l/camera/v4lcameracontrol.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef V4LCAMERACONTROL_H
-#define V4LCAMERACONTROL_H
-
-#include <QtCore/qobject.h>
-#include <qmediarecorder.h>
-#include <experimental/qcameracontrol.h>
-
-QTM_USE_NAMESPACE
-
-class V4LCameraService;
-class V4LCameraSession;
-
-class V4LCameraControl : public QCameraControl
-{
- Q_OBJECT
-public:
- V4LCameraControl(QObject *parent = 0);
- ~V4LCameraControl();
-
- void start();
- void stop();
- QCamera::State state() const;
-
- QCamera::CaptureMode captureMode() const { return m_captureMode; }
- void setCaptureMode(QCamera::CaptureMode mode)
- {
- if (m_captureMode != mode) {
- m_captureMode = mode;
- emit captureModeChanged(mode);
- }
- }
-
- QCamera::CaptureModes supportedCaptureModes() const
- {
- return QCamera::CaptureStillImage | QCamera::CaptureVideo;
- }
-
-
-private:
- V4LCameraSession *m_session;
- V4LCameraService *m_service;
- QCamera::CaptureMode m_captureMode;
-};
-
-#endif
diff --git a/plugins/multimedia/v4l/camera/v4lcameraservice.cpp b/plugins/multimedia/v4l/camera/v4lcameraservice.cpp
deleted file mode 100644
index 29016aae2a..0000000000
--- a/plugins/multimedia/v4l/camera/v4lcameraservice.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qvariant.h>
-#include <QtGui/qwidget.h>
-
-#include "v4lcameraservice.h"
-#include "v4lcameracontrol.h"
-#include "v4lcamerasession.h"
-#include "v4lvideorenderer.h"
-#include "v4lvideooutputcontrol.h"
-#include "v4lvideodevicecontrol.h"
-#include "v4limagecapturecontrol.h"
-#include "v4lmediacontainercontrol.h"
-#include "v4lvideoencode.h"
-#include "v4lrecordercontrol.h"
-
-V4LCameraService::V4LCameraService(QObject *parent):
- QMediaService(parent)
-{
- m_session = new V4LCameraSession(this);
- m_control = new V4LCameraControl(m_session);
-
- m_videoOutput = new V4LVideoOutputControl(this);
- m_videoOutput->setOutput(QVideoOutputControl::RendererOutput);
-
- m_videoDevice = new V4LVideoDeviceControl(m_session);
-
- m_videoRenderer = new V4LVideoRendererControl(m_session, this);
-
- m_imageCapture = new V4LImageCaptureControl(m_session);
-
- m_formatControl = new V4LMediaContainerControl(m_session);
-
- m_videoEncode = new V4LVideoEncode(m_session);
-
- m_recorderControl = new V4LRecorderControl(m_session);
-
- m_device = QByteArray("/dev/video1");
-}
-
-V4LCameraService::~V4LCameraService()
-{
- delete m_control;
- delete m_session;
- delete m_videoOutput;
- delete m_videoDevice;
- delete m_videoRenderer;
- delete m_imageCapture;
- delete m_formatControl;
- delete m_videoEncode;
- delete m_recorderControl;
-}
-
-QMediaControl *V4LCameraService::control(const char *name) const
-{
- if(qstrcmp(name,QCameraControl_iid) == 0)
- return m_control;
-
- if(qstrcmp(name,QVideoOutputControl_iid) == 0)
- return m_videoOutput;
-
- if(qstrcmp(name,QVideoRendererControl_iid) == 0)
- return m_videoRenderer;
-
- if(qstrcmp(name,QVideoDeviceControl_iid) == 0)
- return m_videoDevice;
-
- if (qstrcmp(name, QImageCaptureControl_iid) == 0)
- return m_imageCapture;
-
- if (qstrcmp(name, QMediaContainerControl_iid) == 0)
- return m_formatControl;
-
- if (qstrcmp(name, QVideoEncoderControl_iid) == 0)
- return m_videoEncode;
-
- if (qstrcmp(name, QMediaRecorderControl_iid) == 0)
- return m_recorderControl;
-
- return 0;
-}
diff --git a/plugins/multimedia/v4l/camera/v4lcameraservice.h b/plugins/multimedia/v4l/camera/v4lcameraservice.h
deleted file mode 100644
index fb8650925e..0000000000
--- a/plugins/multimedia/v4l/camera/v4lcameraservice.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef V4LCAMERASERVICE_H
-#define V4LCAMERASERVICE_H
-
-#include <QtCore/qobject.h>
-
-#include <qmediaservice.h>
-QTM_USE_NAMESPACE
-
-class V4LCameraControl;
-class V4LCameraSession;
-class V4LVideoOutputControl;
-class V4LVideoDeviceControl;
-class V4LVideoRendererControl;
-class V4LImageCaptureControl;
-class V4LMediaContainerControl;
-class V4LVideoEncode;
-class V4LRecorderControl;
-
-class V4LCameraService : public QMediaService
-{
- Q_OBJECT
-
-public:
- V4LCameraService(QObject *parent = 0);
- ~V4LCameraService();
-
- QMediaControl *control(const char *name) const;
-
-private:
- V4LCameraControl *m_control;
- V4LCameraSession *m_session;
- V4LVideoOutputControl *m_videoOutput;
- V4LVideoDeviceControl *m_videoDevice;
- V4LVideoRendererControl *m_videoRenderer;
- V4LImageCaptureControl *m_imageCapture;
- V4LMediaContainerControl *m_formatControl;
- V4LVideoEncode *m_videoEncode;
- V4LRecorderControl *m_recorderControl;
- QByteArray m_device;
-};
-
-#endif
diff --git a/plugins/multimedia/v4l/camera/v4lcamerasession.cpp b/plugins/multimedia/v4l/camera/v4lcamerasession.cpp
deleted file mode 100644
index 77560af2de..0000000000
--- a/plugins/multimedia/v4l/camera/v4lcamerasession.cpp
+++ /dev/null
@@ -1,769 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/qwidget.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qdebug.h>
-#include <QtMultimedia/qabstractvideobuffer.h>
-#include <QtMultimedia/qvideosurfaceformat.h>
-
-#include <linux/types.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <linux/videodev2.h>
-
-#include "v4lcamerasession.h"
-#include "v4lvideorenderer.h"
-#include "v4lvideobuffer.h"
-
-
-V4LCameraSession::V4LCameraSession(QObject *parent)
- :QObject(parent)
-{
- available = false;
- resolutions.clear();
- formats.clear();
- m_state = QMediaRecorder::StoppedState;
- m_device = "/dev/video1";
- preview = false;
- toFile = false;
- converter = 0;
- active = false;
-
- sfd = ::open(m_device.constData(), O_RDWR);
-
- if (sfd != -1) {
- available = true;
-
- // get formats available
- 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(sfd, VIDIOC_ENUM_FMT, &fmt) == -1) {
- if(errno == EINVAL)
- break;
- }
- formats.append(fmt.pixelformat);
- }
-
- // get sizes available
- resolutions << QSize(176, 144) << QSize(320, 240) << QSize(640, 480);
-
- ::close(sfd);
- sfd = -1;
- }
- m_output = 0;
- m_surface = 0;
- m_windowSize = QSize(320,240);
- pixelF = QVideoFrame::Format_RGB32;
- savedPixelF = QVideoFrame::Format_RGB32;
-}
-
-V4LCameraSession::~V4LCameraSession()
-{
-}
-
-void V4LCameraSession::captureImage(const QString &fileName)
-{
- m_snapshot = fileName;
-}
-
-void V4LCameraSession::setSurface(QAbstractVideoSurface* surface)
-{
- m_surface = surface;
-}
-
-bool V4LCameraSession::deviceReady()
-{
- return available;
-}
-
-int V4LCameraSession::framerate() const
-{
- return -1;
-}
-
-void V4LCameraSession::setFrameRate(int rate)
-{
- Q_UNUSED(rate)
-}
-
-int V4LCameraSession::brightness() const
-{
- if(sfd == -1) return -1;
-
- struct v4l2_control control_s;
- int err;
- control_s.id = V4L2_CID_BRIGHTNESS;
- if ((err = ::ioctl(sfd, VIDIOC_G_CTRL, &control_s)) < 0)
- return -1;
-
- return control_s.value;
-}
-
-void V4LCameraSession::setBrightness(int b)
-{
- if(sfd == -1) return;
-
- struct v4l2_control control_s;
- int err;
- control_s.id = V4L2_CID_BRIGHTNESS;
- control_s.value = b;
- if ((err = ::ioctl(sfd, VIDIOC_S_CTRL, &control_s)) < 0)
- return;
-}
-
-int V4LCameraSession::contrast() const
-{
- if(sfd == -1) return -1;
-
- struct v4l2_control control_s;
- int err;
- control_s.id = V4L2_CID_CONTRAST;
- if ((err = ::ioctl(sfd, VIDIOC_G_CTRL, &control_s)) < 0)
- return -1;
-
- return control_s.value;
-}
-
-void V4LCameraSession::setContrast(int c)
-{
- if(sfd == -1) return;
-
- struct v4l2_control control_s;
- int err;
- control_s.id = V4L2_CID_CONTRAST;
- control_s.value = c;
- if ((err = ::ioctl(sfd, VIDIOC_S_CTRL, &control_s)) < 0)
- return;
-}
-
-int V4LCameraSession::saturation() const
-{
- if(sfd == -1) return -1;
-
- struct v4l2_control control_s;
- int err;
- control_s.id = V4L2_CID_SATURATION;
- if ((err = ::ioctl(sfd, VIDIOC_G_CTRL, &control_s)) < 0)
- return -1;
-
- return control_s.value;
-}
-
-void V4LCameraSession::setSaturation(int s)
-{
- if(sfd == -1) return;
-
- struct v4l2_control control_s;
- int err;
- control_s.id = V4L2_CID_SATURATION;
- control_s.value = s;
- if ((err = ::ioctl(sfd, VIDIOC_S_CTRL, &control_s)) < 0)
- return;
-}
-
-int V4LCameraSession::hue() const
-{
- if(sfd == -1) return -1;
-
- struct v4l2_control control_s;
- int err;
- control_s.id = V4L2_CID_HUE;
- if ((err = ::ioctl(sfd, VIDIOC_G_CTRL, &control_s)) < 0)
- return -1;
-
- return control_s.value;
-}
-
-void V4LCameraSession::setHue(int h)
-{
- if(sfd == -1) return;
-
- struct v4l2_control control_s;
- int err;
- control_s.id = V4L2_CID_HUE;
- control_s.value = h;
- if ((err = ::ioctl(sfd, VIDIOC_S_CTRL, &control_s)) < 0)
- return;
-}
-
-int V4LCameraSession::sharpness() const
-{
- return -1;
-}
-
-void V4LCameraSession::setSharpness(int s)
-{
- Q_UNUSED(s)
-}
-
-int V4LCameraSession::zoom() const
-{
- return -1;
-}
-
-void V4LCameraSession::setZoom(int z)
-{
- Q_UNUSED(z)
-}
-
-bool V4LCameraSession::backlightCompensation() const
-{
- return false;
-}
-
-void V4LCameraSession::setBacklightCompensation(bool b)
-{
- Q_UNUSED(b)
-}
-
-int V4LCameraSession::whitelevel() const
-{
- return -1;
-}
-
-void V4LCameraSession::setWhitelevel(int w)
-{
- Q_UNUSED(w)
-}
-
-int V4LCameraSession::rotation() const
-{
- return 0;
-}
-
-void V4LCameraSession::setRotation(int r)
-{
- Q_UNUSED(r)
-}
-
-bool V4LCameraSession::flash() const
-{
- return false;
-}
-
-void V4LCameraSession::setFlash(bool f)
-{
- Q_UNUSED(f)
-}
-
-bool V4LCameraSession::autofocus() const
-{
- return false;
-}
-
-void V4LCameraSession::setAutofocus(bool f)
-{
- Q_UNUSED(f)
-}
-
-QSize V4LCameraSession::frameSize() const
-{
- return m_windowSize;
-}
-
-void V4LCameraSession::setFrameSize(const QSize& s)
-{
- m_windowSize = s;
-}
-
-void V4LCameraSession::setDevice(const QString &device)
-{
- available = false;
- m_state = QMediaRecorder::StoppedState;
- m_device = QByteArray(device.toLocal8Bit().constData());
-
- sfd = ::open(m_device.constData(), O_RDWR);
-
- if (sfd != -1) {
- available = true;
-
- // get formats available
- 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(sfd, VIDIOC_ENUM_FMT, &fmt) == -1) {
- if(errno == EINVAL)
- break;
- }
- formats.append(fmt.pixelformat);
- }
-
- // get sizes available
- resolutions << QSize(176, 144) << QSize(320, 240) << QSize(640, 480);
-
- ::close(sfd);
- sfd = -1;
- }
- active = false;
-}
-
-QList<QVideoFrame::PixelFormat> V4LCameraSession::supportedPixelFormats()
-{
- QList<QVideoFrame::PixelFormat> list;
-
- if(available) {
- for(int i=0;i<formats.size();i++) {
- if(formats.at(i) == V4L2_PIX_FMT_YUYV)
- list << QVideoFrame::Format_YUYV;
- else if(formats.at(i) == V4L2_PIX_FMT_UYVY)
- list << QVideoFrame::Format_UYVY;
- else if(formats.at(i) == V4L2_PIX_FMT_RGB24)
- list << QVideoFrame::Format_RGB24;
- else if(formats.at(i) == V4L2_PIX_FMT_RGB32)
- list << QVideoFrame::Format_RGB32;
- else if(formats.at(i) == V4L2_PIX_FMT_RGB565)
- list << QVideoFrame::Format_RGB565;
- }
- }
-
- return list;
-}
-
-QVideoFrame::PixelFormat V4LCameraSession::pixelFormat() const
-{
- return pixelF;
-}
-
-void V4LCameraSession::setPixelFormat(QVideoFrame::PixelFormat fmt)
-{
- pixelF = fmt;
- savedPixelF = fmt;
-}
-
-QList<QSize> V4LCameraSession::supportedResolutions()
-{
- QList<QSize> list;
-
- if(available) {
- list << resolutions;
- }
-
- return list;
-}
-
-bool V4LCameraSession::setOutputLocation(const QUrl &sink)
-{
- m_sink = sink;
-
- return true;
-}
-
-QUrl V4LCameraSession::outputLocation() const
-{
- return m_sink;
-}
-
-qint64 V4LCameraSession::position() const
-{
- return timeStamp.elapsed();
-}
-
-QMediaRecorder::State V4LCameraSession::state() const
-{
- return m_state;
-}
-
-void V4LCameraSession::previewMode(bool value)
-{
- preview = value;
-}
-
-void V4LCameraSession::captureToFile(bool value)
-{
- if(toFile && m_file.isOpen())
- m_file.close();
-
- toFile = value;
-}
-
-bool V4LCameraSession::isFormatSupported(QVideoFrame::PixelFormat pFormat)
-{
- if(sfd == -1)
- return false;
-
- int ret;
- struct v4l2_format fmt;
-
- memset(&fmt, 0, sizeof(fmt));
- fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- fmt.fmt.pix.width = m_windowSize.width();
- fmt.fmt.pix.height = m_windowSize.height();
-
- if(pFormat == QVideoFrame::Format_YUYV)
- fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
- if(pFormat == QVideoFrame::Format_RGB24)
- fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB24;
- if(pFormat == QVideoFrame::Format_RGB32)
- fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB32;
- if(pFormat == QVideoFrame::Format_RGB565)
- fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB565;
- if(pFormat == QVideoFrame::Format_UYVY)
- fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;
-
- fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
- ret = ::ioctl(sfd, VIDIOC_S_FMT, &fmt);
-
- if(ret == -1)
- return false;
-
- return true;
-}
-
-void V4LCameraSession::record()
-{
- pixelF = savedPixelF;
-
- if(active && toFile && m_state != QMediaRecorder::PausedState) {
- // Camera is active and captureToFile(true)
- m_state = QMediaRecorder::RecordingState;
- emit recordStateChanged(m_state);
- return;
- } else if(sfd > 0)
- return;
-
- sfd = ::open(m_device.constData(), O_RDWR);
- if(sfd == -1) {
- qWarning()<<"can't open v4l "<<m_device;
- m_state = QMediaRecorder::StoppedState;
- emit cameraStateChanged(QCamera::StoppedState);
- return;
- }
-
- bool match = false;
- QList<QVideoFrame::PixelFormat> fmts = supportedPixelFormats();
-
- // first try and use what we have
- if ((fmts.contains(pixelF)) && isFormatSupported(pixelF) &&
- m_surface->isFormatSupported(QVideoSurfaceFormat(m_windowSize,pixelF)))
- match = true;
-
- // try and find a match between camera and surface that doesn't require a converter
- if(!match) {
- foreach(QVideoFrame::PixelFormat format, fmts) {
- if (m_surface->isFormatSupported(QVideoSurfaceFormat(m_windowSize,format))) {
- // found a match, try to use it!
- if(isFormatSupported(format)) {
- match = true;
- pixelF = format;
- break;
- }
- }
- }
- }
-
- // try to see if we can use the converter
- if(!match) {
- // no direct match up found, see if we can use the converter
- if(m_surface->isFormatSupported(QVideoSurfaceFormat(m_windowSize,QVideoFrame::Format_RGB32)) ||
- m_surface->isFormatSupported(QVideoSurfaceFormat(m_windowSize,QVideoFrame::Format_RGB24)) ||
- m_surface->isFormatSupported(QVideoSurfaceFormat(m_windowSize,QVideoFrame::Format_RGB565))) {
- // converter can convert YUYV->RGB565, UYVY->RGB565 and YUV420P->RGB565
- if (pixelF == QVideoFrame::Format_YUYV || pixelF == QVideoFrame::Format_UYVY ||
- pixelF == QVideoFrame::Format_YUV420P) {
- if(isFormatSupported(pixelF)) {
- match = true;
- converter = CameraFormatConverter::createFormatConverter(pixelF,m_windowSize.width(),
- m_windowSize.height());
- }
- }
- if (!match) {
- // fallback, cant convert your format so set to one that I can get working!
- foreach(QVideoFrame::PixelFormat format, fmts) {
- if(format == QVideoFrame::Format_YUYV || format == QVideoFrame::Format_UYVY ||
- format == QVideoFrame::Format_YUV420P) {
- if(isFormatSupported(format)) {
- pixelF = format;
- match = true;
- converter = CameraFormatConverter::createFormatConverter(pixelF,m_windowSize.width(),
- m_windowSize.height());
- break;
- }
- }
- }
- }
- }
- }
- if(!match) {
- qWarning() << "error setting camera format, no supported formats available";
- m_state = QMediaRecorder::StoppedState;
- emit cameraStateChanged(QCamera::StoppedState);
- return;
- }
-
- int ret;
- struct v4l2_requestbuffers req;
- memset(&req, 0, sizeof(req));
- req.count = 4;
- req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- req.memory = V4L2_MEMORY_MMAP;
- ret = ::ioctl(sfd, VIDIOC_REQBUFS, &req);
- if(ret == -1) {
- qWarning()<<"error allocating buffers";
- m_state = QMediaRecorder::StoppedState;
- emit cameraStateChanged(QCamera::StoppedState);
- return;
- }
- for(int i=0;i<(int)req.count;++i) {
- struct v4l2_buffer buf;
- memset(&buf, 0 , sizeof(buf));
- buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- buf.memory = V4L2_MEMORY_MMAP;
- buf.index = i;
- ret = ::ioctl(sfd, VIDIOC_QUERYBUF, &buf);
- if(ret == -1) {
- qWarning()<<"error allocating buffers";
- m_state = QMediaRecorder::StoppedState;
- emit cameraStateChanged(QCamera::StoppedState);
- return;
- }
- void* mmap_data = ::mmap(0,buf.length,PROT_READ | PROT_WRITE,MAP_SHARED,sfd,buf.m.offset);
- if (mmap_data == reinterpret_cast<void*>(-1)) {
- qWarning()<<"can't mmap video data";
- ::close(sfd);
- sfd = -1;
- m_state = QMediaRecorder::StoppedState;
- emit cameraStateChanged(QCamera::StoppedState);
- return;
- }
- video_buffer v4l_buf;
- v4l_buf.start = reinterpret_cast<char*>(mmap_data);
- v4l_buf.length = buf.length;
- buffers.append(v4l_buf);
- }
- // start stream
- for(int i=0;i<(int)req.count;++i) {
- struct v4l2_buffer buf;
- memset(&buf,0,sizeof(buf));
- buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- buf.memory = V4L2_MEMORY_MMAP;
- buf.index = i;
- ret = ::ioctl(sfd, VIDIOC_QBUF, &buf);
- if(ret == -1) {
- qWarning()<<"can't mmap video data";
- ::close(sfd);
- sfd = -1;
- m_state = QMediaRecorder::StoppedState;
- emit cameraStateChanged(QCamera::StoppedState);
- return;
- }
- }
- v4l2_buf_type buf_type;
- buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- ret = ::ioctl(sfd, VIDIOC_STREAMON, &buf_type);
- if(ret < 0) {
- qWarning()<<"can't start capture";
- ::close(sfd);
- sfd = -1;
- m_state = QMediaRecorder::StoppedState;
- emit cameraStateChanged(QCamera::StoppedState);
- return;
- }
- notifier = new QSocketNotifier(sfd, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(captureFrame()));
- notifier->setEnabled(1);
- if (!converter) {
- QVideoSurfaceFormat requestedFormat(m_windowSize,pixelF);
-
- bool check = m_surface->isFormatSupported(requestedFormat);
-
- if(check) {
- m_surface->start(requestedFormat);
-
- m_state = QMediaRecorder::RecordingState;
- emit cameraStateChanged(QCamera::ActiveState);
- timeStamp.restart();
- }
- } else {
- QVideoSurfaceFormat requestedFormat(m_windowSize,QVideoFrame::Format_RGB32);
- m_surface->start(requestedFormat);
- m_state = QMediaRecorder::RecordingState;
- emit cameraStateChanged(QCamera::ActiveState);
- timeStamp.restart();
- }
- active = true;
-}
-
-void V4LCameraSession::pause()
-{
- if(sfd != -1) {
- v4l2_buf_type buf_type;
- buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- ::ioctl(sfd, VIDIOC_STREAMOFF, &buf_type);
- if (notifier) {
- notifier->setEnabled(false);
- disconnect(notifier, 0, 0, 0);
- delete notifier;
- notifier = 0;
- }
- ::close(sfd);
- sfd = -1;
- m_state = QMediaRecorder::PausedState;
- emit recordStateChanged(m_state);
- }
-}
-
-void V4LCameraSession::stop()
-{
- if(sfd != -1) {
-
- if(toFile && m_file.isOpen() && m_state != QMediaRecorder::StoppedState) {
- // just stop writing to file.
- m_file.close();
-
- m_state = QMediaRecorder::StoppedState;
- emit recordStateChanged(m_state);
- return;
- }
-
- v4l2_buf_type buf_type;
- buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- ::ioctl(sfd, VIDIOC_STREAMOFF, &buf_type);
- if (notifier) {
- notifier->setEnabled(false);
- disconnect(notifier, 0, 0, 0);
- delete notifier;
- notifier = 0;
- }
- // Dequeue remaining buffers
- for(int i = 0;i < 4; ++i) {
- v4l2_buffer buf;
- memset(&buf, 0, sizeof(struct v4l2_buffer));
- buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- buf.memory = V4L2_MEMORY_MMAP;
- buf.index = i;
- if (ioctl(sfd, VIDIOC_QUERYBUF, &buf) == 0) {
- if (buf.flags & V4L2_BUF_FLAG_QUEUED) {
- ::ioctl(sfd, VIDIOC_DQBUF, &buf);
- }
- }
- munmap(buffers.at(buf.index).start,buf.length);
- }
-
- ::close(sfd);
- sfd = -1;
- m_state = QMediaRecorder::StoppedState;
- emit cameraStateChanged(QCamera::StoppedState);
-
- if(converter)
- delete converter;
- converter = 0;
- active = false;
- }
-}
-
-void V4LCameraSession::captureFrame()
-{
- if(sfd == -1) return;
- v4l2_buffer buf;
- memset(&buf, 0, sizeof(struct v4l2_buffer));
- buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- buf.memory = V4L2_MEMORY_MMAP;
- int ret = ioctl(sfd, VIDIOC_DQBUF, &buf);
- if (ret < 0 ) {
- qWarning()<<"error reading frame";
- return;
- }
-
- if(m_surface) {
- if(converter) {
- QImage image;
- image = QImage(converter->convert((unsigned char*)buffers.at(buf.index).start,buf.bytesused),
- m_windowSize.width(),m_windowSize.height(),QImage::Format_RGB16).convertToFormat(QImage::Format_RGB32);
- if(m_snapshot.length() > 0) {
- image.save(m_snapshot,"JPG");
- m_snapshot.clear();
- }
- if(m_sink.toString().length() > 0 && toFile) {
- // save to file
- if(!m_file.isOpen()) {
- if(m_sink.toLocalFile().length() > 0)
- m_file.setFileName(m_sink.toLocalFile());
- else
- m_file.setFileName(m_sink.toString());
- m_file.open(QIODevice::WriteOnly);
- }
- image.save(qobject_cast<QIODevice*>(&m_file),"JPG");
- }
- if(preview) {
- QVideoFrame frame(image);
- m_surface->present(frame);
- }
- ret = ioctl(sfd, VIDIOC_QBUF, &buf);
-
- } else {
- QVideoSurfaceFormat sfmt = m_surface->surfaceFormat();
- if(sfmt.pixelFormat() == QVideoFrame::Format_RGB565) {
- QImage image;
- image = QImage((unsigned char*)buffers.at(buf.index).start,
- m_windowSize.width(), m_windowSize.height(), QImage::Format_RGB16);
- QVideoFrame frame(image);
- m_surface->present(frame);
- ret = ioctl(sfd, VIDIOC_QBUF, &buf);
-
- } else {
- V4LVideoBuffer* packet = new V4LVideoBuffer((unsigned char*)buffers.at(buf.index).start, sfd, buf);
- packet->setBytesPerLine(m_windowSize.width()*4);
- QVideoFrame frame(packet,m_windowSize,pixelF);
- frame.setStartTime(buf.timestamp.tv_sec);
- m_surface->present(frame);
- }
- }
-
- } else
- ret = ioctl(sfd, VIDIOC_QBUF, &buf);
-}
diff --git a/plugins/multimedia/v4l/camera/v4lcamerasession.h b/plugins/multimedia/v4l/camera/v4lcamerasession.h
deleted file mode 100644
index a8848066b1..0000000000
--- a/plugins/multimedia/v4l/camera/v4lcamerasession.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef V4LCAMERASESSION_H
-#define V4LCAMERASESSION_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qsocketnotifier.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qfile.h>
-#include <QtMultimedia/qvideoframe.h>
-#include <QtMultimedia/qabstractvideosurface.h>
-
-#include <qmediarecorder.h>
-#include <experimental/qcamera.h>
-
-#include "cameraformatconverter.h"
-
-QTM_USE_NAMESPACE
-
-class V4LVideoRenderer;
-
-struct video_buffer {
- void* start;
- size_t length;
-};
-
-class V4LCameraSession : public QObject
-{
- Q_OBJECT
-public:
- V4LCameraSession(QObject *parent = 0);
- ~V4LCameraSession();
-
- bool deviceReady();
-
- // camera controls
-
- int framerate() const;
- void setFrameRate(int rate);
- int brightness() const;
- void setBrightness(int b);
- int contrast() const;
- void setContrast(int c);
- int saturation() const;
- void setSaturation(int s);
- int hue() const;
- void setHue(int h);
- int sharpness() const;
- void setSharpness(int s);
- int zoom() const;
- void setZoom(int z);
- bool backlightCompensation() const;
- void setBacklightCompensation(bool);
- int whitelevel() const;
- void setWhitelevel(int w);
- int rotation() const;
- void setRotation(int r);
- bool flash() const;
- void setFlash(bool f);
- bool autofocus() const;
- void setAutofocus(bool f);
-
- QSize frameSize() const;
- void setFrameSize(const QSize& s);
- void setDevice(const QString &device);
- QList<QVideoFrame::PixelFormat> supportedPixelFormats();
- QVideoFrame::PixelFormat pixelFormat() const;
- void setPixelFormat(QVideoFrame::PixelFormat fmt);
- QList<QSize> supportedResolutions();
-
- // media control
-
- bool setOutputLocation(const QUrl &sink);
- QUrl outputLocation() const;
- qint64 position() const;
- QMediaRecorder::State state() const;
- void record();
- void pause();
- void stop();
-
- void setSurface(QAbstractVideoSurface* surface);
-
- void captureImage(const QString &fileName);
-
- void previewMode(bool value);
- void captureToFile(bool value);
-
-Q_SIGNALS:
- void durationChanged(qint64 position);
- void error(int error, const QString &errorString);
- void cameraStateChanged(QCamera::State);
- void recordStateChanged(QMediaRecorder::State);
- void imageCaptured(const QString &fileName, const QImage &img);
-
-private Q_SLOTS:
- void captureFrame();
-
-private:
- bool isFormatSupported(QVideoFrame::PixelFormat fmt);
-
- QSocketNotifier *notifier;
- QList<video_buffer> buffers;
-
- int sfd;
- QTime timeStamp;
- bool available;
- bool preview;
- bool toFile;
- bool active;
- QMediaRecorder::State m_state;
- QByteArray m_device;
- QUrl m_sink;
- QFile m_file;
- V4LVideoRenderer* m_output;
- QAbstractVideoSurface* m_surface;
- QVideoFrame::PixelFormat pixelF;
- QVideoFrame::PixelFormat savedPixelF;
- QSize m_windowSize;
- QList<QSize> resolutions;
- QList<unsigned int> formats;
-
- CameraFormatConverter* converter;
-
- QString m_snapshot;
-};
-
-#endif
diff --git a/plugins/multimedia/v4l/camera/v4limagecapturecontrol.cpp b/plugins/multimedia/v4l/camera/v4limagecapturecontrol.cpp
deleted file mode 100644
index 40bf3eb22b..0000000000
--- a/plugins/multimedia/v4l/camera/v4limagecapturecontrol.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "v4limagecapturecontrol.h"
-
-V4LImageCaptureControl::V4LImageCaptureControl(V4LCameraSession *session)
- :QImageCaptureControl(session), m_session(session), m_ready(false)
-{
- connect(m_session, SIGNAL(cameraStateChanged(QCamera::State)), SLOT(updateState()));
- connect(m_session, SIGNAL(imageCaptured(QString,QImage)), this, SIGNAL(imageCaptured(QString,QImage)));
-}
-
-V4LImageCaptureControl::~V4LImageCaptureControl()
-{
-}
-
-bool V4LImageCaptureControl::isReadyForCapture() const
-{
- return m_ready;
-}
-
-void V4LImageCaptureControl::capture(const QString &fileName)
-{
- m_session->captureImage(fileName);
-}
-
-void V4LImageCaptureControl::updateState()
-{
- bool ready = m_session->state() == QMediaRecorder::RecordingState;
- if(m_ready != ready)
- emit readyForCaptureChanged(m_ready = ready);
-}
diff --git a/plugins/multimedia/v4l/camera/v4limagecapturecontrol.h b/plugins/multimedia/v4l/camera/v4limagecapturecontrol.h
deleted file mode 100644
index 53945116ec..0000000000
--- a/plugins/multimedia/v4l/camera/v4limagecapturecontrol.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef V4LIMAGECAPTURECONTROL_H
-#define V4LIMAGECAPTURECONTROL_H
-
-#include <experimental/qimagecapturecontrol.h>
-#include "v4lcamerasession.h"
-QTM_USE_NAMESPACE
-
-class V4LImageCaptureControl : public QImageCaptureControl
-{
- Q_OBJECT
-public:
- V4LImageCaptureControl(V4LCameraSession *session);
- virtual ~V4LImageCaptureControl();
-
- bool isReadyForCapture() const;
- void capture(const QString &fileName);
- void cancelCapture() {}
-
-private slots:
- void updateState();
-
-private:
- V4LCameraSession *m_session;
- bool m_ready;
-};
-
-#endif // V4LCAPTURECONTROL_H
diff --git a/plugins/multimedia/v4l/camera/v4lmediacontainercontrol.cpp b/plugins/multimedia/v4l/camera/v4lmediacontainercontrol.cpp
deleted file mode 100644
index ef6b9e78ef..0000000000
--- a/plugins/multimedia/v4l/camera/v4lmediacontainercontrol.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "v4lmediacontainercontrol.h"
-
-V4LMediaContainerControl::V4LMediaContainerControl(QObject *parent)
- :QMediaContainerControl(parent)
-{
- m_format = "mpeg";
- m_supportedContainers.append("mpeg");
- setContainerMimeType(m_supportedContainers[0]);
-}
-
-
diff --git a/plugins/multimedia/v4l/camera/v4lmediacontainercontrol.h b/plugins/multimedia/v4l/camera/v4lmediacontainercontrol.h
deleted file mode 100644
index 829c4df8a1..0000000000
--- a/plugins/multimedia/v4l/camera/v4lmediacontainercontrol.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef V4LMEDIACONTAINERCONTROL_H
-#define V4LMEDIACONTAINERCONTROL_H
-
-#include <qmediacontainercontrol.h>
-#include <QtCore/qstringlist.h>
-QTM_USE_NAMESPACE
-
-class V4LMediaContainerControl : public QMediaContainerControl
-{
-Q_OBJECT
-public:
- V4LMediaContainerControl(QObject *parent);
- virtual ~V4LMediaContainerControl() {};
-
- virtual QStringList supportedContainers() const { return m_supportedContainers; }
- virtual QString containerMimeType() const { return m_format; }
- virtual void setContainerMimeType(const QString &formatMimeType) { m_format = formatMimeType; }
-
- virtual QString containerDescription(const QString &formatMimeType) const { Q_UNUSED(formatMimeType) return QString(); }
-
-private:
- QString m_format;
- QStringList m_supportedContainers;
-};
-
-#endif // V4LMEDIACONTAINERCONTROL_H
diff --git a/plugins/multimedia/v4l/camera/v4lrecordercontrol.cpp b/plugins/multimedia/v4l/camera/v4lrecordercontrol.cpp
deleted file mode 100644
index 5f2bb809d9..0000000000
--- a/plugins/multimedia/v4l/camera/v4lrecordercontrol.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "v4lrecordercontrol.h"
-
-V4LRecorderControl::V4LRecorderControl(V4LCameraSession *session)
- :QMediaRecorderControl(session), m_session(session), m_state(QMediaRecorder::StoppedState)
-{
- connect(m_session, SIGNAL(recordStateChanged(QMediaRecorder::State)), SLOT(updateState(QMediaRecorder::State)));
- connect(m_session, SIGNAL(error(int,QString)), SIGNAL(error(int,QString)));
- connect(m_session, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
-}
-
-V4LRecorderControl::~V4LRecorderControl()
-{
-}
-
-QUrl V4LRecorderControl::outputLocation() const
-{
- return m_session->outputLocation();
-}
-
-bool V4LRecorderControl::setOutputLocation(const QUrl &sink)
-{
- m_session->setOutputLocation(sink);
- return true;
-}
-
-
-QMediaRecorder::State V4LRecorderControl::state() const
-{
- return m_session->state();
-}
-
-void V4LRecorderControl::updateState(QMediaRecorder::State newState)
-{
- if (m_state != newState) {
- m_state = newState;
- emit stateChanged(m_state);
- }
-}
-
-qint64 V4LRecorderControl::duration() const
-{
- return m_session->position();
-}
-
-void V4LRecorderControl::record()
-{
- m_session->captureToFile(true);
- m_session->record();
-}
-
-void V4LRecorderControl::pause()
-{
- m_session->pause();
-}
-
-void V4LRecorderControl::stop()
-{
- m_session->stop();
- m_session->captureToFile(false);
-}
diff --git a/plugins/multimedia/v4l/camera/v4lrecordercontrol.h b/plugins/multimedia/v4l/camera/v4lrecordercontrol.h
deleted file mode 100644
index d6bf18b473..0000000000
--- a/plugins/multimedia/v4l/camera/v4lrecordercontrol.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef V4LCAPTURECONTROL_H
-#define V4LCAPTURECONTROL_H
-
-#include <qmediarecordercontrol.h>
-#include "v4lcamerasession.h"
-QTM_USE_NAMESPACE
-
-class V4LRecorderControl : public QMediaRecorderControl
-{
- Q_OBJECT
- Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
-
-public:
- V4LRecorderControl(V4LCameraSession *session);
- virtual ~V4LRecorderControl();
-
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl &sink);
-
- QMediaRecorder::State state() const;
-
- qint64 duration() const;
-
- void applySettings() {}
-
-public slots:
- void record();
- void pause();
- void stop();
-
-private slots:
- void updateState(QMediaRecorder::State state);
-
-private:
- V4LCameraSession *m_session;
- QMediaRecorder::State m_state;
-};
-
-#endif // V4LCAPTURECONTROL_H
diff --git a/plugins/multimedia/v4l/camera/v4lvideobuffer.cpp b/plugins/multimedia/v4l/camera/v4lvideobuffer.cpp
deleted file mode 100644
index f9cb35924b..0000000000
--- a/plugins/multimedia/v4l/camera/v4lvideobuffer.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "v4lvideobuffer.h"
-
-#include <linux/types.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-
-
-V4LVideoBuffer::V4LVideoBuffer(unsigned char *buffer, int fd, v4l2_buffer buf)
- : QAbstractVideoBuffer(NoHandle)
- , m_buffer(buffer)
- , m_length(buf.bytesused)
- , m_fd(fd)
- , m_bytesPerLine(0)
- , m_mode(NotMapped)
- , m_buf(buf)
-{
-}
-
-V4LVideoBuffer::~V4LVideoBuffer()
-{
- ioctl(m_fd, VIDIOC_QBUF, &m_buf);
-}
-
-void V4LVideoBuffer::setBytesPerLine(int bytesPerLine)
-{
- m_bytesPerLine = bytesPerLine;
-}
-
-QAbstractVideoBuffer::MapMode V4LVideoBuffer::mapMode() const
-{
- return m_mode;
-}
-
-uchar *V4LVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine)
-{
- if (mode != NotMapped && m_mode == NotMapped) {
- if (numBytes)
- *numBytes = m_length;
-
- m_mode = mode;
-
- if(bytesPerLine)
- *bytesPerLine = m_bytesPerLine;
-
- return m_buffer;
- } else {
- return 0;
- }
-}
-void V4LVideoBuffer::unmap()
-{
- m_mode = NotMapped;
-}
-
diff --git a/plugins/multimedia/v4l/camera/v4lvideobuffer.h b/plugins/multimedia/v4l/camera/v4lvideobuffer.h
deleted file mode 100644
index 06a10df231..0000000000
--- a/plugins/multimedia/v4l/camera/v4lvideobuffer.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef V4LVIDEOBUFFER_H
-#define V4LVIDEOBUFFER_H
-
-#include <QtCore/qsize.h>
-#include <QtMultimedia/QAbstractVideoBuffer>
-
-#include <linux/types.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <linux/videodev2.h>
-
-class V4LVideoBuffer : public QAbstractVideoBuffer
-{
-public:
- V4LVideoBuffer(unsigned char *buffer, int fd, v4l2_buffer buf);
- ~V4LVideoBuffer();
-
- MapMode mapMode() const;
-
- uchar *map(MapMode mode, int *numBytes, int *bytesPerLine);
- void unmap();
-
- void setBytesPerLine(int bytesPerLine);
-
-private:
- unsigned char *m_buffer;
- int m_length;
- int m_fd;
- int m_bytesPerLine;
- MapMode m_mode;
- v4l2_buffer m_buf;
-};
-
-
-#endif
diff --git a/plugins/multimedia/v4l/camera/v4lvideodevicecontrol.cpp b/plugins/multimedia/v4l/camera/v4lvideodevicecontrol.cpp
deleted file mode 100644
index 5ca4f4852e..0000000000
--- a/plugins/multimedia/v4l/camera/v4lvideodevicecontrol.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qfile.h>
-#include <QtCore/qdir.h>
-#include <QtGui/qicon.h>
-
-#include "v4lvideodevicecontrol.h"
-#include "v4lcamerasession.h"
-
-V4LVideoDeviceControl::V4LVideoDeviceControl(QObject *parent)
- : QVideoDeviceControl(parent)
-{
- m_session = qobject_cast<V4LCameraSession*>(parent);
-
- QDir cameras = QDir::root();
- cameras.setFilter(QDir::NoDotAndDotDot | QDir::AllEntries);
- if (!cameras.cd("sys/class/video4linux"))
- return;
- else {
- QFileInfoList list = cameras.entryInfoList();
- for (int i = 0; i < list.size(); ++i) {
- QFileInfo fileInfo = list.at(i);
- if (fileInfo.fileName().contains(QLatin1String("video"))) {
- QString videoName = QString("%1/%2/name").arg("/sys/class/video4linux").
- arg(fileInfo.fileName());
- QFile videoFile(videoName);
- if (videoFile.exists()) {
- if (videoFile.open(QIODevice::ReadOnly)) {
- char str[31];
- memset(str,0,31);
- if (videoFile.read(str,30) > 0) {
- devices.append(QString("v4l:/dev/%1").arg(fileInfo.fileName()).
- toLocal8Bit().constData());
- descriptions.append(QString(str).simplified());
- }
- videoFile.close();
- }
- }
- }
- }
- }
- selected = 0;
-}
-
-int V4LVideoDeviceControl::deviceCount() const
-{
- return devices.count();
-}
-
-QString V4LVideoDeviceControl::deviceName(int index) const
-{
- if(index >= 0 && index <= devices.count())
- return devices.at(index);
-
- return QString();
-}
-
-QString V4LVideoDeviceControl::deviceDescription(int index) const
-{
- if(index >= 0 && index <= descriptions.count())
- return descriptions.at(index);
-
- return QString();
-}
-
-QIcon V4LVideoDeviceControl::deviceIcon(int index) const
-{
- Q_UNUSED(index)
-
- return QIcon();
-}
-
-int V4LVideoDeviceControl::defaultDevice() const
-{
- return 0;
-}
-
-int V4LVideoDeviceControl::selectedDevice() const
-{
- return selected;
-}
-
-void V4LVideoDeviceControl::setSelectedDevice(int index)
-{
- if(index >= 0 && index <= devices.count()) {
- if (m_session) {
- QString device = devices.at(index);
- if (device.startsWith("v4l:"))
- device.remove(0,4);
- m_session->setDevice(device);
- }
- selected = index;
- }
-}
-
diff --git a/plugins/multimedia/v4l/camera/v4lvideodevicecontrol.h b/plugins/multimedia/v4l/camera/v4lvideodevicecontrol.h
deleted file mode 100644
index c70acd3e9a..0000000000
--- a/plugins/multimedia/v4l/camera/v4lvideodevicecontrol.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef V4LVIDEODEVICECONTROL_H
-#define V4LVIDEODEVICECONTROL_H
-
-#include <qvideodevicecontrol.h>
-QTM_USE_NAMESPACE
-
-class V4LCameraSession;
-
-class V4LVideoDeviceControl : public QVideoDeviceControl
-{
- Q_OBJECT
-public:
- V4LVideoDeviceControl(QObject *parent = 0);
-
- int deviceCount() const;
- QString deviceName(int index) const;
- QString deviceDescription(int index) const;
- QIcon deviceIcon(int index) const;
- int defaultDevice() const;
- int selectedDevice() const;
-
-public Q_SLOTS:
- void setSelectedDevice(int index);
-
-private:
- V4LCameraSession* m_session;
-
- QList<QString> devices;
- QList<QString> descriptions;
-
- int selected;
-};
-
-#endif
diff --git a/plugins/multimedia/v4l/camera/v4lvideoencode.cpp b/plugins/multimedia/v4l/camera/v4lvideoencode.cpp
deleted file mode 100644
index dd03861db9..0000000000
--- a/plugins/multimedia/v4l/camera/v4lvideoencode.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "v4lvideoencode.h"
-#include "v4lcamerasession.h"
-
-V4LVideoEncode::V4LVideoEncode(QObject *parent)
- :QVideoEncoderControl(parent)
-{
- m_session = qobject_cast<V4LCameraSession*>(parent);
-
- m_codecs.append("video/mj2");
- m_codecDescriptions.insert("video/mj2",QString("Motion JPEG"));
- m_videoSettings.setCodec(m_codecs[0]);
-}
-
-V4LVideoEncode::~V4LVideoEncode()
-{
-}
-
-QList<QSize> V4LVideoEncode::supportedResolutions(const QVideoEncoderSettings &, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- if(m_session)
- return m_session->supportedResolutions();
-
- QList<QSize> res;
- return res;
-}
-
-
-QList< qreal > V4LVideoEncode::supportedFrameRates(const QVideoEncoderSettings &, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- QList<qreal> res;
- res << 24.0 << 12.0;
- return res;
-}
-
-QStringList V4LVideoEncode::supportedVideoCodecs() const
-{
- return m_codecs;
-}
-
-QString V4LVideoEncode::videoCodecDescription(const QString &codecName) const
-{
- Q_UNUSED(codecName)
-
- return QString("Motion JPEG");
-}
-
-QStringList V4LVideoEncode::supportedEncodingOptions(const QString &codec) const
-{
- Q_UNUSED(codec)
-
- return QStringList();
-}
-
-QVariant V4LVideoEncode::encodingOption(const QString &codec, const QString &name) const
-{
- Q_UNUSED(codec)
- Q_UNUSED(name)
-
- return QVariant();
-}
-
-void V4LVideoEncode::setEncodingOption(
- const QString &codec, const QString &name, const QVariant &value)
-{
- Q_UNUSED(codec)
- Q_UNUSED(name)
- Q_UNUSED(value)
-}
-
-QVideoEncoderSettings V4LVideoEncode::videoSettings() const
-{
- return m_videoSettings;
-}
-
-void V4LVideoEncode::setVideoSettings(const QVideoEncoderSettings &settings)
-{
- m_videoSettings = settings;
-}
-
diff --git a/plugins/multimedia/v4l/camera/v4lvideoencode.h b/plugins/multimedia/v4l/camera/v4lvideoencode.h
deleted file mode 100644
index 6b112aefe1..0000000000
--- a/plugins/multimedia/v4l/camera/v4lvideoencode.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef V4LVIDEOENCODE_H
-#define V4LVIDEOENCODE_H
-
-#include <qvideoencodercontrol.h>
-class V4LCameraSession;
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-QTM_USE_NAMESPACE
-
-class V4LVideoEncode : public QVideoEncoderControl
-{
- Q_OBJECT
-public:
- V4LVideoEncode(QObject *parent);
- virtual ~V4LVideoEncode();
-
- QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
-
- QList< qreal > supportedFrameRates(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
-
- QPair<int,int> rateAsRational() const;
-
- QStringList supportedVideoCodecs() const;
- QString videoCodecDescription(const QString &codecName) const;
-
- QVideoEncoderSettings videoSettings() const;
- void setVideoSettings(const QVideoEncoderSettings &settings);
-
- QStringList supportedEncodingOptions(const QString &codec) const;
- QVariant encodingOption(const QString &codec, const QString &name) const;
- void setEncodingOption(const QString &codec, const QString &name, const QVariant &value);
-
-private:
- V4LCameraSession *m_session;
- QStringList m_codecs;
- QMap<QString,QString> m_codecDescriptions;
- QMap<QString,QByteArray> m_elementNames;
- QMap<QString,QStringList> m_codecOptions;
-
- QVideoEncoderSettings m_videoSettings;
- QMap<QString, QMap<QString, QVariant> > m_options;
-};
-
-#endif
diff --git a/plugins/multimedia/v4l/camera/v4lvideooutputcontrol.cpp b/plugins/multimedia/v4l/camera/v4lvideooutputcontrol.cpp
deleted file mode 100644
index 3d197220e9..0000000000
--- a/plugins/multimedia/v4l/camera/v4lvideooutputcontrol.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "v4lvideooutputcontrol.h"
-
-V4LVideoOutputControl::V4LVideoOutputControl(QObject *parent)
- : QVideoOutputControl(parent)
- , m_output(NoOutput)
-{
- m_outputs.append(QVideoOutputControl::RendererOutput);
-}
-
-QList<QVideoOutputControl::Output> V4LVideoOutputControl::availableOutputs() const
-{
- return m_outputs;
-}
-
-QVideoOutputControl::Output V4LVideoOutputControl::output() const
-{
- return m_output;
-}
-
-void V4LVideoOutputControl::setOutput(Output output)
-{
- if (!m_outputs.contains(output))
- output = NoOutput;
-
- emit availableOutputsChanged(m_outputs);
-}
diff --git a/plugins/multimedia/v4l/camera/v4lvideooutputcontrol.h b/plugins/multimedia/v4l/camera/v4lvideooutputcontrol.h
deleted file mode 100644
index bb63193ec8..0000000000
--- a/plugins/multimedia/v4l/camera/v4lvideooutputcontrol.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef V4LVIDEOOUTPUTCONTROL_H
-#define V4LVIDEOOUTPUTCONTROL_H
-
-#include <qvideooutputcontrol.h>
-QTM_USE_NAMESPACE
-
-class V4LVideoOutputControl : public QVideoOutputControl
-{
- Q_OBJECT
-public:
- V4LVideoOutputControl(QObject *parent = 0);
-
- QList<Output> availableOutputs() const;
-
- Output output() const;
- void setOutput(Output output);
-
-private:
- QList<Output> m_outputs;
- Output m_output;
-};
-
-#endif
diff --git a/plugins/multimedia/v4l/camera/v4lvideorenderer.cpp b/plugins/multimedia/v4l/camera/v4lvideorenderer.cpp
deleted file mode 100644
index dd528aa32d..0000000000
--- a/plugins/multimedia/v4l/camera/v4lvideorenderer.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "v4lvideorenderer.h"
-
-V4LVideoRendererControl::V4LVideoRendererControl(V4LCameraSession* session, QObject *parent)
- :QVideoRendererControl(parent),
- m_surface(0),
- m_session(session)
-{
-}
-
-V4LVideoRendererControl::~V4LVideoRendererControl()
-{
-}
-
-QAbstractVideoSurface* V4LVideoRendererControl::surface() const
-{
- return m_surface;
-}
-
-void V4LVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
-{
- m_surface = surface;
- if(m_session)
- m_session->setSurface(m_surface);
-}
diff --git a/plugins/multimedia/v4l/camera/v4lvideorenderer.h b/plugins/multimedia/v4l/camera/v4lvideorenderer.h
deleted file mode 100644
index 9a4e2bfb4d..0000000000
--- a/plugins/multimedia/v4l/camera/v4lvideorenderer.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef V4LVIDEORENDERER_H
-#define V4LVIDEORENDERER_H
-
-#include <qvideorenderercontrol.h>
-#include "v4lcamerasession.h"
-QTM_USE_NAMESPACE
-
-class CameraFormatConverter;
-
-class V4LVideoRendererControl : public QVideoRendererControl
-{
- Q_OBJECT
-public:
- V4LVideoRendererControl(V4LCameraSession* session, QObject *parent = 0);
- ~V4LVideoRendererControl();
-
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
-
- void setSession(V4LCameraSession* session);
-
-private:
- QAbstractVideoSurface* m_surface;
- V4LCameraSession* m_session;
- CameraFormatConverter* converter;
-};
-
-#endif // V4LVIDEORENDERER_H
diff --git a/plugins/multimedia/v4l/v4l.pro b/plugins/multimedia/v4l/v4l.pro
index 17a7fa0f44..a8a5aa3875 100644
--- a/plugins/multimedia/v4l/v4l.pro
+++ b/plugins/multimedia/v4l/v4l.pro
@@ -17,7 +17,6 @@ HEADERS += v4lserviceplugin.h
SOURCES += v4lserviceplugin.cpp
include(radio/radio.pri)
-include(camera/camera.pri)
target.path=$$QT_MOBILITY_PREFIX/plugins/mediaservice
INSTALLS+=target
diff --git a/plugins/multimedia/v4l/v4lserviceplugin.cpp b/plugins/multimedia/v4l/v4lserviceplugin.cpp
index 041e493eaa..4e07b588d8 100644
--- a/plugins/multimedia/v4l/v4lserviceplugin.cpp
+++ b/plugins/multimedia/v4l/v4lserviceplugin.cpp
@@ -45,7 +45,6 @@
#include <QtCore/qdir.h>
#include "v4lserviceplugin.h"
-#include "v4lcameraservice.h"
#include "v4lradioservice.h"
#include <qmediaserviceprovider.h>
@@ -54,8 +53,7 @@
QStringList V4LServicePlugin::keys() const
{
return QStringList() <<
- QLatin1String(Q_MEDIASERVICE_RADIO) <<
- QLatin1String(Q_MEDIASERVICE_CAMERA);
+ QLatin1String(Q_MEDIASERVICE_RADIO);
}
QMediaService* V4LServicePlugin::create(QString const& key)
@@ -63,9 +61,6 @@ QMediaService* V4LServicePlugin::create(QString const& key)
if (key == QLatin1String(Q_MEDIASERVICE_RADIO))
return new V4LRadioService;
- if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
- return new V4LCameraService;
-
return 0;
}
@@ -76,64 +71,14 @@ void V4LServicePlugin::release(QMediaService *service)
QList<QByteArray> V4LServicePlugin::devices(const QByteArray &service) const
{
- if (service == Q_MEDIASERVICE_CAMERA) {
- if (m_cameraDevices.isEmpty())
- updateDevices();
-
- return m_cameraDevices;
- }
-
return QList<QByteArray>();
}
QString V4LServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
{
- if (service == Q_MEDIASERVICE_CAMERA) {
- if (m_cameraDevices.isEmpty())
- updateDevices();
-
- for (int i=0; i<m_cameraDevices.count(); i++)
- if (m_cameraDevices[i] == device)
- return m_cameraDescriptions[i];
- }
-
return QString();
}
-void V4LServicePlugin::updateDevices() const
-{
- m_cameraDevices.clear();
- m_cameraDescriptions.clear();
-
- QDir cameras = QDir::root();
- cameras.setFilter(QDir::NoDotAndDotDot | QDir::AllEntries);
- if (!cameras.cd("sys/class/video4linux"))
- return;
- else {
- QFileInfoList list = cameras.entryInfoList();
- for (int i = 0; i < list.size(); ++i) {
- QFileInfo fileInfo = list.at(i);
- if (fileInfo.fileName().contains(QLatin1String("video"))) {
- QString videoName = QString("%1/%2/name").arg("/sys/class/video4linux").
- arg(fileInfo.fileName());
- QFile videoFile(videoName);
- if (videoFile.exists()) {
- if (videoFile.open(QIODevice::ReadOnly)) {
- char str[31];
- memset(str,0,31);
- if (videoFile.read(str,30) > 0) {
- m_cameraDevices.append(QString("v4l:/dev/%1").arg(fileInfo.fileName()).
- toLocal8Bit().constData());
- m_cameraDescriptions.append(QString(str).simplified());
- }
- videoFile.close();
- }
- }
- }
- }
- }
-}
-
Q_EXPORT_PLUGIN2(v4lengine, V4LServicePlugin);
diff --git a/plugins/multimedia/v4l/v4lserviceplugin.h b/plugins/multimedia/v4l/v4lserviceplugin.h
index a9e0ad4dd2..d361360741 100644
--- a/plugins/multimedia/v4l/v4lserviceplugin.h
+++ b/plugins/multimedia/v4l/v4lserviceplugin.h
@@ -58,12 +58,6 @@ public:
QList<QByteArray> devices(const QByteArray &service) const;
QString deviceDescription(const QByteArray &service, const QByteArray &device);
-
-private:
- void updateDevices() const;
-
- mutable QList<QByteArray> m_cameraDevices;
- mutable QStringList m_cameraDescriptions;
};
#endif // V4LSERVICEPLUGIN_H