[FFmpeg-devel] [PATCH] avformat/internal: Don't auto-include os_support.h

Martin Storsjö martin at martin.st
Thu Aug 31 23:55:01 EEST 2023


On Thu, 31 Aug 2023, Andreas Rheinhardt wrote:

> It includes various Windows-specific headers when compiling
> for Windows and these sometimes cause issues: E.g. winbase.h
> defines IGNORE, which clashes with a macro used in the Matroska
> muxer (since 884653ee5be03ed38db957c14fad51b300611c8c) and demuxer.
>
> This header provides fallback defines for various stuff that is
> mostly not used directly by (de)muxers at all:
> mkdir, rename, rmdir, unlink, access, poll, pollfd, nfds_t,
> closesocket, socklen_t, fstat, stat, lseek, SHUT_(RD|WR|RDWR)
> and various POLL* constants.
>
> Ergo fix this issue by not auto-including this header in lots
> of places via an inclusion in internal.h and instead include
> it everywhere where the above stuff is used (most of these
> translation units already included os_support.h).
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
> libavformat/img2dec.c  | 1 +
> libavformat/internal.h | 1 -
> libavformat/rtsp.h     | 1 +
> libavformat/utils.c    | 1 +
> 4 files changed, 3 insertions(+), 1 deletion(-)

Ok with me, if you did a reasonable effort to check that this covers all 
the cases of the redirected functions. Spreading those includes everywhere 
isn't very nice indeed.

This increases the risk of accidentally adding new uses of these functions 
without picking up the redirects, but I guess that's manageable.

// Martin



More information about the ffmpeg-devel mailing list