Fixes limitation of input duration that showspectrumpic can process.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -30,7 +30,6 @@ · 29 unmodified lines | |||
| 30 | #include <math.h> | 30 | #include <math.h> |
| 31 | 31 | ||
| 32 | #include "libavutil/tx.h" | 32 | #include "libavutil/tx.h" |
| 33 | #include "libavutil/audio_fifo.h" | ||
| 34 | #include "libavutil/avassert.h" | 33 | #include "libavutil/avassert.h" |
| 35 | #include "libavutil/avstring.h" | 34 | #include "libavutil/avstring.h" |
| 36 | #include "libavutil/channel_layout.h" | 35 | #include "libavutil/channel_layout.h" |
| @@ -53,6 +52,8 @@ enum ColorMode { CHANNEL, INTENSITY, RAINBOW, MORELAND, NEBULAE, FIRE, FIERY, · 16 unmodified lines | |||
| 53 | enum SlideMode { REPLACE, SCROLL, FULLFRAME, RSCROLL, LREPLACE, NB_SLIDES }; | 52 | enum SlideMode { REPLACE, SCROLL, FULLFRAME, RSCROLL, LREPLACE, NB_SLIDES }; |
| 54 | enum Orientation { VERTICAL, HORIZONTAL, NB_ORIENTATIONS }; | 53 | enum Orientation { VERTICAL, HORIZONTAL, NB_ORIENTATIONS }; |
| 55 | 54 | ||
| 55 | #define DEFAULT_LENGTH 300 | ||
| 56 | |||
| 56 | typedef struct ShowSpectrumContext { | 57 | typedef struct ShowSpectrumContext { |
| 57 | const AVClass *class; | 58 | const AVClass *class; |
| 58 | int w, h; | 59 | int w, h; |
| @@ -60,6 +61,7 @@ typedef struct ShowSpectrumContext { · 1 unmodified line | |||
| 60 | AVRational auto_frame_rate; | 61 | AVRational auto_frame_rate; |
| 61 | AVRational frame_rate; | 62 | AVRational frame_rate; |
| 62 | AVFrame *outpicref; | 63 | AVFrame *outpicref; |
| 64 | AVFrame *in_frame; | ||
| 63 | int nb_display_channels; | 65 | int nb_display_channels; |
| 64 | int orientation; | 66 | int orientation; |
| 65 | int channel_width; | 67 | int channel_width; |
| @@ -95,7 +97,6 @@ typedef struct ShowSpectrumContext { · 29 unmodified lines | |||
| 95 | int hop_size; | 97 | int hop_size; |
| 96 | float *combine_buffer; ///< color combining buffer (3 * h items) | 98 | float *combine_buffer; ///< color combining buffer (3 * h items) |
| 97 | float **color_buffer; ///< color buffer (3 * h * ch items) | 99 | float **color_buffer; ///< color buffer (3 * h * ch items) |
| 98 | AVAudioFifo *fifo; | ||
| 99 | int64_t pts; | 100 | int64_t pts; |
| 100 | int64_t old_pts; | 101 | int64_t old_pts; |
| 101 | int old_len; | 102 | int old_len; |
| @@ -104,7 +105,12 @@ typedef struct ShowSpectrumContext { · 2 unmodified lines | |||
| 104 | int start_x, start_y; | 105 | int start_x, start_y; |
| 105 | float drange, limit; | 106 | float drange, limit; |
| 106 | float dmin, dmax; | 107 | float dmin, dmax; |
| 108 | uint64_t samples; | ||
| 107 | int (*plot_channel)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); | 109 | int (*plot_channel)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); |
| 110 | |||
| 111 | AVFrame **frames; | ||
| 112 | unsigned int nb_frames; | ||
| 113 | unsigned int frames_size; | ||
| 108 | } ShowSpectrumContext; | 114 | } ShowSpectrumContext; |
| 109 | 115 | ||
| 110 | #define OFFSET(x) offsetof(ShowSpectrumContext, x) | 116 | #define OFFSET(x) offsetof(ShowSpectrumContext, x) |
| @@ -330,12 +336,19 @@ static av_cold void uninit(AVFilterContext *ctx) · 219 unmodified lines | |||
| 330 | } | 336 | } |
| 331 | av_freep(&s->magnitudes); | 337 | av_freep(&s->magnitudes); |
| 332 | av_frame_free(&s->outpicref); | 338 | av_frame_free(&s->outpicref); |
| 333 | av_audio_fifo_free(s->fifo); | 339 | av_frame_free(&s->in_frame); |
| 334 | if (s->phases) { | 340 | if (s->phases) { |
| 335 | for (i = 0; i < s->nb_display_channels; i++) | 341 | for (i = 0; i < s->nb_display_channels; i++) |
| 336 | av_freep(&s->phases[i]); | 342 | av_freep(&s->phases[i]); |
| 337 | } | 343 | } |
| 338 | av_freep(&s->phases); | 344 | av_freep(&s->phases); |
| 345 | |||
| 346 | while (s->nb_frames > 0) { | ||
| 347 | av_frame_free(&s->frames[s->nb_frames - 1]); | ||
| 348 | s->nb_frames--; | ||
| 349 | } | ||
| 350 | |||
| 351 | av_freep(&s->frames); | ||
| 339 | } | 352 | } |
| 340 | 353 | ||
| 341 | static int query_formats(AVFilterContext *ctx) | 354 | static int query_formats(AVFilterContext *ctx) |
| @@ -380,6 +393,13 @@ static int run_channel_fft(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo · 38 unmodified lines | |||
| 380 | 393 | ||
| 381 | /* fill FFT input with the number of samples available */ | 394 | /* fill FFT input with the number of samples available */ |
| 382 | const float *p = (float *)fin->extended_data[ch]; | 395 | const float *p = (float *)fin->extended_data[ch]; |
| 396 | float *in_frame = (float *)s->in_frame->extended_data[ch]; | ||
| 397 | |||
| 398 | memmove(in_frame, in_frame + s->hop_size, (s->fft_size - s->hop_size) * sizeof(float)); | ||
| 399 | memcpy(in_frame + s->fft_size - s->hop_size, p, fin->nb_samples * sizeof(float)); | ||
| 400 | |||
| 401 | for (int i = fin->nb_samples; i < s->hop_size; i++) | ||
| 402 | in_frame[i + s->fft_size - s->hop_size] = 0.f; | ||
| 383 | 403 | ||
| 384 | if (s->stop) { | 404 | if (s->stop) { |
| 385 | float theta, phi, psi, a, b, S, c; | 405 | float theta, phi, psi, a, b, S, c; |
| @@ -391,7 +411,7 @@ static int run_channel_fft(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo · 5 unmodified lines | |||
| 391 | int M = s->win_size / 2; | 411 | int M = s->win_size / 2; |
| 392 | 412 | ||
| 393 | for (n = 0; n < s->win_size; n++) { | 413 | for (n = 0; n < s->win_size; n++) { |
| 394 | s->fft_data[ch][n].re = p[n] * window_func_lut[n]; | 414 | s->fft_data[ch][n].re = in_frame[n] * window_func_lut[n]; |
| 395 | s->fft_data[ch][n].im = 0; | 415 | s->fft_data[ch][n].im = 0; |
| 396 | } | 416 | } |
| 397 | 417 | ||
| @@ -458,7 +478,7 @@ static int run_channel_fft(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo · 60 unmodified lines | |||
| 458 | } | 478 | } |
| 459 | } else { | 479 | } else { |
| 460 | for (n = 0; n < s->win_size; n++) { | 480 | for (n = 0; n < s->win_size; n++) { |
| 461 | s->fft_in[ch][n].re = p[n] * window_func_lut[n]; | 481 | s->fft_in[ch][n].re = in_frame[n] * window_func_lut[n]; |
| 462 | s->fft_in[ch][n].im = 0; | 482 | s->fft_in[ch][n].im = 0; |
| 463 | } | 483 | } |
| 464 | 484 | ||
| @@ -726,7 +746,7 @@ static float get_iscale(AVFilterContext *ctx, int scale, float a) · 261 unmodified lines | |||
| 726 | return a; | 746 | return a; |
| 727 | } | 747 | } |
| 728 | 748 | ||
| 729 | static int draw_legend(AVFilterContext *ctx, int samples) | 749 | static int draw_legend(AVFilterContext *ctx, uint64_t samples) |
| 730 | { | 750 | { |
| 731 | ShowSpectrumContext *s = ctx->priv; | 751 | ShowSpectrumContext *s = ctx->priv; |
| 732 | AVFilterLink *inlink = ctx->inputs[0]; | 752 | AVFilterLink *inlink = ctx->inputs[0]; |
| @@ -1239,10 +1259,15 @@ static int config_output(AVFilterLink *outlink) · 506 unmodified lines | |||
| 1239 | av_log(ctx, AV_LOG_VERBOSE, "s:%dx%d FFT window size:%d\n", | 1259 | av_log(ctx, AV_LOG_VERBOSE, "s:%dx%d FFT window size:%d\n", |
| 1240 | s->w, s->h, s->win_size); | 1260 | s->w, s->h, s->win_size); |
| 1241 | 1261 | ||
| 1242 | av_audio_fifo_free(s->fifo); | 1262 | s->in_frame = ff_get_audio_buffer(inlink, s->win_size); |
| 1243 | s->fifo = av_audio_fifo_alloc(inlink->format, inlink->channels, s->win_size); | 1263 | if (!s->in_frame) |
| 1244 | if (!s->fifo) | 1264 | return AVERROR(ENOMEM); |
| 1265 | |||
| 1266 | s->frames = av_fast_realloc(NULL, &s->frames_size, | ||
| 1267 | DEFAULT_LENGTH * sizeof(*(s->frames))); | ||
| 1268 | if (!s->frames) | ||
| 1245 | return AVERROR(ENOMEM); | 1269 | return AVERROR(ENOMEM); |
| 1270 | |||
| 1246 | return 0; | 1271 | return 0; |
| 1247 | } | 1272 | } |
| 1248 | 1273 | ||
| @@ -1439,7 +1464,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples) · 190 unmodified lines | |||
| 1439 | } | 1464 | } |
| 1440 | 1465 | ||
| 1441 | if (s->sliding != FULLFRAME || s->xpos == 0) | 1466 | if (s->sliding != FULLFRAME || s->xpos == 0) |
| 1442 | outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base); | 1467 | s->pts = outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base); |
| 1443 | 1468 | ||
| 1444 | if (s->sliding == LREPLACE) { | 1469 | if (s->sliding == LREPLACE) { |
| 1445 | s->xpos--; | 1470 | s->xpos--; |
| @@ -1507,65 +1532,40 @@ static int activate(AVFilterContext *ctx) · 61 unmodified lines | |||
| 1507 | AVFilterLink *inlink = ctx->inputs[0]; | 1532 | AVFilterLink *inlink = ctx->inputs[0]; |
| 1508 | AVFilterLink *outlink = ctx->outputs[0]; | 1533 | AVFilterLink *outlink = ctx->outputs[0]; |
| 1509 | ShowSpectrumContext *s = ctx->priv; | 1534 | ShowSpectrumContext *s = ctx->priv; |
| 1510 | int ret; | 1535 | int ret, status; |
| 1536 | int64_t pts; | ||
| 1511 | 1537 | ||
| 1512 | FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); | 1538 | FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); |
| 1513 | 1539 | ||
| 1514 | if (av_audio_fifo_size(s->fifo) < s->win_size) { | 1540 | if (s->outpicref) { |
| 1515 | AVFrame *frame = NULL; | 1541 | AVFrame *fin; |
| 1516 | 1542 | ||
| 1517 | ret = ff_inlink_consume_frame(inlink, &frame); | 1543 | ret = ff_inlink_consume_samples(inlink, s->hop_size, s->hop_size, &fin); |
| 1518 | if (ret < 0) | 1544 | if (ret < 0) |
| 1519 | return ret; | 1545 | return ret; |
| 1520 | if (ret > 0) { | 1546 | if (ret > 0) { |
| 1521 | s->pts = frame->pts; | 1547 | s->consumed += fin->nb_samples; |
| 1522 | s->consumed = 0; | 1548 | ff_filter_execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); |
| 1523 | 1549 | ||
| 1524 | av_audio_fifo_write(s->fifo, (void **)frame->extended_data, frame->nb_samples); | 1550 | if (s->data == D_MAGNITUDE) |
| 1525 | av_frame_free(&frame); | 1551 | ff_filter_execute(ctx, calc_channel_magnitudes, NULL, NULL, s->nb_display_channels); |
| 1526 | } | ||
| 1527 | } | ||
| 1528 | 1552 | ||
| 1529 | if (s->outpicref && (av_audio_fifo_size(s->fifo) >= s->win_size || | 1553 | if (s->data == D_PHASE) |
| 1530 | ff_outlink_get_status(inlink))) { | 1554 | ff_filter_execute(ctx, calc_channel_phases, NULL, NULL, s->nb_display_channels); |
| 1531 | AVFrame *fin = ff_get_audio_buffer(inlink, s->win_size); | ||
| 1532 | if (!fin) | ||
| 1533 | return AVERROR(ENOMEM); | ||
| 1534 | 1555 | ||
| 1535 | fin->pts = s->pts + s->consumed; | 1556 | if (s->data == D_UPHASE) |
| 1536 | s->consumed += s->hop_size; | 1557 | ff_filter_execute(ctx, calc_channel_uphases, NULL, NULL, s->nb_display_channels); |
| 1537 | ret = av_audio_fifo_peek(s->fifo, (void **)fin->extended_data, | 1558 | |
| 1538 | FFMIN(s->win_size, av_audio_fifo_size(s->fifo))); | 1559 | ret = plot_spectrum_column(inlink, fin); |
| 1539 | if (ret < 0) { | ||
| 1540 | av_frame_free(&fin); | 1560 | av_frame_free(&fin); |
| 1541 | return ret; | 1561 | if (ret <= 0) |
| 1562 | return ret; | ||
| 1542 | } | 1563 | } |
| 1543 | |||
| 1544 | av_assert0(fin->nb_samples == s->win_size); | ||
| 1545 | |||
| 1546 | ff_filter_execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); | ||
| 1547 | |||
| 1548 | if (s->data == D_MAGNITUDE) | ||
| 1549 | ff_filter_execute(ctx, calc_channel_magnitudes, NULL, NULL, s->nb_display_channels); | ||
| 1550 | |||
| 1551 | if (s->data == D_PHASE) | ||
| 1552 | ff_filter_execute(ctx, calc_channel_phases, NULL, NULL, s->nb_display_channels); | ||
| 1553 | |||
| 1554 | if (s->data == D_UPHASE) | ||
| 1555 | ff_filter_execute(ctx, calc_channel_uphases, NULL, NULL, s->nb_display_channels); | ||
| 1556 | |||
| 1557 | ret = plot_spectrum_column(inlink, fin); | ||
| 1558 | |||
| 1559 | av_frame_free(&fin); | ||
| 1560 | av_audio_fifo_drain(s->fifo, s->hop_size); | ||
| 1561 | if (ret <= 0 && !ff_outlink_get_status(inlink)) | ||
| 1562 | return ret; | ||
| 1563 | } | 1564 | } |
| 1564 | 1565 | ||
| 1565 | if (ff_outlink_get_status(inlink) == AVERROR_EOF && | 1566 | if (ff_outlink_get_status(inlink) == AVERROR_EOF && |
| 1566 | s->sliding == FULLFRAME && | 1567 | s->sliding == FULLFRAME && |
| 1567 | s->xpos > 0 && s->outpicref) { | 1568 | s->xpos > 0 && s->outpicref) { |
| 1568 | int64_t pts; | ||
| 1569 | 1569 | ||
| 1570 | if (s->orientation == VERTICAL) { | 1570 | if (s->orientation == VERTICAL) { |
| 1571 | for (int i = 0; i < outlink->h; i++) { | 1571 | for (int i = 0; i < outlink->h; i++) { |
| @@ -1588,17 +1588,19 @@ static int activate(AVFilterContext *ctx) · 16 unmodified lines | |||
| 1588 | return 0; | 1588 | return 0; |
| 1589 | } | 1589 | } |
| 1590 | 1590 | ||
| 1591 | FF_FILTER_FORWARD_STATUS(inlink, outlink); | 1591 | if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { |
| 1592 | if (av_audio_fifo_size(s->fifo) >= s->win_size || | 1592 | if (status == AVERROR_EOF) { |
| 1593 | ff_inlink_queued_frames(inlink) > 0 || | 1593 | ff_outlink_set_status(outlink, status, s->pts); |
| 1594 | ff_outlink_get_status(inlink) == AVERROR_EOF) { | 1594 | return 0; |
| 1595 | } | ||
| 1596 | } | ||
| 1597 | |||
| 1598 | if (ff_inlink_queued_samples(inlink) >= s->hop_size) { | ||
| 1595 | ff_filter_set_ready(ctx, 10); | 1599 | ff_filter_set_ready(ctx, 10); |
| 1596 | return 0; | 1600 | return 0; |
| 1597 | } | 1601 | } |
| 1598 | 1602 | ||
| 1599 | if (ff_outlink_frame_wanted(outlink) && av_audio_fifo_size(s->fifo) < s->win_size && | 1603 | if (ff_outlink_frame_wanted(outlink)) { |
| 1600 | ff_inlink_queued_frames(inlink) == 0 && | ||
| 1601 | ff_outlink_get_status(inlink) != AVERROR_EOF) { | ||
| 1602 | ff_inlink_request_frame(inlink); | 1604 | ff_inlink_request_frame(inlink); |
| 1603 | return 0; | 1605 | return 0; |
| 1604 | } | 1606 | } |
| @@ -1691,39 +1693,53 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink) · 86 unmodified lines | |||
| 1691 | AVFilterContext *ctx = outlink->src; | 1693 | AVFilterContext *ctx = outlink->src; |
| 1692 | ShowSpectrumContext *s = ctx->priv; | 1694 | ShowSpectrumContext *s = ctx->priv; |
| 1693 | AVFilterLink *inlink = ctx->inputs[0]; | 1695 | AVFilterLink *inlink = ctx->inputs[0]; |
| 1694 | int ret, samples; | 1696 | int ret; |
| 1695 | 1697 | ||
| 1696 | ret = ff_request_frame(inlink); | 1698 | ret = ff_request_frame(inlink); |
| 1697 | samples = av_audio_fifo_size(s->fifo); | 1699 | if (ret == AVERROR_EOF && s->outpicref && s->samples > 0) { |
| 1698 | if (ret == AVERROR_EOF && s->outpicref && samples > 0) { | ||
| 1699 | int consumed = 0; | 1700 | int consumed = 0; |
| 1700 | int x = 0, sz = s->orientation == VERTICAL ? s->w : s->h; | 1701 | int x = 0, sz = s->orientation == VERTICAL ? s->w : s->h; |
| 1702 | unsigned int nb_frame = 0; | ||
| 1701 | int ch, spf, spb; | 1703 | int ch, spf, spb; |
| 1704 | int src_offset = 0; | ||
| 1702 | AVFrame *fin; | 1705 | AVFrame *fin; |
| 1703 | 1706 | ||
| 1704 | spf = s->win_size * (samples / ((s->win_size * sz) * ceil(samples / (float)(s->win_size * sz)))); | 1707 | spf = s->win_size * (s->samples / ((s->win_size * sz) * ceil(s->samples / (float)(s->win_size * sz)))); |
| 1705 | spf = FFMAX(1, spf); | 1708 | spf = FFMAX(1, spf); |
| 1706 | 1709 | ||
| 1707 | spb = (samples / (spf * sz)) * spf; | 1710 | spb = (s->samples / (spf * sz)) * spf; |
| 1708 | 1711 | ||
| 1709 | fin = ff_get_audio_buffer(inlink, s->win_size); | 1712 | fin = ff_get_audio_buffer(inlink, spf); |
| 1710 | if (!fin) | 1713 | if (!fin) |
| 1711 | return AVERROR(ENOMEM); | 1714 | return AVERROR(ENOMEM); |
| 1712 | 1715 | ||
| 1713 | while (x < sz) { | 1716 | while (x < sz) { |
| 1714 | ret = av_audio_fifo_peek(s->fifo, (void **)fin->extended_data, s->win_size); | 1717 | int acc_samples = 0; |
| 1715 | if (ret < 0) { | 1718 | int dst_offset = 0; |
| 1716 | av_frame_free(&fin); | 1719 | |
| 1717 | return ret; | 1720 | while (nb_frame <= s->nb_frames) { |
| 1718 | } | 1721 | AVFrame *cur_frame = s->frames[nb_frame]; |
| 1719 | 1722 | int cur_frame_samples = cur_frame->nb_samples; | |
| 1720 | av_audio_fifo_drain(s->fifo, spf); | 1723 | int nb_samples = 0; |
| 1724 | |||
| 1725 | if (acc_samples < spf) { | ||
| 1726 | nb_samples = FFMIN(spf - acc_samples, cur_frame_samples - src_offset); | ||
| 1727 | acc_samples += nb_samples; | ||
| 1728 | av_samples_copy(fin->extended_data, cur_frame->extended_data, | ||
| 1729 | dst_offset, src_offset, nb_samples, | ||
| 1730 | cur_frame->channels, AV_SAMPLE_FMT_FLTP); | ||
| 1731 | } | ||
| 1721 | 1732 | ||
| 1722 | if (ret < s->win_size) { | 1733 | src_offset += nb_samples; |
| 1723 | for (ch = 0; ch < s->nb_display_channels; ch++) { | 1734 | dst_offset += nb_samples; |
| 1724 | memset(fin->extended_data[ch] + ret * sizeof(float), 0, | 1735 | if (cur_frame_samples <= src_offset) { |
| 1725 | (s->win_size - ret) * sizeof(float)); | 1736 | av_frame_free(&s->frames[nb_frame]); |
| 1737 | nb_frame++; | ||
| 1738 | src_offset = 0; | ||
| 1726 | } | 1739 | } |
| 1740 | |||
| 1741 | if (acc_samples == spf) | ||
| 1742 | break; | ||
| 1727 | } | 1743 | } |
| 1728 | 1744 | ||
| 1729 | ff_filter_execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); | 1745 | ff_filter_execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); |
| @@ -1746,7 +1762,7 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink) · 16 unmodified lines | |||
| 1746 | s->outpicref->pts = 0; | 1762 | s->outpicref->pts = 0; |
| 1747 | 1763 | ||
| 1748 | if (s->legend) | 1764 | if (s->legend) |
| 1749 | draw_legend(ctx, samples); | 1765 | draw_legend(ctx, s->samples); |
| 1750 | 1766 | ||
| 1751 | ret = ff_filter_frame(outlink, s->outpicref); | 1767 | ret = ff_filter_frame(outlink, s->outpicref); |
| 1752 | s->outpicref = NULL; | 1768 | s->outpicref = NULL; |
| @@ -1759,11 +1775,20 @@ static int showspectrumpic_filter_frame(AVFilterLink *inlink, AVFrame *insamples · 6 unmodified lines | |||
| 1759 | { | 1775 | { |
| 1760 | AVFilterContext *ctx = inlink->dst; | 1776 | AVFilterContext *ctx = inlink->dst; |
| 1761 | ShowSpectrumContext *s = ctx->priv; | 1777 | ShowSpectrumContext *s = ctx->priv; |
| 1762 | int ret; | 1778 | void *ptr; |
| 1763 | 1779 | ||
| 1764 | ret = av_audio_fifo_write(s->fifo, (void **)insamples->extended_data, insamples->nb_samples); | 1780 | if (s->nb_frames + 1ULL > s->frames_size / sizeof(*(s->frames))) { |
| 1765 | av_frame_free(&insamples); | 1781 | ptr = av_fast_realloc(s->frames, &s->frames_size, s->frames_size * 2); |
| 1766 | return ret; | 1782 | if (!ptr) |
| 1783 | return AVERROR(ENOMEM); | ||
| 1784 | s->frames = ptr; | ||
| 1785 | } | ||
| 1786 | |||
| 1787 | s->frames[s->nb_frames] = insamples; | ||
| 1788 | s->samples += insamples->nb_samples; | ||
| 1789 | s->nb_frames++; | ||
| 1790 | |||
| 1791 | return 0; | ||
| 1767 | } | 1792 | } |
| 1768 | 1793 | ||
| 1769 | static const AVFilterPad showspectrumpic_inputs[] = { | 1794 | static const AVFilterPad showspectrumpic_inputs[] = { |