1 /***************************************************************************
2 * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
3 * Based on code by Arendt David <admin@prnet.org> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (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 *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
28 #include <linux/input.h>
30 #include <media_ctrl/mediactrl.h>
32 typedef struct input_event EV;
34 class ShuttleThread : public QThread
39 void init(QObject *parent, const QString &device);
43 unsigned short jogvalue;
45 volatile bool stop_me;
50 void handle_event(const struct media_ctrl_event& ev);
51 void jog(const struct media_ctrl_event& ev);
52 void shuttle(const struct media_ctrl_event& ev);
53 void key(const struct media_ctrl_event& ev);
56 void handle_event(EV ev);
57 void jog(unsigned int value);
58 void shuttle(int value);
59 void key(unsigned short code, unsigned int value);
63 typedef QMap<QString, QString> DeviceMap;
64 typedef QMap<QString, QString>::iterator DeviceMapIter;
66 class JogShuttle: public QObject
70 explicit JogShuttle(const QString &device, QObject * parent = 0);
73 void initDevice(const QString &device);
74 static QString canonicalDevice(const QString& device);
75 static DeviceMap enumerateDevices(const QString& devPath);
76 static int keysCount(const QString& devPath);
79 virtual void customEvent(QEvent * e);
82 ShuttleThread m_shuttleProcess;