Function swr_alloc_set_opts2

pub unsafe extern "C" fn swr_alloc_set_opts2(
    ps: *mut *mut SwrContext,
    out_ch_layout: *const AVChannelLayout,
    out_sample_fmt: i32,
    out_sample_rate: i32,
    in_ch_layout: *const AVChannelLayout,
    in_sample_fmt: i32,
    in_sample_rate: i32,
    log_offset: i32,
    log_ctx: *mut c_void,
) -> i32
Expand description

Allocate SwrContext if needed and set/reset common parameters.

This function does not require *ps to be allocated with swr_alloc(). On the other hand, swr_alloc() can use swr_alloc_set_opts2() to set the parameters on the allocated context.

@param ps Pointer to an existing Swr context if available, or to NULL if not. On success, ps will be set to the allocated context. @param out_ch_layout output channel layout (e.g. AV_CHANNEL_LAYOUT_) @param out_sample_fmt output sample format (AV_SAMPLE_FMT_). @param out_sample_rate output sample rate (frequency in Hz) @param in_ch_layout input channel layout (e.g. AV_CHANNEL_LAYOUT_) @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*). @param in_sample_rate input sample rate (frequency in Hz) @param log_offset logging level offset @param log_ctx parent logging context, can be NULL

@see swr_init(), swr_free() @return 0 on success, a negative AVERROR code on error. On error, the Swr context is freed and *ps set to NULL.