Browse code

avfilter/vf_showinfo: show timebase & framerate too

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2015/01/17 23:16:42
Showing 1 changed files
... ...
@@ -162,11 +162,36 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
162 162
     return ff_filter_frame(inlink->dst->outputs[0], frame);
163 163
 }
164 164
 
165
+static int config_props(AVFilterContext *ctx, AVFilterLink *link, int is_out)
166
+{
167
+
168
+    av_log(ctx, AV_LOG_INFO, "config %s time_base: %d/%d, frame_rate: %d/%d\n",
169
+           is_out ? "out" :"in",
170
+           link->time_base.num, link->time_base.den,
171
+           link->frame_rate.num, link->frame_rate.den
172
+    );
173
+
174
+    return 0;
175
+}
176
+
177
+static int config_props_in(AVFilterLink *link)
178
+{
179
+    AVFilterContext *ctx = link->dst;
180
+    return config_props(ctx, link, 0);
181
+}
182
+
183
+static int config_props_out(AVFilterLink *link)
184
+{
185
+    AVFilterContext *ctx = link->src;
186
+    return config_props(ctx, link, 1);
187
+}
188
+
165 189
 static const AVFilterPad avfilter_vf_showinfo_inputs[] = {
166 190
     {
167 191
         .name         = "default",
168 192
         .type         = AVMEDIA_TYPE_VIDEO,
169 193
         .filter_frame = filter_frame,
194
+        .config_props  = config_props_in,
170 195
     },
171 196
     { NULL }
172 197
 };
... ...
@@ -174,7 +199,8 @@ static const AVFilterPad avfilter_vf_showinfo_inputs[] = {
174 174
 static const AVFilterPad avfilter_vf_showinfo_outputs[] = {
175 175
     {
176 176
         .name = "default",
177
-        .type = AVMEDIA_TYPE_VIDEO
177
+        .type = AVMEDIA_TYPE_VIDEO,
178
+        .config_props  = config_props_out,
178 179
     },
179 180
     { NULL }
180 181
 };