在 6.1 Ffmpeg 中,使用“ch_layout”代替“channel_layout”和“number”。 “ch_layout”是“AVChannelLayout *”类型。该类型在channel_layout.h中定义,该文件中也定义了某种“ch_layout”。 如果我想使用“av_dict_set_int()”将“ch_layout”设置为“AV_CHANNEL_LAYOUT_STEREO”,我应该在“value”中填写什么?
/**
* Macro to define native channel layouts
*
* @note This doesn't use designated initializers for compatibility with C++ 17 and older.
*/
#define AV_CHANNEL_LAYOUT_MASK(nb, m) \
{ /* .order */ AV_CHANNEL_ORDER_NATIVE, \
/* .nb_channels */ (nb), \
/* .u.mask */ { m }, \
/* .opaque */ NULL }
/**
* @name Common pre-defined channel layouts
* @{
*/
#define AV_CHANNEL_LAYOUT_MONO AV_CHANNEL_LAYOUT_MASK(1, AV_CH_LAYOUT_MONO)
#define AV_CHANNEL_LAYOUT_STEREO AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO)
#define AV_CHANNEL_LAYOUT_2POINT1 AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2POINT1)
#define AV_CHANNEL_LAYOUT_2_1 AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2_1)
/**
* Convenience wrapper for av_dict_set() that converts the value to a string
* and stores it.
*
* Note: If ::AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
*/
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
TLDR 它接受与之前相同的值,这里是直接来自 ffmpeg 源的示例
AVChannelLayout layout = (s->output_channels == 1) ? (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO :
(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
av_opt_set_chlayout(s->swr, "out_chlayout", &layout, 0);
av_opt_set_chlayout(s->swr, "in_chlayout", &layout, 0);