-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathx_edit_marks.diff
384 lines (377 loc) · 14.3 KB
/
x_edit_marks.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
diff -Nur vdr-1.7.35.orig/menu.c vdr-1.7.35/menu.c
--- vdr-1.7.35.orig/menu.c 2013-01-06 14:17:16.294348853 +0100
+++ vdr-1.7.35/menu.c 2013-01-06 14:47:22.374362432 +0100
@@ -5156,10 +5156,6 @@
case kGreen: SkipSeconds(-60); break;
case kYellow|k_Repeat:
case kYellow: SkipSeconds( 60); break;
- case k1|k_Repeat:
- case k1: SkipSeconds(-20); break;
- case k3|k_Repeat:
- case k3: SkipSeconds( 20); break;
case kPrev|k_Repeat:
case kPrev: if (lastSkipTimeout.TimedOut()) {
lastSkipSeconds = REPLAYCONTROLSKIPSECONDS;
@@ -5187,10 +5183,46 @@
Stop();
return osEnd;
default: {
+ bool play, forward;
+ int speed;
+ int Current, Total;
+ cMark *m;
+
DoShowMode = false;
switch (int(Key)) {
// Editing:
- case kMarkToggle: MarkToggle(); break;
+ case k1|k_Repeat:
+ case k1: if (GetReplayMode(play, forward, speed) && !play && GetIndex(Current, Total) && (m = marks.Get(Current)) != NULL) {
+ displayFrames = true;
+ int p = SkipFrames(-SecondsToFrames(5, FramesPerSecond()));
+ cMark *m2;
+ if ((m2 = marks.Prev(m)) != NULL && m2->Position() >= p)
+ break;
+ m->SetPosition(p); Goto(p, true);
+ marks.Save();
+ }
+ else
+ SkipSeconds(-20);
+ break;
+ case k3|k_Repeat:
+ case k3: if (GetReplayMode(play, forward, speed) && !play && GetIndex(Current, Total) && (m = marks.Get(Current)) != NULL) {
+ displayFrames = true;
+ int p = SkipFrames(SecondsToFrames(5, FramesPerSecond()));
+ cMark *m2;
+ if ((m2 = marks.Next(m)) != NULL && m2->Position() <= p)
+ break;
+ m->SetPosition(p); Goto(p, true);
+ marks.Save();
+ }
+ else
+ SkipSeconds(20);
+ break;
+ case kMarkToggle: if (GetReplayMode(play, forward, speed) && play) {
+ displayFrames = true;
+ Pause();
+ }
+ MarkToggle();
+ break;
case kMarkJumpBack|k_Repeat:
case kMarkJumpBack: MarkJump(false); break;
case kMarkJumpForward|k_Repeat:
diff -Nur vdr-1.7.35.orig/menu.c.orig vdr-1.7.35/menu.c.orig
--- vdr-1.7.35.orig/menu.c.orig 2013-01-06 13:57:44.294331278 +0100
+++ vdr-1.7.35/menu.c.orig 2013-01-06 14:17:16.294348853 +0100
@@ -18,6 +18,7 @@
#include "config.h"
#include "cutter.h"
#include "eitscan.h"
+#include "filetransfer.h"
#include "i18n.h"
#include "interface.h"
#include "plugin.h"
@@ -2218,6 +2219,167 @@
DisplayMenu->SetItem(Text(), Index, Current, Selectable);
}
+// --- cMenuEditRecording ----------------------------------------------------
+
+class cMenuEditRecording : public cOsdMenu {
+private:
+ char name[MaxFileName];
+ cMenuEditStrItem *file;
+ cOsdItem *marksItem, *resumeItem;
+ bool isResume, isMarks;
+ cRecording *recording;
+ void SetHelpKeys(void);
+ eOSState SetFolder(void);
+public:
+ cMenuEditRecording(cRecording *Recording);
+ virtual eOSState ProcessKey(eKeys Key);
+};
+
+cMenuEditRecording::cMenuEditRecording(cRecording *Recording)
+:cOsdMenu(tr("Edit recording"), 14)
+{
+ cMarks marks;
+
+ file = NULL;
+ recording = Recording;
+
+ if (recording) {
+ Utf8Strn0Cpy(name, recording->Name(), sizeof(name));
+ Add(file = new cMenuEditStrItem(tr("File"), name, sizeof(name)));
+
+ Add(new cOsdItem("", osUnknown, false));
+
+ Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("Date"), *DayDateTime(recording->Start())), osUnknown, false));
+
+ cChannel *channel = Channels.GetByChannelID(((cRecordingInfo *)recording->Info())->ChannelID());
+ if (channel)
+ Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("Channel"), *ChannelString(channel, 0)), osUnknown, false));
+
+ int recLen = recording->LengthInSeconds();
+ if (recLen >= 0)
+ Add(new cOsdItem(cString::sprintf("%s:\t%d:%02d:%02d", tr("Length"), recLen / 3600, recLen / 60 % 60, recLen % 60), osUnknown, false));
+ else
+ recLen = 0;
+
+ int dirSize = DirSizeMB(recording->FileName());
+ cString bitRate = recLen ? cString::sprintf(" (%.2f MBit/s)", 8.0 * dirSize / recLen) : cString("");
+ Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("Format"), recording->IsPesRecording() ? tr("PES") : tr("TS")), osUnknown, false));
+ Add(new cOsdItem((dirSize > 9999) ? cString::sprintf("%s:\t%.2f GB%s", tr("Size"), dirSize / 1024.0, *bitRate) : cString::sprintf("%s:\t%d MB%s", tr("Size"), dirSize, *bitRate), osUnknown, false));
+
+ Add(new cOsdItem("", osUnknown, false));
+
+ isMarks = marks.Load(recording->FileName(), recording->FramesPerSecond(), recording->IsPesRecording()) && marks.Count();
+ marksItem = new cOsdItem(tr("Delete marks information?"), osUser1, isMarks);
+ Add(marksItem);
+
+ cResumeFile ResumeFile(recording->FileName(), recording->IsPesRecording());
+ isResume = (ResumeFile.Read() != -1);
+ resumeItem = new cOsdItem(tr("Delete resume information?"), osUser2, isResume);
+ Add(resumeItem);
+ }
+
+ SetHelpKeys();
+}
+
+void cMenuEditRecording::SetHelpKeys(void)
+{
+ SetHelp(tr("Button$Folder"), tr("Button$Cut"), tr("Button$Copy"), tr("Button$Rename/Move"));
+}
+
+eOSState cMenuEditRecording::SetFolder(void)
+{
+ cMenuFolder *mf = (cMenuFolder *)SubMenu();
+ if (mf) {
+ cString Folder = mf->GetFolder();
+ char *p = strrchr(name, FOLDERDELIMCHAR);
+ if (p)
+ p++;
+ else
+ p = name;
+ if (!isempty(*Folder))
+ strn0cpy(name, cString::sprintf("%s%c%s", *Folder, FOLDERDELIMCHAR, p), sizeof(name));
+ else if (p != name)
+ memmove(name, p, strlen(p) + 1);
+ SetCurrent(file);
+ Display();
+ }
+ return CloseSubMenu();
+}
+
+eOSState cMenuEditRecording::ProcessKey(eKeys Key)
+{
+ eOSState state = cOsdMenu::ProcessKey(Key);
+
+ if (state == osUnknown) {
+ switch (Key) {
+ case kRed:
+ return AddSubMenu(new cMenuFolder(tr("Select folder"), &Folders, name));
+ break;
+ case kGreen:
+ if (!cCutter::Active()) {
+ if (!isMarks)
+ Skins.Message(mtError, tr("No editing marks defined!"));
+ else if (!cCutter::Start(recording->FileName(), strcmp(recording->Name(), name) ? *NewVideoFileName(recording->FileName(), name) : NULL, false))
+ Skins.Message(mtError, tr("Can't start editing process!"));
+ else
+ Skins.Message(mtInfo, tr("Editing process started"));
+ }
+ else
+ Skins.Message(mtError, tr("Editing process already active!"));
+ return osContinue;
+ case kYellow:
+ case kBlue:
+ if (strcmp(recording->Name(), name)) {
+ if (!cFileTransfer::Active()) {
+ if (cFileTransfer::Start(recording, name, (Key == kYellow)))
+ Skins.Message(mtInfo, tr("File transfer started"));
+ else
+ Skins.Message(mtError, tr("Can't start file transfer!"));
+ }
+ else
+ Skins.Message(mtError, tr("File transfer already active!"));
+ }
+ return osRecordings;
+ default:
+ break;
+ }
+ return osContinue;
+ }
+ else if (state == osEnd && HasSubMenu())
+ state = SetFolder();
+ else if (state == osUser1) {
+ if (isMarks && Interface->Confirm(tr("Delete marks information?"))) {
+ cMarks marks;
+ marks.Load(recording->FileName(), recording->FramesPerSecond(), recording->IsPesRecording());
+ cMark *mark = marks.First();
+ while (mark) {
+ cMark *nextmark = marks.Next(mark);
+ marks.Del(mark);
+ mark = nextmark;
+ }
+ marks.Save();
+ isMarks = false;
+ marksItem->SetSelectable(isMarks);
+ SetCurrent(First());
+ Display();
+ }
+ return osContinue;
+ }
+ else if (state == osUser2) {
+ if (isResume && Interface->Confirm(tr("Delete resume information?"))) {
+ cResumeFile ResumeFile(recording->FileName(), recording->IsPesRecording());
+ ResumeFile.Delete();
+ isResume = false;
+ resumeItem->SetSelectable(isResume);
+ SetCurrent(First());
+ Display();
+ }
+ return osContinue;
+ }
+
+ return state;
+}
+
// --- cMenuRecordings -------------------------------------------------------
cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus)
@@ -2450,6 +2612,16 @@
return osContinue;
}
+eOSState cMenuRecordings::Edit(void)
+{
+ if (HasSubMenu() || Count() == 0)
+ return osContinue;
+ cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
+ if (ri && !ri->IsDirectory() && ri->Recording())
+ return AddSubMenu(new cMenuEditRecording(ri->Recording()));
+ return osContinue;
+}
+
eOSState cMenuRecordings::ProcessKey(eKeys Key)
{
bool HadSubMenu = HasSubMenu();
@@ -2463,7 +2635,7 @@
case kRed: return (helpKeys > 1 && RecordingCommands.Count()) ? Commands() : Play();
case kGreen: return Rewind();
case kYellow: return Delete();
- case kInfo:
+ case kInfo: return Edit();
case kBlue: return Info();
case k0: return Sort();
case k1...k9: return Commands(Key);
@@ -3356,6 +3528,7 @@
replaying = false;
stopReplayItem = NULL;
cancelEditingItem = NULL;
+ cancelFileTransferItem = NULL;
stopRecordingItem = NULL;
recordControlsState = 0;
Set();
@@ -3466,6 +3639,19 @@
result = true;
}
+ // File transfer control:
+ bool FileTransferActive = cFileTransfer::Active();
+ if (FileTransferActive && !cancelFileTransferItem) {
+ // TRANSLATORS: note the leading blank!
+ Add(cancelFileTransferItem = new cOsdItem(tr(" Cancel file transfer"), osCancelTransfer));
+ result = true;
+ }
+ else if (cancelFileTransferItem && !FileTransferActive) {
+ Del(cancelFileTransferItem->Index());
+ cancelFileTransferItem = NULL;
+ result = true;
+ }
+
// Record control:
if (cRecordControls::StateChanged(recordControlsState)) {
while (stopRecordingItem) {
@@ -3535,6 +3721,12 @@
return osEnd;
}
break;
+ case osCancelTransfer:
+ if (Interface->Confirm(tr("Cancel file transfer?"))) {
+ cFileTransfer::Stop();
+ return osEnd;
+ }
+ break;
case osPlugin: {
cMenuPluginItem *item = (cMenuPluginItem *)Get(Current());
if (item) {
@@ -4514,6 +4706,10 @@
// --- cReplayControl --------------------------------------------------------
+#define REPLAYCONTROLSKIPLIMIT 9 // s
+#define REPLAYCONTROLSKIPSECONDS 90 // s
+#define REPLAYCONTROLSKIPTIMEOUT 5000 // ms
+
cReplayControl *cReplayControl::currentReplayControl = NULL;
cString cReplayControl::fileName;
@@ -4527,6 +4723,9 @@
lastCurrent = lastTotal = -1;
lastPlay = lastForward = false;
lastSpeed = -2; // an invalid value
+ lastSkipKey = kNone;
+ lastSkipSeconds = REPLAYCONTROLSKIPSECONDS;
+ lastSkipTimeout.Set(0);
timeoutShow = 0;
timeSearchActive = false;
cRecording Recording(fileName);
@@ -4859,7 +5058,7 @@
Skins.Message(mtError, tr("No editing marks defined!"));
else if (!marks.GetNumSequences())
Skins.Message(mtError, tr("No editing sequences defined!"));
- else if (!cCutter::Start(fileName))
+ else if (!cCutter::Start(fileName, NULL, false))
Skins.Message(mtError, tr("Can't start editing process!"));
else
Skins.Message(mtInfo, tr("Editing process started"));
@@ -4957,6 +5156,32 @@
case kGreen: SkipSeconds(-60); break;
case kYellow|k_Repeat:
case kYellow: SkipSeconds( 60); break;
+ case k1|k_Repeat:
+ case k1: SkipSeconds(-20); break;
+ case k3|k_Repeat:
+ case k3: SkipSeconds( 20); break;
+ case kPrev|k_Repeat:
+ case kPrev: if (lastSkipTimeout.TimedOut()) {
+ lastSkipSeconds = REPLAYCONTROLSKIPSECONDS;
+ lastSkipKey = kPrev;
+ }
+ else if (RAWKEY(lastSkipKey) != kPrev && lastSkipSeconds > (2 * REPLAYCONTROLSKIPLIMIT)) {
+ lastSkipSeconds /= 2;
+ lastSkipKey = kNone;
+ }
+ lastSkipTimeout.Set(REPLAYCONTROLSKIPTIMEOUT);
+ SkipSeconds(-lastSkipSeconds); break;
+ case kNext|k_Repeat:
+ case kNext: if (lastSkipTimeout.TimedOut()) {
+ lastSkipSeconds = REPLAYCONTROLSKIPSECONDS;
+ lastSkipKey = kNext;
+ }
+ else if (RAWKEY(lastSkipKey) != kNext && lastSkipSeconds > (2 * REPLAYCONTROLSKIPLIMIT)) {
+ lastSkipSeconds /= 2;
+ lastSkipKey = kNone;
+ }
+ lastSkipTimeout.Set(REPLAYCONTROLSKIPTIMEOUT);
+ SkipSeconds(lastSkipSeconds); break;
case kStop:
case kBlue: Hide();
Stop();
@@ -4966,12 +5191,8 @@
switch (int(Key)) {
// Editing:
case kMarkToggle: MarkToggle(); break;
- case kPrev|k_Repeat:
- case kPrev:
case kMarkJumpBack|k_Repeat:
case kMarkJumpBack: MarkJump(false); break;
- case kNext|k_Repeat:
- case kNext:
case kMarkJumpForward|k_Repeat:
case kMarkJumpForward: MarkJump(true); break;
case kMarkMoveBack|k_Repeat: