MCPcopy Create free account
hub / github.com/byhook/ffmpeg4android / opt_channel_layout

Function opt_channel_layout

ffmpeg-single-cmd/src/main/cpp/ffmpeg_opt.c:3023–3057  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3021}
3022
3023static int opt_channel_layout(void *optctx, const char *opt, const char *arg)
3024{
3025 OptionsContext *o = optctx;
3026 char layout_str[32];
3027 char *stream_str;
3028 char *ac_str;
3029 int ret, channels, ac_str_size;
3030 uint64_t layout;
3031
3032 layout = av_get_channel_layout(arg);
3033 if (!layout) {
3034 av_log(NULL, AV_LOG_ERROR, "Unknown channel layout: %s\n", arg);
3035 return AVERROR(EINVAL);
3036 }
3037 snprintf(layout_str, sizeof(layout_str), "%"PRIu64, layout);
3038 ret = opt_default_new(o, opt, layout_str);
3039 if (ret < 0)
3040 return ret;
3041
3042 /* set 'ac' option based on channel layout */
3043 channels = av_get_channel_layout_nb_channels(layout);
3044 snprintf(layout_str, sizeof(layout_str), "%d", channels);
3045 stream_str = strchr(opt, ':');
3046 ac_str_size = 3 + (stream_str ? strlen(stream_str) : 0);
3047 ac_str = av_mallocz(ac_str_size);
3048 if (!ac_str)
3049 return AVERROR(ENOMEM);
3050 av_strlcpy(ac_str, "ac", 3);
3051 if (stream_str)
3052 av_strlcat(ac_str, stream_str, ac_str_size);
3053 ret = parse_option(o, ac_str, layout_str, options);
3054 av_free(ac_str);
3055
3056 return ret;
3057}
3058
3059static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
3060{

Callers

nothing calls this directly

Calls 2

opt_default_newFunction · 0.85
parse_optionFunction · 0.85

Tested by

no test coverage detected