[FFmpeg-devel] [PATCH] Mask away AVSEEK_FORCE properly in some checks in url_fseek()
Michael Niedermayer
michaelni
Tue Mar 23 14:27:07 CET 2010
On Tue, Mar 23, 2010 at 01:20:58PM +0100, Tomas H?rdin wrote:
> Hi
>
> I've a bug in url_fseek(): it always returns AVERROR(EINVAL) when whence
> has AVSEEK_FORCE. The solution is to simply mask away AVSEEK_FORCE in
> the three places whence is tested for equality. Patch attached.
>
> /Tomas
> aviobuf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> a9aec82352efcaf60fa32c246de99219439aa769 whencefix.patch
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index da05251..b3d055d 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -136,10 +136,10 @@ int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence)
>
> pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));
>
> - if (whence != SEEK_CUR && whence != SEEK_SET)
> + if ((whence & ~AVSEEK_FORCE) != SEEK_CUR && (whence & ~AVSEEK_FORCE) != SEEK_SET)
> return AVERROR(EINVAL);
>
> - if (whence == SEEK_CUR) {
> + if ((whence & ~AVSEEK_FORCE) == SEEK_CUR) {
> offset1 = pos + (s->buf_ptr - s->buffer);
> if (offset == 0)
> return offset1;
int force= whence & AVSEEK_FORCE;
whence &= ~AVSEEK_FORCE;
seems more readable to me
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- 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/20100323/f4407073/attachment.pgp>
More information about the ffmpeg-devel
mailing list