PCMFrame.h 1005 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * 叶海辉
  3. * QQ群121376426
  4. * http://blog.yundiantech.com/
  5. */
  6. #ifndef PCMFRAME_H
  7. #define PCMFRAME_H
  8. #include <stdint.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include <stdio.h>
  12. #include <memory>
  13. //extern "C"
  14. //{
  15. // #include <libavutil/samplefmt.h>
  16. //}
  17. #define PCMFramePtr std::shared_ptr<PCMFrame>
  18. ///本程序固定使用AV_SAMPLE_FMT_S16 44100 双声道
  19. class PCMFrame
  20. {
  21. public:
  22. PCMFrame();
  23. ~PCMFrame();
  24. void setFrameBuffer(const uint8_t * const buffer, const unsigned int &size, const int64_t &time);
  25. uint8_t *getBuffer(){return mFrameBuffer;}
  26. unsigned int getSize(){return mFrameBufferSize;}
  27. void setPts(const int64_t &time){mPts = time;}
  28. int64_t getPts(){return mPts;}
  29. private:
  30. uint8_t *mFrameBuffer; //pcm数据
  31. unsigned int mFrameBufferSize; //pcm数据长度
  32. int64_t mPts;
  33. // enum AVSampleFormat mSampleFmt;//输出的采样格式
  34. // int mSampleRate;//采样率
  35. // int mChannels; //声道数
  36. };
  37. #endif // PCMFRAME_H