* Fallback for PreparedFfmpegFilter::Open() just in case the filter's * native output format could not be determined. * * TODO: improve the MPD filter API to allow returning the output * format later, and eliminate this kludge */
| 29 | * format later, and eliminate this kludge |
| 30 | */ |
| 31 | static auto |
| 32 | OpenWithAformat(const char *graph_string, AudioFormat &in_audio_format) |
| 33 | { |
| 34 | Ffmpeg::FilterGraph graph; |
| 35 | |
| 36 | auto &buffer_src = |
| 37 | Ffmpeg::MakeAudioBufferSource(in_audio_format, *graph); |
| 38 | |
| 39 | auto &buffer_sink = Ffmpeg::MakeAudioBufferSink(*graph); |
| 40 | |
| 41 | AudioFormat out_audio_format = in_audio_format; |
| 42 | auto &aformat = Ffmpeg::MakeAformat(out_audio_format, *graph); |
| 43 | |
| 44 | if (int error = avfilter_link(&aformat, 0, &buffer_sink, 0); error < 0) |
| 45 | throw MakeFfmpegError(error, "avfilter_link() failed"); |
| 46 | |
| 47 | graph.ParseSingleInOut(graph_string, aformat, buffer_src); |
| 48 | graph.CheckAndConfigure(); |
| 49 | |
| 50 | return std::make_unique<FfmpegFilter>(in_audio_format, |
| 51 | out_audio_format, |
| 52 | std::move(graph), |
| 53 | buffer_src, |
| 54 | buffer_sink); |
| 55 | } |
| 56 | |
| 57 | std::unique_ptr<Filter> |
| 58 | PreparedFfmpegFilter::Open(AudioFormat &in_audio_format) |
no test coverage detected