1 /*
2 * Copyright (c) 2014 Luca Barbato <lu_zero@gentoo.org>
3 * Copyright (c) 2014 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
25
27 {
29
30 if (in) {
32 goto fail;
34 goto fail;
36 goto fail;
37 }
38
39 if (out) {
41 goto fail;
43 goto fail;
45 goto fail;
46 }
47
48 return 0;
49 fail:
52 }
53
56 {
58
59 if (in) {
64 }
65 }
66
67 if (out) {
72 }
73 }
74
76 }
77
80 {
84 int out_nb_samples = 0, in_nb_samples = 0;
85
86 if (out) {
89 }
90
91 if (in) {
94 }
95
96 ret =
swr_convert(s, out_data, out_nb_samples, in_data, in_nb_samples);
97
98 if (ret < 0) {
99 if (out)
102 }
103
104 if (out)
106
107 return 0;
108 }
109
111 {
113 int samples = out->
linesize[0] / bytes_per_sample;
114
116 return samples;
117 } else {
119 return samples / channels;
120 }
121 }
122
125 {
127
133 setup = 1;
134 } else {
135 // return as is or reconfigure for input changes?
138 }
139
140 if (out) {
144 + 3;
146 if (setup)
149 }
150 } else {
153 }
154 }
155
157 }
158