mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avfilter/avf_showspectrum: stop rewriting pts
Also fix dropping of first frame for fullframe sliding.
This commit is contained in:
parent
61224c856c
commit
07b8d6a897
@ -93,12 +93,12 @@ typedef struct ShowSpectrumContext {
|
||||
double win_scale;
|
||||
float overlap;
|
||||
float gain;
|
||||
int consumed;
|
||||
int hop_size;
|
||||
float *combine_buffer; ///< color combining buffer (3 * h items)
|
||||
float **color_buffer; ///< color buffer (3 * h * ch items)
|
||||
int64_t pts;
|
||||
int64_t old_pts;
|
||||
int64_t in_pts;
|
||||
int old_len;
|
||||
int single_pic;
|
||||
int legend;
|
||||
@ -1464,7 +1464,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)
|
||||
}
|
||||
|
||||
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) {
|
||||
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->old_pts < outpicref->pts) {
|
||||
if (s->old_pts < outpicref->pts || s->sliding == FULLFRAME) {
|
||||
AVFrame *clone;
|
||||
|
||||
if (s->legend) {
|
||||
@ -1544,7 +1544,6 @@ static int activate(AVFilterContext *ctx)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret > 0) {
|
||||
s->consumed += fin->nb_samples;
|
||||
ff_filter_execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels);
|
||||
|
||||
if (s->data == D_MAGNITUDE)
|
||||
@ -1556,6 +1555,8 @@ static int activate(AVFilterContext *ctx)
|
||||
if (s->data == D_UPHASE)
|
||||
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);
|
||||
av_frame_free(&fin);
|
||||
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);
|
||||
}
|
||||
}
|
||||
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;
|
||||
ret = ff_filter_frame(outlink, s->outpicref);
|
||||
s->outpicref = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user