/xbmc/utils/StreamUtils.cpp

http://github.com/xbmc/xbmc · C++ · 32 lines · 19 code · 2 blank · 11 comment · 14 complexity · 3e94924d75dc5acb3fbc4f118a44a252 MD5 · raw file

  1. /*
  2. * Copyright (C) 2005-2018 Team Kodi
  3. * This file is part of Kodi - https://kodi.tv
  4. *
  5. * SPDX-License-Identifier: GPL-2.0-or-later
  6. * See LICENSES/README.md for more information.
  7. */
  8. #include "StreamUtils.h"
  9. int StreamUtils::GetCodecPriority(const std::string &codec)
  10. {
  11. /*
  12. * Technically flac, truehd, and dtshd_ma are equivalently good as they're all lossless. However,
  13. * ffmpeg can't decode dtshd_ma losslessy yet.
  14. */
  15. if (codec == "flac") // Lossless FLAC
  16. return 7;
  17. if (codec == "truehd") // Dolby TrueHD
  18. return 6;
  19. if (codec == "dtshd_ma") // DTS-HD Master Audio (previously known as DTS++)
  20. return 5;
  21. if (codec == "dtshd_hra") // DTS-HD High Resolution Audio
  22. return 4;
  23. if (codec == "eac3") // Dolby Digital Plus
  24. return 3;
  25. if (codec == "dca") // DTS
  26. return 2;
  27. if (codec == "ac3") // Dolby Digital
  28. return 1;
  29. return 0;
  30. }