00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00026 #ifndef SWR_H
00027 #define SWR_H
00028 
00029 #include <inttypes.h>
00030 #include "libavutil/samplefmt.h"
00031 
00032 #define LIBSWRESAMPLE_VERSION_MAJOR 0
00033 #define LIBSWRESAMPLE_VERSION_MINOR 15
00034 #define LIBSWRESAMPLE_VERSION_MICRO 100
00035 
00036 #define LIBSWRESAMPLE_VERSION_INT  AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
00037                                                   LIBSWRESAMPLE_VERSION_MINOR, \
00038                                                   LIBSWRESAMPLE_VERSION_MICRO)
00039 
00040 #if LIBSWRESAMPLE_VERSION_MAJOR < 1
00041 #define SWR_CH_MAX 32   
00042 #endif
00043 
00044 #define SWR_FLAG_RESAMPLE 1 
00045 //TODO use int resample ?
00046 
00047 
00048 enum SwrDitherType {
00049     SWR_DITHER_NONE = 0,
00050     SWR_DITHER_RECTANGULAR,
00051     SWR_DITHER_TRIANGULAR,
00052     SWR_DITHER_TRIANGULAR_HIGHPASS,
00053     SWR_DITHER_NB,              
00054 };
00055 
00057 enum SwrFilterType {
00058     SWR_FILTER_TYPE_CUBIC,              
00059     SWR_FILTER_TYPE_BLACKMAN_NUTTALL,   
00060     SWR_FILTER_TYPE_KAISER,             
00061 };
00062 
00063 typedef struct SwrContext SwrContext;
00064 
00071 const AVClass *swr_get_class(void);
00072 
00082 struct SwrContext *swr_alloc(void);
00083 
00089 int swr_init(struct SwrContext *s);
00090 
00111 struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
00112                                       int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
00113                                       int64_t  in_ch_layout, enum AVSampleFormat  in_sample_fmt, int  in_sample_rate,
00114                                       int log_offset, void *log_ctx);
00115 
00119 void swr_free(struct SwrContext **s);
00120 
00139 int swr_convert(struct SwrContext *s, uint8_t **out, int out_count,
00140                                 const uint8_t **in , int in_count);
00141 
00155 int64_t swr_next_pts(struct SwrContext *s, int64_t pts);
00156 
00160 int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance);
00161 
00170 int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
00171 
00181 int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride);
00182 
00186 int swr_drop_output(struct SwrContext *s, int count);
00187 
00191 int swr_inject_silence(struct SwrContext *s, int count);
00192 
00209 int64_t swr_get_delay(struct SwrContext *s, int64_t base);
00210 
00214 unsigned swresample_version(void);
00215 
00219 const char *swresample_configuration(void);
00220 
00224 const char *swresample_license(void);
00225 
00226 #endif