[FFmpeg-devel] [PATCH/RFC] Prefer getaddrinfo over gethostbyname

Ronald S. Bultje rsbultje
Mon Jan 4 04:21:38 CET 2010

Hi Martin,

On Sun, Jan 3, 2010 at 6:11 PM, Martin Storsj? <martin at martin.st> wrote:
> The resolve_host vs full ipv6 support in the udp protocol isn't cleaned up
> - this may need a bit more work, I just replaced the non-ipv6 codepath to
> use getaddrinfo with only the AF_INET protocol family. I guess the
> much of the separate ipv4/ipv6 codepaths could be merged now.

udp.c is a mess when it comes to this. I don't see an easy way of
merging the two because they evolved completely separately since their
original emergence. :-(.

> Also, for platforms where getaddrinfo isn't available, I'm not sure if
> defining a replacement of our own with the same name is the best solution
> - on e.g. windows, a symbol with that name is available on modern windows
> versions, but it isn't available in the mingw link libraries. (To retain
> compatibility with older versions, one is supposed to dynamically load the
> getaddrinfo function pointer, or use a wrapper for gethostbyname if the
> symbol isn't found.) One extra solution perhaps would be to add
> #define getaddrinfo ff_getaddrinfo

Yes, that's the best way.

> Also, if the platform doesn't have a proper getaddrinfo, ffserver will
> need to use it from libavformat, so in that case it should be a public
> symbol. (What's the case with resolve_host at the moment?)

resolve_host() is private but ffserver defies all rules. No reason to
not do that here, also... Especially since we consider it a platform
function and ossupport just "fixes" platform deficiencies.


More information about the ffmpeg-devel mailing list