int ff_hls_write_file_entry(AVIOContext *out, int insert_discont,

                             int byterange_mode,

                             double duration, int round_duration,

                             int64_t size, int64_t pos, //Used only if HLS_SINGLE_FILE flag is set

                             char *baseurl, //Ignored if NULL

                             char *filename, double *prog_date_time) {

    if (!out || !filename)

        return AVERROR(EINVAL);



    if (insert_discont) {

        avio_printf(out, "#EXT-X-DISCONTINUITY\n");

    }

    if (round_duration)

        avio_printf(out, "#EXTINF:%ld,\n",  lrint(duration));

    else

        avio_printf(out, "#EXTINF:%f,\n", duration);

    if (byterange_mode)

        avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n", size, pos);



    if (prog_date_time) {

        time_t tt, wrongsecs;

        int milli;

        struct tm *tm, tmpbuf;

        char buf0[128], buf1[128];

        tt = (int64_t)*prog_date_time;

        milli = av_clip(lrint(1000*(*prog_date_time - tt)), 0, 999);

        tm = localtime_r(&tt, &tmpbuf);

        strftime(buf0, sizeof(buf0), "%Y-%m-%dT%H:%M:%S", tm);

        if (!strftime(buf1, sizeof(buf1), "%z", tm) || buf1[1]<'0' ||buf1[1]>'2') {

            int tz_min, dst = tm->tm_isdst;

            tm = gmtime_r(&tt, &tmpbuf);

            tm->tm_isdst = dst;

            wrongsecs = mktime(tm);

            tz_min = (FFABS(wrongsecs - tt) + 30) / 60;

            snprintf(buf1, sizeof(buf1),

                     "%c%02d%02d",

                     wrongsecs <= tt ? '+' : '-',

                     tz_min / 60,

                     tz_min % 60);

        }

        avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, milli, buf1);

        *prog_date_time += duration;

    }

    if (baseurl)

        avio_printf(out, "%s", baseurl);

    avio_printf(out, "%s\n", filename);



    return 0;

}

int ff_hls_write_file_entry(AVIOContext *out, int insert_discont,

                             int byterange_mode,

                             double duration, int round_duration,

                             int64_t size, int64_t pos, 

                             char *baseurl, 

                             char *filename, double *prog_date_time) {

    if (!out || !filename)

        return AVERROR(EINVAL);



    if (insert_discont) {

        avio_printf(out, "#EXT-X-DISCONTINUITY\n");

    }

    if (round_duration)

        avio_printf(out, "#EXTINF:%ld,\n",  lrint(duration));

    else

        avio_printf(out, "#EXTINF:%f,\n", duration);

    if (byterange_mode)

        avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n", size, pos);



    if (prog_date_time) {

        time_t tt, wrongsecs;

        int milli;

        struct tm *tm, tmpbuf;

        char buf0[128], buf1[128];

        tt = (int64_t)*prog_date_time;

        milli = av_clip(lrint(1000*(*prog_date_time - tt)), 0, 999);

        tm = localtime_r(&tt, &tmpbuf);

        strftime(buf0, sizeof(buf0), "%Y-%m-%dT%H:%M:%S", tm);

        if (!strftime(buf1, sizeof(buf1), "%z", tm) || buf1[1]<'0' ||buf1[1]>'2') {

            int tz_min, dst = tm->tm_isdst;

            tm = gmtime_r(&tt, &tmpbuf);

            tm->tm_isdst = dst;

            wrongsecs = mktime(tm);

            tz_min = (FFABS(wrongsecs - tt) + 30) / 60;

            snprintf(buf1, sizeof(buf1),

                     "%c%02d%02d",

                     wrongsecs <= tt ? '+' : '-',

                     tz_min / 60,

                     tz_min % 60);

        }

        avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, milli, buf1);

        *prog_date_time += duration;

    }

    if (baseurl)

        avio_printf(out, "%s", baseurl);

    avio_printf(out, "%s\n", filename);



    return 0;

}

int FUNC_0(AVIOContext *VAR_0, int VAR_1,

                             int VAR_2,

                             double VAR_3, int VAR_4,

                             int64_t VAR_5, int64_t VAR_6, 

                             char *VAR_7, 

                             char *VAR_8, double *VAR_9) {

    if (!VAR_0 || !VAR_8)

        return AVERROR(EINVAL);



    if (VAR_1) {

        avio_printf(VAR_0, "#EXT-X-DISCONTINUITY\n");

    }

    if (VAR_4)

        avio_printf(VAR_0, "#EXTINF:%ld,\n",  lrint(VAR_3));

    else

        avio_printf(VAR_0, "#EXTINF:%f,\n", VAR_3);

    if (VAR_2)

        avio_printf(VAR_0, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n", VAR_5, VAR_6);



    if (VAR_9) {

        time_t tt, wrongsecs;

        int VAR_10;

        struct VAR_11 *VAR_11, VAR_12;

        char VAR_13[128], VAR_14[128];

        tt = (int64_t)*VAR_9;

        VAR_10 = av_clip(lrint(1000*(*VAR_9 - tt)), 0, 999);

        VAR_11 = localtime_r(&tt, &VAR_12);

        strftime(VAR_13, sizeof(VAR_13), "%Y-%m-%dT%H:%M:%S", VAR_11);

        if (!strftime(VAR_14, sizeof(VAR_14), "%z", VAR_11) || VAR_14[1]<'0' ||VAR_14[1]>'2') {

            int VAR_15, VAR_16 = VAR_11->tm_isdst;

            VAR_11 = gmtime_r(&tt, &VAR_12);

            VAR_11->tm_isdst = VAR_16;

            wrongsecs = mktime(VAR_11);

            VAR_15 = (FFABS(wrongsecs - tt) + 30) / 60;

            snprintf(VAR_14, sizeof(VAR_14),

                     "%c%02d%02d",

                     wrongsecs <= tt ? '+' : '-',

                     VAR_15 / 60,

                     VAR_15 % 60);

        }

        avio_printf(VAR_0, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", VAR_13, VAR_10, VAR_14);

        *VAR_9 += VAR_3;

    }

    if (VAR_7)

        avio_printf(VAR_0, "%s", VAR_7);

    avio_printf(VAR_0, "%s\n", VAR_8);



    return 0;

}

int FUNC_0(AVIOContext *VAR_0, int VAR_1,
int VAR_2,
double VAR_3, int VAR_4,
int64_t VAR_5, int64_t VAR_6,
char *VAR_7,
char *VAR_8, double *VAR_9) { if (!VAR_0 || !VAR_8)
return AVERROR(EINVAL); if (VAR_1) { avio_printf(VAR_0, "#EXT-X-DISCONTINUITY\n"); } if (VAR_4)
avio_printf(VAR_0, "#EXTINF:%ld,\n",  lrint(VAR_3)); else
avio_printf(VAR_0, "#EXTINF:%f,\n", VAR_3); if (VAR_2)
avio_printf(VAR_0, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n", VAR_5, VAR_6); if (VAR_9) { time_t tt, wrongsecs; int VAR_10; struct VAR_11 *VAR_11, VAR_12; char VAR_13[128], VAR_14[128]; tt = (int64_t)*VAR_9; VAR_10 = av_clip(lrint(1000*(*VAR_9 - tt)), 0, 999); VAR_11 = localtime_r(&tt, &VAR_12); strftime(VAR_13, sizeof(VAR_13), "%Y-%m-%dT%H:%M:%S", VAR_11); if (!strftime(VAR_14, sizeof(VAR_14), "%z", VAR_11) || VAR_14[1]<'0' ||VAR_14[1]>'2') { int VAR_15, VAR_16 = VAR_11->tm_isdst; VAR_11 = gmtime_r(&tt, &VAR_12); VAR_11->tm_isdst = VAR_16; wrongsecs = mktime(VAR_11); VAR_15 = (FFABS(wrongsecs - tt) + 30) / 60; snprintf(VAR_14, sizeof(VAR_14),
"%c%02d%02d",
wrongsecs <= tt ? '+' : '-',
VAR_15 / 60,
VAR_15 % 60); } avio_printf(VAR_0, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", VAR_13, VAR_10, VAR_14); *VAR_9 += VAR_3; } if (VAR_7)
avio_printf(VAR_0, "%s", VAR_7); avio_printf(VAR_0, "%s\n", VAR_8); return 0; }