1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 #include "config.h"
19
20 #include <stdlib.h>
21 #include <stdio.h>
22 #include <inttypes.h>
25
26 #define MAX_CHANNELS 32
27
28
35
36 static const uint8_t
data_U8 [] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
37 static const int16_t
data_S16[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
38 static const float data_FLT[] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0};
39
47 };
48
50 {
54 }
56 }
57
59 {
60 fprintf(stderr,
"%s\n",
str);
61 exit(1);
62 }
63
65 {
69 ? test_sample->
nb_ch : 1;
70 int line_size = (buffers > 1) ? nb_samples * byte_offset
71 : nb_samples * byte_offset * test_sample->
nb_ch;
72 for (p = 0; p < buffers; ++p){
73 for(
b = 0;
b < line_size;
b+=byte_offset){
74 for (
f = 0;
f < byte_offset;
f++){
75 int order = !HAVE_BIGENDIAN ? (byte_offset -
f - 1) :
f;
76 printf(
"%02x", *((uint8_t*)data_planes[p] +
b + order));
77 }
78 putchar(' ');
79 }
80 putchar('\n');
81 }
82 }
83
85 {
91 if (!data_planes)
92 ERROR(
"failed to allocate memory!");
96
100 ERROR(
"failed to allocate memory!");
101 }
102
104 }
105
107 int nb_samples,
int offset)
108 {
111
113 return 0;
114 }
116 return 0;
117 }
119
121 data_planes[
i] = (uint8_t*)test_sample->
data_planes[
i] + offset_size;
122 }
123
125 }
126
128 {
133 if (!afifo) {
134 ERROR(
"ERROR: av_audio_fifo_alloc returned NULL!");
135 }
138 ERROR(
"ERROR: av_audio_fifo_write failed!");
139 }
141
144 ERROR(
"ERROR: av_audio_fifo_write failed!");
145 }
148
151 ERROR(
"ERROR: av_audio_fifo_read failed!");
152 }
156
157 /* test av_audio_fifo_peek */
160 ERROR(
"ERROR: av_audio_fifo_peek failed!");
161 }
165
166 /* test av_audio_fifo_peek_at */
171 ERROR(
"ERROR: av_audio_fifo_peek_at failed!");
172 }
175 }
177
178 /* test av_audio_fifo_drain */
181 ERROR(
"ERROR: av_audio_fifo_drain failed!");
182 }
184 ERROR(
"drain failed to flush all samples in audio_fifo!");
185 }
186
187 /* deallocate */
190 }
191
193 {
195
196 for (t = 0; t <
tests; ++t){
197 printf(
"\nTEST: %d\n\n", t+1);
199 }
200 return 0;
201 }