static int update_streams_from_subdemuxer(AVFormatContext *s, struct playlist *pls)

{

    while (pls->n_main_streams < pls->ctx->nb_streams) {

        int ist_idx = pls->n_main_streams;

        AVStream *st = avformat_new_stream(s, NULL);

        AVStream *ist = pls->ctx->streams[ist_idx];



        if (!st)

            return AVERROR(ENOMEM);



        st->id = pls->index;

        set_stream_info_from_input_stream(st, pls, ist);



        dynarray_add(&pls->main_streams, &pls->n_main_streams, st);



        add_stream_to_programs(s, pls, st);

    }



    return 0;

}

static int update_streams_from_subdemuxer(AVFormatContext *s, struct playlist *pls)

{

    while (pls->n_main_streams < pls->ctx->nb_streams) {

        int ist_idx = pls->n_main_streams;

        AVStream *st = avformat_new_stream(s, NULL);

        AVStream *ist = pls->ctx->streams[ist_idx];



        if (!st)

            return AVERROR(ENOMEM);



        st->id = pls->index;

        set_stream_info_from_input_stream(st, pls, ist);



        dynarray_add(&pls->main_streams, &pls->n_main_streams, st);



        add_stream_to_programs(s, pls, st);

    }



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, struct playlist *VAR_1)

{

    while (VAR_1->n_main_streams < VAR_1->ctx->nb_streams) {

        int VAR_2 = VAR_1->n_main_streams;

        AVStream *st = avformat_new_stream(VAR_0, NULL);

        AVStream *ist = VAR_1->ctx->streams[VAR_2];



        if (!st)

            return AVERROR(ENOMEM);



        st->id = VAR_1->index;

        set_stream_info_from_input_stream(st, VAR_1, ist);



        dynarray_add(&VAR_1->main_streams, &VAR_1->n_main_streams, st);



        add_stream_to_programs(VAR_0, VAR_1, st);

    }



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, struct playlist *VAR_1)
{ while (VAR_1->n_main_streams < VAR_1->ctx->nb_streams) { int VAR_2 = VAR_1->n_main_streams; AVStream *st = avformat_new_stream(VAR_0, NULL); AVStream *ist = VAR_1->ctx->streams[VAR_2]; if (!st)
return AVERROR(ENOMEM); st->id = VAR_1->index; set_stream_info_from_input_stream(st, VAR_1, ist); dynarray_add(&VAR_1->main_streams, &VAR_1->n_main_streams, st); add_stream_to_programs(VAR_0, VAR_1, st); } return 0; }