| @@ -62,6 +62,7 @@ typedef struct { · 61 unmodified lines |
| 62 | 62 | enum AVSampleFormat *sample_fmts; ///< list of accepted sample formats, terminated by AV_SAMPLE_FMT_NONE |
| 63 | 63 | int64_t *channel_layouts; ///< list of accepted channel layouts, terminated by -1 |
| 64 | 64 | int all_channel_counts; |
| 65 | + int *sample_rates; ///< list of accepted sample rates, terminated by -1 |
| 65 | 66 | } BufferSinkContext; |
| 66 | 67 | |
| 67 | 68 | #define FIFO_INIT_SIZE 8 |
| @@ -303,6 +304,11 @@ static av_cold int asink_init(AVFilterContext *ctx, const char *args, void *opaq · 235 unmodified lines |
| 303 | 304 | if (!buf->sample_fmts) |
| 304 | 305 | return AVERROR(ENOMEM); |
| 305 | 306 | } |
| 307 | + if (params && params->sample_rates) { |
| 308 | + buf->sample_rates = ff_copy_int_list(params->sample_rates); |
| 309 | + if (!buf->sample_rates) |
| 310 | + return AVERROR(ENOMEM); |
| 311 | + } |
| 306 | 312 | if (params && (params->channel_layouts || params->channel_counts)) { |
| 307 | 313 | if (params->all_channel_counts) { |
| 308 | 314 | av_log(ctx, AV_LOG_ERROR, |
| @@ -324,6 +330,7 @@ static av_cold void asink_uninit(AVFilterContext *ctx) · 15 unmodified lines |
| 324 | 330 | BufferSinkContext *buf = ctx->priv; |
| 325 | 331 | |
| 326 | 332 | av_freep(&buf->sample_fmts); |
| 333 | + av_freep(&buf->sample_rates); |
| 327 | 334 | av_freep(&buf->channel_layouts); |
| 328 | 335 | common_uninit(ctx); |
| 329 | 336 | } |
| @@ -348,6 +355,13 @@ static int asink_query_formats(AVFilterContext *ctx) · 18 unmodified lines |
| 348 | 355 | ff_set_common_channel_layouts(ctx, layouts); |
| 349 | 356 | } |
| 350 | 357 | |
| 358 | + if (buf->sample_rates) { |
| 359 | + formats = ff_make_format_list(buf->sample_rates); |
| 360 | + if (!formats) |
| 361 | + return AVERROR(ENOMEM); |
| 362 | + ff_set_common_samplerates(ctx, formats); |
| 363 | + } |
| 364 | + |
| 351 | 365 | return 0; |
| 352 | 366 | } |
| 353 | 367 | |