static void update_initial_timestamps(AVFormatContext *s, int stream_index,

                                      int64_t dts, int64_t pts, AVPacket *pkt)

{

    AVStream *st       = s->streams[stream_index];

    AVPacketList *pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue;

    int64_t pts_buffer[MAX_REORDER_DELAY+1];

    int64_t shift;

    int i, delay;



    if (st->first_dts != AV_NOPTS_VALUE ||

        dts           == AV_NOPTS_VALUE ||

        st->cur_dts   == AV_NOPTS_VALUE ||

        is_relative(dts))

        return;



    delay         = st->codec->has_b_frames;

    st->first_dts = dts - (st->cur_dts - RELATIVE_TS_BASE);

    st->cur_dts   = dts;

    shift         = st->first_dts - RELATIVE_TS_BASE;



    for (i = 0; i<MAX_REORDER_DELAY+1; i++)

        pts_buffer[i] = AV_NOPTS_VALUE;



    if (is_relative(pts))

        pts += shift;



    for (; pktl; pktl = get_next_pkt(s, st, pktl)) {

        if (pktl->pkt.stream_index != stream_index)

            continue;

        if (is_relative(pktl->pkt.pts))

            pktl->pkt.pts += shift;



        if (is_relative(pktl->pkt.dts))

            pktl->pkt.dts += shift;



        if (st->start_time == AV_NOPTS_VALUE && pktl->pkt.pts != AV_NOPTS_VALUE)

            st->start_time = pktl->pkt.pts;



        if (pktl->pkt.pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY && has_decode_delay_been_guessed(st)) {

            pts_buffer[0] = pktl->pkt.pts;

            for (i = 0; i<delay && pts_buffer[i] > pts_buffer[i + 1]; i++)

                FFSWAP(int64_t, pts_buffer[i], pts_buffer[i + 1]);



            pktl->pkt.dts = select_from_pts_buffer(st, pts_buffer, pktl->pkt.dts);

        }

    }



    if (st->start_time == AV_NOPTS_VALUE)

        st->start_time = pts;

}

static void update_initial_timestamps(AVFormatContext *s, int stream_index,

                                      int64_t dts, int64_t pts, AVPacket *pkt)

{

    AVStream *st       = s->streams[stream_index];

    AVPacketList *pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue;

    int64_t pts_buffer[MAX_REORDER_DELAY+1];

    int64_t shift;

    int i, delay;



    if (st->first_dts != AV_NOPTS_VALUE ||

        dts           == AV_NOPTS_VALUE ||

        st->cur_dts   == AV_NOPTS_VALUE ||

        is_relative(dts))

        return;



    delay         = st->codec->has_b_frames;

    st->first_dts = dts - (st->cur_dts - RELATIVE_TS_BASE);

    st->cur_dts   = dts;

    shift         = st->first_dts - RELATIVE_TS_BASE;



    for (i = 0; i<MAX_REORDER_DELAY+1; i++)

        pts_buffer[i] = AV_NOPTS_VALUE;



    if (is_relative(pts))

        pts += shift;



    for (; pktl; pktl = get_next_pkt(s, st, pktl)) {

        if (pktl->pkt.stream_index != stream_index)

            continue;

        if (is_relative(pktl->pkt.pts))

            pktl->pkt.pts += shift;



        if (is_relative(pktl->pkt.dts))

            pktl->pkt.dts += shift;



        if (st->start_time == AV_NOPTS_VALUE && pktl->pkt.pts != AV_NOPTS_VALUE)

            st->start_time = pktl->pkt.pts;



        if (pktl->pkt.pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY && has_decode_delay_been_guessed(st)) {

            pts_buffer[0] = pktl->pkt.pts;

            for (i = 0; i<delay && pts_buffer[i] > pts_buffer[i + 1]; i++)

                FFSWAP(int64_t, pts_buffer[i], pts_buffer[i + 1]);



            pktl->pkt.dts = select_from_pts_buffer(st, pts_buffer, pktl->pkt.dts);

        }

    }



    if (st->start_time == AV_NOPTS_VALUE)

        st->start_time = pts;

}

    int64_t shift;     shift         = st->first_dts - RELATIVE_TS_BASE;
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1,

                                      int64_t VAR_2, int64_t VAR_3, AVPacket *VAR_4)

{

    AVStream *st       = VAR_0->streams[VAR_1];

    AVPacketList *pktl = VAR_0->internal->packet_buffer ? VAR_0->internal->packet_buffer : VAR_0->internal->parse_queue;

    int64_t pts_buffer[MAX_REORDER_DELAY+1];

    int64_t shift;

    int VAR_5, VAR_6;



    if (st->first_dts != AV_NOPTS_VALUE ||

        VAR_2           == AV_NOPTS_VALUE ||

        st->cur_dts   == AV_NOPTS_VALUE ||

        is_relative(VAR_2))

        return;



    VAR_6         = st->codec->has_b_frames;

    st->first_dts = VAR_2 - (st->cur_dts - RELATIVE_TS_BASE);

    st->cur_dts   = VAR_2;

    shift         = st->first_dts - RELATIVE_TS_BASE;



    for (VAR_5 = 0; VAR_5<MAX_REORDER_DELAY+1; VAR_5++)

        pts_buffer[VAR_5] = AV_NOPTS_VALUE;



    if (is_relative(VAR_3))

        VAR_3 += shift;



    for (; pktl; pktl = get_next_pkt(VAR_0, st, pktl)) {

        if (pktl->VAR_4.VAR_1 != VAR_1)

            continue;

        if (is_relative(pktl->VAR_4.VAR_3))

            pktl->VAR_4.VAR_3 += shift;



        if (is_relative(pktl->VAR_4.VAR_2))

            pktl->VAR_4.VAR_2 += shift;



        if (st->start_time == AV_NOPTS_VALUE && pktl->VAR_4.VAR_3 != AV_NOPTS_VALUE)

            st->start_time = pktl->VAR_4.VAR_3;



        if (pktl->VAR_4.VAR_3 != AV_NOPTS_VALUE && VAR_6 <= MAX_REORDER_DELAY && has_decode_delay_been_guessed(st)) {

            pts_buffer[0] = pktl->VAR_4.VAR_3;

            for (VAR_5 = 0; VAR_5<VAR_6 && pts_buffer[VAR_5] > pts_buffer[VAR_5 + 1]; VAR_5++)

                FFSWAP(int64_t, pts_buffer[VAR_5], pts_buffer[VAR_5 + 1]);



            pktl->VAR_4.VAR_2 = select_from_pts_buffer(st, pts_buffer, pktl->VAR_4.VAR_2);

        }

    }



    if (st->start_time == AV_NOPTS_VALUE)

        st->start_time = VAR_3;

}

static void FUNC_0(AVFormatContext *VAR_0, int VAR_1,
int64_t VAR_2, int64_t VAR_3, AVPacket *VAR_4)
{ AVStream *st       = VAR_0->streams[VAR_1]; AVPacketList *pktl = VAR_0->internal->packet_buffer ? VAR_0->internal->packet_buffer : VAR_0->internal->parse_queue; int64_t pts_buffer[MAX_REORDER_DELAY+1]; int64_t shift; int VAR_5, VAR_6; if (st->first_dts != AV_NOPTS_VALUE ||
VAR_2           == AV_NOPTS_VALUE ||
st->cur_dts   == AV_NOPTS_VALUE ||
is_relative(VAR_2))
return; VAR_6         = st->codec->has_b_frames; st->first_dts = VAR_2 - (st->cur_dts - RELATIVE_TS_BASE); st->cur_dts   = VAR_2; shift         = st->first_dts - RELATIVE_TS_BASE; for (VAR_5 = 0; VAR_5<MAX_REORDER_DELAY+1; VAR_5++) pts_buffer[VAR_5] = AV_NOPTS_VALUE; if (is_relative(VAR_3))
VAR_3 += shift; for (; pktl; pktl = get_next_pkt(VAR_0, st, pktl)) { if (pktl->VAR_4.VAR_1 != VAR_1)
continue; if (is_relative(pktl->VAR_4.VAR_3))
pktl->VAR_4.VAR_3 += shift; if (is_relative(pktl->VAR_4.VAR_2))
pktl->VAR_4.VAR_2 += shift; if (st->start_time == AV_NOPTS_VALUE && pktl->VAR_4.VAR_3 != AV_NOPTS_VALUE)
st->start_time = pktl->VAR_4.VAR_3; if (pktl->VAR_4.VAR_3 != AV_NOPTS_VALUE && VAR_6 <= MAX_REORDER_DELAY && has_decode_delay_been_guessed(st)) { pts_buffer[0] = pktl->VAR_4.VAR_3; for (VAR_5 = 0; VAR_5<VAR_6 && pts_buffer[VAR_5] > pts_buffer[VAR_5 + 1]; VAR_5++) FFSWAP(int64_t, pts_buffer[VAR_5], pts_buffer[VAR_5 + 1]); pktl->VAR_4.VAR_2 = select_from_pts_buffer(st, pts_buffer, pktl->VAR_4.VAR_2); } } if (st->start_time == AV_NOPTS_VALUE)
st->start_time = VAR_3; }