[Ffmpeg-devel] [PATCH] MingW RTSP support

Michael A. Kohn mike
Sun Apr 2 16:58:10 CEST 2006



On Sat, 1 Apr 2006, Rich Felker wrote:

> On Sat, Apr 01, 2006 at 11:32:02PM +0100, M?ns Rullg?rd wrote:
> > Diego Biurrun <diego at biurrun.de> writes:
> >
> > > On Fri, Mar 31, 2006 at 06:46:25PM -0500, Rich Felker wrote:
> > >> On Fri, Mar 31, 2006 at 01:15:59PM -0600, Michael A. Kohn wrote:
> > >> > +#ifndef __MINGW32__
> > >> >  #include <sys/socket.h>
> > >> >  #include <netinet/in.h>
> > >> > -#ifndef __BEOS__
> > >> > -# include <arpa/inet.h>
> > >> > -#else
> > >> > +#include <netdb.h>
> > >> > +#endif
> > >> > +#ifdef __BEOS__
> > >> >  # include "barpainet.h"
> > >> > +#elif !defined(__MINGW32__)
> > >> > +# include <arpa/inet.h>
> > >> >  #endif
> > >> > -#include <netdb.h>
> > >>
> > >> This stuff is still unnecessary. Just add the missing headers to your
> > >> mingw.
> > >
> > > Why?  We use #ifdef to support different platforms in many places, this
> > > looks pretty normal to me...
> >
> > Well, it *is* pretty unreadable too...
>
> No only is this special-casing of operating systems completely
> unreadable and unmaintainable; it also means that, when the offending
> broken OS is fixed, the workarounds for the old broken version will
> still be in place and the new corrected OS probably will not work!
> This is completely unacceptable.
>
> If there must be workarounds for broken operating systems in the form
> of preprocessor conditions, then they need to be conditional on
> individual broken features, e.g. #ifdef BROKEN_SOCKETS rather than
> #ifdef __MINGW32__ or #ifdef WIN32. Then, the broken things must be
> _detected_ in the configure script rather than being hard-coded, so
> that if the broken OS ever fixes its noncompliance, the new fixed
> version will immediately work without changing the application's build
> system.
>
> Rich

Personally, I don't think the change from..

#include "avformat.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifndef __BEOS__
# include <arpa/inet.h>
#else
# include "barpainet.h"
#endif
#include <netdb.h>

to..

#include "avformat.h"
#include <unistd.h>
#include <sys/types.h>
#ifndef __MINGW32__
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#endif
#ifdef __BEOS__
# include "barpainet.h"
#elif !defined(__MINGW32__)
# include <arpa/inet.h>
#endif

.. is that much more gross, but I see your point.. if you let one thing
slide, other gross things get in..

I mean.. i know you guys don't care much for the OS that MingW programs
run on.. but i think these changes are pretty small in order to expand the
audience of ffmpeg.. lots of people could benifit from it..

As far as modifying mingw itself... adding in the missing include files in
the mingw directory... I would vote against that just because I'd be
willing to bet most people who would compile ffmpeg on the MingW OS's
would end up getting compiler errors while trying to build it and probably
just start putting bug reports on these lists.. I'd bet 99% of them would
never figure to add the missing include files into MingW..

Maybe another alternative would be to just include a patch file in the
source tree that gets automatically patched in when a user configures
ffmpeg for MingW?

btw.. speaking of gross #defines.. these three lines appear at the top of
tcp.c..

#if defined(__BEOS__) || defined(__INNOTEK_LIBC__)
typedef int socklen_t;
#endif

Shouldn't these three lines be on os_support.h?  I almost moved them
there, but I wasn't sure if the BEOS build would break if I did.







More information about the ffmpeg-devel mailing list