internal.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
  3. *
  4. * This file is part of Libav.
  5. *
  6. * Libav 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. * Libav 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 Libav; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef AVRESAMPLE_INTERNAL_H
  21. #define AVRESAMPLE_INTERNAL_H
  22. #include "libavutil/audio_fifo.h"
  23. #include "libavutil/log.h"
  24. #include "libavutil/opt.h"
  25. #include "libavutil/samplefmt.h"
  26. #include "avresample.h"
  27. #include "audio_convert.h"
  28. #include "audio_data.h"
  29. #include "audio_mix.h"
  30. #include "resample.h"
  31. struct AVAudioResampleContext {
  32. const AVClass *av_class; /**< AVClass for logging and AVOptions */
  33. uint64_t in_channel_layout; /**< input channel layout */
  34. enum AVSampleFormat in_sample_fmt; /**< input sample format */
  35. int in_sample_rate; /**< input sample rate */
  36. uint64_t out_channel_layout; /**< output channel layout */
  37. enum AVSampleFormat out_sample_fmt; /**< output sample format */
  38. int out_sample_rate; /**< output sample rate */
  39. enum AVSampleFormat internal_sample_fmt; /**< internal sample format */
  40. enum AVMixCoeffType mix_coeff_type; /**< mixing coefficient type */
  41. double center_mix_level; /**< center mix level */
  42. double surround_mix_level; /**< surround mix level */
  43. double lfe_mix_level; /**< lfe mix level */
  44. int force_resampling; /**< force resampling */
  45. int filter_size; /**< length of each FIR filter in the resampling filterbank relative to the cutoff frequency */
  46. int phase_shift; /**< log2 of the number of entries in the resampling polyphase filterbank */
  47. int linear_interp; /**< if 1 then the resampling FIR filter will be linearly interpolated */
  48. double cutoff; /**< resampling cutoff frequency. 1.0 corresponds to half the output sample rate */
  49. int in_channels; /**< number of input channels */
  50. int out_channels; /**< number of output channels */
  51. int resample_channels; /**< number of channels used for resampling */
  52. int downmix_needed; /**< downmixing is needed */
  53. int upmix_needed; /**< upmixing is needed */
  54. int mixing_needed; /**< either upmixing or downmixing is needed */
  55. int resample_needed; /**< resampling is needed */
  56. int in_convert_needed; /**< input sample format conversion is needed */
  57. int out_convert_needed; /**< output sample format conversion is needed */
  58. AudioData *in_buffer; /**< buffer for converted input */
  59. AudioData *resample_out_buffer; /**< buffer for output from resampler */
  60. AudioData *out_buffer; /**< buffer for converted output */
  61. AVAudioFifo *out_fifo; /**< FIFO for output samples */
  62. AudioConvert *ac_in; /**< input sample format conversion context */
  63. AudioConvert *ac_out; /**< output sample format conversion context */
  64. ResampleContext *resample; /**< resampling context */
  65. AudioMix *am; /**< channel mixing context */
  66. };
  67. #endif /* AVRESAMPLE_INTERNAL_H */