1 /*
2 * audio conversion
3 * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * audio conversion
25 * @author Michael Niedermayer <michaelni@gmx.at>
26 */
27
34
38 };
39
42 const float *matrix,
int flags)
43 {
45 if (in_channels!=out_channels)
46 return NULL; /* FIXME: not supported */
48 if (!ctx)
49 return NULL;
53 return ctx;
54 }
55
57 {
59 }
60
62 void *
const out[6],
const int out_stride[6],
63 const void *
const in[6],
const int in_stride[6],
int len)
64 {
65 int ch;
66
67 //FIXME optimize common cases
68
70 const int is= in_stride[ch];
71 const int os= out_stride[ch];
75 if(!out[ch])
76 continue;
77
78 #define CONV(ofmt, otype, ifmt, expr)\
79 if(ctx->fmt_pair == ofmt + AV_SAMPLE_FMT_NB*ifmt){\
80 do{\
81 *(otype*)po = expr; pi += is; po += os;\
82 }while(po < end);\
83 }
84
85 //FIXME put things below under ifdefs so we do not waste space for cases no codec will need
86 //FIXME rounding ?
87
113 else return -1;
114 }
115 return 0;
116 }