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

Sébastien Zwickert szwickert
Wed Apr 22 15:29:24 CEST 2009

On Apr 21, 2009, at 12:55 PM, S?bastien Zwickert wrote:

> 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

New patch in attachment that fixes this issue by removing - 
D_POSIX_C_SOURCE flag in configure file where target os is darwin...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: udp_multicast_darwin.patch
Type: application/octet-stream
Size: 626 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090422/522ccd0c/attachment.obj>
-------------- next part --------------

Sebastien Zwickert

More information about the ffmpeg-devel mailing list