[FFmpeg-devel] [PATCH] IPv6 support for mingw32

Martin Storsjö martin
Thu Jan 7 09:55:01 CET 2010

On Thu, 7 Jan 2010, Zuxy Meng wrote:

> 2010/1/6 Martin Storsj? <martin at martin.st>:
> > Hi Zuxy,
> >
> > On Wed, 6 Jan 2010, Zuxy Meng wrote:
> >
> >> Without this patch mplayer build would fail but ffmpeg is fine,
> >> because currently ffmpeg's configure disables IPv6 on Windows.
> >
> > Could you elaborate on how mplayer's build fails if ffmpeg is configured
> > with IPv6 disabled?
> The problem is that the link stage would fail when CONFIG_IPV6 is set
> for libavformat/udp.c, due to calling convention differences for
> getaddrinfo() and freeaddrinfo().
> Without explicit options, mplayer's configure enables CONFIG_IPV6 for
> mingw but ffmpeg's configure disables it, because the latter tries to
> actually build a small program calling getaddrinfo(), which would fail
> during linking.

Ok, so the actual culprit in that build problem is that mplayer's 
configure forcibly enables things that ffmpeg's configure wouldn't enable, 

> >> There's a tradeoff however, that the built binaries can't run on Windows
> >> 2000 or older, as getaddrinfo() and freeaddrinfo() are available as part
> >> of the OS since Windows XP. It's possible to run IPv6 on Windows
> >> 2000/ME/98 with IPv6 Technology Preview installed but that requires
> >> inclusion of wspiapi.h that isn't shipped in MinGW due to license
> >> conflicts.
> >
> > Skipping backwards compatibility for this kind of feature isn't something
> > I'd do lighthandedly.
> >
> > The common approach to preserve backwards compatibility (without losing
> > the IPv6 functionality on the newer versions that actually have a proper
> > getaddrinfo) on windows is to load them using GetProcAddress, and provide
> > a fallback wrapper if they aren't found. Fallback wrappers already are
> > provided in the "[PATCH/RFC] Prefer getaddrinfo over gethostbyname"
> > thread, so adding support for loading the proper ones on top of those
> > patches is quite easy. I can give that a try.
> Actually there is a wspiapi.h that just does that. However it's
> copyrighted by MS. You can take a look at it from
> http://pf.itd.nrl.navy.mil/mdp/dox/html/wspiapi_8h-source.html for
> reference.

There's no need for that, I've already made a reimplementation of my own - 
see the latest patches in the other thread.

In the latest patch series in that thread, I first remove the checks for 
getaddrinfo in the CONFIG_IPV6 check, since we already provide fallbacks 
for that function. I also add the winsock headers to the CONFIG_IPV6 
check, so that the check succeeds on mingw.

If I understand the mplayer build problem correctly, this is enough to 
make things work in that build configuration, right?

The last patches in that series enable actual IPv6 support on windows, 
either by loading getaddrinfo & co dynamically (roughly equivalent to what 
wspiapi.h does) or by linking directly to the symbols (and thus requiring 

But as for the mplayer build problem, neither of these actually are 
required for fixing the build problem - if patches up to 0011 in the 
series are applied, the build problem should be fixed.

// Martin

More information about the ffmpeg-devel mailing list