static void dash_free(AVFormatContext *s)
{
    DASHContext *c = s->priv_data;
    int i, j;
    if (c->as) {
        for (i = 0; i < c->nb_as; i++)
            av_dict_free(&c->as[i].metadata);
        av_freep(&c->as);
        c->nb_as = 0;
    }
    if (!c->streams)
        return;
    for (i = 0; i < s->nb_streams; i++) {
        OutputStream *os = &c->streams[i];
        if (os->ctx && os->ctx_inited)
            av_write_trailer(os->ctx);
        if (os->ctx && os->ctx->pb)
            ffio_free_dyn_buf(&os->ctx->pb);
        ff_format_io_close(s, &os->out);
        if (os->ctx)
            avformat_free_context(os->ctx);
        for (j = 0; j < os->nb_segments; j++)
            av_free(os->segments[j]);
        av_free(os->segments);
    }
    av_freep(&c->streams);
}
static void dash_free(AVFormatContext *s)
{
    DASHContext *c = s->priv_data;
    int i, j;
    if (c->as) {
        for (i = 0; i < c->nb_as; i++)
            av_dict_free(&c->as[i].metadata);
        av_freep(&c->as);
        c->nb_as = 0;
    }
    if (!c->streams)
        return;
    for (i = 0; i < s->nb_streams; i++) {
        OutputStream *os = &c->streams[i];
        if (os->ctx && os->ctx_inited)
            av_write_trailer(os->ctx);
        if (os->ctx && os->ctx->pb)
            ffio_free_dyn_buf(&os->ctx->pb);
        ff_format_io_close(s, &os->out);
        if (os->ctx)
            avformat_free_context(os->ctx);
        for (j = 0; j < os->nb_segments; j++)
            av_free(os->segments[j]);
        av_free(os->segments);
    }
    av_freep(&c->streams);
}
static void FUNC_0(AVFormatContext *VAR_0)
{
    DASHContext *c = VAR_0->priv_data;
    int VAR_1, VAR_2;
    if (c->as) {
        for (VAR_1 = 0; VAR_1 < c->nb_as; VAR_1++)
            av_dict_free(&c->as[VAR_1].metadata);
        av_freep(&c->as);
        c->nb_as = 0;
    }
    if (!c->streams)
        return;
    for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {
        OutputStream *os = &c->streams[VAR_1];
        if (os->ctx && os->ctx_inited)
            av_write_trailer(os->ctx);
        if (os->ctx && os->ctx->pb)
            ffio_free_dyn_buf(&os->ctx->pb);
        ff_format_io_close(VAR_0, &os->out);
        if (os->ctx)
            avformat_free_context(os->ctx);
        for (VAR_2 = 0; VAR_2 < os->nb_segments; VAR_2++)
            av_free(os->segments[VAR_2]);
        av_free(os->segments);
    }
    av_freep(&c->streams);
}
static void FUNC_0(AVFormatContext *VAR_0)
{ DASHContext *c = VAR_0->priv_data; int VAR_1, VAR_2; if (c->as) { for (VAR_1 = 0; VAR_1 < c->nb_as; VAR_1++) av_dict_free(&c->as[VAR_1].metadata); av_freep(&c->as); c->nb_as = 0; } if (!c->streams)
return; for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { OutputStream *os = &c->streams[VAR_1]; if (os->ctx && os->ctx_inited)
av_write_trailer(os->ctx); if (os->ctx && os->ctx->pb)
ffio_free_dyn_buf(&os->ctx->pb); ff_format_io_close(VAR_0, &os->out); if (os->ctx)
avformat_free_context(os->ctx); for (VAR_2 = 0; VAR_2 < os->nb_segments; VAR_2++) av_free(os->segments[VAR_2]); av_free(os->segments); } av_freep(&c->streams); }