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
9 #include "StreamUtils.h"
10
GetCodecPriority(const std::string & codec)11 int StreamUtils::GetCodecPriority(const std::string &codec)
12 {
13 /*
14 * Technically flac, truehd, and dtshd_ma are equivalently good as they're all lossless. However,
15 * ffmpeg can't decode dtshd_ma losslessy yet.
16 */
17 if (codec == "flac") // Lossless FLAC
18 return 7;
19 if (codec == "truehd") // Dolby TrueHD
20 return 6;
21 if (codec == "dtshd_ma") // DTS-HD Master Audio (previously known as DTS++)
22 return 5;
23 if (codec == "dtshd_hra") // DTS-HD High Resolution Audio
24 return 4;
25 if (codec == "eac3") // Dolby Digital Plus
26 return 3;
27 if (codec == "dca") // DTS
28 return 2;
29 if (codec == "ac3") // Dolby Digital
30 return 1;
31 return 0;
32 }
33