You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.5KB

  1. /*
  2. * LGPL
  3. */
  4. /*
  5. * typical parsed command line:
  6. * msmpeg4:bitrate=720000:qmax=16
  7. *
  8. */
  9. #include "avcodec.h"
  10. /*
  11. * possible extension - use for decoder options
  12. * - for given codec names filter only correct
  13. * options given (could be passed with 'str')
  14. */
  15. /**
  16. * \param avctx where to store parsed results
  17. * \param str string with options for parsing
  18. * \param config allocated avc_config_t for external parsing
  19. * i.e. external program might learn about all available
  20. * options for given codec
  21. **/
  22. void avcodec_getopt(AVCodecContext* avctx, char* str, avc_config_t** config)
  23. {
  24. AVCodecContext avctx_tmp;
  25. AVCodecContext* ctx = (avctx) ? avctx : &avctx_tmp;
  26. static const char* class_h263 = ",msmpeg4,";
  27. //"huffyuv,wmv1,msmpeg4v2,msmpeg4,mpeg4,mpeg1,mpeg1video,mjpeg,rv10,h263,h263p"
  28. avc_config_t cnf[] =
  29. {
  30. // FIXME: sorted by importance!!!
  31. // expert option should follow more common ones
  32. {
  33. "bitrate", "desired video bitrate",
  34. FF_CONF_TYPE_INT, &ctx->bit_rate, 4, 240000000, 800000, NULL, class_h263
  35. }, {
  36. "vhq", "very high quality",
  37. FF_CONF_TYPE_FLAG, &ctx->flags, 0, CODEC_FLAG_HQ, 0, NULL, class_h263
  38. }, {
  39. "ratetol", "number of bits the bitstream is allowed to diverge from the reference"
  40. "the reference can be CBR (for CBR pass1) or VBR (for pass2)",
  41. FF_CONF_TYPE_INT, &ctx->bit_rate_tolerance, 4, 240000000, 8000, NULL, class_h263
  42. }, {
  43. "qmin", "minimum quantizer", FF_CONF_TYPE_INT, &ctx->qmin, 1, 31, 2, NULL, class_h263
  44. }, {
  45. "qmax", "maximum qunatizer", FF_CONF_TYPE_INT, &ctx->qmax, 1, 31, 31, NULL, class_h263
  46. }, {
  47. "rc_eq", "rate control equation",
  48. FF_CONF_TYPE_STRING, &ctx->rc_eq, 0, 0, 0, "tex^qComp" /* FILLME options */, class_h263
  49. }, {
  50. "rc_minrate", "rate control minimum bitrate",
  51. FF_CONF_TYPE_INT, &ctx->rc_min_rate, 4, 24000000, 0, NULL, class_h263
  52. }, {
  53. "rc_maxrate", "rate control maximum bitrate",
  54. FF_CONF_TYPE_INT, &ctx->rc_max_rate, 4, 24000000, 0, NULL, class_h263
  55. }, {
  56. "psnr", "calculate PSNR of compressed frames",
  57. FF_CONF_TYPE_FLAG, &ctx->flags, 0, CODEC_FLAG_PSNR, 0, NULL, class_h263
  58. }, {
  59. "rc_override", "ratecontrol override (=startframe,endframe,qscale,quality_factor)",
  60. FF_CONF_TYPE_RCOVERIDE, &ctx->rc_override, 0, 0, 0, NULL, class_h263
  61. },
  62. { NULL, NULL, 0, NULL, 0, 0, 0, NULL, NULL }
  63. };
  64. if (config)
  65. {
  66. *config = malloc(sizeof(cnf));
  67. if (*config)
  68. memcpy(*config, cnf, sizeof(cnf));
  69. }
  70. }