[FFmpeg-devel] [PATCH] "Metal Gear Solid: The Twin Snakes" demuxer

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Mar 25 12:13:43 CEST 2012


On Wed, Mar 21, 2012 at 10:18:54PM +0000, Paul B Mahol wrote:
> +static int read_packet(AVFormatContext *s, AVPacket *pkt)
> +{
> +    AVIOContext *pb = s->pb;
> +    uint32_t chunk_size, payload_size;
> +    int ret;
> +
> +    if (url_feof(pb))
> +        return AVERROR_EOF;
> +
> +    avio_skip(pb, 4);
> +    chunk_size = avio_rb32(pb);
> +    avio_skip(pb, 4);
> +    payload_size = avio_rb32(pb);
> +
> +    if (chunk_size < payload_size + 16)
> +        return AVERROR(EIO);
> +
> +    ret = av_get_packet(pb, pkt, payload_size);
> +    if (ret < 0)
> +        return ret;

You should set pkt->pos correctly (i.e. decrement it by 16)
and enable generic seek.


More information about the ffmpeg-devel mailing list