static void compute_chapters_end(AVFormatContext *s)

{

    unsigned int i, j;

    int64_t max_time = s->duration +

                       ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time);



    for (i = 0; i < s->nb_chapters; i++)

        if (s->chapters[i]->end == AV_NOPTS_VALUE) {

            AVChapter *ch = s->chapters[i];

            int64_t end = max_time ? av_rescale_q(max_time, AV_TIME_BASE_Q,

                                                  ch->time_base)

                                   : INT64_MAX;



            for (j = 0; j < s->nb_chapters; j++) {

                AVChapter *ch1     = s->chapters[j];

                int64_t next_start = av_rescale_q(ch1->start, ch1->time_base,

                                                  ch->time_base);

                if (j != i && next_start > ch->start && next_start < end)

                    end = next_start;

            }

            ch->end = (end == INT64_MAX) ? ch->start : end;

        }

}

static void compute_chapters_end(AVFormatContext *s)

{

    unsigned int i, j;

    int64_t max_time = s->duration +

                       ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time);



    for (i = 0; i < s->nb_chapters; i++)

        if (s->chapters[i]->end == AV_NOPTS_VALUE) {

            AVChapter *ch = s->chapters[i];

            int64_t end = max_time ? av_rescale_q(max_time, AV_TIME_BASE_Q,

                                                  ch->time_base)

                                   : INT64_MAX;



            for (j = 0; j < s->nb_chapters; j++) {

                AVChapter *ch1     = s->chapters[j];

                int64_t next_start = av_rescale_q(ch1->start, ch1->time_base,

                                                  ch->time_base);

                if (j != i && next_start > ch->start && next_start < end)

                    end = next_start;

            }

            ch->end = (end == INT64_MAX) ? ch->start : end;

        }

}

    int64_t max_time = s->duration +
static void FUNC_0(AVFormatContext *VAR_0)

{

    unsigned int VAR_1, VAR_2;

    int64_t max_time = VAR_0->duration +

                       ((VAR_0->start_time == AV_NOPTS_VALUE) ? 0 : VAR_0->start_time);



    for (VAR_1 = 0; VAR_1 < VAR_0->nb_chapters; VAR_1++)

        if (VAR_0->chapters[VAR_1]->end == AV_NOPTS_VALUE) {

            AVChapter *ch = VAR_0->chapters[VAR_1];

            int64_t end = max_time ? av_rescale_q(max_time, AV_TIME_BASE_Q,

                                                  ch->time_base)

                                   : INT64_MAX;



            for (VAR_2 = 0; VAR_2 < VAR_0->nb_chapters; VAR_2++) {

                AVChapter *ch1     = VAR_0->chapters[VAR_2];

                int64_t next_start = av_rescale_q(ch1->start, ch1->time_base,

                                                  ch->time_base);

                if (VAR_2 != VAR_1 && next_start > ch->start && next_start < end)

                    end = next_start;

            }

            ch->end = (end == INT64_MAX) ? ch->start : end;

        }

}

static void FUNC_0(AVFormatContext *VAR_0)
{ unsigned int VAR_1, VAR_2; int64_t max_time = VAR_0->duration +
((VAR_0->start_time == AV_NOPTS_VALUE) ? 0 : VAR_0->start_time); for (VAR_1 = 0; VAR_1 < VAR_0->nb_chapters; VAR_1++) if (VAR_0->chapters[VAR_1]->end == AV_NOPTS_VALUE) { AVChapter *ch = VAR_0->chapters[VAR_1]; int64_t end = max_time ? av_rescale_q(max_time, AV_TIME_BASE_Q,
ch->time_base)
: INT64_MAX; for (VAR_2 = 0; VAR_2 < VAR_0->nb_chapters; VAR_2++) { AVChapter *ch1     = VAR_0->chapters[VAR_2]; int64_t next_start = av_rescale_q(ch1->start, ch1->time_base,
ch->time_base); if (VAR_2 != VAR_1 && next_start > ch->start && next_start < end)
end = next_start; } ch->end = (end == INT64_MAX) ? ch->start : end; } }