[FFmpeg-devel] [PATCH] IVF demuxer

Reimar Döffinger Reimar.Doeffinger
Fri May 21 07:21:23 CEST 2010


On Thu, May 20, 2010 at 09:26:23PM -0400, David Conrad wrote:
> +    st->codec->width  = get_le16(s->pb);
> +    st->codec->height = get_le16(s->pb);
> +    st->time_base.den = get_le32(s->pb);
> +    st->time_base.num = get_le32(s->pb);


The demuxer won't work without valid values for those, so you should
check them in the probe function, it is a bit weak currently IMO.

> +    st->duration = get_le64(s->pb) * av_q2d(st->time_base);

Huh? Duration is in the stream time base, so this seems wrong to me...

> +static int read_packet(AVFormatContext *s, AVPacket *pkt)
> +{
> +    int ret, size = get_le32(s->pb);
> +    int64_t pts = get_le64(s->pb);
> +
> +    ret = av_get_packet(s->pb, pkt, size);
> +    pkt->stream_index = 0;
> +    pkt->pts = pts;
> +
> +    return ret;
> +}
> +
> +AVInputFormat ivf_demuxer = {
> +    "ivf",
> +    NULL_IF_CONFIG_SMALL("Indeo Video File Format"),
> +    0,
> +    probe,
> +    read_header,
> +    read_packet,

You should set pkt->pos correctly and enable automatic index generation
so that seeking works.



More information about the ffmpeg-devel mailing list