]> git.sesse.net Git - kdenlive/blobdiff - src/jogshuttle.h
jogshuttle: cmake files cleaned up a little bit
[kdenlive] / src / jogshuttle.h
index 7503bcfb8f5be7a6e05079a3abbe468d02a4fdb0..36e1f4c8df435725f66149b98a5ea2d1a7ee3940 100644 (file)
 #ifndef SHUTTLE_H
 #define SHUTTLE_H
 
-#include <qthread.h>
+#include <QThread>
 #include <QObject>
+#include <QMap>
 
 #include <linux/input.h>
-
+#include <sys/time.h>
+#include <media_ctrl/mediactrl.h>
 
 typedef struct input_event EV;
 
@@ -34,31 +36,41 @@ class ShuttleThread : public QThread
 
 public:
     virtual void run();
-    void init(QObject *parent, QString device);
+    void init(QObject *parent, const QString &device);
     QObject *m_parent;
     int shuttlevalue;
-    bool shuttlechange;
+    int shuttlecounter;
     unsigned short jogvalue;
     bool isWorking();
-    bool stop_me;
+    volatile bool stop_me;
     QString m_device;
 
 private:
     bool m_isWorking;
     void handle_event(EV ev);
+    void handle_event(struct media_ctrl_event ev);
+    void jog(struct media_ctrl_event ev);
     void jog(unsigned int value);
     void shuttle(int value);
+    void shuttle(struct media_ctrl_event ev);
     void key(unsigned short code, unsigned int value);
+    void key(struct media_ctrl_event ev);
 };
 
+typedef QMap<QString, QString> DeviceMap;
+typedef QMap<QString, QString>::iterator DeviceMapIter;
 
 class JogShuttle: public QObject
 {
-Q_OBJECT public:
-    explicit JogShuttle(QString device, QObject * parent = 0);
+    Q_OBJECT
+public:
+    explicit JogShuttle(const QString &device, QObject * parent = 0);
     ~JogShuttle();
     void stopDevice();
-    void initDevice(QString device);
+    void initDevice(const QString &device);
+    static QString enumerateDevice(const QString& device);
+    static DeviceMap enumerateDevices(const QString& devPath);
+    static int keysCount(const QString& devPath);
 
 protected:
     virtual void customEvent(QEvent * e);
@@ -67,11 +79,9 @@ private:
     ShuttleThread m_shuttleProcess;
 
 signals:
-    void rewind1();
-    void forward1();
-    void rewind(double);
-    void forward(double);
-    void stop();
+    void jogBack();
+    void jogForward();
+    void shuttlePos(int);
     void button(int);
 };