static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size, uint8_t **data)

{

    AVIOContext *pb = s->pb;

    int len;



    for(;;) {

        len = ffio_read_indirect(pb, buf, TS_PACKET_SIZE, data);

        if (len != TS_PACKET_SIZE)

            return len < 0 ? len : AVERROR_EOF;

        /* check packet sync byte */

        if ((*data)[0] != 0x47) {

            /* find a new packet start */

            avio_seek(pb, -TS_PACKET_SIZE, SEEK_CUR);

            if (mpegts_resync(s) < 0)

                return AVERROR(EAGAIN);

            else

                continue;

        } else {

            break;

        }

    }

    return 0;

}

static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size, uint8_t **data)

{

    AVIOContext *pb = s->pb;

    int len;



    for(;;) {

        len = ffio_read_indirect(pb, buf, TS_PACKET_SIZE, data);

        if (len != TS_PACKET_SIZE)

            return len < 0 ? len : AVERROR_EOF;

        

        if ((*data)[0] != 0x47) {

            

            avio_seek(pb, -TS_PACKET_SIZE, SEEK_CUR);

            if (mpegts_resync(s) < 0)

                return AVERROR(EAGAIN);

            else

                continue;

        } else {

            break;

        }

    }

    return 0;

}

static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size, uint8_t **data)
static int FUNC_0(AVFormatContext *VAR_0, uint8_t *VAR_1, int VAR_2, uint8_t **VAR_3)

{

    AVIOContext *pb = VAR_0->pb;

    int VAR_4;



    for(;;) {

        VAR_4 = ffio_read_indirect(pb, VAR_1, TS_PACKET_SIZE, VAR_3);

        if (VAR_4 != TS_PACKET_SIZE)

            return VAR_4 < 0 ? VAR_4 : AVERROR_EOF;

        

        if ((*VAR_3)[0] != 0x47) {

            

            avio_seek(pb, -TS_PACKET_SIZE, SEEK_CUR);

            if (mpegts_resync(VAR_0) < 0)

                return AVERROR(EAGAIN);

            else

                continue;

        } else {

            break;

        }

    }

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, uint8_t *VAR_1, int VAR_2, uint8_t **VAR_3)
{ AVIOContext *pb = VAR_0->pb; int VAR_4; for(;;) { VAR_4 = ffio_read_indirect(pb, VAR_1, TS_PACKET_SIZE, VAR_3); if (VAR_4 != TS_PACKET_SIZE)
return VAR_4 < 0 ? VAR_4 : AVERROR_EOF; if ((*VAR_3)[0] != 0x47) { avio_seek(pb, -TS_PACKET_SIZE, SEEK_CUR); if (mpegts_resync(VAR_0) < 0)
return AVERROR(EAGAIN); else
continue; } else { break; } } return 0; }