int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,

                     int nb_samples, enum AVSampleFormat sample_fmt, int align)

{

    uint8_t *buf;

    int size = av_samples_get_buffer_size(NULL, nb_channels, nb_samples,

                                          sample_fmt, align);

    if (size < 0)

        return size;



    buf = av_mallocz(size);

    if (!buf)

        return AVERROR(ENOMEM);



    size = av_samples_fill_arrays(audio_data, linesize, buf, nb_channels,

                                  nb_samples, sample_fmt, align);

    if (size < 0) {

        av_free(buf);

        return size;

    }

    return 0;

}

int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,

                     int nb_samples, enum AVSampleFormat sample_fmt, int align)

{

    uint8_t *buf;

    int size = av_samples_get_buffer_size(NULL, nb_channels, nb_samples,

                                          sample_fmt, align);

    if (size < 0)

        return size;



    buf = av_mallocz(size);

    if (!buf)

        return AVERROR(ENOMEM);



    size = av_samples_fill_arrays(audio_data, linesize, buf, nb_channels,

                                  nb_samples, sample_fmt, align);

    if (size < 0) {

        av_free(buf);

        return size;

    }

    return 0;

}

int FUNC_0(uint8_t **VAR_0, int *VAR_1, int VAR_2,

                     int VAR_3, enum AVSampleFormat VAR_4, int VAR_5)

{

    uint8_t *buf;

    int VAR_6 = av_samples_get_buffer_size(NULL, VAR_2, VAR_3,

                                          VAR_4, VAR_5);

    if (VAR_6 < 0)

        return VAR_6;



    buf = av_mallocz(VAR_6);

    if (!buf)

        return AVERROR(ENOMEM);



    VAR_6 = av_samples_fill_arrays(VAR_0, VAR_1, buf, VAR_2,

                                  VAR_3, VAR_4, VAR_5);

    if (VAR_6 < 0) {

        av_free(buf);

        return VAR_6;

    }

    return 0;

}

int FUNC_0(uint8_t **VAR_0, int *VAR_1, int VAR_2,
int VAR_3, enum AVSampleFormat VAR_4, int VAR_5)
{ uint8_t *buf; int VAR_6 = av_samples_get_buffer_size(NULL, VAR_2, VAR_3,
VAR_4, VAR_5); if (VAR_6 < 0)
return VAR_6; buf = av_mallocz(VAR_6); if (!buf)
return AVERROR(ENOMEM); VAR_6 = av_samples_fill_arrays(VAR_0, VAR_1, buf, VAR_2,
VAR_3, VAR_4, VAR_5); if (VAR_6 < 0) { av_free(buf); return VAR_6; } return 0; }