]> git.sesse.net Git - kdenlive/blob - src/lib/external/media_ctrl/mediactrl.h
mediactrl: update address of GPL foundation
[kdenlive] / src / lib / external / media_ctrl / mediactrl.h
1 /*
2 * mediactrl.c -- Jog Shuttle device support
3 * Copyright (C) 2001-2007 Dan Dennedy <dan@dennedy.org>
4 *
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.
9 *
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.
14 *
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 */
20
21 #ifndef _MEDIA_CTRL_H
22 #define _MEDIA_CTRL_H
23
24
25 // just to make the code more readable
26 #define KEY_RELEASE                     0x00
27 #define KEY_PRESS                       0x01
28
29 // not used yet
30 #define MEDIA_ST_ACTIVE                 0x02
31 #define MEDIA_ST_INACTIVE               0x01
32
33 // media ctrl event types
34 #define MEDIA_CTRL_EVENT_NONE           0x00
35 #define MEDIA_CTRL_EVENT_KEY            0x01
36 #define MEDIA_CTRL_EVENT_JOG            0x02
37 #define MEDIA_CTRL_EVENT_SHUTTLE        0x03
38 #define MEDIA_CTRL_EVENT_STICK          0x04
39
40 // the disconnect event - not used yet
41 #define MEDIA_CTRL_DISCONNECT           0x01
42
43 #define MEDIA_CTRL_SHIFT                0x01
44
45 #define MEDIA_CTRL_PLAY                 0x10
46 #define MEDIA_CTRL_PLAY_FWD             0x10
47 #define MEDIA_CTRL_REVERSE              0x11
48 #define MEDIA_CTRL_PLAY_REV             0x11
49 #define MEDIA_CTRL_STOP                 0x12
50 #define MEDIA_CTRL_PAUSE                0x13
51 #define MEDIA_CTRL_NEXT                 0x14
52 #define MEDIA_CTRL_PREV                 0x15
53 #define MEDIA_CTRL_RECORD               0x16
54 #define MEDIA_CTRL_FAST_FORWARD         0x17
55 #define MEDIA_CTRL_REWIND               0x18
56
57 #define MEDIA_CTRL_STICK_LEFT           0x20
58 #define MEDIA_CTRL_STICK_RIGHT          0x21
59 #define MEDIA_CTRL_STICK_UP             0x22
60 #define MEDIA_CTRL_STICK_DOWN           0x23
61
62 /* function keys, usually at top of device */
63 #define MEDIA_CTRL_F1                   0x100
64 #define MEDIA_CTRL_F2                   0x101
65 #define MEDIA_CTRL_F3                   0x102
66 #define MEDIA_CTRL_F4                   0x103
67 #define MEDIA_CTRL_F5                   0x104
68 #define MEDIA_CTRL_F6                   0x105
69 #define MEDIA_CTRL_F7                   0x106
70 #define MEDIA_CTRL_F8                   0x107
71 #define MEDIA_CTRL_F9                   0x108
72 #define MEDIA_CTRL_F10                  0x109
73 #define MEDIA_CTRL_F11                  0x10a
74 #define MEDIA_CTRL_F12                  0x10b
75 #define MEDIA_CTRL_F13                  0x10c
76 #define MEDIA_CTRL_F14                  0x10d
77 #define MEDIA_CTRL_F15                  0x10e
78 #define MEDIA_CTRL_F16                  0x10f
79
80 #define MEDIA_CTRL_B1                   0x110
81 #define MEDIA_CTRL_B2                   0x111
82 #define MEDIA_CTRL_B3                   0x112
83 #define MEDIA_CTRL_B4                   0x113
84 #define MEDIA_CTRL_B5                   0x114
85 #define MEDIA_CTRL_B6                   0x115
86 #define MEDIA_CTRL_B7                   0x116
87 #define MEDIA_CTRL_B8                   0x117
88 #define MEDIA_CTRL_B9                   0x118
89 #define MEDIA_CTRL_B10                  0x119
90 #define MEDIA_CTRL_B11                  0x11a
91 #define MEDIA_CTRL_B12                  0x11b
92 #define MEDIA_CTRL_B13                  0x11c
93 #define MEDIA_CTRL_B14                  0x11d
94 #define MEDIA_CTRL_B15                  0x11e
95 #define MEDIA_CTRL_B16                  0x11f
96
97 #ifdef __cplusplus
98 extern "C" {
99 #endif
100
101 struct media_ctrl_device;
102
103 struct media_ctrl_key {
104         int key;  // internal keycode - do not use
105         const char *name;
106         int code; // eventcode
107 //      int action;
108 };
109
110 struct media_ctrl_event {
111         struct timeval time;
112         unsigned short type;
113         unsigned short code;
114         char *name;
115         int value;
116         unsigned short index;
117 };
118
119 struct media_ctrl {
120         
121         int fd;
122         int eventno;
123         
124         int status;
125
126         struct media_ctrl_device *device;
127
128         long jogpos;
129         int  shuttlepos;
130         
131         int lastval;
132         int lastshu;
133         
134         int jogrel; // accumulate relative values if events come too fast
135         unsigned long last_jog_time; // last jog event
136
137 };
138
139 struct media_ctrl_device {
140         int vendor;
141         int product;
142         const char *name;
143         struct media_ctrl_key *keys;
144         void (*translate)(struct media_ctrl *ctrl, struct input_event *ev, struct media_ctrl_event *me);
145 };
146
147 void media_ctrl_open(struct media_ctrl *);
148 void media_ctrl_open2(struct media_ctrl *, const char *devname);
149 void media_ctrl_close(struct media_ctrl *);
150 void media_ctrl_read_event(struct media_ctrl *, struct media_ctrl_event *);
151
152 struct  media_ctrl_key *media_ctrl_get_keys(struct media_ctrl *);
153 int media_ctrl_get_keys_count(struct media_ctrl *);
154
155 #ifdef __cplusplus
156 }
157 #endif
158
159 #endif