static void alloc_and_copy(uint8_t **poutbuf,          int *poutbuf_size,

                           const uint8_t *sps_pps, uint32_t sps_pps_size,

                           const uint8_t *in,      uint32_t in_size) {

    uint32_t offset = *poutbuf_size;

    uint8_t nal_header_size = offset ? 3 : 4;



    *poutbuf_size += sps_pps_size+in_size+nal_header_size;

    *poutbuf = av_realloc(*poutbuf, *poutbuf_size);

    if (sps_pps)

        memcpy(*poutbuf+offset, sps_pps, sps_pps_size);

    memcpy(*poutbuf+sps_pps_size+nal_header_size+offset, in, in_size);

    if (!offset)

        AV_WB32(*poutbuf+sps_pps_size, 1);

    else {

        (*poutbuf+offset)[0] = (*poutbuf+offset)[1] = 0;

        (*poutbuf+offset)[2] = 1;

    }

}

static void alloc_and_copy(uint8_t **poutbuf,          int *poutbuf_size,

                           const uint8_t *sps_pps, uint32_t sps_pps_size,

                           const uint8_t *in,      uint32_t in_size) {

    uint32_t offset = *poutbuf_size;

    uint8_t nal_header_size = offset ? 3 : 4;



    *poutbuf_size += sps_pps_size+in_size+nal_header_size;

    *poutbuf = av_realloc(*poutbuf, *poutbuf_size);

    if (sps_pps)

        memcpy(*poutbuf+offset, sps_pps, sps_pps_size);

    memcpy(*poutbuf+sps_pps_size+nal_header_size+offset, in, in_size);

    if (!offset)

        AV_WB32(*poutbuf+sps_pps_size, 1);

    else {

        (*poutbuf+offset)[0] = (*poutbuf+offset)[1] = 0;

        (*poutbuf+offset)[2] = 1;

    }

}

        (*poutbuf+offset)[0] = (*poutbuf+offset)[1] = 0;         (*poutbuf+offset)[2] = 1;
static void FUNC_0(uint8_t **VAR_0,          int *VAR_1,

                           const uint8_t *VAR_2, uint32_t VAR_3,

                           const uint8_t *VAR_4,      uint32_t VAR_5) {

    uint32_t offset = *VAR_1;

    uint8_t nal_header_size = offset ? 3 : 4;



    *VAR_1 += VAR_3+VAR_5+nal_header_size;

    *VAR_0 = av_realloc(*VAR_0, *VAR_1);

    if (VAR_2)

        memcpy(*VAR_0+offset, VAR_2, VAR_3);

    memcpy(*VAR_0+VAR_3+nal_header_size+offset, VAR_4, VAR_5);

    if (!offset)

        AV_WB32(*VAR_0+VAR_3, 1);

    else {

        (*VAR_0+offset)[0] = (*VAR_0+offset)[1] = 0;

        (*VAR_0+offset)[2] = 1;

    }

}

static void FUNC_0(uint8_t **VAR_0,          int *VAR_1,
const uint8_t *VAR_2, uint32_t VAR_3,
const uint8_t *VAR_4,      uint32_t VAR_5) { uint32_t offset = *VAR_1; uint8_t nal_header_size = offset ? 3 : 4; *VAR_1 += VAR_3+VAR_5+nal_header_size; *VAR_0 = av_realloc(*VAR_0, *VAR_1); if (VAR_2)
memcpy(*VAR_0+offset, VAR_2, VAR_3); memcpy(*VAR_0+VAR_3+nal_header_size+offset, VAR_4, VAR_5); if (!offset)
AV_WB32(*VAR_0+VAR_3, 1); else { (*VAR_0+offset)[0] = (*VAR_0+offset)[1] = 0; (*VAR_0+offset)[2] = 1; } }