Browse code

ffplay: add support for changing pixel format

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

Fixes ticket 123 and 238.

Signed-off-by: Marton Balint <cus@passwd.hu>

Marton Balint authored on 2012/06/07 05:32:25
Showing 1 changed files
... ...
@@ -1648,6 +1648,7 @@ static int video_thread(void *arg)
1648 1648
     AVFilterContext *filt_out = NULL, *filt_in = NULL;
1649 1649
     int last_w = is->video_st->codec->width;
1650 1650
     int last_h = is->video_st->codec->height;
1651
+    enum PixelFormat last_format = is->video_st->codec->pix_fmt;
1651 1652
 
1652 1653
     if ((ret = configure_video_filters(graph, is, vfilters)) < 0) {
1653 1654
         SDL_Event event;
... ...
@@ -1684,7 +1685,8 @@ static int video_thread(void *arg)
1684 1684
 
1685 1685
 #if CONFIG_AVFILTER
1686 1686
         if (   last_w != is->video_st->codec->width
1687
-            || last_h != is->video_st->codec->height) {
1687
+            || last_h != is->video_st->codec->height
1688
+            || last_format != is->video_st->codec->pix_fmt) {
1688 1689
             av_log(NULL, AV_LOG_INFO, "Frame changed from size:%dx%d to size:%dx%d\n",
1689 1690
                    last_w, last_h, is->video_st->codec->width, is->video_st->codec->height);
1690 1691
             avfilter_graph_free(&graph);
... ...
@@ -1697,6 +1699,7 @@ static int video_thread(void *arg)
1697 1697
             filt_out = is->out_video_filter;
1698 1698
             last_w = is->video_st->codec->width;
1699 1699
             last_h = is->video_st->codec->height;
1700
+            last_format = is->video_st->codec->pix_fmt;
1700 1701
         }
1701 1702
 
1702 1703
         frame->pts = pts_int;