avfilter/avf_showspectrum: stop rewriting pts
Also fix dropping of first frame for fullframe sliding.
This commit is contained in:
@@ -93,12 +93,12 @@ typedef struct ShowSpectrumContext {
|
|||||||
double win_scale;
|
double win_scale;
|
||||||
float overlap;
|
float overlap;
|
||||||
float gain;
|
float gain;
|
||||||
int consumed;
|
|
||||||
int hop_size;
|
int hop_size;
|
||||||
float *combine_buffer; ///< color combining buffer (3 * h items)
|
float *combine_buffer; ///< color combining buffer (3 * h items)
|
||||||
float **color_buffer; ///< color buffer (3 * h * ch items)
|
float **color_buffer; ///< color buffer (3 * h * ch items)
|
||||||
int64_t pts;
|
int64_t pts;
|
||||||
int64_t old_pts;
|
int64_t old_pts;
|
||||||
|
int64_t in_pts;
|
||||||
int old_len;
|
int old_len;
|
||||||
int single_pic;
|
int single_pic;
|
||||||
int legend;
|
int legend;
|
||||||
@@ -1464,7 +1464,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s->sliding != FULLFRAME || s->xpos == 0)
|
if (s->sliding != FULLFRAME || s->xpos == 0)
|
||||||
s->pts = outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base);
|
s->pts = outpicref->pts = av_rescale_q(s->in_pts, inlink->time_base, outlink->time_base);
|
||||||
|
|
||||||
if (s->sliding == LREPLACE) {
|
if (s->sliding == LREPLACE) {
|
||||||
s->xpos--;
|
s->xpos--;
|
||||||
@@ -1481,7 +1481,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!s->single_pic && (s->sliding != FULLFRAME || s->xpos == 0)) {
|
if (!s->single_pic && (s->sliding != FULLFRAME || s->xpos == 0)) {
|
||||||
if (s->old_pts < outpicref->pts) {
|
if (s->old_pts < outpicref->pts || s->sliding == FULLFRAME) {
|
||||||
AVFrame *clone;
|
AVFrame *clone;
|
||||||
|
|
||||||
if (s->legend) {
|
if (s->legend) {
|
||||||
@@ -1544,7 +1544,6 @@ static int activate(AVFilterContext *ctx)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
s->consumed += fin->nb_samples;
|
|
||||||
ff_filter_execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels);
|
ff_filter_execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels);
|
||||||
|
|
||||||
if (s->data == D_MAGNITUDE)
|
if (s->data == D_MAGNITUDE)
|
||||||
@@ -1556,6 +1555,8 @@ static int activate(AVFilterContext *ctx)
|
|||||||
if (s->data == D_UPHASE)
|
if (s->data == D_UPHASE)
|
||||||
ff_filter_execute(ctx, calc_channel_uphases, NULL, NULL, s->nb_display_channels);
|
ff_filter_execute(ctx, calc_channel_uphases, NULL, NULL, s->nb_display_channels);
|
||||||
|
|
||||||
|
if (s->xpos == 0 || s->sliding != FULLFRAME)
|
||||||
|
s->in_pts = fin->pts;
|
||||||
ret = plot_spectrum_column(inlink, fin);
|
ret = plot_spectrum_column(inlink, fin);
|
||||||
av_frame_free(&fin);
|
av_frame_free(&fin);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
@@ -1580,7 +1581,7 @@ static int activate(AVFilterContext *ctx)
|
|||||||
memset(s->outpicref->data[2] + i * s->outpicref->linesize[2], 128, outlink->w);
|
memset(s->outpicref->data[2] + i * s->outpicref->linesize[2], 128, outlink->w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->outpicref->pts += av_rescale_q(s->consumed, inlink->time_base, outlink->time_base);
|
s->outpicref->pts = av_rescale_q(s->in_pts, inlink->time_base, outlink->time_base);
|
||||||
pts = s->outpicref->pts;
|
pts = s->outpicref->pts;
|
||||||
ret = ff_filter_frame(outlink, s->outpicref);
|
ret = ff_filter_frame(outlink, s->outpicref);
|
||||||
s->outpicref = NULL;
|
s->outpicref = NULL;
|
||||||
|
Reference in New Issue
Block a user