[FFmpeg-devel] [PATCH] IPv6 support v.2

Nicolas George nicolas.george
Wed Nov 7 17:21:55 CET 2007


Le septidi 17 brumaire, an CCXVI, Luca Abeni a ?crit?:
> For example, udp.c currently contains a lot of code duplication between
> IPv6 and IPv4. I believe that removing this code duplication is the first
> step.

Nitpick: this is not IPv6 vs. IPv4, this is protocol-independent vs.
IPv4-only. This means that in ideal circumstances, the former completely
supersedes the latter. Ideal circumstances mean two things:

- The protocol-independent version has been properly reviewed and debugged.

- The operating system has the necessary functions.

The key to achieve the first point is that everyone uses the code.

For the second point, the "necessary functions" are getaddrinfo, and
secondarily getnameinfo. These function have nothing magic, nor
system-dependant, nor anything. It is perfectly possible to implement them
on top of the legacy functions (gethostbyname and cousins); Stevens did it
in UNP, it takes the best part of a chapter, but it works. Fortunately,
ffmpeg (like most other programs) only uses a very small subset of
getaddrinfo cases, and writing an implementation suitable for its needs
would be just a matter of a few lines.

Therefore, one possible course of action would be:

- Simply drop the IPv4-only code.

- If people complain that ffmpeg does not build anymore on their old
  operating system, write a limited implementation of getaddrinfo.

Another solution, which is probably better, would be to move all
network-related code somewhere together in libavutil.

This would require reviewing the code in all ffmpeg to see what API would
actually be needed, and careful design of that API, but this would make
maintenance a lot more easier.

Regards,

-- 
  Nicolas George




More information about the ffmpeg-devel mailing list