Go to the documentation of this file.
   38     return 2.0 * (
av_lfg_get(lfg) / (double)UINT_MAX) - 1.0;
 
   41 #define PUT_FUNC(name, fmt, type, expr)                                     \ 
   42 static void put_sample_ ## name(void **data, enum AVSampleFormat sample_fmt,\ 
   43                                 int channels, int sample, int ch,           \ 
   47     type **out = (type **)data;                                             \ 
   48     if (av_sample_fmt_is_planar(sample_fmt))                                \ 
   49         out[ch][sample] = v;                                                \ 
   51         out[0][sample * channels + ch] = v;                                 \ 
   91 #define PUT_SAMPLE put_sample(data, sample_fmt, channels, k, ch, v); 
  136             v = sin(taba[ch]) * 0.30;
 
  138             f = tabf1[ch] + (((tabf2[ch] - tabf1[ch]) * 
i) / 
sample_rate);
 
  148             double amp = (1.0 + sin(ampa)) * 0.15;
 
  189 int main(
int argc, 
char **argv)
 
  196     unsigned int in_buf_size;
 
  197     unsigned int out_buf_size;
 
  202     uint64_t in_ch_layout;
 
  206     uint64_t out_ch_layout;
 
  210     int num_formats, num_rates, num_layouts;
 
  211     int i, j, k, l, m, n;
 
  219                    "[<num sample rates> [<num channel layouts>]]]\n" 
  220                    "Default is 2 2 2\n");
 
  223         num_formats = strtol(argv[1], 
NULL, 0);
 
  227         num_rates = strtol(argv[2], 
NULL, 0);
 
  231         num_layouts = strtol(argv[3], 
NULL, 0);
 
  241     out_buf_size = in_buf_size;
 
  257     for (
i = 0; 
i < num_formats; 
i++) {
 
  259         for (k = 0; k < num_layouts; k++) {
 
  262             for (m = 0; m < num_rates; m++) {
 
  266                                              in_channels, in_rate * 6,
 
  272                 audiogen(&
rnd, (
void **)in_data, in_fmt, in_channels, in_rate, in_rate * 6);
 
  274                 for (j = 0; j < num_formats; j++) {
 
  276                     for (l = 0; l < num_layouts; l++) {
 
  279                         for (n = 0; n < num_rates; n++) {
 
  284                                    in_channels, out_channels, in_rate, out_rate);
 
  287                                                          out_buf, out_channels,
 
  288                                                          out_rate * 6, out_fmt, 0);
 
  310                                                          in_data,  in_linesize,  in_rate * 6);
 
  
@ AV_SAMPLE_FMT_FLTP
float, planar
attribute_deprecated AVAudioResampleContext * avresample_alloc_context(void)
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
#define AV_CH_LAYOUT_MONO
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Fill plane data pointers and linesize for samples with sample format sample_fmt.
#define AVRESAMPLE_MAX_CHANNELS
#define PUT_FUNC(name, fmt, type, expr)
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
attribute_deprecated int avresample_get_delay(AVAudioResampleContext *avr)
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
#define AV_CH_LAYOUT_STEREO
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
attribute_deprecated int avresample_open(AVAudioResampleContext *avr)
static double dbl_rand(AVLFG *lfg)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
static const uint64_t layouts[]
#define AV_CH_LAYOUT_5POINT1
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
int av_strncasecmp(const char *a, const char *b, size_t n)
Locale-independent case-insensitive compare.
attribute_deprecated void avresample_free(AVAudioResampleContext **avr)
Context structure for the Lagged Fibonacci PRNG.
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
attribute_deprecated int avresample_convert(AVAudioResampleContext *avr, uint8_t **output, int out_plane_size, int out_samples, uint8_t *const *input, int in_plane_size, int in_samples)
int main(int argc, char **argv)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
#define AV_LOG_INFO
Standard information.
attribute_deprecated void avresample_close(AVAudioResampleContext *avr)
void av_log_set_level(int level)
Set the log level.
attribute_deprecated int avresample_available(AVAudioResampleContext *avr)
AVSampleFormat
Audio sample formats.
#define AV_CH_LAYOUT_7POINT1
@ AV_SAMPLE_FMT_S16
signed 16 bits
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Get the required buffer size for the given audio parameters.
static void audiogen(AVLFG *rnd, void **data, enum AVSampleFormat sample_fmt, int channels, int sample_rate, int nb_samples)
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
Get the packed alternative form of the given sample format.
@ AV_SAMPLE_FMT_DBLP
double, planar
@ AV_SAMPLE_FMT_DBL
double
@ AV_SAMPLE_FMT_S32
signed 32 bits