]> code.delx.au - pulseaudio/blob - src/pulsecore/ffmpeg/avcodec.h
merge 'lennart' branch back into trunk.
[pulseaudio] / src / pulsecore / ffmpeg / avcodec.h
1 /*
2 * copyright (c) 2001 Fabrice Bellard
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg 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 * FFmpeg 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 FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef AVCODEC_H
22 #define AVCODEC_H
23
24 /* Just a heavily bastardized version of the original file from
25 * ffmpeg, just enough to get resample2.c to compile without
26 * modification -- Lennart */
27
28 #if !defined(PACKAGE) && defined(HAVE_CONFIG_H)
29 #include <config.h>
30 #endif
31
32 #include <sys/types.h>
33 #include <inttypes.h>
34 #include <math.h>
35 #include <string.h>
36 #include <stdlib.h>
37 #include <assert.h>
38
39 #define av_mallocz(l) calloc(1, (l))
40 #define av_malloc(l) malloc(l)
41 #define av_realloc(p,l) realloc((p),(l))
42 #define av_free(p) free(p)
43
44 static inline void av_freep(void *k) {
45 void **p = k;
46
47 if (p) {
48 free(*p);
49 *p = NULL;
50 }
51 }
52
53 static inline int av_clip(int a, int amin, int amax)
54 {
55 if (a < amin) return amin;
56 else if (a > amax) return amax;
57 else return a;
58 }
59
60 #define av_log(a,b,c)
61
62 #define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
63 #define FFSIGN(a) ((a) > 0 ? 1 : -1)
64
65 #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
66 #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
67
68 struct AVResampleContext;
69 struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
70 int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
71 void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
72 void av_resample_close(struct AVResampleContext *c);
73 void av_build_filter(int16_t *filter, double factor, int tap_count, int phase_count, int scale, int type);
74
75 /*
76 * crude lrintf for non-C99 systems.
77 */
78 #ifndef HAVE_LRINTF
79 #define lrintf(x) ((long int)(x))
80 #endif
81
82 #endif /* AVCODEC_H */