[FFmpeg-devel] [PATCH] IVF demuxer

David Conrad lessen42
Sat May 22 01:15:25 CEST 2010


On May 21, 2010, at 1:21 AM, Reimar D?ffinger wrote:

> 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.

Width/height can be set in the decoder if missing from the format, and an invalid frame rate should be checks in read_header IMO.

I changed the probe function to look at the header size too; I think checking the first 8 bytes for exact vaules is strong enough; the AVI probe only checks 8 bytes too.

>> +    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...

Oops, fixed

>> +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.

Done, along with alignment stuff Diego pointed out.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: textmate stdin GOuawQ.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100521/ece8b902/attachment.txt>



More information about the ffmpeg-devel mailing list