00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SWR_INTERNAL_H
00022 #define SWR_INTERNAL_H
00023
00024 #include "swresample.h"
00025
00026 typedef struct AudioData{
00027 uint8_t *ch[SWR_CH_MAX];
00028 uint8_t *data;
00029 int ch_count;
00030 int bps;
00031 int count;
00032 int planar;
00033 } AudioData;
00034
00035 typedef struct SwrContext {
00036 const AVClass *av_class;
00037 int log_level_offset;
00038 void *log_ctx;
00039 enum AVSampleFormat in_sample_fmt;
00040 enum AVSampleFormat int_sample_fmt;
00041 enum AVSampleFormat out_sample_fmt;
00042 int64_t in_ch_layout;
00043 int64_t out_ch_layout;
00044 int in_sample_rate;
00045 int out_sample_rate;
00046 int flags;
00047 float slev;
00048 float clev;
00049 float rematrix_volume;
00050 const int *channel_map;
00051 int used_ch_count;
00052
00053 int int_bps;
00054 int resample_first;
00055 int rematrix;
00056
00057 AudioData in;
00058 AudioData postin;
00059 AudioData midbuf;
00060 AudioData preout;
00061 AudioData out;
00062 AudioData in_buffer;
00063 int in_buffer_index;
00064 int in_buffer_count;
00065 int resample_in_constraint;
00066
00067 struct AudioConvert *in_convert;
00068 struct AudioConvert *out_convert;
00069 struct AudioConvert *full_convert;
00070 struct ResampleContext *resample;
00071
00072 float matrix[SWR_CH_MAX][SWR_CH_MAX];
00073 int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX];
00074 uint8_t matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1];
00075
00076
00077 }SwrContext;
00078
00079 struct ResampleContext *swri_resample_init(struct ResampleContext *, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
00080 void swri_resample_free(struct ResampleContext **c);
00081 int swri_multiple_resample(struct ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed);
00082 void swri_resample_compensate(struct ResampleContext *c, int sample_delta, int compensation_distance);
00083 int swri_resample(struct ResampleContext *c, int16_t *dst, const int16_t *src, int *consumed, int src_size, int dst_size, int update_ctx);
00084
00085 int swri_rematrix_init(SwrContext *s);
00086 int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy);
00087
00088 #endif