]> git.sesse.net Git - ffmpeg/blobdiff - ffplay.c
Merge commit '55aa03b9f8f11ebb7535424cc0e5635558590f49'
[ffmpeg] / ffplay.c
index f300f7e567df81b09d0c5de04533f9ab4d1810ab..93090ad60bb6c67874632aec41e481d7a1d4f0b6 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -116,7 +116,6 @@ typedef struct PacketQueue {
 typedef struct VideoPicture {
     double pts;             // presentation timestamp for this picture
     int64_t pos;            // byte position in file
-    int skip;
     SDL_Overlay *bmp;
     int width, height; /* source height & width */
     AVRational sample_aspect_ratio;
@@ -1261,7 +1260,7 @@ static void pictq_prev_picture(VideoState *is) {
     VideoPicture *prevvp;
     /* update queue size and signal for the previous picture */
     prevvp = &is->pictq[(is->pictq_rindex + VIDEO_PICTURE_QUEUE_SIZE - 1) % VIDEO_PICTURE_QUEUE_SIZE];
-    if (prevvp->allocated && !prevvp->skip) {
+    if (prevvp->allocated && prevvp->serial == is->videoq.serial) {
         SDL_LockMutex(is->pictq_mutex);
         if (is->pictq_size < VIDEO_PICTURE_QUEUE_SIZE - 1) {
             if (--is->pictq_rindex == -1)
@@ -1316,7 +1315,7 @@ retry:
             /* dequeue the picture */
             vp = &is->pictq[is->pictq_rindex];
 
-            if (vp->skip) {
+            if (vp->serial != is->videoq.serial) {
                 pictq_next_picture(is);
                 goto retry;
             }
@@ -1619,7 +1618,6 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
 
         vp->pts = pts;
         vp->pos = pos;
-        vp->skip = 0;
         vp->serial = serial;
 
         /* now we can update the picture count */
@@ -1634,7 +1632,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
 
 static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacket *pkt, int *serial)
 {
-    int got_picture, i;
+    int got_picture;
 
     if (packet_queue_get(&is->videoq, pkt, 1, serial) < 0)
         return -1;
@@ -1644,9 +1642,6 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke
 
         SDL_LockMutex(is->pictq_mutex);
         // Make sure there are no long delay timers (ideally we should just flush the queue but that's harder)
-        for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) {
-            is->pictq[i].skip = 1;
-        }
         while (is->pictq_size && !is->videoq.abort_request) {
             SDL_CondWait(is->pictq_cond, is->pictq_mutex);
         }
@@ -1753,6 +1748,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
     if (!buffersink_params)
         return AVERROR(ENOMEM);
 
+    av_opt_get_int(sws_opts, "sws_flags", 0, &sws_flags);
     snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%"PRId64, sws_flags);
     graph->scale_sws_opts = av_strdup(sws_flags_str);
 
@@ -1814,6 +1810,7 @@ static int video_thread(void *arg)
     int last_w = 0;
     int last_h = 0;
     enum AVPixelFormat last_format = -2;
+    int last_serial = -1;
 
     if (codec->codec->capabilities & CODEC_CAP_DR1) {
         is->use_dr1 = 1;
@@ -1844,7 +1841,8 @@ static int video_thread(void *arg)
 #if CONFIG_AVFILTER
         if (   last_w != frame->width
             || last_h != frame->height
-            || last_format != frame->format) {
+            || last_format != frame->format
+            || last_serial != serial) {
             av_log(NULL, AV_LOG_INFO, "Frame changed from size:%dx%d to size:%dx%d\n",
                    last_w, last_h, frame->width, frame->height);
             avfilter_graph_free(&graph);
@@ -1862,6 +1860,7 @@ static int video_thread(void *arg)
             last_w = frame->width;
             last_h = frame->height;
             last_format = frame->format;
+            last_serial = serial;
         }
 
         frame->pts = pts_int;
@@ -3241,7 +3240,7 @@ static const OptionDef options[] = {
     { "infbuf", OPT_BOOL | OPT_EXPERT, { &infinite_buffer }, "don't limit the input buffer size (useful with realtime streams)", "" },
     { "window_title", OPT_STRING | HAS_ARG, { &window_title }, "set window title", "window title" },
 #if CONFIG_AVFILTER
-    { "vf", OPT_STRING | HAS_ARG, { &vfilters }, "video filters", "filter list" },
+    { "vf", OPT_STRING | HAS_ARG, { &vfilters }, "set video filters", "filter_graph" },
 #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" },