@@ -76,30 +76,25 @@ bool read_audio_data(const std::string & fname, std::vector<float>& pcmf32, std:
7676
7777 fprintf (stderr, " %s: read %zu bytes from stdin\n " , __func__, audio_data.size ());
7878 }
79- else if (is_wav_buffer (fname)) {
80- if ((result = ma_decoder_init_memory (audio_data.data (), audio_data.size (), &decoder_config, &decoder)) != MA_SUCCESS) {
81- fprintf (stderr, " Error: failed to open audio data from fname buffer (%s)\n " , ma_result_description (result));
82-
83- return false ;
84- }
85- }
86- else if ((result = ma_decoder_init_file (fname.c_str (), &decoder_config, &decoder)) != MA_SUCCESS) {
79+ else if (((result = ma_decoder_init_file (fname.c_str (), &decoder_config, &decoder)) != MA_SUCCESS)) {
8780#if defined(WHISPER_FFMPEG)
88- if (ffmpeg_decode_audio (fname, audio_data) != 0 ) {
89- fprintf (stderr, " error: failed to ffmpeg decode '%s'\n " , fname.c_str ());
81+ if (ffmpeg_decode_audio (fname, audio_data) != 0 ) {
82+ fprintf (stderr, " error: failed to ffmpeg decode '%s'\n " , fname.c_str ());
9083
91- return false ;
92- }
84+ return false ;
85+ }
9386
94- if ((result = ma_decoder_init_memory (audio_data.data (), audio_data.size (), &decoder_config, &decoder)) != MA_SUCCESS) {
95- fprintf (stderr, " error: failed to read audio data as wav (%s)\n " , ma_result_description (result));
87+ if ((result = ma_decoder_init_memory (audio_data.data (), audio_data.size (), &decoder_config, &decoder)) != MA_SUCCESS) {
88+ fprintf (stderr, " error: failed to read audio data as wav (%s)\n " , ma_result_description (result));
9689
97- return false ;
98- }
90+ return false ;
91+ }
9992#else
100- fprintf (stderr, " error: failed to open '%s' file (%s)\n " , fname.c_str (), ma_result_description (result));
93+ if ((result = ma_decoder_init_memory (fname.c_str (), fname.size (), &decoder_config, &decoder)) != MA_SUCCESS) {
94+ fprintf (stderr, " error: failed to read audio data as wav (%s)\n " , ma_result_description (result));
10195
102- return false ;
96+ return false ;
97+ }
10398#endif
10499 }
105100
0 commit comments