]> git.sesse.net Git - ffmpeg/blob - libavresample/internal.h
lavr: typedef internal structs in internal.h
[ffmpeg] / libavresample / internal.h
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
21 #ifndef AVRESAMPLE_INTERNAL_H
22 #define AVRESAMPLE_INTERNAL_H
23
24 #include "libavutil/audio_fifo.h"
25 #include "libavutil/log.h"
26 #include "libavutil/opt.h"
27 #include "libavutil/samplefmt.h"
28 #include "avresample.h"
29
30 typedef struct AudioData AudioData;
31 typedef struct AudioConvert AudioConvert;
32 typedef struct AudioMix AudioMix;
33 typedef struct ResampleContext ResampleContext;
34
35 struct AVAudioResampleContext {
36     const AVClass *av_class;        /**< AVClass for logging and AVOptions  */
37
38     uint64_t in_channel_layout;                 /**< input channel layout   */
39     enum AVSampleFormat in_sample_fmt;          /**< input sample format    */
40     int in_sample_rate;                         /**< input sample rate      */
41     uint64_t out_channel_layout;                /**< output channel layout  */
42     enum AVSampleFormat out_sample_fmt;         /**< output sample format   */
43     int out_sample_rate;                        /**< output sample rate     */
44     enum AVSampleFormat internal_sample_fmt;    /**< internal sample format */
45     enum AVMixCoeffType mix_coeff_type;         /**< mixing coefficient type */
46     double center_mix_level;                    /**< center mix level       */
47     double surround_mix_level;                  /**< surround mix level     */
48     double lfe_mix_level;                       /**< lfe mix level          */
49     int normalize_mix_level;                    /**< enable mix level normalization */
50     int force_resampling;                       /**< force resampling       */
51     int filter_size;                            /**< length of each FIR filter in the resampling filterbank relative to the cutoff frequency */
52     int phase_shift;                            /**< log2 of the number of entries in the resampling polyphase filterbank */
53     int linear_interp;                          /**< if 1 then the resampling FIR filter will be linearly interpolated */
54     double cutoff;                              /**< resampling cutoff frequency. 1.0 corresponds to half the output sample rate */
55     enum AVResampleFilterType filter_type;      /**< resampling filter type */
56     int kaiser_beta;                            /**< beta value for Kaiser window (only applicable if filter_type == AV_FILTER_TYPE_KAISER) */
57     enum AVResampleDitherMethod dither_method;  /**< dither method          */
58
59     int in_channels;        /**< number of input channels                   */
60     int out_channels;       /**< number of output channels                  */
61     int resample_channels;  /**< number of channels used for resampling     */
62     int downmix_needed;     /**< downmixing is needed                       */
63     int upmix_needed;       /**< upmixing is needed                         */
64     int mixing_needed;      /**< either upmixing or downmixing is needed    */
65     int resample_needed;    /**< resampling is needed                       */
66     int in_convert_needed;  /**< input sample format conversion is needed   */
67     int out_convert_needed; /**< output sample format conversion is needed  */
68
69     AudioData *in_buffer;           /**< buffer for converted input         */
70     AudioData *resample_out_buffer; /**< buffer for output from resampler   */
71     AudioData *out_buffer;          /**< buffer for converted output        */
72     AVAudioFifo *out_fifo;          /**< FIFO for output samples            */
73
74     AudioConvert *ac_in;        /**< input sample format conversion context  */
75     AudioConvert *ac_out;       /**< output sample format conversion context */
76     ResampleContext *resample;  /**< resampling context                      */
77     AudioMix *am;               /**< channel mixing context                  */
78     enum AVMatrixEncoding matrix_encoding;      /**< matrixed stereo encoding */
79
80     /**
81      * mix matrix
82      * only used if avresample_set_matrix() is called before avresample_open()
83      */
84     double *mix_matrix;
85 };
86
87 #endif /* AVRESAMPLE_INTERNAL_H */