audio-repack.h 950 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #endif
  5. #include <stdint.h>
  6. #include <string.h>
  7. #include <obs.h>
  8. struct audio_repack;
  9. typedef int (*audio_repack_func_t)(struct audio_repack *, const uint8_t *, uint32_t);
  10. struct audio_repack {
  11. uint8_t *packet_buffer;
  12. uint32_t packet_size;
  13. uint32_t base_src_size;
  14. uint32_t base_dst_size;
  15. uint32_t pad_dst_size;
  16. uint32_t squash_count;
  17. uint32_t bytes_per_sample;
  18. audio_repack_func_t repack_func;
  19. };
  20. enum _audio_repack_mode {
  21. repack_mode_8to2ch = 0,
  22. repack_mode_8to3ch,
  23. repack_mode_8to4ch,
  24. repack_mode_8to5ch,
  25. repack_mode_8to6ch,
  26. repack_mode_8to5ch_swap,
  27. repack_mode_8to6ch_swap,
  28. repack_mode_8ch_swap,
  29. repack_mode_8ch,
  30. };
  31. typedef enum _audio_repack_mode audio_repack_mode_t;
  32. extern int audio_repack_init(struct audio_repack *repack, audio_repack_mode_t repack_mode, uint8_t bits_per_sample);
  33. extern void audio_repack_free(struct audio_repack *repack);
  34. #ifdef __cplusplus
  35. }
  36. #endif