]> git.sesse.net Git - kdenlive/blob - src/v4l/v4lcapture.cpp
Complete rewrite of the video4linux capture to use MLT, in progress.
[kdenlive] / src / v4l / v4lcapture.cpp
1 /***************************************************************************
2  *   Copyright (C) 2010 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <pthread.h>
24 #include <unistd.h>
25 #include <fcntl.h>
26
27 #include <QDebug>
28 #include <QImage>
29 #include <QTimer>
30 #include <QPainter>
31
32 #include <KDebug>
33 #include <KLocale>
34
35 #include "v4lcapture.h"
36 #include "kdenlivesettings.h"
37
38
39 V4lCaptureHandler::V4lCaptureHandler()
40 {
41 }
42
43 //static
44
45 QStringList V4lCaptureHandler::getDeviceName(QString input)
46 {
47     src_t v4lsrc;
48
49     /* Set source options... */
50     memset(&v4lsrc, 0, sizeof(v4lsrc));
51     v4lsrc.input      = NULL;
52     v4lsrc.tuner      = 0;
53     v4lsrc.frequency  = 0;
54     v4lsrc.delay      = 0;
55     v4lsrc.timeout    = 10; /* seconds */
56     v4lsrc.use_read   = 0;
57     v4lsrc.list       = 0;
58     v4lsrc.palette    = SRC_PAL_ANY;
59     v4lsrc.width      = 384;
60     v4lsrc.height     = 288;
61     v4lsrc.fps        = 0;
62     v4lsrc.option     = NULL;
63     v4lsrc.source     = strdup(input.toUtf8().constData());
64     char *pixelformatdescription;
65     pixelformatdescription = (char *) calloc(2048, sizeof(char));
66     QString deviceName(query_v4ldevice(&v4lsrc, &pixelformatdescription));
67     QString info(pixelformatdescription);
68     free (pixelformatdescription);
69     QStringList result;
70     result << (deviceName.isEmpty() ? input : deviceName) << info;
71     return result;
72 }
73
74
75