Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: small vdr replay problem
Sergei Haller wrote:
>
> On 31 Mar 2002, Dariush Forouher (DF) wrote:
>
> DF> When I want to jump to a specific position in a video, I press the red
> DF> button and enter the the time. The problem is that often the --:-- field
> DF> disappears faster than i could press the buttons. Could you please
> DF> change the time to a greater value, that vdr waits.
>
> BTW: it has already been discussed some day, but I don't know any more,
> what was the end of the discussion: someone had the idea for this to be
> entered like this:
> press red -> "--:--" is displayed
> press 1 -> "--:-1" is displayed. if "play", "pause" etc. is pressed in
> this stage, it is considered as 1 minute
> press 5 -> "--:15" is displayed. if "play", "pause" etc. is pressed in
> this stage, it is considered as 15 minutes
> press 0 -> "-1:50" is displayed. if "play", "pause" etc. is pressed in
> this stage, it is considered as 1 hour and 50 mins.
> and so on.
>
> it's a good idea in my eyes: this would require less key pressings for a
> jump.
I have changed this now as follows. Please give it a try.
Note that the line numbers may be somewhat off...
Klaus
--- menu.c 2002/03/31 13:39:56
+++ menu.c 2002/03/31 15:20:47
@@ -3108,64 +3108,47 @@
void cReplayControl::TimeSearchDisplay(void)
{
char buf[64];
- int len;
-
strcpy(buf, tr("Jump: "));
- len = strlen(buf);
-
- switch (timeSearchPos) {
- case 1: sprintf(buf + len, "%01d-:--", timeSearchHH / 10); break;
- case 2: sprintf(buf + len, "%02d:--", timeSearchHH); break;
- case 3: sprintf(buf + len, "%02d:%01d-", timeSearchHH, timeSearchMM / 10); break;
- case 4: sprintf(buf + len, "%02d:%02d", timeSearchHH, timeSearchMM); break;
- default: sprintf(buf + len, "--:--"); break;
- }
-
+ int len = strlen(buf);
+ char h10 = '0' + (timeSearchTime >> 24);
+ char h1 = '0' + ((timeSearchTime & 0x00FF0000) >> 16);
+ char m10 = '0' + ((timeSearchTime & 0x0000FF00) >> 8);
+ char m1 = '0' + (timeSearchTime & 0x000000FF);
+ char ch10 = timeSearchPos > 3 ? h10 : '-';
+ char ch1 = timeSearchPos > 2 ? h1 : '-';
+ char cm10 = timeSearchPos > 1 ? m10 : '-';
+ char cm1 = timeSearchPos > 0 ? m1 : '-';
+ sprintf(buf + len, "%c%c:%c%c", ch10, ch1, cm10, cm1);
DisplayAtBottom(buf);
}
void cReplayControl::TimeSearchProcess(eKeys Key)
{
- int Seconds = timeSearchHH * 3600 + timeSearchMM * 60;
+#define STAY_SECONDS_OFF_END 10
+ int Seconds = (timeSearchTime >> 24) * 36000 + ((timeSearchTime & 0x00FF0000) >> 16) * 3600 + ((timeSearchTime & 0x0000FF00) >> 8) * 600 + (timeSearchTime & 0x000000FF) * 60;
+ int Current = (lastCurrent / FRAMESPERSEC);
+ int Total = (lastTotal / FRAMESPERSEC);
switch (Key) {
case k0 ... k9:
- {
- int n = Key - k0;
- int s = (lastTotal / FRAMESPERSEC);
- int m = s / 60 % 60;
- int h = s / 3600;
- switch (timeSearchPos) {
- case 0: if (n * 10 <= h) {
- timeSearchHH = n * 10;
- timeSearchPos++;
- }
- break;
- case 1: if (timeSearchHH + n <= h) {
- timeSearchHH += n;
- timeSearchPos++;
- }
- break;
- case 2: if (n <= 5 && timeSearchHH * 60 + n * 10 <= h * 60 + m) {
- timeSearchMM += n * 10;
- timeSearchPos++;
- }
- break;
- case 3: if (timeSearchHH * 60 + timeSearchMM + n <= h * 60 + m) {
- timeSearchMM += n;
- timeSearchPos++;
- }
- break;
- }
- TimeSearchDisplay();
- }
+ if (timeSearchPos < 4) {
+ timeSearchTime <<= 8;
+ timeSearchTime |= Key - k0;
+ timeSearchPos++;
+ TimeSearchDisplay();
+ }
break;
case kLeft:
- case kRight:
- dvbApi->SkipSeconds(Seconds * (Key == kRight ? 1 : -1));
+ case kRight: {
+ int dir = (Key == kRight ? 1 : -1);
+ if (dir > 0)
+ Seconds = min(Total - Current - STAY_SECONDS_OFF_END, Seconds);
+ dvbApi->SkipSeconds(Seconds * dir);
timeSearchActive = false;
+ }
break;
case kUp:
case kDown:
+ Seconds = min(Total - STAY_SECONDS_OFF_END, Seconds);
dvbApi->Goto(Seconds * FRAMESPERSEC, Key == kDown);
timeSearchActive = false;
break;
@@ -3185,7 +3168,7 @@
void cReplayControl::TimeSearch(void)
{
- timeSearchHH = timeSearchMM = timeSearchPos = 0;
+ timeSearchTime = timeSearchPos = 0;
timeSearchHide = false;
if (modeOnly)
Hide();
--
_______________________________________________________________
Klaus Schmidinger Phone: +49-8635-6989-10
CadSoft Computer GmbH Fax: +49-8635-6989-40
Hofmark 2 Email: kls@cadsoft.de
D-84568 Pleiskirchen, Germany URL: www.cadsoft.de
_______________________________________________________________
Home |
Main Index |
Thread Index