AAC.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
  3. *
  4. * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
  5. *
  6. * Use of this source code is governed by MIT-like license that can be found in the
  7. * LICENSE file in the root of the source tree. All contributing project authors
  8. * may be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef ZLMEDIAKIT_AAC_H
  11. #define ZLMEDIAKIT_AAC_H
  12. #include "Extension/Frame.h"
  13. #include "Extension/Track.h"
  14. #define ADTS_HEADER_LEN 7
  15. namespace mediakit{
  16. /**
  17. * aac音频通道
  18. * AAC audio channel
  19. * [AUTO-TRANSLATED:0d58b638]
  20. */
  21. class AACTrack : public AudioTrack {
  22. public:
  23. using Ptr = std::shared_ptr<AACTrack>;
  24. AACTrack() = default;
  25. /**
  26. * 通过aac extra data 构造对象
  27. * Construct object through AAC extra data
  28. * [AUTO-TRANSLATED:1fa035c8]
  29. */
  30. AACTrack(const std::string &aac_cfg);
  31. bool ready() const override;
  32. CodecId getCodecId() const override;
  33. int getAudioChannel() const override;
  34. int getAudioSampleRate() const override;
  35. int getAudioSampleBit() const override;
  36. bool inputFrame(const Frame::Ptr &frame) override;
  37. toolkit::Buffer::Ptr getExtraData() const override;
  38. void setExtraData(const uint8_t *data, size_t size) override;
  39. bool update() override;
  40. private:
  41. Sdp::Ptr getSdp(uint8_t payload_type) const override;
  42. Track::Ptr clone() const override;
  43. bool inputFrame_l(const Frame::Ptr &frame);
  44. private:
  45. std::string _cfg;
  46. int _channel = 0;
  47. int _sampleRate = 0;
  48. int _sampleBit = 16;
  49. };
  50. }//namespace mediakit
  51. #endif //ZLMEDIAKIT_AAC_H