af_volume.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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_AF_VOLUME_H
  23. #define AVFILTER_AF_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. typedef struct VolumeContext {
  55. const AVClass *class;
  56. AVFloatDSPContext fdsp;
  57. enum PrecisionType precision;
  58. enum EvalMode eval_mode;
  59. const char *volume_expr;
  60. AVExpr *volume_pexpr;
  61. double var_values[VAR_VARS_NB];
  62. double volume;
  63. int volume_i;
  64. int channels;
  65. int planes;
  66. enum AVSampleFormat sample_fmt;
  67. void (*scale_samples)(uint8_t *dst, const uint8_t *src, int nb_samples,
  68. int volume);
  69. int samples_align;
  70. } VolumeContext;
  71. void ff_volume_init_x86(VolumeContext *vol);
  72. #endif /* AVFILTER_AF_VOLUME_H */