2 * Copyright (C) 2011 Michael Niedermayer (michaelni@gmx.at)
4 * This file is part of libswresample
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.
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.
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
25 #include "libavutil/samplefmt.h"
27 #define LIBSWRESAMPLE_VERSION_MAJOR 0
28 #define LIBSWRESAMPLE_VERSION_MINOR 0
29 #define LIBSWRESAMPLE_VERSION_MICRO 0
33 #define SWR_FLAG_RESAMPLE 1///< Force resampling even if equal sample rate
34 //TODO use int resample ?
35 //long term TODO can we enable this dynamically?
41 * Allocate SwrContext.
42 * @see swr_init(),swr_free()
43 * @return NULL on error
45 struct SwrContext *swr_alloc(void);
48 * Initialize context after user parameters have been set.
49 * @return negativo n error
51 int swr_init(struct SwrContext *s);
54 * Allocate SwrContext.
55 * @see swr_init(),swr_free()
56 * @return NULL on error
58 struct SwrContext *swr_alloc2(struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
59 int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
60 int log_offset, void *log_ctx);
63 * Free the given SwrContext.
64 * And set the pointer to NULL
66 void swr_free(struct SwrContext **s);
70 * @param in_count Number of input samples available in one channel.
71 * @param out_count Amount of space available for output in samples per channel.
72 * @return number of samples output per channel
74 int swr_convert(struct SwrContext *s, uint8_t *out[SWR_CH_MAX], int out_count,
75 const uint8_t *in [SWR_CH_MAX], int in_count);
77 void swr_compensate(struct SwrContext *s, int sample_delta, int compensation_distance);