Unified · Split
| @@ -220,6 +220,7 @@ static AVFilterBufferRef *copy_buffer_ref(AVFilterContext *ctx, · 219 unmodified lines | ||
| 220 | 220 | { |
| 221 | 221 | AVFilterLink *outlink = ctx->outputs[0]; |
| 222 | 222 | AVFilterBufferRef *buf; |
| 223 | + int channels, data_size, i; | |
| 223 | 224 | |
| 224 | 225 | switch (outlink->type) { |
| 225 | 226 | |
| @@ -231,6 +232,17 @@ static AVFilterBufferRef *copy_buffer_ref(AVFilterContext *ctx, · 5 unmodified lines | ||
| 231 | 232 | ref->format, ref->video->w, ref->video->h); |
| 232 | 233 | break; |
| 233 | 234 | |
| 235 | + case AVMEDIA_TYPE_AUDIO: | |
| 236 | + buf = avfilter_get_audio_buffer(outlink, AV_PERM_WRITE, | |
| 237 | + ref->audio->nb_samples); | |
| 238 | + channels = av_get_channel_layout_nb_channels(ref->audio->channel_layout); | |
| 239 | + data_size = av_samples_get_buffer_size(NULL, channels, | |
| 240 | + ref->audio->nb_samples, | |
| 241 | + ref->format, 1); | |
| 242 | + for (i = 0; i < FF_ARRAY_ELEMS(ref->buf->data) && ref->buf->data[i]; i++) | |
| 243 | + memcpy(buf->buf->data[i], ref->buf->data[i], data_size); | |
| 244 | + break; | |
| 245 | + | |
| 234 | 246 | default: |
| 235 | 247 | return NULL; |
| 236 | 248 | } |