dts.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2021 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_FORMATS_MP4_DTS_H_
  5. #define MEDIA_FORMATS_MP4_DTS_H_
  6. #include <stdint.h>
  7. #include <vector>
  8. #include "build/build_config.h"
  9. #include "media/base/audio_codecs.h"
  10. #include "media/base/channel_layout.h"
  11. #include "media/base/media_export.h"
  12. #include "media/base/media_log.h"
  13. #include "media/media_buildflags.h"
  14. namespace media {
  15. namespace mp4 {
  16. // This class parses the DTS information from decoder specific information
  17. // embedded in the ddts box in an ISO BMFF file.
  18. // Please refer to ETSI TS 102 114 Annex E.3.3 DTSSpecificBox for more
  19. // details.
  20. class MEDIA_EXPORT DTS {
  21. public:
  22. DTS();
  23. DTS(const DTS& other);
  24. ~DTS();
  25. // Parse the DTS config from the ddts box.
  26. bool Parse(const std::vector<uint8_t>& data, MediaLog* media_log);
  27. uint32_t GetDtsSamplingFrequency() const;
  28. uint32_t GetMaxBitrate() const;
  29. uint32_t GetAvgBitrate() const;
  30. uint8_t GetPcmSampleDepth() const;
  31. int GetFrameDuration() const;
  32. private:
  33. // Logs the parameters of a DTS stream to DVLOG level 3.
  34. void LogDtsParameters();
  35. // The maximum sampling frequency stored in the compressed audio stream.
  36. uint32_t dts_sampling_frequency_ = 0;
  37. // The peak bit rate in bits per second.
  38. // If the stream is a constant bitrate, this shall have the same value as
  39. // avg_bitrate.
  40. // If the maximum bitrate is unknown, this shall be set to 0.
  41. uint32_t max_bitrate_ = 0;
  42. // The average bitrate in bits per second.
  43. uint32_t avg_bitrate_ = 0;
  44. // The bit depth of the rendered audio. For DTS formats this is usually
  45. // 24-bits.
  46. uint8_t pcm_sample_depth_ = 0;
  47. // The number of audio samples represented in a complete audio access
  48. // unit at dts_sampling_frequency.
  49. int frame_duration_ = 0;
  50. };
  51. } // namespace mp4
  52. } // namespace media
  53. #endif