MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / OpenWithAformat

Function OpenWithAformat

src/filter/plugins/FfmpegFilterPlugin.cxx:31–55  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

29 * format later, and eliminate this kludge
30 */
31static auto
32OpenWithAformat(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
57std::unique_ptr<Filter>
58PreparedFfmpegFilter::Open(AudioFormat &in_audio_format)

Callers 1

OpenMethod · 0.85

Calls 2

MakeFfmpegErrorFunction · 0.85
ParseSingleInOutMethod · 0.80

Tested by

no test coverage detected