AudioParser: throw exception on error

This commit is contained in:
Max Kellermann
2016-10-28 21:46:20 +02:00
parent 1b39efb694
commit 13001c018c
11 changed files with 80 additions and 164 deletions

View File

@@ -25,22 +25,21 @@
#ifndef MPD_AUDIO_PARSER_HXX
#define MPD_AUDIO_PARSER_HXX
#include "Compiler.h"
struct AudioFormat;
class Error;
/**
* Parses a string in the form "SAMPLE_RATE:BITS:CHANNELS" into an
* #AudioFormat.
*
* @param dest the destination #audio_format struct
* Throws #std::runtime_error on error.
*
* @param src the input string
* @param mask if true, then "*" is allowed for any number of items
* @param error location to store the error occurring, or NULL to
* ignore errors
* @return true on success
*/
bool
audio_format_parse(AudioFormat &dest, const char *src,
bool mask, Error &error);
gcc_pure
AudioFormat
ParseAudioFormat(const char *src, bool mask);
#endif