History

lavfi/abuffersink: add sample_rates field to AVABufferSinkParams

Allow to select sample rates.

Stefano Sabatini committed 13 years ago

Commit b59cd081 parent 5085b464 files · +19 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavfilter/buffersink.h +1 −0
  3. libavfilter/sink_buffer.c +14 −0
  4. libavfilter/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2012-10-22 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2013-02-24 - xxxxxx - lavfi 3.41.100 - buffersink.h
19+ Add sample_rates field to AVABufferSinkParams.
20+
1821 2013-01-17 - a1a707f - lavf 54.61.100
1922 Add av_codec_get_tag2().
2023
libavfilter/buffersink.h+1−0
@@ -48,6 +48,7 @@ typedef struct { · 47 unmodified lines
4848 const int64_t *channel_layouts; ///< list of allowed channel layouts, terminated by -1
4949 const int *channel_counts; ///< list of allowed channel counts, terminated by -1
5050 int all_channel_counts; ///< if not 0, accept any channel count or layout
51+ int *sample_rates; ///< list of allowed sample rates, terminated by -1
5152 } AVABufferSinkParams;
5253
5354 /**
libavfilter/sink_buffer.c+14−0
@@ -62,6 +62,7 @@ typedef struct { · 61 unmodified lines
6262 enum AVSampleFormat *sample_fmts; ///< list of accepted sample formats, terminated by AV_SAMPLE_FMT_NONE
6363 int64_t *channel_layouts; ///< list of accepted channel layouts, terminated by -1
6464 int all_channel_counts;
65+ int *sample_rates; ///< list of accepted sample rates, terminated by -1
6566 } BufferSinkContext;
6667
6768 #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
303304 if (!buf->sample_fmts)
304305 return AVERROR(ENOMEM);
305306 }
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+ }
306312 if (params && (params->channel_layouts || params->channel_counts)) {
307313 if (params->all_channel_counts) {
308314 av_log(ctx, AV_LOG_ERROR,
@@ -324,6 +330,7 @@ static av_cold void asink_uninit(AVFilterContext *ctx) · 15 unmodified lines
324330 BufferSinkContext *buf = ctx->priv;
325331
326332 av_freep(&buf->sample_fmts);
333+ av_freep(&buf->sample_rates);
327334 av_freep(&buf->channel_layouts);
328335 common_uninit(ctx);
329336 }
@@ -348,6 +355,13 @@ static int asink_query_formats(AVFilterContext *ctx) · 18 unmodified lines
348355 ff_set_common_channel_layouts(ctx, layouts);
349356 }
350357
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+
351365 return 0;
352366 }
353367
libavfilter/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 #include "libavutil/avutil.h"
3030
3131 #define LIBAVFILTER_VERSION_MAJOR 3
32−#define LIBAVFILTER_VERSION_MINOR 40
32+#define LIBAVFILTER_VERSION_MINOR 41
3333 #define LIBAVFILTER_VERSION_MICRO 100
3434
3535 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t