[Ffmpeg-devel] FFMPEG RTSP for Windows
Thu Mar 30 18:49:28 CEST 2006
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
you must include:
unsigned sleep(unsigned x)
once in an unobtrusive place, or just:
#define sleep(x) Sleep((x)*1000)
However I'm still skeptical since you explicitly stated your test was
> it doesn't have sleep.. when I compiled libavformat as it was it gave a
> warning on sleep(1); .. and broke other places so I assumed mingw was
> missing sleep() also and changed it to Win32 style:
Don't assume. I'm almost sure that's incorrect.
> > +#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.
> > +#ifdef CONFIG_WIN32
> > + getsockopt (fd, SOL_SOCKET, SO_ERROR, (char FAR *)&ret, (int
> > *)&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.
> > -#ifdef __BEOS__
> > +#if defined(__BEOS__) || defined(CONFIG_WIN32)
> > len = recv(s->fd, buf, size, 0);
> > #else
> > len = read(s->fd, buf, size);
> > IMO it's safe to use recv always.
> that's fine.. however the code as it was originally written was using
> recv() only for BEOS and read() otherwise. I did not choose to use read()
> on Unix so don't blame me for that. And same for send.
Yes, I don't blame you for missing this. It was just a comment to
> > Using shutdown() instead of close() or closesocket() should be safe on
> > both unix and windows.
> once again... the original code was written close() so I chose to stick
Sorry, I was wrong about what shutdown() does anyway.
More information about the ffmpeg-devel