News:

--

Main Menu

slider position displayed time

Started by Jan Gruuthuse, September 28, 2016, 06:55:07 AM

Previous topic - Next topic

Jan Gruuthuse

how to tell if patch was applied correctly?
I did: git apply update.diff with above code starting with:
Quotediff --git a/avidemux/common/gui_navigate.cpp b/avidemux/common/gui_navigate.cpp
and rebuild

Jan Gruuthuse

Quote from: eumagga0x2a on September 30, 2016, 07:46:44 AM
Just to be sure: what does

grep -n "getNKFramePTS(&pts)" avidemux/common/gui_navigate.cpp

return when run in the Avidemux top source directory?
73:                if(false==video_body->getNKFramePTS(&pts))

eumagga0x2a

Yes, it is patched. I strongly hope that Mean will look at it and test as well, because the patch fixes the bug for me 100%, I can't reproduce the buggy behaviour when dragging slider to zero with patched Avidemux.

I usually just use

patch -p1 < /path/to/the/diff/file.patch

to patch and

patch -Rp1 < /path/to/the/diff/file.patch

to revert.

Jan Gruuthuse

#18
you do test with with mpeg-ts over 2 hours in duration? Just in case?
I try your way of patching, see if that makes difference.
update:
patch -p1 < ~/Downloads/dragging-slider-to-zero-does-not-rewind-video-to-zero-fix.patch
Quotepatching file avidemux/common/gui_navigate.cpp

test if code is present:
grep -n "getNKFramePTS(&pts)" avidemux/common/gui_navigate.cpp
Quote73:                if(false==video_body->getNKFramePTS(&pts))

now rebuilding

eumagga0x2a

Yes, with transport streams, program streams and mkv files up to 3 hours in duration, both HD (h264) and mpeg2. Works 100%

The way of patching should not matter in this case, because the patch was successfully applied.


eumagga0x2a

Actually, the approach used in the path would fail in the case if getNKFramePTS (getting the PTS of the next keyframe) fails at the start of the video for whatever reason. Could you please drag the slider from right fully to the left (and leave it there) and post the last ~100 lines of the Avidemux console output?

Jan Gruuthuse

as requested: 7zipped, its a bit longer

eumagga0x2a

Thank you, but the slider was never moved fully to the left (to zero) as requested. You've moved it fully to the right instead and left it there:

grep Scale\ : SliderFromLeft\ ToRight
  [HandleAction_Navigate]  Scale :9
  [HandleAction_Navigate]  Scale :1211
  [HandleAction_Navigate]  Scale :2128
  [HandleAction_Navigate]  Scale :2173
  [HandleAction_Navigate]  Scale :2618
  [HandleAction_Navigate]  Scale :2947
  [HandleAction_Navigate]  Scale :3179
  [HandleAction_Navigate]  Scale :3259
  [HandleAction_Navigate]  Scale :3500
  [HandleAction_Navigate]  Scale :3758
  [HandleAction_Navigate]  Scale :4016
  [HandleAction_Navigate]  Scale :4087
  [HandleAction_Navigate]  Scale :4363
  [HandleAction_Navigate]  Scale :4657
  [HandleAction_Navigate]  Scale :4862
  [HandleAction_Navigate]  Scale :4889
  [HandleAction_Navigate]  Scale :5058
  [HandleAction_Navigate]  Scale :5646
  [HandleAction_Navigate]  Scale :6652
  [HandleAction_Navigate]  Scale :6803
  [HandleAction_Navigate]  Scale :7124
  [HandleAction_Navigate]  Scale :7578
  [HandleAction_Navigate]  Scale :7907
  [HandleAction_Navigate]  Scale :7925
  [HandleAction_Navigate]  Scale :7970
  [HandleAction_Navigate]  Scale :8308
  [HandleAction_Navigate]  Scale :8700
  [HandleAction_Navigate]  Scale :9207
  [HandleAction_Navigate]  Scale :9288
  [HandleAction_Navigate]  Scale :9323
  [HandleAction_Navigate]  Scale :9421
  [HandleAction_Navigate]  Scale :9813
  [HandleAction_Navigate]  Scale :9858
  [HandleAction_Navigate]  Scale :9920
  [HandleAction_Navigate]  Scale :9947
  [HandleAction_Navigate]  Scale :10000

Jan Gruuthuse


Jan Gruuthuse

I see, you did not mention: the jump to start only happens when you release left mouse press.
It's a way of solving issue, ....

eumagga0x2a

Quote from: Jan Gruuthuse on September 30, 2016, 08:47:04 AM
I see, you did not mention: the jump to start only happens when you release left mouse press.

No, it works for me even without releasing the slider (which executes ACT_Scale once again: https://github.com/mean00/avidemux2/blob/master/avidemux/qt4/ADM_userInterfaces/ADM_gui/Q_gui2.cpp#L251 at line 259).

  [HandleAction]  ************ Scale **************
  [HandleAction]  ************ Scale **************
  [HandleAction_Navigate]  Scale :0
  [HandleAction_Navigate]  Scale Time:5 ms (total=8100366 ms)
  [HandleAction_Navigate]  Scale Time:00:00:00,005 ms
  [searchPreviousKeyFrameInRef]  Cannot find keyframe with PTS less than 00:00:00,005
  [getPKFramePTS]   No previous previous keyfr for frameTime 5000 in ref 0 seg:0 nkTime 140724603453 refTime:5 ms startTime=0 r=0
  [searchNextKeyFrameInRef]  Found nextkeyframe 706 0:0:0 at frame 0
  [HandleAction_Navigate]  Seeking to  Time:00:00:00,706 ms
  [DecodePictureUpToIntra]   DecodeUpToInta 0 ref:0


Is says "Found nextkeyframe" so it should have worked.

Console output from your Avidemux build differs from mine in one significant point though: there are always double scale events all over the place. Don't understand why yet.

Jan Gruuthuse


eumagga0x2a

#27
Would you please test the following compound not-for-production patch (which includes an unrelated fix for PgDown after loading a video resulting in an error)? As far as I understand, it would force Avidemux to redraw twice after a scale event and when navigating to the next or previous keyframe.

diff --git a/avidemux/common/gui_navigate.cpp b/avidemux/common/gui_navigate.cpp
index 23df368..f3b5615 100644
--- a/avidemux/common/gui_navigate.cpp
+++ b/avidemux/common/gui_navigate.cpp
@@ -70,9 +70,12 @@ static int ignore_change=0;
           ADM_info("Scale Time:%s ms \n",ADM_us2plain(pts));
            if(false==video_body->getPKFramePTS(&pts))
             {
-                ADM_warning("Cannot seek to %" PRIu64" ms\n",pts/1000);
-                ignore_change--;
-                break;
+                if(false==video_body->getNKFramePTS(&pts))
+                {
+                    ADM_warning("Cannot seek to %" PRIu64" ms\n",pts/1000);
+                    ignore_change--;
+                    break;
+                }
             }
              ADM_info("Seeking to  Time:%s ms \n",ADM_us2plain(pts));
             if(true!=admPreview::seekToIntraPts(pts))
@@ -80,6 +83,7 @@ static int ignore_change=0;
                 ADM_warning("Scale: Seeking to intra at %" PRIu64" ms failed\n",pts/1000);
             }
             UI_setCurrentTime(pts);
+            admPreview::samePicture();
             UI_purge();
             ignore_change--;
         }
@@ -90,8 +94,26 @@ static int ignore_change=0;
                 uint64_t pts;
                 if(action==ACT_GotoMarkA) pts=video_body->getMarkerAPts();
                         else  pts=video_body->getMarkerBPts();
-                GUI_GoToTime(pts);
-                 
+                if(false==video_body->goToTimeVideo(pts))
+                {
+                    if(action==ACT_GotoMarkA)
+                    {
+                        ADM_warning("Go to Marker A: Seek to time %s ms failed\n",ADM_us2plain(pts));
+                    }else // PTS returned by getMarkerBPts() may be beyond the last frame.
+                          // Go to the last frame then.
+                    {
+                        pts=video_body->getLastKeyFramePts();
+                        if(pts==ADM_NO_PTS) break;           
+                        admPreview::deferDisplay(1);
+                        GUI_GoToTime(pts);
+                        while(admPreview::nextPicture())
+                        {
+                        }
+                        admPreview::deferDisplay(0);
+                    }
+                }
+                admPreview::samePicture();
+                GUI_setCurrentFrameAndTime();
             }
             break;

@@ -228,6 +250,7 @@ void GUI_NextKeyFrame(void)
         A_timedError(QT_TRANSLATE_NOOP("navigate","Cannot go to next keyframe"));
         return;
       }
+    admPreview::samePicture();
     GUI_setCurrentFrameAndTime();
     UI_purge();
}
@@ -297,6 +320,7 @@ void GUI_PreviousKeyFrame(void)
           A_timedError(QT_TRANSLATE_NOOP("navigate","Cannot go to previous keyframe"));
  return;
       }
+    admPreview::samePicture();
     GUI_setCurrentFrameAndTime();
     UI_purge();


This patch includes the previous one, so please revert dragging-slider-to-zero-does-not-rewind-video-to-zero-fix.patch first.

Jan Gruuthuse


eumagga0x2a

The patch was not related to redoubled scale actions

  [HandleAction]  ************ Scale **************
  [HandleAction]  ************ Scale **************


in the output. It was trying to fix the issue I can't reproduce with the video window showing previous picture (not refreshing). Does Avidemux still fail to display the first keyframe when the slider is dragged (but not released) fully back to the left?