25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
943B

  1. #ifndef _opus_head_h_
  2. #define _opus_head_h_
  3. #include <stddef.h>
  4. #include <stdint.h>
  5. #if defined(__cplusplus)
  6. extern "C" {
  7. #endif
  8. struct opus_head_t
  9. {
  10. uint8_t version;
  11. uint8_t channels;
  12. uint16_t pre_skip;
  13. uint32_t input_sample_rate;
  14. int16_t output_gain;
  15. uint8_t channel_mapping_family;
  16. uint8_t stream_count;
  17. uint8_t coupled_count;
  18. uint8_t channel_mapping[8];
  19. };
  20. /// @return >0-ok, <=0-error
  21. int opus_head_save(const struct opus_head_t* opus, uint8_t* data, size_t bytes);
  22. /// @return >0-ok, <=0-error
  23. int opus_head_load(const uint8_t* data, size_t bytes, struct opus_head_t* opus);
  24. static inline int opus_head_channels(const struct opus_head_t* opus)
  25. {
  26. return 0 == opus->channels ? 2 : opus->channels;
  27. }
  28. int opus_packet_getframes(const void* data, size_t len, int (*onframe)(uint8_t toc, const void* frame, size_t size), void* param);
  29. #if defined(__cplusplus)
  30. }
  31. #endif
  32. #endif /* !_opus_head_h_ */