savonet / ocaml-ffmpeg

OCaml bindings to the FFmpeg library.
http://www.liquidsoap.info/ocaml-ffmpeg/
GNU Lesser General Public License v2.1
48 stars 12 forks source link

Fix decoding logic. #29

Closed toots closed 5 years ago

toots commented 5 years ago

While working with a weird format, I realized some issues with the decoding logic. In this format, every now and then, a bad frame pops out, which ffmpeg is able to ignore and keep decoding just fine.

On the other hand, with the binding, ignoring these frames resulted in chopped output. The reason being that, for each paquet submitted to the decoder, there can be multiple resulting frame. However, currently, the decoder code keeps parity between consumed paquets and decoded frame.

This PR fixes that logic, while cleaning up a little bit around. I'm gonna be testing it, let me know what you think.

Next, I would like to also cleanup the exception logic so that the application is able to catch the right exception (AVERROR_INVALIDDATA). I have a PR pending but it's not ready to merge yet.

toots commented 5 years ago

Okay, I've finished the exception PR. I'm gonna submit everything in one place, closing this.