Browse code

ffplay: Fix auto insertion point of rotation filter

Fixes watermark rotation for videos using auto rotation

Closes #141

wanzhang authored on 2015/07/30 02:16:43
Showing 1 changed files
... ...
@@ -1905,7 +1905,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
1905 1905
     char sws_flags_str[512] = "";
1906 1906
     char buffersrc_args[256];
1907 1907
     int ret;
1908
-    AVFilterContext *filt_src = NULL, *filt_out = NULL, *last_filter = NULL;
1908
+    AVFilterContext *filt_src = NULL, *filt_out = NULL, *head_filter, *last_filter = NULL;
1909 1909
     AVCodecContext *codec = is->video_st->codec;
1910 1910
     AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL);
1911 1911
     AVDictionaryEntry *e = NULL;
... ...
@@ -1945,6 +1945,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
1945 1945
         goto fail;
1946 1946
 
1947 1947
     last_filter = filt_out;
1948
+    head_filter = filt_src;
1948 1949
 
1949 1950
 /* Note: this macro adds a filter before the lastly added filter, so the
1950 1951
  * processing order of the filters is in reverse */
... ...
@@ -1957,11 +1958,11 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
1957 1957
     if (ret < 0)                                                             \
1958 1958
         goto fail;                                                           \
1959 1959
                                                                              \
1960
-    ret = avfilter_link(filt_ctx, 0, last_filter, 0);                        \
1960
+    ret = avfilter_link(head_filter, 0, filt_ctx, 0);                        \
1961 1961
     if (ret < 0)                                                             \
1962 1962
         goto fail;                                                           \
1963 1963
                                                                              \
1964
-    last_filter = filt_ctx;                                                  \
1964
+    head_filter = filt_ctx;                                                  \
1965 1965
 } while (0)
1966 1966
 
1967 1967
     /* SDL YUV code is not handling odd width/height for some driver
... ...
@@ -1985,7 +1986,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
1985 1985
         }
1986 1986
     }
1987 1987
 
1988
-    if ((ret = configure_filtergraph(graph, vfilters, filt_src, last_filter)) < 0)
1988
+    if ((ret = configure_filtergraph(graph, vfilters, head_filter, last_filter)) < 0)
1989 1989
         goto fail;
1990 1990
 
1991 1991
     is->in_video_filter  = filt_src;