Commit 09ece262 authored by Max Kellermann's avatar Max Kellermann

lib/ffmpeg/SampleFormat: add ToFfmpegSampleFormat()

parent 0c6d22fe
......@@ -53,6 +53,28 @@ FromFfmpegSampleFormat(AVSampleFormat sample_fmt) noexcept
}
}
/**
* Convert a MPD #SampleFormat to a FFmpeg #AVSampleFormat. Returns
* AV_SAMPLE_FMT_NONE if there is no direct mapping.
*/
constexpr AVSampleFormat
ToFfmpegSampleFormat(SampleFormat f) noexcept
{
switch (f) {
case SampleFormat::S16:
return AV_SAMPLE_FMT_S16;
case SampleFormat::S32:
return AV_SAMPLE_FMT_S32;
case SampleFormat::FLOAT:
return AV_SAMPLE_FMT_FLT;
default:
return AV_SAMPLE_FMT_NONE;
}
}
} // namespace Ffmpeg
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment