@@ -344,6 +344,7 @@ static const char *video_codec_name;
double rdftspeed = 0.02;
static int64_t cursor_last_shown;
static int cursor_hidden = 0;
+static int show_progress_line = 0;
#if CONFIG_AVFILTER
static const char **vfilters_list = NULL;
static int nb_vfilters = 0;
@@ -1299,21 +1300,6 @@ static int video_open(VideoState *is)
return 0;
}
-/* display the current picture, if any */
-static void video_display(VideoState *is)
-{
- if (!window)
- video_open(is);
-
- SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
- SDL_RenderClear(renderer);
- if (is->audio_st && is->show_mode != SHOW_MODE_VIDEO)
- video_audio_display(is);
- else if (is->video_st)
- video_image_display(is);
- SDL_RenderPresent(renderer);
-}
-
static double get_clock(Clock *c)
{
if (*c->queue_serial != c->serial)
@@ -1513,6 +1499,37 @@ static void update_video_pts(VideoState
sync_clock_to_slave(&is->extclk, &is->vidclk);
}
+static void video_progress_line_display(VideoState *is) {
+ double d = is->ic->duration / 1.0e6;
+ if (d > 0) {
+ double t = get_master_clock(is);
+ int w = is->width * t / d;
+ SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
+ fill_rectangle(0, is->height-1, w, 1);
+ SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
+ fill_rectangle(w, is->height-1, is->width-w, 1);
+ } else {
+ show_progress_line = 0;
+ }
+}
+
+/* display the current picture, if any */
+static void video_display(VideoState *is)
+{
+ if (!window)
+ video_open(is);
+
+ SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
+ SDL_RenderClear(renderer);
+ if (is->audio_st && is->show_mode != SHOW_MODE_VIDEO)
+ video_audio_display(is);
+ else if (is->video_st)
+ video_image_display(is);
+ if (show_progress_line)
+ video_progress_line_display(is);
+ SDL_RenderPresent(renderer);
+}
+
/* called to display each frame */
static void video_refresh(void *opaque, double *remaining_time)
{
@@ -3265,6 +3282,9 @@ static void event_loop(VideoState *cur_s
toggle_audio_display(cur_stream);
#endif
break;
+ case SDLK_l:
+ show_progress_line = !show_progress_line;
+ break;
case SDLK_PAGEUP:
if (cur_stream->ic->nb_chapters <= 1) {
incr = 600.0;
@@ -3543,6 +3563,7 @@ static const OptionDef options[] = {
#endif
{ "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
{ "showmode", HAS_ARG, { .func_arg = opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
+ { "progress", OPT_BOOL, { &show_progress_line}, "show progress line at the bottom", ""},
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { .func_arg = opt_default }, "generic catch all option", "" },
{ "i", OPT_BOOL, { &dummy}, "read specified file", "input_file"},
{ "codec", HAS_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
@@ -3587,6 +3608,7 @@ void show_help_default(const char *opt,
"c cycle program\n"
"w cycle video filters or show modes\n"
"s activate frame-step mode\n"
+ "l toggle progress line at the bottom\n"
"left/right seek backward/forward 10 seconds\n"
"down/up seek backward/forward 1 minute\n"
"page down/page up seek backward/forward 10 minutes\n"