static int aiff_read_packet(AVFormatContext *s,

                            AVPacket *pkt)

{

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

    AIFFInputContext *aiff = s->priv_data;

    int64_t max_size;

    int res, size;



    /* calculate size of remaining data */

    max_size = aiff->data_end - avio_tell(s->pb);

    if (max_size <= 0)

        return AVERROR_EOF;



    /* Now for that packet */

    if (st->codec->block_align >= 17) // GSM, QCLP, IMA4

        size = st->codec->block_align;

    else

        size = (MAX_SIZE / st->codec->block_align) * st->codec->block_align;

    size = FFMIN(max_size, size);

    res = av_get_packet(s->pb, pkt, size);

    if (res < 0)

        return res;



    if (size >= st->codec->block_align)

        pkt->flags &= ~AV_PKT_FLAG_CORRUPT;

    /* Only one stream in an AIFF file */

    pkt->stream_index = 0;

    pkt->duration     = (res / st->codec->block_align) * aiff->block_duration;

    return 0;

}

static int aiff_read_packet(AVFormatContext *s,

                            AVPacket *pkt)

{

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

    AIFFInputContext *aiff = s->priv_data;

    int64_t max_size;

    int res, size;



    

    max_size = aiff->data_end - avio_tell(s->pb);

    if (max_size <= 0)

        return AVERROR_EOF;



    

    if (st->codec->block_align >= 17) 

        size = st->codec->block_align;

    else

        size = (MAX_SIZE / st->codec->block_align) * st->codec->block_align;

    size = FFMIN(max_size, size);

    res = av_get_packet(s->pb, pkt, size);

    if (res < 0)

        return res;



    if (size >= st->codec->block_align)

        pkt->flags &= ~AV_PKT_FLAG_CORRUPT;

    

    pkt->stream_index = 0;

    pkt->duration     = (res / st->codec->block_align) * aiff->block_duration;

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0,

                            AVPacket *VAR_1)

{

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

    AIFFInputContext *aiff = VAR_0->priv_data;

    int64_t max_size;

    int VAR_2, VAR_3;



    

    max_size = aiff->data_end - avio_tell(VAR_0->pb);

    if (max_size <= 0)

        return AVERROR_EOF;



    

    if (st->codec->block_align >= 17) 

        VAR_3 = st->codec->block_align;

    else

        VAR_3 = (MAX_SIZE / st->codec->block_align) * st->codec->block_align;

    VAR_3 = FFMIN(max_size, VAR_3);

    VAR_2 = av_get_packet(VAR_0->pb, VAR_1, VAR_3);

    if (VAR_2 < 0)

        return VAR_2;



    if (VAR_3 >= st->codec->block_align)

        VAR_1->flags &= ~AV_PKT_FLAG_CORRUPT;

    

    VAR_1->stream_index = 0;

    VAR_1->duration     = (VAR_2 / st->codec->block_align) * aiff->block_duration;

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0,
AVPacket *VAR_1)
{ AVStream *st = VAR_0->streams[0]; AIFFInputContext *aiff = VAR_0->priv_data; int64_t max_size; int VAR_2, VAR_3; max_size = aiff->data_end - avio_tell(VAR_0->pb); if (max_size <= 0)
return AVERROR_EOF; if (st->codec->block_align >= 17)
VAR_3 = st->codec->block_align; else
VAR_3 = (MAX_SIZE / st->codec->block_align) * st->codec->block_align; VAR_3 = FFMIN(max_size, VAR_3); VAR_2 = av_get_packet(VAR_0->pb, VAR_1, VAR_3); if (VAR_2 < 0)
return VAR_2; if (VAR_3 >= st->codec->block_align)
VAR_1->flags &= ~AV_PKT_FLAG_CORRUPT; VAR_1->stream_index = 0; VAR_1->duration     = (VAR_2 / st->codec->block_align) * aiff->block_duration; return 0; }