| 22 | } |
| 23 | |
| 24 | static auto |
| 25 | OpenHdcdFilter(AudioFormat &in_audio_format) |
| 26 | { |
| 27 | Ffmpeg::FilterGraph graph; |
| 28 | |
| 29 | auto &buffer_src = |
| 30 | Ffmpeg::MakeAudioBufferSource(in_audio_format, |
| 31 | *graph); |
| 32 | |
| 33 | auto &buffer_sink = Ffmpeg::MakeAudioBufferSink(*graph); |
| 34 | |
| 35 | graph.ParseSingleInOut(hdcd_graph, buffer_sink, buffer_src); |
| 36 | graph.CheckAndConfigure(); |
| 37 | |
| 38 | auto out_audio_format = in_audio_format; |
| 39 | // TODO: convert to 32 bit only if HDCD actually detected |
| 40 | out_audio_format.format = SampleFormat::S32; |
| 41 | |
| 42 | return std::make_unique<FfmpegFilter>(in_audio_format, |
| 43 | out_audio_format, |
| 44 | std::move(graph), |
| 45 | buffer_src, |
| 46 | buffer_sink); |
| 47 | } |
| 48 | |
| 49 | class PreparedHdcdFilter final : public PreparedFilter { |
| 50 | public: |