[mythtv] FF/Rew Repositioning

David Engel dlengel at attbi.com
Sun Jul 27 02:08:56 EDT 2003


On Sat, Jul 26, 2003 at 04:05:14PM -0500, David Engel wrote:
> TiVo handles this by exiting ff/rew without repositioning when the
> beginning or end of the buffer is reached.  I'll see about doing that.

This patch does just that.  In addition, this patch changes a couple
things from the previous one.  First, it does a simple lookup for the
repositioning offset instead of trying to calculate it.  This should
make it more straight forward for people who want to tweak the
offsets.  Second, it does away with the muting stuff in StopFFRew
since it doesn't need to be done there.

David
-- 
David Engel
dlengel at attbi.com

Index: libs/libmythtv/NuppelVideoPlayer.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp,v
retrieving revision 1.234
diff -u -r1.234 NuppelVideoPlayer.cpp
--- libs/libmythtv/NuppelVideoPlayer.cpp	26 Jul 2003 16:49:17 -0000	1.234
+++ libs/libmythtv/NuppelVideoPlayer.cpp	27 Jul 2003 05:56:38 -0000
@@ -1328,16 +1328,20 @@
     return NULL;
 }
 
-void NuppelVideoPlayer::FastForward(float seconds)
+bool NuppelVideoPlayer::FastForward(float seconds)
 {
     if (fftime == 0)
         fftime = (int)(seconds * video_frame_rate);
+
+    return fftime > CalcMaxFFTime(fftime);
 }
 
-void NuppelVideoPlayer::Rewind(float seconds)
+bool NuppelVideoPlayer::Rewind(float seconds)
 {
     if (rewindtime == 0)
         rewindtime = (int)(seconds * video_frame_rate);
+
+    return rewindtime >= framesPlayed;
 }
 
 void NuppelVideoPlayer::SkipCommercials(int direction)
Index: libs/libmythtv/NuppelVideoPlayer.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/NuppelVideoPlayer.h,v
retrieving revision 1.97
diff -u -r1.97 NuppelVideoPlayer.h
--- libs/libmythtv/NuppelVideoPlayer.h	26 Jul 2003 16:49:17 -0000	1.97
+++ libs/libmythtv/NuppelVideoPlayer.h	27 Jul 2003 05:56:38 -0000
@@ -72,8 +72,8 @@
     void Unpause(void); 
     bool GetPause(void);
    
-    void FastForward(float seconds);
-    void Rewind(float seconds);
+    bool FastForward(float seconds);
+    bool Rewind(float seconds);
 
     void SkipCommercials(int direction);
 
Index: libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.83
diff -u -r1.83 tv_play.cpp
--- libs/libmythtv/tv_play.cpp	26 Jul 2003 16:49:17 -0000	1.83
+++ libs/libmythtv/tv_play.cpp	27 Jul 2003 05:56:38 -0000
@@ -39,21 +39,23 @@
 };
 
 struct SeekSpeedInfo {
-  QString   dispString;
-  float  scaling;
+    QString dispString;
+    float   scaling;
+    float   ff_repos;
+    float   rew_repos;
 };
 
 SeekSpeedInfo seek_speed_array[] =
-  {{"", 0.0},
-   {"1/4X", 0.25},
-   {"1/2X", 0.50},
-   {"1X", 1.00},
-   {"1.5X", 1.50},
-   {"2X", 2.24},
-   {"3X", 3.34},
-   {"8X", 7.48},
-   {"10X", 11.18},
-   {"16X", 16.72}};
+  {{"",     0.00,   0.00,   0.00},
+   {"1/4X", 0.25,   0.00,   0.00},
+   {"1/2X", 0.50,   4.00,   4.00},
+   {"1X",   1.00,  12.00,   9.00},
+   {"1.5X", 1.50,  16.00,  11.50},
+   {"2X",   2.24,  20.00,  14.00},
+   {"3X",   3.34,  28.00,  19.00},
+   {"8X",   7.48,  68.00,  44.00},
+   {"10X", 11.18,  84.00,  54.00},
+   {"16X", 16.72, 132.00,  84.00}};
 
 void *SpawnDecode(void *param)
 {
@@ -904,7 +906,7 @@
         }
         case Key_Z:
         {
-            StopFFRew();
+            StopFFRew(true);
             DoSkipCommercials(1);
             break;
         }
@@ -915,13 +917,13 @@
         }
         case Key_Q:
         {
-            StopFFRew();
+            StopFFRew(true);
             DoSkipCommercials(-1);
             break;
         }
         case Key_S: case Key_P: 
         {
-            StopFFRew();
+            StopFFRew(true);
             DoPause();
             break;
         }
@@ -929,7 +931,7 @@
         {
             if (!stickykeys)
             {
-                StopFFRew();
+                StopFFRew(true);
                 DoFF(fftime); 
                 break;
             }
@@ -951,7 +953,7 @@
         {
             if (!stickykeys)
             {
-                StopFFRew();
+                StopFFRew(true);
                 DoRew(rewtime);
                 break;
             }
@@ -1029,7 +1031,7 @@
                     case Key_9: ff_rew_index = SSPEED_FAST_6; break;
 
                     default:
-                       StopFFRew();
+                       StopFFRew(true);
                        was_doing_ff_rew = true;
                        break;
                 }
@@ -1376,7 +1378,8 @@
         osd->StartPause(pos, slidertype, scaleString, desc, 2);
     }
 
-    activenvp->FastForward(time * ff_rew_scaling);
+    if (activenvp->FastForward(time * ff_rew_scaling))
+	StopFFRew(false);
 
     if (muted) 
         muteTimer->start(600, true);
@@ -1416,7 +1419,8 @@
         osd->StartPause(pos, slidertype, scaleString, desc, 2);
     }
 
-    activenvp->Rewind(time * ff_rew_scaling);
+    if (activenvp->Rewind(time * ff_rew_scaling))
+	StopFFRew(false);
 
     if (muted) 
         muteTimer->start(600, true);
@@ -1428,32 +1432,18 @@
     }
 }
 
-void TV::StopFFRew(void)
+void TV::StopFFRew(bool repos)
 {
     if (!doing_ff_rew)
         return;
 
-    const double ff_offset = 7.00;
-    const double ff_scale = 6.00;
-    const double rew_offset = 0.00;
-    const double rew_scale = 6.00;
-
-    bool muted = false;
-
-    if (volumeControl && !volumeControl->GetMute())
+    if (repos)
     {
-        volumeControl->ToggleMute();
-        muted = true;
+	if (doing_ff_rew > 0)
+	    activenvp->Rewind(seek_speed_array[ff_rew_index].ff_repos);
+	else
+	    activenvp->FastForward(seek_speed_array[ff_rew_index].rew_repos);
     }
-
-    ff_rew_scaling = seek_speed_array[ff_rew_index].scaling;
-    if (doing_ff_rew > 0)
-        activenvp->Rewind(ff_offset + ff_scale * ff_rew_scaling);
-    else
-        activenvp->FastForward(rew_offset + rew_scale * ff_rew_scaling);
-
-    if (muted) 
-        muteTimer->start(600, true);
 
     doing_ff_rew = 0;
     ff_rew_index = SSPEED_NORMAL;
Index: libs/libmythtv/tv_play.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.h,v
retrieving revision 1.39
diff -u -r1.39 tv_play.h
--- libs/libmythtv/tv_play.h	25 Jul 2003 01:23:40 -0000	1.39
+++ libs/libmythtv/tv_play.h	27 Jul 2003 05:56:38 -0000
@@ -118,7 +118,7 @@
 
     void DoInfo(void);
     void DoPause(void);
-    void StopFFRew(void);
+    void StopFFRew(bool repos);
     void DoFF(int time);
     void DoRew(int time);
     void DoJumpAhead(void);


More information about the mythtv-dev mailing list