[FFmpeg-devel] [PATCH] Fix compilation on OpenBSD

Andrew Savchenko bircoph
Tue Nov 18 11:38:45 CET 2008


Hi,

On Tuesday 18 November 2008 00:25, M?ns Rullg?rd wrote:
[...]
> > But I'm not a system owner and I'm not allowed to install this
> > kind of software outside of main ports tree.)
>
> How can anyone live under such conditions?

Security implies some limitations. Obviously, this system is not a 
desktop, but mencoder power was required here. Anyway I'll install 
newer gmake in my local private path later.

> > Index: libavcodec/nellymoserenc.c
> > ==============================================================
> >===== --- libavcodec/nellymoserenc.c	(revision 15864)
> > +++ libavcodec/nellymoserenc.c	(working copy)
> > @@ -45,6 +45,10 @@
> >  #define POW_TABLE_SIZE (1<<11)
> >  #define POW_TABLE_OFFSET 3
> >
> > +#if !defined(INFINITY) && defined(HUGE_VAL)
> > +#define INFINITY HUGE_VAL
> > +#endif
>
> 1. INFINITY is as standard as HUGE_VAL, so anywhere you find
> one, you should have the other.  

I doubt it, HUGE_VAL is definitely in POSIX, but I can't find 
nothing about INFINITY. This is some cite from math.h in OpenBSD:
===================================
/*
 * ANSI/POSIX
 */
extern char __infinity[];
#define HUGE_VAL        (*(double *)(void *)__infinity)

And from Linux box:
===================================
/* IEEE positive infinity.  */

#if __GNUC_PREREQ(3,3)
# define INFINITY       (__builtin_inff())
#else
# define INFINITY       HUGE_VALF
#endif
===================================
IEEE != POSIX in general.

> If your system headers only 
> define one of them, it is these which should be fixed, not
> FFmpeg.

Are you really, really sure in this? Cant you, please, be so kind 
to point me where POSIX and only POSIX stands for INFINITY *must* 
be defined?

And what do you suppose me to do? Write to OpenBSD development 
team? They will likely reject this "fix", and even if they'll 
accept it, it will take ages to make update of all OpenBSD setups 
reasonable.

> 2. HUGE_VAL is of type double, whereas INFINITY is of type
> float. Using HUGE_VAL where a float is expected might not work
> as expected.

Well, this patch is not my own invention. It is used and works for 
ages at MPlayer, please look at libmpcodecs/ve_lavc.c. As shown in 
cite from math.h at OpenBSD earlier, HUGE_VAL is practically 
converted *char to *(double*) value, so I doubt there is some 
difference between double and float here. If you insist, I may use 
HUGE instead.

> 3. Aside from the above, this is the wrong place to add a
> missing definition of INFINITY.

Why? Have you a better idea? I will be glad to hear it.
The only place where it is used in FFmpeg is nellymouserenc.c, so I 
assume it to be this file specific, and I placed in at the 
beginning of the file whereas most #define directives are placed 
usually.

-- 
Best regards,
Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081118/cdda6958/attachment.pgp>



More information about the ffmpeg-devel mailing list