Yeah, found the problems in libmpeg2. It was nothing wrong with the library (well, except some signedness issues), it was my linker which didn’t correctly update the function pointers in the arrays.
A quick workaround was to convert everything into switch statements.
The signedness issue was to do with the state enumeration. STATE_INTERNAL_NORETURN was supposed to be a negative value but since the enumeration was an unsigned type, when -1 was cast to it, it’s value was represented incorrectly. Casting it to a signed integer appears to have fixed the problem.
I am really a bad programmer : Maybe it’s my lack of knowledge or maybe it’s my laziness but I also gave up on libtheora.
I’m having another go at libmpeg2
Yeah, I gave up on libmpeg2 (I was so close though 😦 ) since I couldn’t identify the bug and the mailing lists seemed to be empty. The code wasn’t well commented and documentation was far too lacking. To an amateur programmer, that’s already too big of a challenge.
Instead, I’ve started using libogg and libtheora. It took over an hour and a half worth of Makefile hacking and manipulating configure options but I got there in the end. I now have the static libraries in my ndless lib folder ready for linking against. I’ve already begun reading documentation and I’ll start with libtheora tomorrow.
Obvious advantages over other video codec libraries:
- Ogg and Theora are liberal formats which means they aren’t encumbered by patents so I can be sure I’ll be able to use them freely.
- It’s less complex than libav which means less Makefile hacking and less clutter.
- It’s better documented than libmpeg2
Basically, to build these libraries, you need to configure it in a way that only the library is built. Anything else (including tests and documentation) should be avoided since they usually fail to build (for example, there was a C program used to build the documentation that refused to build so I had to hack the Makefile to skip it).
This project is finally starting to look workable now 😀 But, as always, assistance is appreciated if you can spare it.
There seems to be a bug somewhere in the library (or maybe my code is just wrong). This will set me back a long way :. Anyhow, debugging has begun.
The library keeps claiming I have an invalid stream even when I run the same file on the same library on my computer.
This morning, I went through the sample code for the libmpeg2 library and I think I’ve got the main jist of it.
I wrote up some code based on the samples and it’s going through testing now.
I’m in the mood for writing code for the calculator and (after not bothering with Linux anymore) came up with an idea for playing movies on the calculator.
So far, I’ve been trying to build various libraries for video decoding but the only one I succeeded in building was libmpeg2. I have a static library that I can link to and some header files so I can get started.
Unfortunately, libmpeg2 has almost no documentation and at the moment, I’m just trying to work out what each function does. If anyone would like to help me write this program, please contact me.
If you want to do some independent work, here is the build options I used to get it to build:
CFLAGS="-mcpu=arm926ej-s -I "/path/to/ndless/trunk/include" -fpic -fno-builtin " ./configure --host=arm-none-eabi --enable-shared=no --prefix="/path/to/ndless/trunk" && echo "install: all: " > src/Makefile make make install
The test programs won’t compile so we won’t bother (hence overriding the Makefile in the src folder).
After that, you should be able to use the header files included and it should link properly. Again, if you know or have worked out how to decode a MPEG stream into bitmaps, please tell me.