types.h 870 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include "foundation/types.h"
  3. enum Agave_PositionType
  4. {
  5. AGAVE_PLAYPOSITION_100NANOECONDS = 0,
  6. AGAVE_PLAYPOSITION_MILLISECONDS = 1,
  7. AGAVE_PLAYPOSITION_SECONDS = 2,
  8. AGAVE_PLAYPOSITION_HMSF= 3,
  9. AGAVE_PLAYPOSITION_SAMPLE_FRAMES = 4,
  10. AGAVE_PLAYPOSITION_BYTES = 5,
  11. AGAVE_PLAYPOSITION_PACKETS = 6,
  12. };
  13. struct Agave_HMSF
  14. {
  15. uint8_t hours;
  16. uint8_t minutes;
  17. uint8_t seconds;
  18. uint8_t frames;
  19. };
  20. union Agave_Position
  21. {
  22. uint64_t nanoseconds100; // in increments of 100 nanoseconds (microsoft style)
  23. uint64_t milliseconds;
  24. double seconds;
  25. Agave_HMSF hmsf;
  26. uint64_t sample_frames;
  27. uint64_t bytes;
  28. uint64_t packets;
  29. };
  30. struct Agave_Seek
  31. {
  32. Agave_PositionType position_type;
  33. Agave_Position position;
  34. };
  35. static void Agave_Seek_SetBytes(Agave_Seek *seek, uint64_t bytes)
  36. {
  37. seek->position_type=AGAVE_PLAYPOSITION_BYTES;
  38. seek->position.bytes = bytes;
  39. }