[FFmpeg-devel] [PATCH 1/2] add support for generic seeking by?reading timestamps in nuv

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Sep 12 23:21:36 CEST 2011


On Mon, Sep 12, 2011 at 07:51:08PM +0200, Joakim Plate wrote:
> + * \return TRUE if the syncword is found.

1, not TRUE

> +static int64_t nuv_read_dts(AVFormatContext *s, int stream_index,
> +                               int64_t *ppos, int64_t pos_limit)

Strange indentation.

> +        if (avio_read(pb, hdr, HDRSIZE) <= 0)

Shouldn't that check for < HDRSIZE?

> +                av_add_index_entry(s->streams[frametype == NUV_VIDEO ? ctx->v_id : ctx->a_id]
> +                                 , pos, dts, size + HDRSIZE, 0, hdr[2] == 0 ? AVINDEX_KEYFRAME : 0);

, is strangely placed.
Also since you do not check that v_id/a_id is >= 0 that can crash in a
file that is marked to contain no stream for that packet type.
Also IIRC your other patch uses hdr[2] only for video, this uses it for audio
and video, one isn't right...

> +                if ((frametype == NUV_VIDEO && stream_index == ctx->v_id) ||
> +                    (frametype == NUV_AUDIO && stream_index == ctx->a_id)) {

Also this duplicates code, I think you'd want a
stream_id = frametype == NUV_VIDEO ? ctx->v_id : ctx->a_id;
if (stream_id < 0) ...
But looks fairly good otherwise.


More information about the ffmpeg-devel mailing list