opt_common.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /*
  2. * Option handlers shared between the tools.
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef FFTOOLS_OPT_COMMON_H
  21. #define FFTOOLS_OPT_COMMON_H
  22. #include "config.h"
  23. #include "cmdutils.h"
  24. #if CONFIG_AVDEVICE
  25. /**
  26. * Print a listing containing autodetected sinks of the output device.
  27. * Device name with options may be passed as an argument to limit results.
  28. */
  29. int show_sinks(void *optctx, const char *opt, const char *arg);
  30. /**
  31. * Print a listing containing autodetected sources of the input device.
  32. * Device name with options may be passed as an argument to limit results.
  33. */
  34. int show_sources(void *optctx, const char *opt, const char *arg);
  35. #endif
  36. #if CONFIG_AVDEVICE
  37. #define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
  38. { "sources" , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = show_sources }, \
  39. "list sources of the input device", "device" }, \
  40. { "sinks" , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = show_sinks }, \
  41. "list sinks of the output device", "device" }, \
  42. #else
  43. #define CMDUTILS_COMMON_OPTIONS_AVDEVICE
  44. #endif
  45. /**
  46. * Print the license of the program to stdout. The license depends on
  47. * the license of the libraries compiled into the program.
  48. * This option processing function does not utilize the arguments.
  49. */
  50. int show_license(void *optctx, const char *opt, const char *arg);
  51. /**
  52. * Generic -h handler common to all fftools.
  53. */
  54. int show_help(void *optctx, const char *opt, const char *arg);
  55. /**
  56. * Print the version of the program to stdout. The version message
  57. * depends on the current versions of the repository and of the libav*
  58. * libraries.
  59. * This option processing function does not utilize the arguments.
  60. */
  61. int show_version(void *optctx, const char *opt, const char *arg);
  62. /**
  63. * Print the build configuration of the program to stdout. The contents
  64. * depend on the definition of FFMPEG_CONFIGURATION.
  65. * This option processing function does not utilize the arguments.
  66. */
  67. int show_buildconf(void *optctx, const char *opt, const char *arg);
  68. /**
  69. * Print a listing containing all the formats supported by the
  70. * program (including devices).
  71. * This option processing function does not utilize the arguments.
  72. */
  73. int show_formats(void *optctx, const char *opt, const char *arg);
  74. /**
  75. * Print a listing containing all the muxers supported by the
  76. * program (including devices).
  77. * This option processing function does not utilize the arguments.
  78. */
  79. int show_muxers(void *optctx, const char *opt, const char *arg);
  80. /**
  81. * Print a listing containing all the demuxer supported by the
  82. * program (including devices).
  83. * This option processing function does not utilize the arguments.
  84. */
  85. int show_demuxers(void *optctx, const char *opt, const char *arg);
  86. /**
  87. * Print a listing containing all the devices supported by the
  88. * program.
  89. * This option processing function does not utilize the arguments.
  90. */
  91. int show_devices(void *optctx, const char *opt, const char *arg);
  92. /**
  93. * Print a listing containing all the codecs supported by the
  94. * program.
  95. * This option processing function does not utilize the arguments.
  96. */
  97. int show_codecs(void *optctx, const char *opt, const char *arg);
  98. /**
  99. * Print a listing containing all the decoders supported by the
  100. * program.
  101. */
  102. int show_decoders(void *optctx, const char *opt, const char *arg);
  103. /**
  104. * Print a listing containing all the encoders supported by the
  105. * program.
  106. */
  107. int show_encoders(void *optctx, const char *opt, const char *arg);
  108. /**
  109. * Print a listing containing all the bit stream filters supported by the
  110. * program.
  111. * This option processing function does not utilize the arguments.
  112. */
  113. int show_bsfs(void *optctx, const char *opt, const char *arg);
  114. /**
  115. * Print a listing containing all the protocols supported by the
  116. * program.
  117. * This option processing function does not utilize the arguments.
  118. */
  119. int show_protocols(void *optctx, const char *opt, const char *arg);
  120. /**
  121. * Print a listing containing all the filters supported by the
  122. * program.
  123. * This option processing function does not utilize the arguments.
  124. */
  125. int show_filters(void *optctx, const char *opt, const char *arg);
  126. /**
  127. * Print a listing containing all the pixel formats supported by the
  128. * program.
  129. * This option processing function does not utilize the arguments.
  130. */
  131. int show_pix_fmts(void *optctx, const char *opt, const char *arg);
  132. /**
  133. * Print a listing containing all the standard channel layouts supported by
  134. * the program.
  135. * This option processing function does not utilize the arguments.
  136. */
  137. int show_layouts(void *optctx, const char *opt, const char *arg);
  138. /**
  139. * Print a listing containing all the sample formats supported by the
  140. * program.
  141. */
  142. int show_sample_fmts(void *optctx, const char *opt, const char *arg);
  143. /**
  144. * Print a listing containing all supported stream dispositions.
  145. */
  146. int show_dispositions(void *optctx, const char *opt, const char *arg);
  147. /**
  148. * Print a listing containing all the color names and values recognized
  149. * by the program.
  150. */
  151. int show_colors(void *optctx, const char *opt, const char *arg);
  152. /**
  153. * Set the libav* libraries log level.
  154. */
  155. int opt_loglevel(void *optctx, const char *opt, const char *arg);
  156. int opt_report(void *optctx, const char *opt, const char *arg);
  157. int init_report(const char *env, FILE **file);
  158. int opt_max_alloc(void *optctx, const char *opt, const char *arg);
  159. /**
  160. * Override the cpuflags.
  161. */
  162. int opt_cpuflags(void *optctx, const char *opt, const char *arg);
  163. /**
  164. * Override the cpucount.
  165. */
  166. int opt_cpucount(void *optctx, const char *opt, const char *arg);
  167. #define CMDUTILS_COMMON_OPTIONS \
  168. { "L", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_license }, "show license" }, \
  169. { "h", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
  170. { "?", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_help }, "show help", "topic" }, \
  171. { "help", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_help }, "show help", "topic" }, \
  172. { "-help", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_help }, "show help", "topic" }, \
  173. { "version", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_version }, "show version" }, \
  174. { "buildconf", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_buildconf }, "show build configuration" }, \
  175. { "formats", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_formats }, "show available formats" }, \
  176. { "muxers", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
  177. { "demuxers", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
  178. { "devices", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
  179. { "codecs", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_codecs }, "show available codecs" }, \
  180. { "decoders", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
  181. { "encoders", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
  182. { "bsfs", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
  183. { "protocols", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_protocols }, "show available protocols" }, \
  184. { "filters", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
  185. { "pix_fmts", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
  186. { "layouts", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
  187. { "sample_fmts", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
  188. { "dispositions", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
  189. { "colors", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_colors }, "show available color names" }, \
  190. { "loglevel", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
  191. { "v", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
  192. { "report", OPT_TYPE_FUNC, OPT_EXPERT, { .func_arg = opt_report }, "generate a report" }, \
  193. { "max_alloc", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
  194. { "cpuflags", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
  195. { "cpucount", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
  196. { "hide_banner", OPT_TYPE_BOOL, OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
  197. CMDUTILS_COMMON_OPTIONS_AVDEVICE \
  198. #endif /* FFTOOLS_OPT_COMMON_H */