dca.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * dca.h
  3. * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
  4. *
  5. * This file is part of libdca, a free DTS Coherent Acoustics stream decoder.
  6. * See http://www.videolan.org/developers/libdca.html for updates.
  7. *
  8. * libdca is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * libdca is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the
  20. * Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  22. */
  23. #ifndef LIBDCA_DCA_H
  24. #define LIBDCA_DCA_H
  25. /* x86 accelerations */
  26. #define MM_ACCEL_X86_MMX 0x80000000
  27. #define MM_ACCEL_X86_3DNOW 0x40000000
  28. #define MM_ACCEL_X86_MMXEXT 0x20000000
  29. uint32_t mm_accel (void);
  30. #if defined(LIBDCA_FIXED)
  31. typedef int32_t sample_t;
  32. typedef int32_t level_t;
  33. #elif defined(LIBDCA_DOUBLE)
  34. typedef double sample_t;
  35. typedef double level_t;
  36. #else
  37. typedef float sample_t;
  38. typedef float level_t;
  39. #endif
  40. typedef struct dca_state_s dca_state_t;
  41. #define DCA_MONO 0
  42. #define DCA_CHANNEL 1
  43. #define DCA_STEREO 2
  44. #define DCA_STEREO_SUMDIFF 3
  45. #define DCA_STEREO_TOTAL 4
  46. #define DCA_3F 5
  47. #define DCA_2F1R 6
  48. #define DCA_3F1R 7
  49. #define DCA_2F2R 8
  50. #define DCA_3F2R 9
  51. #define DCA_4F2R 10
  52. #define DCA_DOLBY 101 /* FIXME */
  53. #define DCA_CHANNEL_MAX DCA_3F2R /* We don't handle anything above that */
  54. #define DCA_CHANNEL_BITS 6
  55. #define DCA_CHANNEL_MASK 0x3F
  56. #define DCA_LFE 0x80
  57. #define DCA_ADJUST_LEVEL 0x100
  58. dca_state_t * dca_init (uint32_t mm_accel);
  59. int dca_syncinfo (dca_state_t *state, uint8_t * buf, int * flags,
  60. int * sample_rate, int * bit_rate, int *frame_length);
  61. int dca_frame (dca_state_t * state, uint8_t * buf, int * flags,
  62. level_t * level, sample_t bias);
  63. void dca_dynrng (dca_state_t * state,
  64. level_t (* call) (level_t, void *), void * data);
  65. int dca_blocks_num (dca_state_t * state);
  66. int dca_block (dca_state_t * state);
  67. sample_t * dca_samples (dca_state_t * state);
  68. void dca_free (dca_state_t * state);
  69. #endif /* LIBDCA_DCA_H */