This is more correct.
Unified · Split
| @@ -173,7 +173,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 172 unmodified lines | |||
| 173 | if (av_frame_is_writable(in)) { | 173 | if (av_frame_is_writable(in)) { |
| 174 | out = in; | 174 | out = in; |
| 175 | } else { | 175 | } else { |
| 176 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 176 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 177 | if (!out) { | 177 | if (!out) { |
| 178 | av_frame_free(&in); | 178 | av_frame_free(&in); |
| 179 | return AVERROR(ENOMEM); | 179 | return AVERROR(ENOMEM); |
| @@ -192,7 +192,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 191 unmodified lines | |||
| 192 | if (ctx->is_disabled || !s->delays) | 192 | if (ctx->is_disabled || !s->delays) |
| 193 | return ff_filter_frame(ctx->outputs[0], frame); | 193 | return ff_filter_frame(ctx->outputs[0], frame); |
| 194 | 194 | ||
| 195 | out_frame = ff_get_audio_buffer(inlink, frame->nb_samples); | 195 | out_frame = ff_get_audio_buffer(ctx->outputs[0], frame->nb_samples); |
| 196 | if (!out_frame) { | 196 | if (!out_frame) { |
| 197 | av_frame_free(&frame); | 197 | av_frame_free(&frame); |
| 198 | return AVERROR(ENOMEM); | 198 | return AVERROR(ENOMEM); |
| @@ -279,7 +279,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 278 unmodified lines | |||
| 279 | if (av_frame_is_writable(frame)) { | 279 | if (av_frame_is_writable(frame)) { |
| 280 | out_frame = frame; | 280 | out_frame = frame; |
| 281 | } else { | 281 | } else { |
| 282 | out_frame = ff_get_audio_buffer(inlink, frame->nb_samples); | 282 | out_frame = ff_get_audio_buffer(ctx->outputs[0], frame->nb_samples); |
| 283 | if (!out_frame) { | 283 | if (!out_frame) { |
| 284 | av_frame_free(&frame); | 284 | av_frame_free(&frame); |
| 285 | return AVERROR(ENOMEM); | 285 | return AVERROR(ENOMEM); |
| @@ -96,7 +96,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 95 unmodified lines | |||
| 96 | if (av_frame_is_writable(in)) { | 96 | if (av_frame_is_writable(in)) { |
| 97 | out = in; | 97 | out = in; |
| 98 | } else { | 98 | } else { |
| 99 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 99 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 100 | if (!out) { | 100 | if (!out) { |
| 101 | av_frame_free(&in); | 101 | av_frame_free(&in); |
| 102 | return AVERROR(ENOMEM); | 102 | return AVERROR(ENOMEM); |
| @@ -282,7 +282,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) · 281 unmodified lines | |||
| 282 | if (av_frame_is_writable(buf)) { | 282 | if (av_frame_is_writable(buf)) { |
| 283 | out_buf = buf; | 283 | out_buf = buf; |
| 284 | } else { | 284 | } else { |
| 285 | out_buf = ff_get_audio_buffer(inlink, nb_samples); | 285 | out_buf = ff_get_audio_buffer(outlink, nb_samples); |
| 286 | if (!out_buf) | 286 | if (!out_buf) |
| 287 | return AVERROR(ENOMEM); | 287 | return AVERROR(ENOMEM); |
| 288 | av_frame_copy_props(out_buf, buf); | 288 | av_frame_copy_props(out_buf, buf); |
| @@ -214,7 +214,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 213 unmodified lines | |||
| 214 | if (av_frame_is_writable(in)) { | 214 | if (av_frame_is_writable(in)) { |
| 215 | out = in; | 215 | out = in; |
| 216 | } else { | 216 | } else { |
| 217 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 217 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 218 | if (!out) { | 218 | if (!out) { |
| 219 | av_frame_free(&in); | 219 | av_frame_free(&in); |
| 220 | return AVERROR(ENOMEM); | 220 | return AVERROR(ENOMEM); |
| @@ -135,7 +135,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 134 unmodified lines | |||
| 135 | if (av_frame_is_writable(in)) { | 135 | if (av_frame_is_writable(in)) { |
| 136 | out = in; | 136 | out = in; |
| 137 | } else { | 137 | } else { |
| 138 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 138 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 139 | if (!out) { | 139 | if (!out) { |
| 140 | av_frame_free(&in); | 140 | av_frame_free(&in); |
| 141 | return AVERROR(ENOMEM); | 141 | return AVERROR(ENOMEM); |
| @@ -247,7 +247,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inbuf) · 246 unmodified lines | |||
| 247 | if (av_frame_is_writable(inbuf)) { | 247 | if (av_frame_is_writable(inbuf)) { |
| 248 | outbuf = inbuf; | 248 | outbuf = inbuf; |
| 249 | } else { | 249 | } else { |
| 250 | outbuf = ff_get_audio_buffer(inlink, inbuf->nb_samples); | 250 | outbuf = ff_get_audio_buffer(outlink, inbuf->nb_samples); |
| 251 | if (!outbuf) { | 251 | if (!outbuf) { |
| 252 | av_frame_free(&inbuf); | 252 | av_frame_free(&inbuf); |
| 253 | return AVERROR(ENOMEM); | 253 | return AVERROR(ENOMEM); |
| @@ -417,7 +417,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) · 416 unmodified lines | |||
| 417 | if (av_frame_is_writable(buf)) { | 417 | if (av_frame_is_writable(buf)) { |
| 418 | out_buf = buf; | 418 | out_buf = buf; |
| 419 | } else { | 419 | } else { |
| 420 | out_buf = ff_get_audio_buffer(inlink, nb_samples); | 420 | out_buf = ff_get_audio_buffer(outlink, nb_samples); |
| 421 | if (!out_buf) { | 421 | if (!out_buf) { |
| 422 | av_frame_free(&buf); | 422 | av_frame_free(&buf); |
| 423 | return AVERROR(ENOMEM); | 423 | return AVERROR(ENOMEM); |
| @@ -135,7 +135,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 134 unmodified lines | |||
| 135 | if (av_frame_is_writable(frame)) { | 135 | if (av_frame_is_writable(frame)) { |
| 136 | out_frame = frame; | 136 | out_frame = frame; |
| 137 | } else { | 137 | } else { |
| 138 | out_frame = ff_get_audio_buffer(inlink, frame->nb_samples); | 138 | out_frame = ff_get_audio_buffer(outlink, frame->nb_samples); |
| 139 | if (!out_frame) { | 139 | if (!out_frame) { |
| 140 | av_frame_free(&frame); | 140 | av_frame_free(&frame); |
| 141 | return AVERROR(ENOMEM); | 141 | return AVERROR(ENOMEM); |
| @@ -247,7 +247,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 246 unmodified lines | |||
| 247 | if (av_frame_is_writable(frame)) { | 247 | if (av_frame_is_writable(frame)) { |
| 248 | out_frame = frame; | 248 | out_frame = frame; |
| 249 | } else { | 249 | } else { |
| 250 | out_frame = ff_get_audio_buffer(inlink, frame->nb_samples); | 250 | out_frame = ff_get_audio_buffer(ctx->outputs[0], frame->nb_samples); |
| 251 | if (!out_frame) { | 251 | if (!out_frame) { |
| 252 | av_frame_free(&frame); | 252 | av_frame_free(&frame); |
| 253 | return AVERROR(ENOMEM); | 253 | return AVERROR(ENOMEM); |
| @@ -185,7 +185,7 @@ static int compand_nodelay(AVFilterContext *ctx, AVFrame *frame) · 184 unmodified lines | |||
| 185 | if (av_frame_is_writable(frame)) { | 185 | if (av_frame_is_writable(frame)) { |
| 186 | out_frame = frame; | 186 | out_frame = frame; |
| 187 | } else { | 187 | } else { |
| 188 | out_frame = ff_get_audio_buffer(inlink, nb_samples); | 188 | out_frame = ff_get_audio_buffer(ctx->outputs[0], nb_samples); |
| 189 | if (!out_frame) { | 189 | if (!out_frame) { |
| 190 | av_frame_free(&frame); | 190 | av_frame_free(&frame); |
| 191 | return AVERROR(ENOMEM); | 191 | return AVERROR(ENOMEM); |
| @@ -249,7 +249,7 @@ static int compand_delay(AVFilterContext *ctx, AVFrame *frame) · 57 unmodified lines | |||
| 249 | 249 | ||
| 250 | if (count >= s->delay_samples) { | 250 | if (count >= s->delay_samples) { |
| 251 | if (!out_frame) { | 251 | if (!out_frame) { |
| 252 | out_frame = ff_get_audio_buffer(inlink, nb_samples - i); | 252 | out_frame = ff_get_audio_buffer(ctx->outputs[0], nb_samples - i); |
| 253 | if (!out_frame) { | 253 | if (!out_frame) { |
| 254 | av_frame_free(&frame); | 254 | av_frame_free(&frame); |
| 255 | return AVERROR(ENOMEM); | 255 | return AVERROR(ENOMEM); |
| @@ -131,7 +131,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 130 unmodified lines | |||
| 131 | AVFrame *out; | 131 | AVFrame *out; |
| 132 | int n, ch; | 132 | int n, ch; |
| 133 | 133 | ||
| 134 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 134 | out = ff_get_audio_buffer(ctx->outputs[0], in->nb_samples); |
| 135 | if (!out) { | 135 | if (!out) { |
| 136 | av_frame_free(&in); | 136 | av_frame_free(&in); |
| 137 | return AVERROR(ENOMEM); | 137 | return AVERROR(ENOMEM); |
| @@ -99,7 +99,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 98 unmodified lines | |||
| 99 | if (av_frame_is_writable(in)) { | 99 | if (av_frame_is_writable(in)) { |
| 100 | out = in; | 100 | out = in; |
| 101 | } else { | 101 | } else { |
| 102 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 102 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 103 | if (!out) { | 103 | if (!out) { |
| 104 | av_frame_free(&in); | 104 | av_frame_free(&in); |
| 105 | return AVERROR(ENOMEM); | 105 | return AVERROR(ENOMEM); |
| @@ -115,7 +115,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) · 114 unmodified lines | |||
| 115 | { | 115 | { |
| 116 | AVFilterLink *outlink = inlink->dst->outputs[0]; | 116 | AVFilterLink *outlink = inlink->dst->outputs[0]; |
| 117 | int16_t *taps, *endin, *in, *out; | 117 | int16_t *taps, *endin, *in, *out; |
| 118 | AVFrame *outsamples = ff_get_audio_buffer(inlink, insamples->nb_samples); | 118 | AVFrame *outsamples = ff_get_audio_buffer(outlink, insamples->nb_samples); |
| 119 | int len; | 119 | int len; |
| 120 | 120 | ||
| 121 | if (!outsamples) { | 121 | if (!outsamples) { |
| @@ -71,7 +71,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 70 unmodified lines | |||
| 71 | if (av_frame_is_writable(in)) { | 71 | if (av_frame_is_writable(in)) { |
| 72 | out = in; | 72 | out = in; |
| 73 | } else { | 73 | } else { |
| 74 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 74 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 75 | if (!out) { | 75 | if (!out) { |
| 76 | av_frame_free(&in); | 76 | av_frame_free(&in); |
| 77 | return AVERROR(ENOMEM); | 77 | return AVERROR(ENOMEM); |
| @@ -148,7 +148,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 147 unmodified lines | |||
| 148 | if (av_frame_is_writable(frame)) { | 148 | if (av_frame_is_writable(frame)) { |
| 149 | out_frame = frame; | 149 | out_frame = frame; |
| 150 | } else { | 150 | } else { |
| 151 | out_frame = ff_get_audio_buffer(inlink, frame->nb_samples); | 151 | out_frame = ff_get_audio_buffer(ctx->outputs[0], frame->nb_samples); |
| 152 | if (!out_frame) { | 152 | if (!out_frame) { |
| 153 | av_frame_free(&frame); | 153 | av_frame_free(&frame); |
| 154 | return AVERROR(ENOMEM); | 154 | return AVERROR(ENOMEM); |
| @@ -144,7 +144,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 143 unmodified lines | |||
| 144 | if (av_frame_is_writable(in)) { | 144 | if (av_frame_is_writable(in)) { |
| 145 | out = in; | 145 | out = in; |
| 146 | } else { | 146 | } else { |
| 147 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 147 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 148 | if (!out) { | 148 | if (!out) { |
| 149 | av_frame_free(&in); | 149 | av_frame_free(&in); |
| 150 | return AVERROR(ENOMEM); | 150 | return AVERROR(ENOMEM); |
| @@ -423,7 +423,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 422 unmodified lines | |||
| 423 | if (av_frame_is_writable(in)) { | 423 | if (av_frame_is_writable(in)) { |
| 424 | out = in; | 424 | out = in; |
| 425 | } else { | 425 | } else { |
| 426 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 426 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 427 | if (!out) { | 427 | if (!out) { |
| 428 | av_frame_free(&in); | 428 | av_frame_free(&in); |
| 429 | return AVERROR(ENOMEM); | 429 | return AVERROR(ENOMEM); |
| @@ -554,7 +554,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 553 unmodified lines | |||
| 554 | uint32_t level; | 554 | uint32_t level; |
| 555 | AVFrame *out; | 555 | AVFrame *out; |
| 556 | 556 | ||
| 557 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 557 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 558 | if (!out) { | 558 | if (!out) { |
| 559 | av_frame_free(&in); | 559 | av_frame_free(&in); |
| 560 | return AVERROR(ENOMEM); | 560 | return AVERROR(ENOMEM); |
| @@ -128,7 +128,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 127 unmodified lines | |||
| 128 | 128 | ||
| 129 | nb_samples = rubberband_available(s->rbs); | 129 | nb_samples = rubberband_available(s->rbs); |
| 130 | if (nb_samples > 0) { | 130 | if (nb_samples > 0) { |
| 131 | out = ff_get_audio_buffer(inlink, nb_samples); | 131 | out = ff_get_audio_buffer(outlink, nb_samples); |
| 132 | if (!out) { | 132 | if (!out) { |
| 133 | av_frame_free(&in); | 133 | av_frame_free(&in); |
| 134 | return AVERROR(ENOMEM); | 134 | return AVERROR(ENOMEM); |
| @@ -187,7 +187,7 @@ static int request_frame(AVFilterLink *outlink) · 52 unmodified lines | |||
| 187 | nb_samples = rubberband_available(s->rbs); | 187 | nb_samples = rubberband_available(s->rbs); |
| 188 | 188 | ||
| 189 | if (nb_samples > 0) { | 189 | if (nb_samples > 0) { |
| 190 | out = ff_get_audio_buffer(inlink, nb_samples); | 190 | out = ff_get_audio_buffer(outlink, nb_samples); |
| 191 | if (!out) | 191 | if (!out) |
| 192 | return AVERROR(ENOMEM); | 192 | return AVERROR(ENOMEM); |
| 193 | out->pts = av_rescale_q(s->nb_samples_out, | 193 | out->pts = av_rescale_q(s->nb_samples_out, |
| @@ -367,7 +367,7 @@ static int acompressor_filter_frame(AVFilterLink *inlink, AVFrame *in) · 366 unmodified lines | |||
| 367 | if (av_frame_is_writable(in)) { | 367 | if (av_frame_is_writable(in)) { |
| 368 | out = in; | 368 | out = in; |
| 369 | } else { | 369 | } else { |
| 370 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 370 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 371 | if (!out) { | 371 | if (!out) { |
| 372 | av_frame_free(&in); | 372 | av_frame_free(&in); |
| 373 | return AVERROR(ENOMEM); | 373 | return AVERROR(ENOMEM); |
| @@ -166,7 +166,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 165 unmodified lines | |||
| 166 | if (av_frame_is_writable(in)) { | 166 | if (av_frame_is_writable(in)) { |
| 167 | out = in; | 167 | out = in; |
| 168 | } else { | 168 | } else { |
| 169 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 169 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 170 | if (!out) { | 170 | if (!out) { |
| 171 | av_frame_free(&in); | 171 | av_frame_free(&in); |
| 172 | return AVERROR(ENOMEM); | 172 | return AVERROR(ENOMEM); |
| @@ -98,7 +98,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 97 unmodified lines | |||
| 98 | if (av_frame_is_writable(in)) { | 98 | if (av_frame_is_writable(in)) { |
| 99 | out = in; | 99 | out = in; |
| 100 | } else { | 100 | } else { |
| 101 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 101 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 102 | if (!out) { | 102 | if (!out) { |
| 103 | av_frame_free(&in); | 103 | av_frame_free(&in); |
| 104 | return AVERROR(ENOMEM); | 104 | return AVERROR(ENOMEM); |
| @@ -57,7 +57,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 56 unmodified lines | |||
| 57 | if (av_frame_is_writable(in)) { | 57 | if (av_frame_is_writable(in)) { |
| 58 | out = in; | 58 | out = in; |
| 59 | } else { | 59 | } else { |
| 60 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 60 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 61 | if (!out) { | 61 | if (!out) { |
| 62 | av_frame_free(&in); | 62 | av_frame_free(&in); |
| 63 | return AVERROR(ENOMEM); | 63 | return AVERROR(ENOMEM); |
| @@ -63,7 +63,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 62 unmodified lines | |||
| 63 | if (av_frame_is_writable(in)) { | 63 | if (av_frame_is_writable(in)) { |
| 64 | out = in; | 64 | out = in; |
| 65 | } else { | 65 | } else { |
| 66 | out = ff_get_audio_buffer(inlink, in->nb_samples); | 66 | out = ff_get_audio_buffer(outlink, in->nb_samples); |
| 67 | if (!out) { | 67 | if (!out) { |
| 68 | av_frame_free(&in); | 68 | av_frame_free(&in); |
| 69 | return AVERROR(ENOMEM); | 69 | return AVERROR(ENOMEM); |
| @@ -410,7 +410,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) · 409 unmodified lines | |||
| 410 | && (vol->precision != PRECISION_FIXED || vol->volume_i > 0)) { | 410 | && (vol->precision != PRECISION_FIXED || vol->volume_i > 0)) { |
| 411 | out_buf = buf; | 411 | out_buf = buf; |
| 412 | } else { | 412 | } else { |
| 413 | out_buf = ff_get_audio_buffer(inlink, nb_samples); | 413 | out_buf = ff_get_audio_buffer(outlink, nb_samples); |
| 414 | if (!out_buf) { | 414 | if (!out_buf) { |
| 415 | av_frame_free(&buf); | 415 | av_frame_free(&buf); |
| 416 | return AVERROR(ENOMEM); | 416 | return AVERROR(ENOMEM); |