int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,

                            uint8_t *data, size_t size)

{

    AVPacketSideData *sd, *tmp;

    int i;



    for (i = 0; i < st->nb_side_data; i++) {

        sd = &st->side_data[i];



        if (sd->type == type) {

            av_freep(&sd->data);

            sd->data = data;

            sd->size = size;

            return 0;

        }

    }



    tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));

    if (!tmp) {

        return AVERROR(ENOMEM);

    }



    st->side_data = tmp;

    st->nb_side_data++;



    sd = &st->side_data[st->nb_side_data - 1];

    sd->type = type;

    sd->data = data;

    sd->size = size;



    return 0;

}

int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,

                            uint8_t *data, size_t size)

{

    AVPacketSideData *sd, *tmp;

    int i;



    for (i = 0; i < st->nb_side_data; i++) {

        sd = &st->side_data[i];



        if (sd->type == type) {

            av_freep(&sd->data);

            sd->data = data;

            sd->size = size;

            return 0;

        }

    }



    tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));

    if (!tmp) {

        return AVERROR(ENOMEM);

    }



    st->side_data = tmp;

    st->nb_side_data++;



    sd = &st->side_data[st->nb_side_data - 1];

    sd->type = type;

    sd->data = data;

    sd->size = size;



    return 0;

}

    tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));
int FUNC_0(AVStream *VAR_0, enum AVPacketSideDataType VAR_1,

                            uint8_t *VAR_2, size_t VAR_3)

{

    AVPacketSideData *sd, *tmp;

    int VAR_4;



    for (VAR_4 = 0; VAR_4 < VAR_0->nb_side_data; VAR_4++) {

        sd = &VAR_0->side_data[VAR_4];



        if (sd->VAR_1 == VAR_1) {

            av_freep(&sd->VAR_2);

            sd->VAR_2 = VAR_2;

            sd->VAR_3 = VAR_3;

            return 0;

        }

    }



    tmp = av_realloc_array(VAR_0->side_data, VAR_0->nb_side_data + 1, sizeof(*tmp));

    if (!tmp) {

        return AVERROR(ENOMEM);

    }



    VAR_0->side_data = tmp;

    VAR_0->nb_side_data++;



    sd = &VAR_0->side_data[VAR_0->nb_side_data - 1];

    sd->VAR_1 = VAR_1;

    sd->VAR_2 = VAR_2;

    sd->VAR_3 = VAR_3;



    return 0;

}

int FUNC_0(AVStream *VAR_0, enum AVPacketSideDataType VAR_1,
uint8_t *VAR_2, size_t VAR_3)
{ AVPacketSideData *sd, *tmp; int VAR_4; for (VAR_4 = 0; VAR_4 < VAR_0->nb_side_data; VAR_4++) { sd = &VAR_0->side_data[VAR_4]; if (sd->VAR_1 == VAR_1) { av_freep(&sd->VAR_2); sd->VAR_2 = VAR_2; sd->VAR_3 = VAR_3; return 0; } } tmp = av_realloc_array(VAR_0->side_data, VAR_0->nb_side_data + 1, sizeof(*tmp)); if (!tmp) { return AVERROR(ENOMEM); } VAR_0->side_data = tmp; VAR_0->nb_side_data++; sd = &VAR_0->side_data[VAR_0->nb_side_data - 1]; sd->VAR_1 = VAR_1; sd->VAR_2 = VAR_2; sd->VAR_3 = VAR_3; return 0; }