toaruos icon indicating copy to clipboard operation
toaruos copied to clipboard

Is it possible to port FFmpeg to toaruos?

Open Vir-BryanQ opened this issue 2 years ago • 4 comments

It seems that there are few tools to deal with multimedia content and I didn't find a way to play a video on toaruos.
I wonder if it is possible to port FFmpeg to toaruos so that toaruos will be more powerful to deal with multimedia content. If possible, how difficult will it be? By the way, are there any video players on toaruos?

Vir-BryanQ avatar Oct 25 '22 09:10 Vir-BryanQ

FFmpeg was ported many years ago, before the switch to an in-house libc. I have not revisited that port, though the “minimp3” library available from the package manager is derived from (very slimmed down) FFmpeg sources. I seem to recall FFmpeg relying on some libc/libm math functions, which may be missing or stubbed, so some more work may be necessary to get it building again.

klange avatar Oct 25 '22 10:10 klange

A comment was posted here but deleted by its author, asking about alternative libms.

I don't intend to import any third-party code to support the in-house libm, but I have considered making musl's libm available from the package manager to support ports. The libm implementation in musl, much like others, is largely derivative of an old Sun libm.

This will require some work in the ld.so to fix up the incorrect, naive implementation of symbol resolution. Thankfully, libm implementations do not tend to rely much, if at all, on the internal details of the libc they are shipped with, so an external libm should be able to co-exist with our own in-house libc.

klange avatar Apr 10 '23 06:04 klange

I wasn't really talking about making a port of musl, but rather about taking the missing math from there and mixing it into your libc. Mathematics in different libc looks about the same, as it is written in assembler. You will not get something fundamentally different if you want to implement it yourself. And yes, I'm talking about what should be in the C standard math module in libc.

mxlgv avatar Apr 12 '23 10:04 mxlgv

as it is written in assembler

There's actually lots of bit twiddling in C to implement the majority of floating point math functions. Even when a platform has an FPU that supports a function directly, a libm implementation may avoid using the hardware instruction if it's known to be slow or inaccurate.

And yes, I'm talking about what should be in the C standard math module in libc.

Again, I don't intend to import any third-party code - even if my own implementations would be necessarily identical. I think the path forward for math function support is to clean up the implementations of functions we do have - the ones needed to power the core OS - and then defer other functions to a third-party package, installable from the repository. Musl is a good candidate for that (I think even mlibc just uses muls's libm!)

klange avatar Apr 12 '23 10:04 klange