cmdl_parser.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /* -----------------------------------------------------------------------------------------------------------
  2. Software License for The Fraunhofer FDK AAC Codec Library for Android
  3. © Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
  4. All rights reserved.
  5. 1. INTRODUCTION
  6. The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements
  7. the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio.
  8. This FDK AAC Codec software is intended to be used on a wide variety of Android devices.
  9. AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual
  10. audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by
  11. independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part
  12. of the MPEG specifications.
  13. Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer)
  14. may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners
  15. individually for the purpose of encoding or decoding bit streams in products that are compliant with
  16. the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license
  17. these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec
  18. software may already be covered under those patent licenses when it is used for those licensed purposes only.
  19. Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality,
  20. are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional
  21. applications information and documentation.
  22. 2. COPYRIGHT LICENSE
  23. Redistribution and use in source and binary forms, with or without modification, are permitted without
  24. payment of copyright license fees provided that you satisfy the following conditions:
  25. You must retain the complete text of this software license in redistributions of the FDK AAC Codec or
  26. your modifications thereto in source code form.
  27. You must retain the complete text of this software license in the documentation and/or other materials
  28. provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form.
  29. You must make available free of charge copies of the complete source code of the FDK AAC Codec and your
  30. modifications thereto to recipients of copies in binary form.
  31. The name of Fraunhofer may not be used to endorse or promote products derived from this library without
  32. prior written permission.
  33. You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec
  34. software or your modifications thereto.
  35. Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software
  36. and the date of any change. For modified versions of the FDK AAC Codec, the term
  37. "Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term
  38. "Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android."
  39. 3. NO PATENT LICENSE
  40. NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer,
  41. ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with
  42. respect to this software.
  43. You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized
  44. by appropriate patent licenses.
  45. 4. DISCLAIMER
  46. This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors
  47. "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties
  48. of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  49. CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages,
  50. including but not limited to procurement of substitute goods or services; loss of use, data, or profits,
  51. or business interruption, however caused and on any theory of liability, whether in contract, strict
  52. liability, or tort (including negligence), arising in any way out of the use of this software, even if
  53. advised of the possibility of such damage.
  54. 5. CONTACT INFORMATION
  55. Fraunhofer Institute for Integrated Circuits IIS
  56. Attention: Audio and Multimedia Departments - FDK AAC LL
  57. Am Wolfsmantel 33
  58. 91058 Erlangen, Germany
  59. www.iis.fraunhofer.de/amm
  60. [email protected]
  61. ----------------------------------------------------------------------------------------------------------- */
  62. /************************** Fraunhofer IIS FDK SysLib **********************
  63. Author(s):
  64. Description: command line parser
  65. ******************************************************************************/
  66. /** \file cmdl_parser.h
  67. * \brief Command line parser.
  68. *
  69. * The command line parser can extract certain data fields out of a character
  70. * string and assign values to variables. It has 2 main functions. One to parse
  71. * a command line in the form of standard C runtime "argc" and "argv" parameters,
  72. * and the other to assemble these parameters reading text lines from a file in
  73. * case the C runtime does not provide them.
  74. */
  75. #ifndef __PARSER_H
  76. #define __PARSER_H
  77. #include "machine_type.h"
  78. #define CMDL_MAX_STRLEN 255
  79. #define CMDL_MAX_ARGC 30
  80. /* \cond */
  81. /* Type definition for text */
  82. #ifdef WIN32
  83. #include <tchar.h>
  84. #ifndef _tstof /* For Visual Studio 6 */
  85. #ifdef _UNICODE
  86. #include <wchar.h>
  87. #define _tstof(x) (float) wcstod(x, NULL) /* For Visual Studio 6 */
  88. #else
  89. #define _tstof atof
  90. #endif
  91. #endif
  92. #ifndef _tstol /* For Visual Studio 6 */
  93. #ifdef _UNICODE
  94. #define _tstol _wtol
  95. #else
  96. #define _tstol atol
  97. #endif
  98. #endif
  99. #ifndef _tstoi /* For Visual Studio 6 */
  100. #ifdef _UNICODE
  101. #define _tstoi _wtoi
  102. #else
  103. #define _tstoi atoi
  104. #endif
  105. #endif
  106. #ifndef TEXTCHAR
  107. #define TEXTCHAR char
  108. #endif
  109. #ifndef _TEXT
  110. #define _TEXT
  111. #endif
  112. #else /* WIN32 */
  113. #define TEXTCHAR char
  114. #define _tcslen(a) FDKstrlen(a)
  115. #define _tcscpy strcpy
  116. #define _tcscmp FDKstrcmp
  117. #define _tcsncmp FDKstrncmp
  118. #define _tscanf scanf
  119. #define _TEXT(x) x
  120. #define _tfopen fopen
  121. #define _ftprintf fprintf
  122. #define _tcsncpy FDKstrncpy
  123. #define _tstof FDKatof
  124. #define _tstol FDKatol
  125. #define _tstoi FDKatoi
  126. #define _tcstol strtol
  127. #define _istdigit isdigit
  128. #endif /* WIN32 */
  129. /* \endcond */
  130. #ifdef __cplusplus
  131. extern "C"
  132. {
  133. #endif
  134. /**
  135. * Scans argc, argv and a scanf style format string for parameters and stores the
  136. * values in the variable number of pointers passed to the function.
  137. For example:
  138. \code
  139. #define ARG_PARAM "(-a %d) (-v %1)"
  140. #define ARG_VALUE &config->aot, &verbose
  141. int nFoundArgs = IIS_ScanCmdl(argc, argv, ARG_PARAM, ARG_VALUE);
  142. \endcode
  143. wheras the wild-cards (\%d, \%1, ..) define the data type of the argument:
  144. - \%1 boolean (e. g. -x)
  145. - \%d integer (e. g. -x 23)
  146. - \%f float (e. g. -x 3.4)
  147. - \%y double (e. g. -x 31415926535897932384626433832795028841971693993751)
  148. - \%s string (e. g. -x "file.dat")
  149. - \%u unsigned character (e. g. -x 3)
  150. - \%c signed character (e. g. -x -3)
  151. More examples on how to use it are located in every (encoder/decoder) example framework.
  152. * \param argc Number of arguments.
  153. * \param argv Complete character string of the command line arguments.
  154. * \param pReqArgs A list of parameters and a corresponding list of memory addresses to
  155. * assign each parameter to.
  156. *
  157. * \return Number of found arguments.
  158. */
  159. INT IIS_ScanCmdl(INT argc, TEXTCHAR* argv[], const TEXTCHAR* pReqArgs, ...);
  160. #ifdef __cplusplus
  161. }
  162. #endif
  163. /**
  164. * Reads a text file, assembles argc and argv parameters for each text line
  165. * and calls the given function for each set of argc, argv parameters.
  166. *
  167. * \param param_filename Name of text file that should be parsed.
  168. * \param pFunction Pointer to function that should be called for every text line found.
  169. *
  170. * \return 0 on success, 1 on failure.
  171. */
  172. INT IIS_ProcessCmdlList(const TEXTCHAR* param_filename, int (*pFunction)(int, TEXTCHAR**));
  173. #endif /* __PARSER_H */