yet another attempt to deal with ffmpeg seeks, fred name/color change
authorGood Guy <good1.2guy@gmail.com>
Wed, 6 Sep 2017 21:52:30 +0000 (15:52 -0600)
committerGood Guy <good1.2guy@gmail.com>
Wed, 6 Sep 2017 21:52:30 +0000 (15:52 -0600)
cinelerra-5.1/cinelerra/appearanceprefs.C
cinelerra-5.1/cinelerra/ffmpeg.C
cinelerra-5.1/cinelerra/timebar.C

index 01779b4f13bca8360faf040f0523f9779cec8c08..a865db1ea5927353570486a86fbbe074eca265f1 100644 (file)
@@ -473,7 +473,7 @@ int DeactivateFocusPolicy::handle_event()
 
 ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y)
  : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement,
-       _("Forward render enable displacement"))
+       _("Always show next frame"))
 {
        this->pwindow = pwindow;
 }
index b451c79780127ca1dbffe59f0f2a62dae583cc94..74b32cf115c2f176a711f098ff59344e5144b46b 100644 (file)
@@ -511,7 +511,13 @@ int FFStream::seek(int64_t no, double rate)
        double secs = pos < 0 ? 0. : pos / rate;
        AVRational time_base = st->time_base;
        int64_t tstmp = time_base.num > 0 ? secs * time_base.den/time_base.num : 0;
-       if( nudge != AV_NOPTS_VALUE ) tstmp += nudge;
+       if( !tstmp ) {
+               if( st->nb_index_entries > 0 ) tstmp = st->index_entries[0].timestamp;
+               else if( st->start_time != AV_NOPTS_VALUE ) tstmp = st->start_time;
+               else if( st->first_dts != AV_NOPTS_VALUE ) tstmp = st->first_dts;
+               else tstmp = INT64_MIN+1;
+       }
+       else if( nudge != AV_NOPTS_VALUE ) tstmp += nudge;
        int idx = st->index;
 #if 0
 // seek all streams using the default timebase.
@@ -531,7 +537,9 @@ int FFStream::seek(int64_t no, double rate)
        }
        int ret = avformat_seek_file(fmt_ctx, st->index, -INT64_MAX, seek, INT64_MAX, flags);
 #else
-       int ret = av_seek_frame(fmt_ctx, idx, tstmp, AVSEEK_FLAG_ANY);
+// finds the first index frame below the target time
+       int flags = AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY;
+       int ret = av_seek_frame(fmt_ctx, idx, tstmp, flags);
 #endif
        int retry = MAX_RETRY;
        while( ret >= 0 ) {
index ed0011cd71f102a52d9b4b45f81436533f1a1536..5325a264dc08adba1390f8df74808cadfe49681a 100644 (file)
@@ -430,7 +430,10 @@ void TimeBar::update(int flush)
                double position = edl->local_session->get_selectionstart(1);
                int64_t pixel = position_to_pixel(position);
 // Draw insertion point position.
-               set_color(mwindow->theme->timebar_cursor_color);
+               int color = mwindow->theme->timebar_cursor_color;
+               if( mwindow->preferences->forward_render_displacement )
+                       color ^= 0x00ffff;
+               set_color(color);
                draw_line(pixel, 0, pixel, get_h());
        }