MCPcopy Create free account
hub / github.com/bbc/audiowaveform / open

Method open

src/SndFileAudioFileReader.cpp:137–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135//------------------------------------------------------------------------------
136
137bool SndFileAudioFileReader::open(const char* input_filename, bool show_info)
138{
139 assert(input_file_ == nullptr);
140
141 if (FileUtil::isStdioFilename(input_filename)) {
142 input_file_ = sf_open_fd(fileno(stdin), SFM_READ, &info_, 0);
143
144 if (input_file_ == nullptr) {
145 log(Error) << "Failed to read input: "
146 << sf_strerror(nullptr) << '\n';
147
148 return false;
149 }
150 }
151 else {
152 input_file_ = sf_open(input_filename, SFM_READ, &info_);
153
154 if (input_file_ == nullptr) {
155 log(Error) << "Failed to read file: " << input_filename << '\n'
156 << sf_strerror(nullptr) << '\n';
157
158 return false;
159 }
160 }
161
162 log(Info) << "Input file: "
163 << FileUtil::getInputFilename(input_filename) << '\n';
164
165 if (show_info) {
166 showInfo(log(Info), info_);
167 }
168
169 return true;
170}
171
172//------------------------------------------------------------------------------
173

Callers

nothing calls this directly

Calls 3

isStdioFilenameFunction · 0.85
getInputFilenameFunction · 0.85
showInfoFunction · 0.70

Tested by

no test coverage detected