Playback/Skipping fixes / cleanup by A. Holst
authorghost <andreas.monzner@multimedia-labs.de>
Tue, 17 Aug 2010 08:18:13 +0000 (10:18 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Tue, 17 Aug 2010 08:20:41 +0000 (10:20 +0200)
* Jumping between marks in the movie, with "<" and ">", doesn't work
  well when there are cut marks in the movie. Especially jumping
  backwards will fail if there is a mark in a cut out region that is
  to be jumped over. (InfoBarGenerics.py, chunks 3 and 4)

* Now when rewind works at all platforms also at low speeds, the
  rewind speeds x2 and x4 should be added again to the
  default. (UsageConfig.py, chunk 1)

* Cleanup some obsolete code: SeekBackHack and non-smooth
  winding. None of these can be used anymore, but remnants were left
  in the code and in the configuration alternatives. It is high time
  to clean these out. (setup.xml, UsageConfig.py chunk 2,
  InfoBarGenerics.py chunks 1 and 2, DVDPlayer)

* In the position gauge of the movie player, marks in the movie are
  shown as red dots. Long time ago the last position was also shown as
  a red dot, which was bad because it was confused with the marks, so
  it was removed. However, jumping between marks in the movie with "<"
  and ">" also stops at the last position, which is useful e.g. if you
  don't automatically start playing from the last position. The code
  below adds the last position back to the position gauge as a green dot,
  to distinguish it from the red ones. (epositiongauge.cpp)

refs bug #570

data/setup.xml
lib/dvb/pvrparse.cpp
lib/gui/epositiongauge.cpp
lib/python/Components/UsageConfig.py
lib/python/Plugins/Extensions/DVDPlayer/plugin.py
lib/python/Screens/InfoBarGenerics.py

index 9425afda93b0dfe1948a7f638bc6dd40058c1ea0..fa8ff3f9f687594b8167fd4506ab8b435e6171e5 100644 (file)
                        <item level="2" text="Fast Forward speeds">config.seek.speeds_forward</item>
                        <item level="2" text="Rewind speeds">config.seek.speeds_backward</item>
                        <item level="2" text="Slow Motion speeds">config.seek.speeds_slowmotion</item>
-<!-- TRANSLATORS: Note that "Enter" in the two strings below should *not*
-     be interpreted as "Give speed as input". The intended meaning is
-     instead "Initial speed when starting winding", i.e. the speed at
-     which "winding mode" is entered when first pressing "rewind" or
-     "fast forward". -->  
-                       <item level="2" text="Enter Fast Forward at speed">config.seek.enter_forward</item>
-                       <item level="2" text="Enter Rewind at speed">config.seek.enter_backward</item>
-<!-- TRANSLATORS: The effect of "Non-smooth winding" is that rather
-     than using ordinary "continuous" or "smooth" winding, a fast
-     sequence of stills is shown when winding at high speeds. This
-     makes it much easier too follow when almost each frame comes from
-     a new scene. The effect is achieved by repeating each shown frame
-     a couple of times. The settings control both at which speed this
-     winding mode sets in, and how many times each frame should be
-     repeated. This was previously called "Discontinuous playback"
-     which was incomprehensible. "Non-smooth winding" may be a better
-     term, but note that there is nothing irregular about it. Synonyms
-     better suited for translation to other languages may be "stepwise
-     winding/playback", or "winding/playback using stills". -->
-                       <item level="2" text="Use non-smooth winding at speeds above">config.seek.stepwise_minspeed</item>
-                       <item level="2" text="Frame repeat count during non-smooth winding">config.seek.stepwise_repeat</item>
+<!-- TRANSLATORS: The following is the speed you get on the first press on fast-forward.
+     It was previously called "enter fast forward at speed" which was easily misunderstood. -->  
+                       <item level="2" text="Initial Fast Forward speed">config.seek.enter_forward</item>
+                       <item level="2" text="Initial Rewind speed">config.seek.enter_backward</item>
                        <item level="2" text="Behavior of 'pause' when paused">config.seek.on_pause</item>
                        <item level="2" text="Behavior of 0 key in PiP-mode">config.usage.pip_zero_button</item>
                        <item level="2" text="Alternative services tuner priority">config.usage.alternatives_priority</item>
index 5cdecbd610095ec2172b811454f0b71ec1013ed6..e19dd1e46ec2bd71f4f3f08f4bd6af98b5945848 100644 (file)
@@ -123,7 +123,7 @@ void eMPEGStreamInformation::fixupDiscontinuties()
                pts_t current = i->second - currentDelta;
                pts_t diff = current - lastpts_t;
                
-               if (llabs(diff) > (90000*5)) // 5sec diff
+               if (llabs(diff) > (90000*10)) // 10sec diff
                {
 //                     eDebug("%llx < %llx, have discont. new timestamp is %llx (diff is %llx)!", current, lastpts_t, i->second, diff);
                        currentDelta = i->second - lastpts_t; /* FIXME: should be the extrapolated new timestamp, based on the current rate */
index ff98c080835532c4565558bb35254616b2673839..e45d4a6c4e328ec4359d404fae2098bc1a72d4bf 100644 (file)
@@ -112,6 +112,7 @@ int ePositionGauge::event(int event, void *data, void *data2)
 //             painter.fill(eRect(0, 10, s.width(), s.height()-20));
                
                pts_t in = 0, out = 0;
+               int xm, xm_last = -1;
                
                std::multiset<cueEntry>::iterator i(m_cue_entries.begin());
                
@@ -126,17 +127,22 @@ int ePositionGauge::event(int event, void *data, void *data2)
                                        continue;
                                } else if (i->what == 1) /* out */
                                        out = i++->where;
-                               else if (i->what == 2) /* mark */
+                               else /* mark or last */
                                {
-                                       int xm = scale(i->where);
-                                       painter.setForegroundColor(gRGB(0xFF8080));
-                                       painter.fill(eRect(xm - 2, 0, 4, s.height()));
+                                       xm = scale(i->where);
+                                       if (i->what == 2) {
+                                               painter.setForegroundColor(gRGB(0xFF8080));
+                                               if (xm - 2 < xm_last) /* Make sure last is not overdrawn */
+                                                       painter.fill(eRect(xm_last, 0, 2 + xm - xm_last, s.height()));
+                                               else
+                                                       painter.fill(eRect(xm - 2, 0, 4, s.height()));
+                                       } else if (i->what == 3) {
+                                               painter.setForegroundColor(gRGB(0x80FF80));
+                                               painter.fill(eRect(xm - 1, 0, 3, s.height()));
+                                               xm_last = xm + 2;
+                                       }
                                        i++;
                                        continue;
-                               } else /* other marker, like last position */
-                               {
-                                       ++i;
-                                       continue;
                                }
                        }
                        
index 6082710768479543100ea036b4584ac788c10d0c..c0213d99fde2b281b4590b58c16a50aac38c0a24 100644 (file)
@@ -93,13 +93,11 @@ def InitUsageConfig():
        config.seek.selfdefined_79 = ConfigNumber(default=300)
 
        config.seek.speeds_forward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
-       config.seek.speeds_backward = ConfigSet(default=[8, 16, 32, 64, 128], choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
+       config.seek.speeds_backward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
        config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8], choices=[2, 4, 6, 8, 12, 16, 25])
 
        config.seek.enter_forward = ConfigSelection(default = "2", choices = ["2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
        config.seek.enter_backward = ConfigSelection(default = "1", choices = ["1", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
-       config.seek.stepwise_minspeed = ConfigSelection(default = "16", choices = ["Never", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
-       config.seek.stepwise_repeat = ConfigSelection(default = "3", choices = ["2", "3", "4", "5", "6"])
 
        config.seek.on_pause = ConfigSelection(default = "play", choices = [
                ("play", _("Play")),
index e092e82fba696d14004d9b32b3d5f6bd8700d581..3d262c921710d4579d4eaeaf7146479d9fee687f 100755 (executable)
@@ -222,8 +222,6 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
                self.saved_config_speeds_backward = config.seek.speeds_backward.value
                self.saved_config_enter_forward = config.seek.enter_forward.value
                self.saved_config_enter_backward = config.seek.enter_backward.value
-               self.saved_config_seek_stepwise_minspeed = config.seek.stepwise_minspeed.value
-               self.saved_config_seek_stepwise_repeat = config.seek.stepwise_repeat.value
                self.saved_config_seek_on_pause = config.seek.on_pause.value
                self.saved_config_seek_speeds_slowmotion = config.seek.speeds_slowmotion.value
 
@@ -233,8 +231,6 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
                config.seek.speeds_slowmotion.value = [ ]
                config.seek.enter_forward.value = "2"
                config.seek.enter_backward.value = "2"
-               config.seek.stepwise_minspeed.value = "Never"
-               config.seek.stepwise_repeat.value = "3"
                config.seek.on_pause.value = "play"
 
        def restore_infobar_seek_config(self):
@@ -243,8 +239,6 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
                config.seek.speeds_slowmotion.value = self.saved_config_seek_speeds_slowmotion
                config.seek.enter_forward.value = self.saved_config_enter_forward
                config.seek.enter_backward.value = self.saved_config_enter_backward
-               config.seek.stepwise_minspeed.value = self.saved_config_seek_stepwise_minspeed
-               config.seek.stepwise_repeat.value = self.saved_config_seek_stepwise_repeat
                config.seek.on_pause.value = self.saved_config_seek_on_pause
 
        def __init__(self, session, dvd_device = None, dvd_filelist = [ ], args = None):
@@ -256,7 +250,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
                HelpableScreen.__init__(self)
                self.save_infobar_seek_config()
                self.change_infobar_seek_config()
-               InfoBarSeek.__init__(self, useSeekBackHack=False)
+               InfoBarSeek.__init__(self)
                InfoBarPVRState.__init__(self)
                self.dvdScreen = self.session.instantiateDialog(DVDOverlay)
 
index f98d4c3398814653deea13416b28fbba943ea0b7..4bcadef9cdf423996932d719c64545bc31dcd575 100644 (file)
@@ -716,7 +716,7 @@ class InfoBarSeek:
        SEEK_STATE_PAUSE = (1, 0, 0, "||")
        SEEK_STATE_EOF = (1, 0, 0, "END")
 
-       def __init__(self, actionmap = "InfobarSeekActions", useSeekBackHack=True):
+       def __init__(self, actionmap = "InfobarSeekActions"):
                self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
                        {
                                iPlayableService.evSeekableStatusChanged: self.__seekableStatusChanged,
@@ -773,20 +773,10 @@ class InfoBarSeek:
                self.__seekableStatusChanged()
 
        def makeStateForward(self, n):
-#              minspeed = config.seek.stepwise_minspeed.value
-#              repeat = int(config.seek.stepwise_repeat.value)
-#              if minspeed != "Never" and n >= int(minspeed) and repeat > 1:
-#                      return (0, n * repeat, repeat, ">> %dx" % n)
-#              else:
-                       return (0, n, 0, ">> %dx" % n)
+               return (0, n, 0, ">> %dx" % n)
 
        def makeStateBackward(self, n):
-#              minspeed = config.seek.stepwise_minspeed.value
-#              repeat = int(config.seek.stepwise_repeat.value)
-#              if minspeed != "Never" and n >= int(minspeed) and repeat > 1:
-#                      return (0, -n * repeat, repeat, "<< %dx" % n)
-#              else:
-                       return (0, -n, 0, "<< %dx" % n)
+               return (0, -n, 0, "<< %dx" % n)
 
        def makeStateSlowMotion(self, n):
                return (0, 0, n, "/%d" % n)
@@ -2084,20 +2074,21 @@ class InfoBarCueSheetSupport:
                return True
 
        def jumpPreviousMark(self):
-               # we add 2 seconds, so if the play position is <2s after
+               # we add 5 seconds, so if the play position is <5s after
                # the mark, the mark before will be used
                self.jumpPreviousNextMark(lambda x: -x-5*90000, start=True)
 
        def jumpNextMark(self):
-               if not self.jumpPreviousNextMark(lambda x: x):
+               if not self.jumpPreviousNextMark(lambda x: x-90000):
                        self.doSeek(-1)
 
        def getNearestCutPoint(self, pts, cmp=abs, start=False):
                # can be optimized
-               beforecut = False
+               beforecut = True
                nearest = None
+               bestdiff = -1
+               instate = True
                if start:
-                       beforecut = True
                        bestdiff = cmp(0 - pts)
                        if bestdiff >= 0:
                                nearest = [0, False]
@@ -2106,14 +2097,19 @@ class InfoBarCueSheetSupport:
                                beforecut = False
                                if cp[1] == self.CUT_TYPE_IN:  # Start is here, disregard previous marks
                                        diff = cmp(cp[0] - pts)
-                                       if diff >= 0:
+                                       if start and diff >= 0:
                                                nearest = cp
                                                bestdiff = diff
                                        else:
                                                nearest = None
-                       if cp[1] in (self.CUT_TYPE_MARK, self.CUT_TYPE_LAST):
+                                               bestdiff = -1
+                       if cp[1] == self.CUT_TYPE_IN:
+                               instate = True
+                       elif cp[1] == self.CUT_TYPE_OUT:
+                               instate = False
+                       elif cp[1] in (self.CUT_TYPE_MARK, self.CUT_TYPE_LAST):
                                diff = cmp(cp[0] - pts)
-                               if diff >= 0 and (nearest is None or bestdiff > diff):
+                               if instate and diff >= 0 and (nearest is None or bestdiff > diff):
                                        nearest = cp
                                        bestdiff = diff
                return nearest