[FFmpeg-devel] [PATCH 0/2] hello + aadec improvements

Karsten Otto ottoka at posteo.de
Sun Jan 28 01:01:12 EET 2018

Hello ffmpeg-devel!

These two patches aim to improve playback support for Audible Format 2/3/4
as implemented in libavformat/aadec.c.

Patch 1 is a very simple improvement of EOF detection in the presence of
trailing data and broken/truncated files. It consists mainly of some extra
error/bounds checks.

Patch 2 adds chapter support and format-specific seeking; due to the
chunk/chapter nature of the content, the two features are very much
intertwined and cannot easily be split into separate patches. The generic
index seek was enabled before, but usually hit the middle of a content chunk
and thus caused garbled playback. The patch fixes this by ensuring proper
chunk alignment and read state update.

Since I am new to ffmpeg development, I am not quite sure if my solution
always does things the way they are supposed to be done (aka best practice).
In particular, I am setting the stream time_base according to the content
bitrate in bytes-per-second, which makes for very convenient conversion
between timestamps and file positions (when removing/adding the chapter
headers from the equation). While it works nicely, I cannot tell if this
breaks things somewhere else.

Please let me know what you think, improvements very welcome!

Disclaimer: No reverse engineering was involved in creating this patch.
Everything was derived from preexisting code, mostly aa_read_packet.

Cheers, Karsten

Karsten Otto (2):
  aadec: improve eof detection
  aadec: add chapters and seeking

 libavformat/aadec.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 81 insertions(+), 5 deletions(-)

2.14.3 (Apple Git-98)

More information about the ffmpeg-devel mailing list