int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)

{

    DynBuffer *d;

    int size;

    static const char padbuf[AV_INPUT_BUFFER_PADDING_SIZE] = {0};

    int padding = 0;



    if (!s) {

        *pbuffer = NULL;

        return 0;

    }



    /* don't attempt to pad fixed-size packet buffers */

    if (!s->max_packet_size) {

        avio_write(s, padbuf, sizeof(padbuf));

        padding = AV_INPUT_BUFFER_PADDING_SIZE;

    }



    avio_flush(s);



    d = s->opaque;

    *pbuffer = d->buffer;

    size = d->size;

    av_free(d);

    av_free(s);

    return size - padding;

}

int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)

{

    DynBuffer *d;

    int size;

    static const char padbuf[AV_INPUT_BUFFER_PADDING_SIZE] = {0};

    int padding = 0;



    if (!s) {

        *pbuffer = NULL;

        return 0;

    }



    

    if (!s->max_packet_size) {

        avio_write(s, padbuf, sizeof(padbuf));

        padding = AV_INPUT_BUFFER_PADDING_SIZE;

    }



    avio_flush(s);



    d = s->opaque;

    *pbuffer = d->buffer;

    size = d->size;

    av_free(d);

    av_free(s);

    return size - padding;

}

int FUNC_0(AVIOContext *VAR_0, uint8_t **VAR_1)

{

    DynBuffer *d;

    int VAR_2;

    static const char VAR_3[AV_INPUT_BUFFER_PADDING_SIZE] = {0};

    int VAR_4 = 0;



    if (!VAR_0) {

        *VAR_1 = NULL;

        return 0;

    }



    

    if (!VAR_0->max_packet_size) {

        avio_write(VAR_0, VAR_3, sizeof(VAR_3));

        VAR_4 = AV_INPUT_BUFFER_PADDING_SIZE;

    }



    avio_flush(VAR_0);



    d = VAR_0->opaque;

    *VAR_1 = d->buffer;

    VAR_2 = d->VAR_2;

    av_free(d);

    av_free(VAR_0);

    return VAR_2 - VAR_4;

}

int FUNC_0(AVIOContext *VAR_0, uint8_t **VAR_1)
{ DynBuffer *d; int VAR_2; static const char VAR_3[AV_INPUT_BUFFER_PADDING_SIZE] = {0}; int VAR_4 = 0; if (!VAR_0) { *VAR_1 = NULL; return 0; } if (!VAR_0->max_packet_size) { avio_write(VAR_0, VAR_3, sizeof(VAR_3)); VAR_4 = AV_INPUT_BUFFER_PADDING_SIZE; } avio_flush(VAR_0); d = VAR_0->opaque; *VAR_1 = d->buffer; VAR_2 = d->VAR_2; av_free(d); av_free(VAR_0); return VAR_2 - VAR_4; }