Merge branch 'bug_570_playback_skip_fixes_and_cleanup_ml_aholst'
authorghost <andreas.monzner@multimedia-labs.de>
Wed, 9 Feb 2011 14:10:03 +0000 (15:10 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Wed, 9 Feb 2011 14:10:03 +0000 (15:10 +0100)
data/setup.xml
lib/dvb/pvrparse.cpp
lib/dvb/tstools.cpp
lib/gui/epositiongauge.cpp
lib/python/Components/UsageConfig.py
lib/python/Plugins/Extensions/DVDPlayer/plugin.py
lib/python/Screens/InfoBarGenerics.py

index f5dea73..c5eb07f 100755 (executable)
                        <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 5cdecbd..e19dd1e 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 1403059..9b47f9b 100644 (file)
@@ -700,9 +700,26 @@ int eDVBTSTools::findFrame(off_t &_offset, size_t &len, int &direction, int fram
                else if (direction == +1)
                        direction = 0;
        }
-                       /* let's find the next frame after the given offset */
        off_t start = offset;
 
+#if 0
+                       /* backtrack to find the previous sequence start, in case of MPEG2 */
+       if ((data & 0xFF) == 0x00) {
+               do {
+                       --start;
+                       if (m_streaminfo.getStructureEntry(start, data, 0))
+                       {
+                               eDebug("get previous failed");
+                               return -1;
+                       }
+               } while (((data & 0xFF) != 9) && ((data & 0xFF) != 0x00) && ((data & 0xFF) != 0xB3)); /* sequence start or previous frame */
+               if ((data & 0xFF) != 0xB3)
+                       start = offset;  /* Failed to find corresponding sequence start, so never mind */
+       }
+
+#endif
+
+                       /* let's find the next frame after the given offset */
        do {
                if (m_streaminfo.getStructureEntry(offset, data, 1))
                {
@@ -717,9 +734,11 @@ int eDVBTSTools::findFrame(off_t &_offset, size_t &len, int &direction, int fram
 //             eDebug("%08llx@%llx (next)", data, offset);
        } while (((data & 0xFF) != 9) && ((data & 0xFF) != 0x00)); /* next frame */
 
+#if 0
                        /* align to TS pkt start */
-//     start = start - (start % 188);
-//     offset = offset - (offset % 188);
+       start = start - (start % 188);
+       offset = offset - (offset % 188);
+#endif
 
        len = offset - start;
        _offset = start;
index ff98c08..e45d4a6 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 8ea9aa6..a265a16 100644 (file)
@@ -102,13 +102,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 d14a623..1f3de1a 100755 (executable)
@@ -244,8 +244,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
 
@@ -255,8 +253,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):
@@ -265,8 +261,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):
@@ -280,7 +274,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 6fa8911..4f6eafc 100644 (file)
@@ -717,7 +717,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,
@@ -774,20 +774,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)
@@ -1970,20 +1960,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]
@@ -1992,14 +1983,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