static void libopus_write_header(AVCodecContext *avctx, int stream_count,

                                 int coupled_stream_count,

                                 const uint8_t *channel_mapping)

{

    uint8_t *p   = avctx->extradata;

    int channels = avctx->channels;



    bytestream_put_buffer(&p, "OpusHead", 8);

    bytestream_put_byte(&p, 1); /* Version */

    bytestream_put_byte(&p, channels);

    bytestream_put_le16(&p, avctx->delay); /* Lookahead samples at 48kHz */

    bytestream_put_le32(&p, avctx->sample_rate); /* Original sample rate */

    bytestream_put_le16(&p, 0); /* Gain of 0dB is recommended. */



    /* Channel mapping */

    if (channels > 2) {

        bytestream_put_byte(&p, channels <= 8 ? 1 : 255);

        bytestream_put_byte(&p, stream_count);

        bytestream_put_byte(&p, coupled_stream_count);

        bytestream_put_buffer(&p, channel_mapping, channels);

    } else {

        bytestream_put_byte(&p, 0);

    }

}

static void libopus_write_header(AVCodecContext *avctx, int stream_count,

                                 int coupled_stream_count,

                                 const uint8_t *channel_mapping)

{

    uint8_t *p   = avctx->extradata;

    int channels = avctx->channels;



    bytestream_put_buffer(&p, "OpusHead", 8);

    bytestream_put_byte(&p, 1); 

    bytestream_put_byte(&p, channels);

    bytestream_put_le16(&p, avctx->delay); 

    bytestream_put_le32(&p, avctx->sample_rate); 

    bytestream_put_le16(&p, 0); 



    

    if (channels > 2) {

        bytestream_put_byte(&p, channels <= 8 ? 1 : 255);

        bytestream_put_byte(&p, stream_count);

        bytestream_put_byte(&p, coupled_stream_count);

        bytestream_put_buffer(&p, channel_mapping, channels);

    } else {

        bytestream_put_byte(&p, 0);

    }

}

static void FUNC_0(AVCodecContext *VAR_0, int VAR_1,

                                 int VAR_2,

                                 const uint8_t *VAR_3)

{

    uint8_t *p   = VAR_0->extradata;

    int VAR_4 = VAR_0->VAR_4;



    bytestream_put_buffer(&p, "OpusHead", 8);

    bytestream_put_byte(&p, 1); 

    bytestream_put_byte(&p, VAR_4);

    bytestream_put_le16(&p, VAR_0->delay); 

    bytestream_put_le32(&p, VAR_0->sample_rate); 

    bytestream_put_le16(&p, 0); 



    

    if (VAR_4 > 2) {

        bytestream_put_byte(&p, VAR_4 <= 8 ? 1 : 255);

        bytestream_put_byte(&p, VAR_1);

        bytestream_put_byte(&p, VAR_2);

        bytestream_put_buffer(&p, VAR_3, VAR_4);

    } else {

        bytestream_put_byte(&p, 0);

    }

}

static void FUNC_0(AVCodecContext *VAR_0, int VAR_1,
int VAR_2,
const uint8_t *VAR_3)
{ uint8_t *p   = VAR_0->extradata; int VAR_4 = VAR_0->VAR_4; bytestream_put_buffer(&p, "OpusHead", 8); bytestream_put_byte(&p, 1); bytestream_put_byte(&p, VAR_4); bytestream_put_le16(&p, VAR_0->delay); bytestream_put_le32(&p, VAR_0->sample_rate); bytestream_put_le16(&p, 0); if (VAR_4 > 2) { bytestream_put_byte(&p, VAR_4 <= 8 ? 1 : 255); bytestream_put_byte(&p, VAR_1); bytestream_put_byte(&p, VAR_2); bytestream_put_buffer(&p, VAR_3, VAR_4); } else { bytestream_put_byte(&p, 0); } }