[FFmpeg-devel] [PATCH] Redefine AVERROR_EOF as a specific FFmpeg error code at the next lavu major bump

Michael Niedermayer michaelni
Tue Mar 16 23:13:19 CET 2010


On Tue, Mar 16, 2010 at 10:00:52PM +0100, Stefano Sabatini wrote:
[...]
> Result of grep:
[...]
> *** ./libavformat/avio.c:204:        return AVERROR(EPIPE);
> 
> int64_t url_seek(URLContext *h, int64_t pos, int whence)
> {
>     int64_t ret;
> 
>     if (!h->prot->url_seek)
>         return AVERROR(EPIPE);
>     ret = h->prot->url_seek(h, pos, whence & ~AVSEEK_FORCE);
>     return ret;
> }
> 
> here looks like we should use instead:
>     if ((ret = h->prot->url_seek) < 0)
>         return ret;

try again when you are awake


> 
> *** ./libavformat/rtspenc.c:96:                return AVERROR(EPIPE);
> *** ./libavformat/rtspenc.c:101:                return AVERROR(EPIPE);
> 
>             ret = ff_rtsp_read_reply(s, &reply, NULL, 1);
>             if (ret < 0)
>                 return AVERROR(EPIPE);
>             if (ret == 1)
>                 ff_rtsp_skip_packet(s);
>             /* XXX: parse message */
>             if (rt->state != RTSP_STATE_STREAMING)
>                 return AVERROR(EPIPE);
> 
> I'm not qualified enough to say if this use is correct, but the use
> seems consistent with the meaning of EPIPE which is "Stream in the
> channel interrupted for some error condition"). Maybe it would be
> better even in the first case to just return ret.
> 

> *** ./libavformat/aviobuf.c:159:            return AVERROR(EPIPE);
> 
> Context:
> int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence)
> ...
>         if (s->eof_reached)
>             return AVERROR(EPIPE);
> 
> seems a perfect place where to return AVERROR_EOF.

theoretically yes


[...]

> *** ./libavutil/error.h:41:#define AVERROR_EOF         AVERROR(EPIPE)   /**< End of file. */
> 
> As you see I'm willing to fix all the possible incongruent uses of
> EPIPE in the code. I'll post a patch on a case by case basis, then
> we should be able to safely apply this patch.
> 
> Regards.
> 

> PS this error handling fix job is boring to death but someone has to
> do it, and I'm happy it's finally going on as it was on my todo list
> since when I started hacking on the FFmpeg code.

it will be more fun to fix the regressions this might cause ;)

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100316/f12f31e4/attachment.pgp>



More information about the ffmpeg-devel mailing list