Use of -EFOO breaks build on Haiku
I had a look at porting to Haiku, however there's one thing that really precludes compilation and use.
The code is full of return -ENOMEM;
and other alike.
While this scheme may be valid in ANSI C and POSIX (although their documentation hasn't really been consistent throughout time), it is very error-prone (I did find errors due to this when porting OpenSound), and it totally breaks on Haiku because we reused BeOS error codes which are defined as negative numbers.
This kind of schemes really ought to be restricted to kernel code, and actually was on BSD it seems.
Please consider changing this. FFmpeg/libav adopted some macros to wrap error codes with proper sign, this could be an option to get it working on Haiku, although it doesn't remove the possibility of errors.