[FFmpeg-devel] [PATCH] UDP fixes join multicast group on Darwin arch

Sébastien Zwickert szwickert
Tue Apr 21 12:55:37 CEST 2009


On Apr 20, 2009, at 6:11 PM, Diego Biurrun wrote:

> On Fri, Apr 17, 2009 at 04:25:42PM +0200, S?bastien Zwickert wrote:
>>
>> I found that udp_join_multicast_group() in libavformat/udp.c is  
>> broken
>> because IP_ADD_MEMBERSHIP and ip_mreq struct aren't defined on Darwin
>> Kernel Version 9.6.0 architecture.
>> I've read this archive
>> http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2008-August/051136.html
>> and i've added the _DARWIN_C_SOURCE definition at the top of the   
>> udp.c
>> file.
>
> The problem is that this struct and definition are only defined when
> _POSIX_C_SOURCE is not defined.  But we compile with _POSIX_C_SOURCE
> set, so it fails.
>

Almost right, this struct is only defined when _POSIX_C_SOURCE is not  
defined OR when _DARWIN_C_SOURCE is defined.

This struct is defined on Apple system in <netinet/in.h> under this  
condition :
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)

> I'm not sure if this is a bug in the Apple system headers or if we
> should disable _POSIX_C_SOURCE on Darwin (probably not) or if we  
> should
> avoid that struct and that definition...


Maybe, disable _POSIX_C_SOURCE is an appropriate solution on Darwin  
because in this case the system headers will act as if we had have  
defined _DARWIN_C_SOURCE, which causes the library and kernel calls to  
conform to _POSIX_C_SOURCE with non-POSIX extensions. Defining  
_POSIX_C_SOURCE excludes all non-POSIX extentions on Darwin.

The link below is the Apple's document (man compat) about the  
compatibility settings:
http://developer.apple.com/documentation/Darwin/Reference/Manpages/man5/compat.5.html

Another document explaining Apple's unix conoformance:
http://developer.apple.com/ReleaseNotes/Darwin/RN-Unix03Conformance/index.html

Sebastien.





More information about the ffmpeg-devel mailing list