af_volume.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * This file is part of FFmpeg.
  3. *
  4. * FFmpeg is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * FFmpeg is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with FFmpeg; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. /**
  19. * @file
  20. * audio volume filter
  21. */
  22. #ifndef AVFILTER_VOLUME_H
  23. #define AVFILTER_VOLUME_H
  24. #include "libavutil/common.h"
  25. #include "libavutil/eval.h"
  26. #include "libavutil/float_dsp.h"
  27. #include "libavutil/opt.h"
  28. #include "libavutil/samplefmt.h"
  29. enum PrecisionType {
  30. PRECISION_FIXED = 0,
  31. PRECISION_FLOAT,
  32. PRECISION_DOUBLE,
  33. };
  34. enum EvalMode {
  35. EVAL_MODE_ONCE,
  36. EVAL_MODE_FRAME,
  37. EVAL_MODE_NB
  38. };
  39. enum VolumeVarName {
  40. VAR_N,
  41. VAR_NB_CHANNELS,
  42. VAR_NB_CONSUMED_SAMPLES,
  43. VAR_NB_SAMPLES,
  44. VAR_POS,
  45. VAR_PTS,
  46. VAR_SAMPLE_RATE,
  47. VAR_STARTPTS,
  48. VAR_STARTT,
  49. VAR_T,
  50. VAR_TB,
  51. VAR_VOLUME,
  52. VAR_VARS_NB
  53. };
  54. enum ReplayGainType {
  55. REPLAYGAIN_DROP,
  56. REPLAYGAIN_IGNORE,
  57. REPLAYGAIN_TRACK,
  58. REPLAYGAIN_ALBUM,
  59. };
  60. typedef struct VolumeContext {
  61. const AVClass *class;
  62. AVFloatDSPContext *fdsp;
  63. int precision;
  64. int eval_mode;
  65. const char *volume_expr;
  66. AVExpr *volume_pexpr;
  67. double var_values[VAR_VARS_NB];
  68. int replaygain;
  69. double replaygain_preamp;
  70. int replaygain_noclip;
  71. double volume;
  72. int volume_i;
  73. int channels;
  74. int planes;
  75. enum AVSampleFormat sample_fmt;
  76. void (*scale_samples)(uint8_t *dst, const uint8_t *src, int nb_samples,
  77. int volume);
  78. int samples_align;
  79. } VolumeContext;
  80. void ff_volume_init_x86(VolumeContext *vol);
  81. #endif /* AVFILTER_VOLUME_H */