Miam-Player  0.8.0
A nice music player
swresample.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011-2013 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 SWRESAMPLE_SWRESAMPLE_H
22 #define SWRESAMPLE_SWRESAMPLE_H
23 
122 #include <stdint.h>
124 #include "libavutil/frame.h"
125 #include "libavutil/samplefmt.h"
126 
127 #include "libswresample/version.h"
128 
129 #if LIBSWRESAMPLE_VERSION_MAJOR < 1
130 #define SWR_CH_MAX 32
131 #endif
132 
140 #define SWR_FLAG_RESAMPLE 1
141 //TODO use int resample ?
142 //long term TODO can we enable this dynamically?
143 
150 
160 };
161 
163 enum SwrEngine {
167 };
168 
174 };
175 
186 typedef struct SwrContext SwrContext;
187 
195 const AVClass *swr_get_class(void);
196 
211 struct SwrContext *swr_alloc(void);
212 
223 int swr_init(struct SwrContext *s);
224 
232 int swr_is_initialized(struct SwrContext *s);
233 
254 struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
255  int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
256  int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
257  int log_offset, void *log_ctx);
258 
271 void swr_free(struct SwrContext **s);
272 
283 void swr_close(struct SwrContext *s);
284 
310 int swr_convert(struct SwrContext *s, uint8_t **out, int out_count,
311  const uint8_t **in , int in_count);
312 
330 int64_t swr_next_pts(struct SwrContext *s, int64_t pts);
331 
357 int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance);
358 
367 int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
368 
392 int swr_build_matrix(uint64_t in_layout, uint64_t out_layout,
393  double center_mix_level, double surround_mix_level,
394  double lfe_mix_level, double rematrix_maxval,
395  double rematrix_volume, double *matrix,
396  int stride, enum AVMatrixEncoding matrix_encoding,
397  void *log_ctx);
398 
408 int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride);
409 
428 int swr_drop_output(struct SwrContext *s, int count);
429 
441 int swr_inject_silence(struct SwrContext *s, int count);
442 
467 int64_t swr_get_delay(struct SwrContext *s, int64_t base);
468 
485 int swr_get_out_samples(struct SwrContext *s, int in_samples);
486 
502 unsigned swresample_version(void);
503 
509 const char *swresample_configuration(void);
510 
516 const char *swresample_license(void);
517 
560  AVFrame *output, const AVFrame *input);
561 
576 int swr_config_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in);
577 
583 #endif /* SWRESAMPLE_SWRESAMPLE_H */
Definition: swresample.h:158
void swr_close(struct SwrContext *s)
Definition: swresample.h:165
SwrFilterType
Definition: swresample.h:170
Definition: swresample.h:155
Definition: swresample.h:154
int64_t swr_next_pts(struct SwrContext *s, int64_t pts)
Definition: frame.h:184
int swr_build_matrix(uint64_t in_layout, uint64_t out_layout, double center_mix_level, double surround_mix_level, double lfe_mix_level, double rematrix_maxval, double rematrix_volume, double *matrix, int stride, enum AVMatrixEncoding matrix_encoding, void *log_ctx)
int swr_get_out_samples(struct SwrContext *s, int in_samples)
int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance)
struct SwrContext * swr_alloc(void)
SwrDitherType
Definition: swresample.h:145
int swr_convert(struct SwrContext *s, uint8_t **out, int out_count, const uint8_t **in, int in_count)
Definition: swresample.h:173
SwrEngine
Definition: swresample.h:163
Definition: swresample.h:172
Definition: swresample.h:148
int64_t swr_get_delay(struct SwrContext *s, int64_t base)
not part of API/ABI
Definition: swresample.h:166
struct SwrContext SwrContext
Definition: swresample.h:186
not part of API/ABI
Definition: swresample.h:159
int swr_drop_output(struct SwrContext *s, int count)
int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride)
struct SwrContext * swr_alloc_set_opts(struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx)
not part of API/ABI
Definition: swresample.h:151
Definition: log.h:67
const AVClass * swr_get_class(void)
Definition: swresample.h:146
AVSampleFormat
Definition: samplefmt.h:58
void swr_free(struct SwrContext **s)
int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map)
const char * swresample_license(void)
Definition: swresample.h:171
Definition: swresample.h:152
Definition: swresample.h:164
int swr_convert_frame(SwrContext *swr, AVFrame *output, const AVFrame *input)
int swr_config_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in)
Definition: swresample.h:149
unsigned swresample_version(void)
Definition: swresample.h:157
Definition: swresample.h:153
Definition: swresample.h:147
AVMatrixEncoding
Definition: channel_layout.h:114
int swr_is_initialized(struct SwrContext *s)
Definition: swresample.h:156
const char * swresample_configuration(void)
int swr_inject_silence(struct SwrContext *s, int count)
int swr_init(struct SwrContext *s)