]> git.sesse.net Git - ffmpeg/blobdiff - ffplay.c
cosmetics : Print newline after error message.
[ffmpeg] / ffplay.c
index 6d48684703c8c522f86296d9821d6d2b207b4481..f80a71e07e5c49cdbbac5aa770f14f744044ed76 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -260,6 +260,8 @@ static int error_concealment = 3;
 static int decoder_reorder_pts= -1;
 static int autoexit;
 static int framedrop=1;
+
+static int rdftspeed=20;
 #if CONFIG_AVFILTER
 static char *vfilters = NULL;
 #endif
@@ -1021,7 +1023,7 @@ static int refresh_thread(void *opaque)
             is->refresh=1;
     SDL_PushEvent(&event);
         }
-        usleep(5000); //FIXME ideally we should wait the correct time but SDLs event passing is so slow it would be silly
+        usleep(is->audio_st && is->show_audio ? rdftspeed*1000 : 5000); //FIXME ideally we should wait the correct time but SDLs event passing is so slow it would be silly
     }
     return 0;
 }
@@ -1280,8 +1282,8 @@ retry:
             av_diff = 0;
             if (is->audio_st && is->video_st)
                 av_diff = get_audio_clock(is) - get_video_clock(is);
-            printf("%7.2f A-V:%7.3f aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64"   \r",
-                   get_master_clock(is), av_diff, aqsize / 1024, vqsize / 1024, sqsize, is->faulty_dts, is->faulty_pts);
+            printf("%7.2f A-V:%7.3f s:%3.1f aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64"   \r",
+                   get_master_clock(is), av_diff, FFMAX(is->skip_frames-1, 0), aqsize / 1024, vqsize / 1024, sqsize, is->faulty_dts, is->faulty_pts);
             fflush(stdout);
             last_time = cur_time;
         }
@@ -1592,6 +1594,7 @@ static int input_request_frame(AVFilterLink *link)
     av_free_packet(&pkt);
 
     picref->pts = pts;
+    picref->pos = pkt.pos;
     picref->pixel_aspect = priv->is->video_st->codec->sample_aspect_ratio;
     avfilter_start_frame(link, avfilter_ref_pic(picref, ~0));
     avfilter_draw_slice(link, 0, link->h, 1);
@@ -1655,7 +1658,7 @@ static int output_query_formats(AVFilterContext *ctx)
 }
 
 static int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
-                                    int64_t *pts)
+                                    int64_t *pts, int64_t *pos)
 {
     AVFilterPicRef *pic;
 
@@ -1667,6 +1670,7 @@ static int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
 
     frame->opaque = pic;
     *pts          = pic->pts;
+    *pos          = pic->pos;
 
     memcpy(frame->data,     pic->data,     sizeof(frame->data));
     memcpy(frame->linesize, pic->linesize, sizeof(frame->linesize));
@@ -1693,7 +1697,7 @@ static int video_thread(void *arg)
 {
     VideoState *is = arg;
     AVFrame *frame= avcodec_alloc_frame();
-    int64_t pts_int;
+    int64_t pts_int, pos;
     double pts;
     int ret;
 
@@ -1746,7 +1750,7 @@ static int video_thread(void *arg)
         while (is->paused && !is->videoq.abort_request)
             SDL_Delay(10);
 #if CONFIG_AVFILTER
-        ret = get_filtered_video_frame(filt_out, frame, &pts_int);
+        ret = get_filtered_video_frame(filt_out, frame, &pts_int, &pos);
 #else
         ret = get_video_frame(is, frame, &pts_int, &pkt);
 #endif
@@ -1759,7 +1763,7 @@ static int video_thread(void *arg)
         pts = pts_int*av_q2d(is->video_st->time_base);
 
 #if CONFIG_AVFILTER
-        ret = output_picture2(is, frame, pts,  -1); /* fixme: unknown pos */
+        ret = output_picture2(is, frame, pts, pos);
 #else
         ret = output_picture2(is, frame, pts,  pkt.pos);
         av_free_packet(&pkt);
@@ -2959,6 +2963,7 @@ static const OptionDef options[] = {
 #if CONFIG_AVFILTER
     { "vfilters", OPT_STRING | HAS_ARG, {(void*)&vfilters}, "video filters", "filter list" },
 #endif
+    { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {(void*)&rdftspeed}, "rdft speed", "msecs" },
     { "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
     { NULL, },
 };