static int mpegts_read_packet(AVFormatContext *s,

                              AVPacket *pkt)

{

    MpegTSContext *ts = s->priv_data;

    int ret, i;




    ts->pkt = pkt;

    ret = handle_packets(ts, 0);

    if (ret < 0) {

        /* flush pes data left */

        for (i = 0; i < NB_PID_MAX; i++) {

            if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {

                PESContext *pes = ts->pids[i]->u.pes_filter.opaque;

                if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {

                    new_pes_packet(pes, pkt);

                    pes->state = MPEGTS_SKIP;

                    ret = 0;

                    break;

                }

            }

        }

    }



    if (!ret && pkt->size < 0)

        ret = AVERROR(EINTR);

    return ret;

}
static int mpegts_read_packet(AVFormatContext *s,

                              AVPacket *pkt)

{

    MpegTSContext *ts = s->priv_data;

    int ret, i;




    ts->pkt = pkt;

    ret = handle_packets(ts, 0);

    if (ret < 0) {

        

        for (i = 0; i < NB_PID_MAX; i++) {

            if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {

                PESContext *pes = ts->pids[i]->u.pes_filter.opaque;

                if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {

                    new_pes_packet(pes, pkt);

                    pes->state = MPEGTS_SKIP;

                    ret = 0;

                    break;

                }

            }

        }

    }



    if (!ret && pkt->size < 0)

        ret = AVERROR(EINTR);

    return ret;

}
static int FUNC_0(AVFormatContext *VAR_0,

                              AVPacket *VAR_1)

{

    MpegTSContext *ts = VAR_0->priv_data;

    int VAR_2, VAR_3;




    ts->VAR_1 = VAR_1;

    VAR_2 = handle_packets(ts, 0);

    if (VAR_2 < 0) {

        

        for (VAR_3 = 0; VAR_3 < NB_PID_MAX; VAR_3++) {

            if (ts->pids[VAR_3] && ts->pids[VAR_3]->type == MPEGTS_PES) {

                PESContext *pes = ts->pids[VAR_3]->u.pes_filter.opaque;

                if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {

                    new_pes_packet(pes, VAR_1);

                    pes->state = MPEGTS_SKIP;

                    VAR_2 = 0;

                    break;

                }

            }

        }

    }



    if (!VAR_2 && VAR_1->size < 0)

        VAR_2 = AVERROR(EINTR);

    return VAR_2;

}
static int FUNC_0(AVFormatContext *VAR_0,
AVPacket *VAR_1)
{ MpegTSContext *ts = VAR_0->priv_data; int VAR_2, VAR_3; ts->VAR_1 = VAR_1; VAR_2 = handle_packets(ts, 0); if (VAR_2 < 0) { for (VAR_3 = 0; VAR_3 < NB_PID_MAX; VAR_3++) { if (ts->pids[VAR_3] && ts->pids[VAR_3]->type == MPEGTS_PES) { PESContext *pes = ts->pids[VAR_3]->u.pes_filter.opaque; if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) { new_pes_packet(pes, VAR_1); pes->state = MPEGTS_SKIP; VAR_2 = 0; break; } } } } if (!VAR_2 && VAR_1->size < 0)
VAR_2 = AVERROR(EINTR); return VAR_2; }