| 121 | } |
| 122 | |
| 123 | [[noreturn]] int ExecuteFfmpeg(const std::vector<string>& args) { |
| 124 | std::vector<char*> args_chars; |
| 125 | std::transform(args.begin(), args.end(), std::back_inserter(args_chars), |
| 126 | [](const string& s) { return const_cast<char*>(s.c_str()); }); |
| 127 | args_chars.push_back(nullptr); |
| 128 | ::execvp(kFfmpegExecutable, args_chars.data()); |
| 129 | // exec only returns on error. |
| 130 | const int error = errno; |
| 131 | LOG(ERROR) << "FFmpeg could not be executed: " << strerror(error); |
| 132 | ::_exit(error); |
| 133 | } |
| 134 | |
| 135 | // Reads a PCM file using signed little endian 16-bit encoding (s16le). |
| 136 | std::vector<float> ReadPcmFile(const string& filename) { |