[FFmpeg-devel] [PATCH 3/5] ffplay: add support for changing pixel format

Marton Balint cus at passwd.hu
Thu Jun 7 00:02:33 CEST 2012


With the filtering code refactored, it was much easier to finally fix this.

Fixes ticket 123 and 238.

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 ffplay.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index e7ee4b1..d832488 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1648,6 +1648,7 @@ static int video_thread(void *arg)
     AVFilterContext *filt_out = NULL, *filt_in = NULL;
     int last_w = is->video_st->codec->width;
     int last_h = is->video_st->codec->height;
+    enum PixelFormat last_format = is->video_st->codec->pix_fmt;
 
     if ((ret = configure_video_filters(graph, is, vfilters)) < 0) {
         SDL_Event event;
@@ -1683,7 +1684,8 @@ static int video_thread(void *arg)
 
 #if CONFIG_AVFILTER
         if (   last_w != is->video_st->codec->width
-            || last_h != is->video_st->codec->height) {
+            || last_h != is->video_st->codec->height
+            || last_format != is->video_st->codec->pix_fmt) {
             av_log(NULL, AV_LOG_INFO, "Frame changed from size:%dx%d to size:%dx%d\n",
                    last_w, last_h, is->video_st->codec->width, is->video_st->codec->height);
             avfilter_graph_free(&graph);
@@ -1694,6 +1696,7 @@ static int video_thread(void *arg)
             filt_out = is->out_video_filter;
             last_w = is->video_st->codec->width;
             last_h = is->video_st->codec->height;
+            last_format = is->video_st->codec->pix_fmt;
         }
 
         frame->pts = pts_int;
-- 
1.7.3.4



More information about the ffmpeg-devel mailing list