1
/* qv4l2: a control panel controlling v4l2 devices.
3
* Copyright (C) 2006 Hans Verkuil <hverkuil@xs4all.nl>
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#include <QMainWindow>
25
#include <QSignalMapper>
27
#include <QGridLayout>
28
#include <QSocketNotifier>
41
typedef std::vector<unsigned> ClassIDVec;
42
typedef std::map<unsigned, ClassIDVec> ClassMap;
43
typedef std::map<unsigned, struct v4l2_queryctrl> CtrlMap;
44
typedef std::map<unsigned, QWidget *> WidgetMap;
47
CTRL_UPDATE_ON_CHANGE = 0x10,
65
class ApplicationWindow: public QMainWindow, public v4l2
71
virtual ~ApplicationWindow();
75
void closeCaptureWin();
78
void setDevice(const QString &device, bool rawOpen);
82
CaptureWin *m_capture;
84
bool startCapture(unsigned buffer_size);
86
void startOutput(unsigned buffer_size);
88
struct buffer *m_buffers;
89
struct v4l2_format m_capSrcFormat;
90
struct v4l2_format m_capDestFormat;
91
unsigned char *m_frameData;
93
struct v4lconvert_data *m_convertData;
94
CapMethod m_capMethod;
104
void ctrlAction(int);
109
virtual void error(const QString &text);
111
void errorCtrl(unsigned id, int err);
112
void errorCtrl(unsigned id, int err, long long v);
113
void info(const QString &info);
114
virtual void closeEvent(QCloseEvent *event);
117
void addWidget(QGridLayout *grid, QWidget *w, Qt::Alignment align = Qt::AlignLeft);
118
void addLabel(QGridLayout *grid, const QString &text, Qt::Alignment align = Qt::AlignRight)
120
addWidget(grid, new QLabel(text, parentWidget()), align);
123
void finishGrid(QGridLayout *grid, unsigned ctrl_class);
124
void addCtrl(QGridLayout *grid, const struct v4l2_queryctrl &qctrl);
125
void updateCtrl(unsigned id);
126
void refresh(unsigned ctrl_class);
127
void setDefaults(unsigned ctrl_class);
128
int getVal(unsigned id);
129
long long getVal64(unsigned id);
130
void setVal(unsigned id, int v);
131
void setVal64(unsigned id, long long v);
132
QString getCtrlFlags(unsigned flags);
133
void setWhat(QWidget *w, unsigned id, long long v);
134
void updateVideoInput();
135
void updateVideoOutput();
136
void updateAudioInput();
137
void updateAudioOutput();
138
void updateStandard();
140
void updateFreqChannel();
142
GeneralTab *m_genTab;
143
QAction *m_capStartAct;
145
QSignalMapper *m_sigMapper;
147
QSocketNotifier *m_capNotifier;
149
int m_row, m_col, m_cols;
151
WidgetMap m_widgetMap;
155
extern ApplicationWindow *g_mw;