Browse code

vf_showinfo: show timebase & framerate too

(cherry picked from ffmpeg commit fdb93996811bacfa7b82995cdc0f93c46f3dc6cc)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Michael Niedermayer authored on 2015/11/04 02:57:27
Showing 1 changed files
... ...
@@ -140,12 +140,36 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
140 140
     return ff_filter_frame(inlink->dst->outputs[0], frame);
141 141
 }
142 142
 
143
+static int config_props(AVFilterContext *ctx, AVFilterLink *link, int is_out)
144
+{
145
+
146
+    av_log(ctx, AV_LOG_INFO, "config %s time_base: %d/%d, frame_rate: %d/%d\n",
147
+           is_out ? "out" : "in",
148
+           link->time_base.num, link->time_base.den,
149
+           link->frame_rate.num, link->frame_rate.den);
150
+
151
+    return 0;
152
+}
153
+
154
+static int config_props_in(AVFilterLink *link)
155
+{
156
+    AVFilterContext *ctx = link->dst;
157
+    return config_props(ctx, link, 0);
158
+}
159
+
160
+static int config_props_out(AVFilterLink *link)
161
+{
162
+    AVFilterContext *ctx = link->src;
163
+    return config_props(ctx, link, 1);
164
+}
165
+
143 166
 static const AVFilterPad avfilter_vf_showinfo_inputs[] = {
144 167
     {
145 168
         .name             = "default",
146 169
         .type             = AVMEDIA_TYPE_VIDEO,
147 170
         .get_video_buffer = ff_null_get_video_buffer,
148 171
         .filter_frame     = filter_frame,
172
+        .config_props     = config_props_in,
149 173
     },
150 174
     { NULL }
151 175
 };
... ...
@@ -153,7 +177,8 @@ static const AVFilterPad avfilter_vf_showinfo_inputs[] = {
153 153
 static const AVFilterPad avfilter_vf_showinfo_outputs[] = {
154 154
     {
155 155
         .name = "default",
156
-        .type = AVMEDIA_TYPE_VIDEO
156
+        .type = AVMEDIA_TYPE_VIDEO,
157
+        .config_props  = config_props_out,
157 158
     },
158 159
     { NULL }
159 160
 };