audio_codecs.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_BASE_AUDIO_CODECS_H_
  5. #define MEDIA_BASE_AUDIO_CODECS_H_
  6. #include <string>
  7. #include "media/base/media_export.h"
  8. namespace media {
  9. enum class AudioCodec {
  10. // These values are histogrammed over time; do not change their ordinal
  11. // values. When deleting a codec replace it with a dummy value; when adding a
  12. // codec, do so at the bottom before kMaxValue, and update the value of
  13. // kMaxValue to equal the new codec.
  14. kUnknown = 0,
  15. kAAC = 1,
  16. kMP3 = 2,
  17. kPCM = 3,
  18. kVorbis = 4,
  19. kFLAC = 5,
  20. kAMR_NB = 6,
  21. kAMR_WB = 7,
  22. kPCM_MULAW = 8,
  23. kGSM_MS = 9,
  24. kPCM_S16BE = 10,
  25. kPCM_S24BE = 11,
  26. kOpus = 12,
  27. kEAC3 = 13,
  28. kPCM_ALAW = 14,
  29. kALAC = 15,
  30. kAC3 = 16,
  31. kMpegHAudio = 17,
  32. kDTS = 18,
  33. kDTSXP2 = 19,
  34. // DO NOT ADD RANDOM AUDIO CODECS!
  35. //
  36. // The only acceptable time to add a new codec is if there is production code
  37. // that uses said codec in the same CL.
  38. // Must always be equal to the largest entry ever logged.
  39. kMaxValue = kDTSXP2,
  40. };
  41. enum class AudioCodecProfile {
  42. // These values are histogrammed over time; do not change their ordinal
  43. // values. When deleting a profile replace it with a dummy value; when adding
  44. // a profile, do so at the bottom before kMaxValue, and update the value of
  45. // kMaxValue to equal the new codec.
  46. kUnknown = 0,
  47. kXHE_AAC = 1,
  48. kMaxValue = kXHE_AAC,
  49. };
  50. std::string MEDIA_EXPORT GetCodecName(AudioCodec codec);
  51. std::string MEDIA_EXPORT GetProfileName(AudioCodecProfile profile);
  52. MEDIA_EXPORT std::ostream& operator<<(std::ostream& os,
  53. const AudioCodec& codec);
  54. MEDIA_EXPORT AudioCodec StringToAudioCodec(const std::string& codec_id);
  55. } // namespace media
  56. #endif // MEDIA_BASE_AUDIO_CODECS_H_