audio_parameter.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * audio_parameter1.h
  3. *
  4. * Created on: 2022年5月6日
  5. * Author: pengzc
  6. */
  7. #ifndef JNI_VOIP_AUDIO_PARAMETER_H_
  8. #define JNI_VOIP_AUDIO_PARAMETER_H_
  9. #include <string>
  10. namespace base {
  11. enum SampleFormat {
  12. SAMPLE_FMT_U8, ///< unsigned 8 bits
  13. SAMPLE_FMT_S16, ///< signed 16 bits
  14. SAMPLE_FMT_S32, ///< signed 32 bits
  15. SAMPLE_FMT_FLT, ///< float
  16. SAMPLE_FMT_DBL, ///< double
  17. SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar
  18. SAMPLE_FMT_S16P, ///< signed 16 bits, planar
  19. SAMPLE_FMT_S32P, ///< signed 32 bits, planar
  20. SAMPLE_FMT_FLTP, ///< float, planar
  21. SAMPLE_FMT_DBLP, ///< double, planar
  22. SAMPLE_FMT_S64, ///< signed 64 bits
  23. SAMPLE_FMT_S64P, ///< signed 64 bits, planar
  24. };
  25. enum SampleRate {
  26. SAMPLE_RATE_8000 = 8000, /* 8kHz sampling rate */
  27. SAMPLE_RATE_11025 = 11025, /* 11.025kHz sampling rate */
  28. SAMPLE_RATE_12000 = 12000, /* 12kHz sampling rate */
  29. SAMPLE_RATE_16000 = 16000, /* 16kHz sampling rate */
  30. SAMPLE_RATE_22050 = 22050, /* 22.05kHz sampling rate */
  31. SAMPLE_RATE_24000 = 24000, /* 24kHz sampling rate */
  32. SAMPLE_RATE_32000 = 32000, /* 32kHz sampling rate */
  33. SAMPLE_RATE_44100 = 44100, /* 44.1kHz sampling rate */
  34. SAMPLE_RATE_48000 = 48000, /* 48kHz sampling rate */
  35. SAMPLE_RATE_96000 = 96000, /* 96kHz sampling rate */
  36. };
  37. enum ChannelLayout {
  38. };
  39. struct AudioParameter {
  40. int number_of_channels;
  41. int sample_rate;
  42. int sample_format;
  43. AudioParameter() {
  44. number_of_channels = 0;
  45. sample_rate = 0;
  46. sample_format = 0;
  47. }
  48. AudioParameter(int number_of_channels, int sample_rate, int sample_format) {
  49. this->number_of_channels = number_of_channels;
  50. this->sample_rate = sample_rate;
  51. this->sample_format = sample_format;
  52. }
  53. std::string ToString();
  54. };
  55. } /* namespace base */
  56. bool operator==(const base::AudioParameter& a, const base::AudioParameter& b);
  57. bool operator!=(const base::AudioParameter& a, const base::AudioParameter& b);
  58. #endif /* JNI_VOIP_AUDIO_PARAMETER_H_ */