[Ffmpeg-devel] FFMPEG RTSP for Windows

Michael A. Kohn mike
Thu Mar 30 22:44:20 CEST 2006

On Thu, 30 Mar 2006, Rich Felker wrote:

> On Thu, Mar 30, 2006 at 07:39:07AM -0600, Michael A. Kohn wrote:
> > >          sleep(1);
> > > +#else
> > > +        Sleep(1000);
> >
> > > This is wrong. I doubt win32 is missing sleep, but if it is, you need
> > > to make an emulation of sleep() using Sleep in a separate
> > > win32-dependent file.
> >
> > This is not wrong... try compiling this in Visual C++:
> You missed the second half of my sentence. Adding #ifdef everywhere is
> not acceptable. Instead if emulation of missing functions is required
> once in an unobtrusive place, or just:
> #ifdef MINGW
> #define sleep(x) Sleep((x)*1000)
> #endif

I'm fine with changing it the way you want it.. where do you suggest
for an unobstrusive place to put the above lines?

> However I'm still skeptical since you explicitly stated your test was
> in MSVC.

If you're referring to this test:

main() { sleep(500); }

I didn't do that test on MSVC.  That won't even compile on MSVC since
sleep isn't defined.  The code above on Linux takes 500 seconds to return
while on Windows with MingW it takes 500 milliseconds.  In stdlib.h in
MingW there is an explaination that sleep() is obsolete in Windows and
Sleep is its replacement.

> > > +#undef rand
> > > +#define random rand
> > > random is not allowed in libav*. If it's used this is a bug and must
> > > be corrected.
> >
> > notice above these lines i wrote:
> >
> > > +/* I'm sure the next two lines are evil in some way, but I'm not sure
> > > +   how else to do that right now */
> >
> > the way it is right now does not compile.  i was hoping someone could have
> > been nice enough to explain why instead of you coming around and insulting
> > me...  i'm sorry if what i did is so horrible, but that was the only way
> > that was going to compile..
> Well if there's buggy code you need to fix it, not pile workarounds on
> top of it that hide the bugs.

Well, I'm not sure how to take care of random() since it doesn't seem to
exist in MingW.  Do you or anyone else on this mailing list have a good

> > > +#ifdef CONFIG_WIN32
> > > +        getsockopt (fd, SOL_SOCKET, SO_ERROR, (char FAR *)&ret, (int
> > FAR
> > > *)&optlen);
> >
> > > The use of the FAR pointer qualifier is ABSOLUTELY WRONG!
> > > This is win16 code!!
> >
> > According to MSDN Libaray that came with the Visual Studio I use when I
> > have to do VC++ things:
> Again MSVC is _not supported_. This is intentional due to noncompliant
> broken things exactly like what you've described here.

I don't use MSVC.  I'm not a Windows guy at all, I only program Windows at
work and when cross compiling my own programs for others to use. I used
MSDN's documentation every once in a while for looking up function
prototypes and such since MingW as I understand it is supposed to be the
GCC compiler working with Microsoft libraries and such.

Anyway, my question is, would you or anyone else like to me make these
changes and resubmit a patch?  or should I just leave this code to myself?


More information about the ffmpeg-devel mailing list