From: Andre Noll Date: Sun, 8 May 2016 09:56:23 +0000 (+0200) Subject: afh: Improve error diagnostics. X-Git-Tag: v0.5.7~37 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=faa0b42a726e96263ae3a1c7e89ce9b014fea44d;hp=faa0b42a726e96263ae3a1c7e89ce9b014fea44d afh: Improve error diagnostics. 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. ---