]> git.sesse.net Git - ffmpeg/blob - libswresample/swresample_internal.h
swr: fix #endif comment ref.
[ffmpeg] / libswresample / swresample_internal.h
1 /*
2  * Copyright (C) 2011 Michael Niedermayer (michaelni@gmx.at)
3  *
4  * This file is part of libswresample
5  *
6  * libswresample 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  * libswresample 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 libswresample; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #ifndef SWR_INTERNAL_H
22 #define SWR_INTERNAL_H
23
24 #include "swresample.h"
25
26 typedef struct AudioData{
27     uint8_t *ch[SWR_CH_MAX];
28     uint8_t *data;
29     int ch_count;
30     int bps;
31     int count;
32     int planar;
33 } AudioData;
34
35 typedef struct SwrContext {          //FIXME find unused fields
36     const AVClass *av_class;
37     int log_level_offset;
38     void *log_ctx;
39     enum AVSampleFormat  in_sample_fmt;
40     enum AVSampleFormat int_sample_fmt; ///<AV_SAMPLE_FMT_FLT OR AV_SAMPLE_FMT_S16
41     enum AVSampleFormat out_sample_fmt;
42     int64_t  in_ch_layout;
43     int64_t out_ch_layout;
44     int      in_sample_rate;
45     int     out_sample_rate;
46     int flags;
47     float slev, clev, rematrix_volume;
48     const int *channel_map;             ///< channel index (or -1 if muted channel) map
49     int used_ch_count;                  ///< number of used channels (mapped channel count if channel_map, otherwise in.ch_count)
50
51     //below are private
52     int int_bps;
53     int resample_first;
54     int rematrix;                   ///< flag to indicate if rematrixing is used
55
56     AudioData in, postin, midbuf, preout, out, in_buffer;
57     int in_buffer_index;
58     int in_buffer_count;
59     int resample_in_constraint;
60
61     struct AVAudioConvert *in_convert;
62     struct AVAudioConvert *out_convert;
63     struct AVAudioConvert *full_convert;
64     struct AVResampleContext *resample;
65
66     float matrix[SWR_CH_MAX][SWR_CH_MAX];
67     int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX];
68     uint8_t matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1];
69
70     //TODO callbacks for asm optims
71 }SwrContext;
72
73 struct AVResampleContext *swr_resample_init(struct AVResampleContext *, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
74 void swr_resample_free(struct AVResampleContext **c);
75 int swr_multiple_resample(struct AVResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed);
76 void swr_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
77 int swr_resample(struct AVResampleContext *c, short *dst, const short *src, int *consumed, int src_size, int dst_size, int update_ctx);
78
79 int swr_rematrix_init(SwrContext *s);
80 int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy);
81 #endif