static int vmd_read_packet(AVFormatContext *s,

                           AVPacket *pkt)

{

    VmdDemuxContext *vmd = (VmdDemuxContext *)s->priv_data;

    ByteIOContext *pb = &s->pb;

    int ret = 0;

    vmd_frame_t *frame;



    if (vmd->current_frame >= vmd->frame_count)

        return -EIO;



    frame = &vmd->frame_table[vmd->current_frame];

    /* position the stream (will probably be there already) */

    url_fseek(pb, frame->frame_offset, SEEK_SET);



    if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))

        return AVERROR_NOMEM;

    memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);

    ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD, 

        frame->frame_size);



    if (ret != frame->frame_size)

        ret = -EIO;

    pkt->stream_index = frame->stream_index;

    pkt->pts = frame->pts;



    vmd->current_frame++;



    return ret;

}

static int vmd_read_packet(AVFormatContext *s,

                           AVPacket *pkt)

{

    VmdDemuxContext *vmd = (VmdDemuxContext *)s->priv_data;

    ByteIOContext *pb = &s->pb;

    int ret = 0;

    vmd_frame_t *frame;



    if (vmd->current_frame >= vmd->frame_count)

        return -EIO;



    frame = &vmd->frame_table[vmd->current_frame];

    

    url_fseek(pb, frame->frame_offset, SEEK_SET);



    if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))

        return AVERROR_NOMEM;

    memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);

    ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD, 

        frame->frame_size);



    if (ret != frame->frame_size)

        ret = -EIO;

    pkt->stream_index = frame->stream_index;

    pkt->pts = frame->pts;



    vmd->current_frame++;



    return ret;

}

    if (ret != frame->frame_size)     pkt->pts = frame->pts;
static int FUNC_0(AVFormatContext *VAR_0,

                           AVPacket *VAR_1)

{

    VmdDemuxContext *vmd = (VmdDemuxContext *)VAR_0->priv_data;

    ByteIOContext *pb = &VAR_0->pb;

    int VAR_2 = 0;

    vmd_frame_t *frame;



    if (vmd->current_frame >= vmd->frame_count)

        return -EIO;



    frame = &vmd->frame_table[vmd->current_frame];

    

    url_fseek(pb, frame->frame_offset, SEEK_SET);



    if (av_new_packet(VAR_1, frame->frame_size + BYTES_PER_FRAME_RECORD))

        return AVERROR_NOMEM;

    memcpy(VAR_1->data, frame->frame_record, BYTES_PER_FRAME_RECORD);

    VAR_2 = get_buffer(pb, VAR_1->data + BYTES_PER_FRAME_RECORD, 

        frame->frame_size);



    if (VAR_2 != frame->frame_size)

        VAR_2 = -EIO;

    VAR_1->stream_index = frame->stream_index;

    VAR_1->pts = frame->pts;



    vmd->current_frame++;



    return VAR_2;

}

static int FUNC_0(AVFormatContext *VAR_0,
AVPacket *VAR_1)
{ VmdDemuxContext *vmd = (VmdDemuxContext *)VAR_0->priv_data; ByteIOContext *pb = &VAR_0->pb; int VAR_2 = 0; vmd_frame_t *frame; if (vmd->current_frame >= vmd->frame_count)
return -EIO; frame = &vmd->frame_table[vmd->current_frame]; url_fseek(pb, frame->frame_offset, SEEK_SET); if (av_new_packet(VAR_1, frame->frame_size + BYTES_PER_FRAME_RECORD))
return AVERROR_NOMEM; memcpy(VAR_1->data, frame->frame_record, BYTES_PER_FRAME_RECORD); VAR_2 = get_buffer(pb, VAR_1->data + BYTES_PER_FRAME_RECORD,
frame->frame_size); if (VAR_2 != frame->frame_size)
VAR_2 = -EIO; VAR_1->stream_index = frame->stream_index; VAR_1->pts = frame->pts; vmd->current_frame++; return VAR_2; }