mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-09-12 02:14:56 +02:00
avdevice/lavfi: Simplify setting sample_fmts
The length of this list is a compile-time constant, so there is no need to calculate it again at runtime. (This also avoids an implicit requirement of -1 == AV_SAMPLE_FMT_NONE.) Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
60a2c74a5e
commit
b7e3ae19b8
@ -271,14 +271,15 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
|
||||
} else if (type == AVMEDIA_TYPE_AUDIO) {
|
||||
static const enum AVSampleFormat sample_fmts[] = {
|
||||
AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32,
|
||||
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL, -1
|
||||
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL,
|
||||
};
|
||||
|
||||
ret = avfilter_graph_create_filter(&sink, abuffersink,
|
||||
inout->name, NULL,
|
||||
NULL, lavfi->graph);
|
||||
if (ret >= 0)
|
||||
ret = av_opt_set_int_list(sink, "sample_fmts", sample_fmts, AV_SAMPLE_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
|
||||
ret = av_opt_set_bin(sink, "sample_fmts", (const uint8_t*)sample_fmts,
|
||||
sizeof(sample_fmts), AV_OPT_SEARCH_CHILDREN);
|
||||
if (ret < 0)
|
||||
goto end;
|
||||
ret = av_opt_set_int(sink, "all_channel_counts", 1,
|
||||
|
Loading…
Reference in New Issue
Block a user