]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
afh: Improve error diagnostics.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 8 May 2016 09:56:23 +0000 (11:56 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 31 Jul 2016 14:54:52 +0000 (16:54 +0200)
If compute_afhi() can not figure out the type of an audio file, it
prints a rather incomprehensive error message for each audiod format
which was tried to no avail. This commit improves the readability of
these error messages by including the path and the name of the audio
format that caused the error.

Before:

$ para_afh /etc/resolv.conf
mp3_read_info: could not read mp3 info
compute_afhi: could not read mp3 info
compute_afhi: ogg sync page-out error (no ogg file?)
compute_afhi: mp4v2 library error
compute_afhi: asf/wma format not recognized
compute_afhi: ogg sync page-out error (no ogg file?)
compute_afhi: could not read meta chain
compute_afhi: ogg sync page-out error (no ogg file?)
main: audio format not recognized

After:

$ para_afh /etc/resolv.conf
get_file_info: /etc/resolv.conf: mp3 format not detected: could not read mp3 info
get_file_info: /etc/resolv.conf: ogg format not detected: ogg sync page-out error (no ogg file?)
get_file_info: /etc/resolv.conf: aac format not detected: did not find esds atom
get_file_info: /etc/resolv.conf: wma format not detected: asf/wma format not recognized
get_file_info: /etc/resolv.conf: spx format not detected: ogg sync page-out error (no ogg file?)
get_file_info: /etc/resolv.conf: flac format not detected: could not read meta chain
get_file_info: /etc/resolv.conf: opus format not detected: ogg sync page-out error (no ogg file?)
main: audio format not recognized

The patch also removes a call to PARA_ERROR_LOG() in the mp3 audio
format handler which is unnecessary because we return the error code
and print the message in the caller anyway.

A new helper, get_file_info(), is introduced to print the diagnostic
messages. Since audio_format_name() is called from this helper,
that function needed to be moved up to avoid a forward declaration.


No differences found