[Ffmpeg-devel] [patch] fall back mmap() call for working on no-mmu systems
Michael Niedermayer
michaelni
Mon Dec 18 19:55:15 CET 2006
Hi
On Sat, Dec 16, 2006 at 01:59:53PM -0500, Mike Frysinger wrote:
> this patch tweaks libavformat/grab.c so that if the call to
> mmap(MAP_SHARED) fails, the code will retry the mmap() call but this
> time with MAP_PRIVATE ... this is needed to work on no-mmu linux
> systems where mmap(MAP_SHARED) typically is not supported
> -mike
> Index: libavformat/grab.c
> ===================================================================
> --- libavformat/grab.c (revision 7322)
> +++ libavformat/grab.c (working copy)
> @@ -57,6 +57,15 @@ static int aiw_init(VideoData *s);
> static int aiw_read_picture(VideoData *s, uint8_t *data);
> static int aiw_close(VideoData *s);
>
> +static void *do_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
> +{
> + void *ret;
> + ret = mmap(start, length, prot, flags, fd, offset);
> + if (ret == (unsigned char*)-1 && (flags & MAP_SHARED))
> + ret = mmap(start, length, prot, (flags & ~MAP_SHARED) | MAP_PRIVATE, fd, offset);
> + return ret;
> +}
> +
tabs are forbidden in svn and i see no sense in having this once used thing
implemented as its own function
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
More information about the ffmpeg-devel
mailing list