1 /*
2 * Copyright (c) 2024 Michael Niedermayer <michael-ffmpeg@niedermayer.cc>
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 #include "config.h"
29
31
33
35
37
49 };
50
68 };
69
77 int in_ch_count, out_ch_count;
78 char in_layout_string[256];
79 char out_layout_string[256];
82 uint8_t *out_data =
NULL;
83 int in_sample_nb;
84 int out_sample_nb =
size;
85 int count;
87
91
100
101 out_sample_nb = bytestream2_get_le32(&gbc) & 0x7FFFFFFF;
102
103 flags64 = bytestream2_get_le64(&gbc);
104 if (flags64 & 0x10)
106 }
107
112
113 // fprintf(stderr, "%s %d %s -> %s %d %s\n",
114 // av_get_sample_fmt_name( in_sample_fmt), in_sample_rate, in_layout_string,
115 // av_get_sample_fmt_name(out_sample_fmt), out_sample_rate, out_layout_string);
116
119 0, 0) < 0) {
120 fprintf(stderr, "Failed swr_alloc_set_opts2()\n");
121 goto end;
122 }
123
125 fprintf(stderr, "Failed swr_init()\n");
126 goto end;
127 }
128
131
132 if (in_sample_nb > 1000*1000 || out_sample_nb > 1000*1000)
133 goto end;
134
136 if (!out_data)
137 goto end;
138
141 goto end;
144 goto end;
145
146 count =
swr_convert(swr, aout, out_sample_nb, (
const uint8_t **)ain, in_sample_nb);
147
148 end:
151
152 return 0;
153 }