Commit 39dc1bc9 authored by Clément Bœsch's avatar Clément Bœsch

lavfi/(a)showinfo: use link frame counter instead of local counter.

parent 81bec0ac
...@@ -43,11 +43,6 @@ typedef struct AShowInfoContext { ...@@ -43,11 +43,6 @@ typedef struct AShowInfoContext {
* Scratch space for individual plane checksums for planar audio * Scratch space for individual plane checksums for planar audio
*/ */
uint32_t *plane_checksums; uint32_t *plane_checksums;
/**
* Frame counter
*/
uint64_t frame;
} AShowInfoContext; } AShowInfoContext;
static av_cold void uninit(AVFilterContext *ctx) static av_cold void uninit(AVFilterContext *ctx)
...@@ -86,10 +81,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) ...@@ -86,10 +81,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
buf->channel_layout); buf->channel_layout);
av_log(ctx, AV_LOG_INFO, av_log(ctx, AV_LOG_INFO,
"n:%"PRIu64" pts:%s pts_time:%s pos:%"PRId64" " "n:%"PRId64" pts:%s pts_time:%s pos:%"PRId64" "
"fmt:%s channels:%d chlayout:%s rate:%d nb_samples:%d " "fmt:%s channels:%d chlayout:%s rate:%d nb_samples:%d "
"checksum:%08X ", "checksum:%08X ",
s->frame, inlink->frame_count,
av_ts2str(buf->pts), av_ts2timestr(buf->pts, &inlink->time_base), av_ts2str(buf->pts), av_ts2timestr(buf->pts, &inlink->time_base),
av_frame_get_pkt_pos(buf), av_frame_get_pkt_pos(buf),
av_get_sample_fmt_name(buf->format), av_frame_get_channels(buf), chlayout_str, av_get_sample_fmt_name(buf->format), av_frame_get_channels(buf), chlayout_str,
...@@ -101,7 +96,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) ...@@ -101,7 +96,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
av_log(ctx, AV_LOG_INFO, "%08X ", s->plane_checksums[i]); av_log(ctx, AV_LOG_INFO, "%08X ", s->plane_checksums[i]);
av_log(ctx, AV_LOG_INFO, "]\n"); av_log(ctx, AV_LOG_INFO, "]\n");
s->frame++;
return ff_filter_frame(inlink->dst->outputs[0], buf); return ff_filter_frame(inlink->dst->outputs[0], buf);
} }
......
...@@ -31,14 +31,9 @@ ...@@ -31,14 +31,9 @@
#include "internal.h" #include "internal.h"
#include "video.h" #include "video.h"
typedef struct {
unsigned int frame;
} ShowInfoContext;
static int filter_frame(AVFilterLink *inlink, AVFrame *frame) static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
ShowInfoContext *showinfo = ctx->priv;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
uint32_t plane_checksum[4] = {0}, checksum = 0; uint32_t plane_checksum[4] = {0}, checksum = 0;
int i, plane, vsub = desc->log2_chroma_h; int i, plane, vsub = desc->log2_chroma_h;
...@@ -59,10 +54,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) ...@@ -59,10 +54,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
} }
av_log(ctx, AV_LOG_INFO, av_log(ctx, AV_LOG_INFO,
"n:%d pts:%s pts_time:%s pos:%"PRId64" " "n:%"PRId64" pts:%s pts_time:%s pos:%"PRId64" "
"fmt:%s sar:%d/%d s:%dx%d i:%c iskey:%d type:%c " "fmt:%s sar:%d/%d s:%dx%d i:%c iskey:%d type:%c "
"checksum:%08X plane_checksum:[%08X", "checksum:%08X plane_checksum:[%08X",
showinfo->frame, inlink->frame_count,
av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base), av_frame_get_pkt_pos(frame), av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base), av_frame_get_pkt_pos(frame),
desc->name, desc->name,
frame->sample_aspect_ratio.num, frame->sample_aspect_ratio.den, frame->sample_aspect_ratio.num, frame->sample_aspect_ratio.den,
...@@ -77,7 +72,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) ...@@ -77,7 +72,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
av_log(ctx, AV_LOG_INFO, " %08X", plane_checksum[plane]); av_log(ctx, AV_LOG_INFO, " %08X", plane_checksum[plane]);
av_log(ctx, AV_LOG_INFO, "]\n"); av_log(ctx, AV_LOG_INFO, "]\n");
showinfo->frame++;
return ff_filter_frame(inlink->dst->outputs[0], frame); return ff_filter_frame(inlink->dst->outputs[0], frame);
} }
...@@ -103,8 +97,6 @@ AVFilter avfilter_vf_showinfo = { ...@@ -103,8 +97,6 @@ AVFilter avfilter_vf_showinfo = {
.name = "showinfo", .name = "showinfo",
.description = NULL_IF_CONFIG_SMALL("Show textual information for each video frame."), .description = NULL_IF_CONFIG_SMALL("Show textual information for each video frame."),
.priv_size = sizeof(ShowInfoContext),
.inputs = avfilter_vf_showinfo_inputs, .inputs = avfilter_vf_showinfo_inputs,
.outputs = avfilter_vf_showinfo_outputs, .outputs = avfilter_vf_showinfo_outputs,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment