1
0

config.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. #include "mp4FastAAClib.h"
  3. #include <windows.h> // or MAX_PATH
  4. #define ENCODER_TYPE_MPEG4 (mmioFOURCC('A','A','C','f'))
  5. #define ENCODER_TYPE_ADTS (mmioFOURCC('A','D','T','S'))
  6. enum
  7. {
  8. AAC_MODE_VBR=0,
  9. AAC_MODE_CBR=1,
  10. /* these are the profile options when CBR is selected */
  11. AAC_PROFILE_AUTOMATIC=0,
  12. AAC_PROFILE_LC=1,
  13. AAC_PROFILE_HE=2,
  14. AAC_PROFILE_HE_V2=3,
  15. /* Surround options */
  16. AAC_SURROUND_BCC = 0, /* Binaural Cue Coding, stereo + surround layer, aka MPEG-Surround */
  17. AAC_SURROUND_DISCRETE = 1, /* Discrete surround (traditional AAC surround sound with separate SCE per channel pair) */
  18. /* defaults */
  19. AAC_DEFAULT_MODE = AAC_MODE_VBR,
  20. AAC_DEFAULT_PROFILE = AAC_PROFILE_AUTOMATIC,
  21. AAC_DEFAULT_BITRATE = 128,
  22. AAC_DEFAULT_PRESET = 4,
  23. AAC_DEFAULT_SURROUND = AAC_SURROUND_BCC,
  24. };
  25. struct AACConfiguration
  26. {
  27. unsigned int mode; /* CBR or VBR */
  28. unsigned int profile; /* what flavor of AAC, e.g. LC, or automatic */
  29. unsigned int bitrate; /* bitrate for CBR */
  30. unsigned int preset; /* preset for VBR */
  31. unsigned int surround; /* 0 = discrete, 1 = MPEG Surround */
  32. };
  33. struct AACConfigurationFile
  34. {
  35. AACConfiguration config;
  36. unsigned int channels;
  37. unsigned int sample_rate;
  38. unsigned int type; /* either ENCODER_TYPE_MPEG4 or ENCODER_TYPE_ADTS */
  39. unsigned int shoutcast; /* 0 by default, 1 if we're being invoked from dsp_sc */
  40. bool changing; /* used internally by preferences */
  41. char config_file[MAX_PATH];
  42. };
  43. AACConfigurationFile *AACConfig_Create(unsigned int type, const char *filename); /* de-allocate with free() */
  44. void AACConfig_Load(AACConfigurationFile *cfg);
  45. void AACConfig_Save(const AACConfigurationFile *cfg);
  46. /* bitrates are in bits/sec (not kbps), divide by 1000 if you need to
  47. TODO: ASSUMES 44.1kHz Stereo. We need to make the encoder API accept samplerate/channels input better!
  48. */
  49. void AACConfig_GetBitrateRange(const AACConfiguration *cfg, int *low, int *high);
  50. AUD_OBJ_TYP AACConfig_GetAOT(const AACConfiguration *cfg);
  51. int AACConfig_GetBitrate(const AACConfiguration *cfg, unsigned int channels);
  52. MPEG4ENC_BITRATE_MODE AACConfig_GetBitrateMode(const AACConfiguration *cfg);
  53. MPEG4ENC_CH_MODE AACConfig_GetChannelMode(const AACConfiguration *cfg, unsigned int channels);
  54. void AACConfig_GetToolString(const MPEG4ENC_SETUP *setup, char tool[], size_t cch);