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(EV ev);
51 void handle_event(struct media_ctrl_event ev);
52 void jog(struct media_ctrl_event ev);
53 void jog(unsigned int value);
54 void shuttle(int value);
55 void shuttle(struct media_ctrl_event ev);
56 void key(unsigned short code, unsigned int value);
57 void key(struct media_ctrl_event ev);
60 typedef QMap<QString, QString> DeviceMap;
61 typedef QMap<QString, QString>::iterator DeviceMapIter;
63 class JogShuttle: public QObject
67 explicit JogShuttle(const QString &device, QObject * parent = 0);
70 void initDevice(const QString &device);
71 static QString canonicalDevice(const QString& device);
72 static DeviceMap enumerateDevices(const QString& devPath);
73 static int keysCount(const QString& devPath);
76 virtual void customEvent(QEvent * e);
79 ShuttleThread m_shuttleProcess;