[mythtv] [PATCH] Time Stretch UI stuff

henri henri at qais.com
Sun Mar 6 23:52:39 UTC 2005



attached is a patch that does 4 things:

- pressing the "TOGGLESTRETCH" actually toggles the time
stretch (or is it now called tempo?) OSD. [not sure i did
that right, just cut'n'pasted from some other handler code]

- adds support for "STRETCHINC" and "STRETCHDEC" in the
keybindings (event code was there)

- adds "RESETSTRETCH" keybinding to get you back to 1x speed

- changes the timeout for the OSD from 10 (too long compared
to the rest of the UI) to either 2 (if you hit
STRETCHINC,DEC, or RESET) or 5 (if you go into TOGGLESTRETCH)


hope the keybindings are ok... hard to find free keys these days!

btw. Time Stretch ROCKS! now if the eeprom would get here
for me to hack my remote using the JP1 plug (URC 6131) to
actually get buttons bound for INC, DEC and RESET....


henri

-------------- next part --------------
Index: libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.240
diff -u -3 -p -u -r1.240 tv_play.cpp
--- libs/libmythtv/tv_play.cpp	9 Feb 2005 20:27:48 -0000	1.240
+++ libs/libmythtv/tv_play.cpp	6 Mar 2005 23:46:09 -0000
@@ -165,7 +165,10 @@ void TV::InitKeys(void)
             "transcoding", "X");
     REG_KEY("TV Playback", "SPEEDINC", "Increase the playback speed", "U");
     REG_KEY("TV Playback", "SPEEDDEC", "Decrease the playback speed", "J");
+    REG_KEY("TV Playback", "STRETCHINC", "Increase the time stretch playback speed", "F4");
+    REG_KEY("TV Playback", "STRETCHDEC", "Decrease the time stretch playback speed", "F3");
     REG_KEY("TV Playback", "TOGGLESTRETCH", "Turn on time stretch control", "A");
+    REG_KEY("TV Playback", "RESETSTRETCH", "Reset time stretch to normal playback speed", "F5");
     REG_KEY("TV Playback", "TOGGLEPICCONTROLS", "Turn on the playback picture "
             "adjustment controls", "F");
     REG_KEY("TV Playback", "TOGGLERECCONTROLS", "Turn on the recording picture "
@@ -1561,9 +1564,9 @@ void TV::ProcessKeypress(QKeyEvent *e)
             handled = true;
 
             if (action == "LEFT")
-                ChangeTimeStretch(-1);
+                ChangeTimeStretch(-1, false);
             else if (action == "RIGHT")
-                ChangeTimeStretch(1);
+                ChangeTimeStretch(1, false);
             else
                 handled = false;
         }
@@ -1626,7 +1629,30 @@ void TV::ProcessKeypress(QKeyEvent *e)
             ChangeSpeed(-1);
         else if (action == "TOGGLESTRETCH")
         {
-            ChangeTimeStretch(0);   // just display
+            if (osd && stretchAdjustment) 
+            {
+                QStringList osetname;
+                osetname << "program_info" << "channel_number" << "status";
+                if (osd->HideSets(osetname))
+                {
+                    ChannelClear();
+                    while (osd->HideSets(osetname))
+                        usleep(1000);
+                    return;
+                }
+            }
+            else 
+            {
+                ChangeTimeStretch(0, false);   // just display
+            }
+        }
+        else if (action == "RESETSTRETCH")
+        {
+            if (normal_speed != 1)
+            {
+                normal_speed = 1;
+                ChangeTimeStretch(0, true);
+            }
         }
         else if (action == "TOGGLEPICCONTROLS")
         {
@@ -1756,9 +1782,9 @@ void TV::ProcessKeypress(QKeyEvent *e)
         else if (action == "MUTE")
             ToggleMute();
         else if (action == "STRETCHINC")
-            ChangeTimeStretch(1);
+             ChangeTimeStretch(1, true);
         else if (action == "STRETCHDEC")
-            ChangeTimeStretch(-1);
+             ChangeTimeStretch(-1, true);
         else if (action == "TOGGLEASPECT")
             ToggleLetterbox();
         else if (action == "MENU")
@@ -1902,6 +1928,7 @@ void TV::ProcessKeypress(QKeyEvent *e)
             {
                 if (!was_doing_ff_rew)
                 {
+
                     if (gContext->GetNumSetting("AltClearSavedPosition", 1)
                         && nvp->GetBookmark())
                         nvp->ClearBookmark(); 
@@ -3292,11 +3319,16 @@ void TV::ChangeVolume(bool up)
     }
 }
 
-void TV::ChangeTimeStretch(int dir, bool allowEdit)
+void TV::ChangeTimeStretch(int dir, bool quickDisplay, bool allowEdit)
 {
     float new_normal_speed = normal_speed + 0.05*dir;
     stretchAdjustment = allowEdit;
 
+    int displayTime = 5;
+
+    if (quickDisplay)
+        displayTime = 2;
+
     if (new_normal_speed > 2.0 || new_normal_speed < 0.48)
         return;
 
@@ -3310,7 +3342,7 @@ void TV::ChangeTimeStretch(int dir, bool
     if (osd)
     {
         int val = (int)(normal_speed*500);
-        osd->StartPause(val, false, tr("Adjust Time Stretch"), text, 10, 
+        osd->StartPause(val, false, tr("Adjust Time Stretch"), text, displayTime, 
                         kOSDFunctionalType_TimeStretchAdjust);
         update_osd_pos = false;
     }
@@ -3858,7 +3890,7 @@ void TV::TreeMenuSelected(OSDListTreeTyp
             normal_speed = stretch;   // alter speed before display
         }
 
-        ChangeTimeStretch(0, !floatRead);   // just display
+        ChangeTimeStretch(0, false, !floatRead);   // just display
     }
     else if (action.left(11) == "TOGGLESLEEP")
     {
Index: libs/libmythtv/tv_play.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.h,v
retrieving revision 1.83
diff -u -3 -p -u -r1.83 tv_play.h
--- libs/libmythtv/tv_play.h	9 Feb 2005 05:22:16 -0000	1.83
+++ libs/libmythtv/tv_play.h	6 Mar 2005 23:46:09 -0000
@@ -150,7 +150,7 @@ class TV : public QObject
     void DoArbSeek(int dir);
     void NormalSpeed(void);
     void ChangeSpeed(int direction);
-    void ChangeTimeStretch(int dir, bool allowEdit = true);
+    void ChangeTimeStretch(int dir, bool quickDisplay, bool allowEdit = true);
     float StopFFRew(void);
     void ChangeFFRew(int direction);
     void SetFFRew(int index);


More information about the mythtv-dev mailing list