| OLD | NEW |
| 1 /* | 1 /* |
| 2 * audio conversion | 2 * audio conversion |
| 3 * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | 3 * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> |
| 4 * Copyright (c) 2008 Peter Ross | 4 * Copyright (c) 2008 Peter Ross |
| 5 * | 5 * |
| 6 * This file is part of FFmpeg. | 6 * This file is part of FFmpeg. |
| 7 * | 7 * |
| 8 * FFmpeg is free software; you can redistribute it and/or | 8 * FFmpeg is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #ifndef AVCODEC_AUDIOCONVERT_H | 23 #ifndef AVCODEC_AUDIOCONVERT_H |
| 24 #define AVCODEC_AUDIOCONVERT_H | 24 #define AVCODEC_AUDIOCONVERT_H |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * @file | 27 * @file |
| 28 * Audio format conversion routines | 28 * Audio format conversion routines |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 | 31 |
| 32 #include "libavutil/cpu.h" |
| 32 #include "avcodec.h" | 33 #include "avcodec.h" |
| 33 | 34 |
| 34 | 35 |
| 35 /** | 36 /** |
| 36 * Generate string corresponding to the sample format with | 37 * Generate string corresponding to the sample format with |
| 37 * number sample_fmt, or a header if sample_fmt is negative. | 38 * number sample_fmt, or a header if sample_fmt is negative. |
| 38 * | 39 * |
| 39 * @param[in] buf the buffer where to write the string | 40 * @param[in] buf the buffer where to write the string |
| 40 * @param[in] buf_size the size of buf | 41 * @param[in] buf_size the size of buf |
| 41 * @param[in] sample_fmt the number of the sample format to print the correspond
ing info string, or | 42 * @param[in] sample_fmt the number of the sample format to print the correspond
ing info string, or |
| (...skipping 11 matching lines...) Expand all Loading... |
| 53 * @return SAMPLE_FMT_NONE on error | 54 * @return SAMPLE_FMT_NONE on error |
| 54 */ | 55 */ |
| 55 enum SampleFormat avcodec_get_sample_fmt(const char* name); | 56 enum SampleFormat avcodec_get_sample_fmt(const char* name); |
| 56 | 57 |
| 57 /** | 58 /** |
| 58 * @return NULL on error | 59 * @return NULL on error |
| 59 */ | 60 */ |
| 60 const char *avcodec_get_channel_name(int channel_id); | 61 const char *avcodec_get_channel_name(int channel_id); |
| 61 | 62 |
| 62 /** | 63 /** |
| 64 * @return channel layout that matches name, 0 if no match |
| 65 */ |
| 66 int64_t avcodec_get_channel_layout(const char *name); |
| 67 |
| 68 /** |
| 63 * Return description of channel layout | 69 * Return description of channel layout |
| 64 */ | 70 */ |
| 65 void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels,
int64_t channel_layout); | 71 void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels,
int64_t channel_layout); |
| 66 | 72 |
| 67 /** | 73 /** |
| 68 * Guess the channel layout | 74 * Guess the channel layout |
| 69 * @param nb_channels | 75 * @param nb_channels |
| 70 * @param codec_id Codec identifier, or CODEC_ID_NONE if unknown | 76 * @param codec_id Codec identifier, or CODEC_ID_NONE if unknown |
| 71 * @param fmt_name Format name, or NULL if unknown | 77 * @param fmt_name Format name, or NULL if unknown |
| 72 * @return Channel layout mask | 78 * @return Channel layout mask |
| 73 */ | 79 */ |
| 74 int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, con
st char *fmt_name); | 80 int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, con
st char *fmt_name); |
| 75 | 81 |
| 76 /** | 82 /** |
| 77 * @return the number of channels in the channel layout. | 83 * @return the number of channels in the channel layout. |
| 78 */ | 84 */ |
| 79 int avcodec_channel_layout_num_channels(int64_t channel_layout); | 85 int avcodec_channel_layout_num_channels(int64_t channel_layout); |
| 80 | 86 |
| 81 struct AVAudioConvert; | 87 struct AVAudioConvert; |
| 82 typedef struct AVAudioConvert AVAudioConvert; | 88 typedef struct AVAudioConvert AVAudioConvert; |
| 83 | 89 |
| 84 /** | 90 /** |
| 85 * Create an audio sample format converter context | 91 * Create an audio sample format converter context |
| 86 * @param out_fmt Output sample format | 92 * @param out_fmt Output sample format |
| 87 * @param out_channels Number of output channels | 93 * @param out_channels Number of output channels |
| 88 * @param in_fmt Input sample format | 94 * @param in_fmt Input sample format |
| 89 * @param in_channels Number of input channels | 95 * @param in_channels Number of input channels |
| 90 * @param[in] matrix Channel mixing matrix (of dimension in_channel*out_channels
). Set to NULL to ignore. | 96 * @param[in] matrix Channel mixing matrix (of dimension in_channel*out_channels
). Set to NULL to ignore. |
| 91 * @param flags See FF_MM_xx | 97 * @param flags See AV_CPU_FLAG_xx |
| 92 * @return NULL on error | 98 * @return NULL on error |
| 93 */ | 99 */ |
| 94 AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channe
ls, | 100 AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channe
ls, |
| 95 enum SampleFormat in_fmt, int in_channels
, | 101 enum SampleFormat in_fmt, int in_channels
, |
| 96 const float *matrix, int flags); | 102 const float *matrix, int flags); |
| 97 | 103 |
| 98 /** | 104 /** |
| 99 * Free audio sample format converter context | 105 * Free audio sample format converter context |
| 100 */ | 106 */ |
| 101 void av_audio_convert_free(AVAudioConvert *ctx); | 107 void av_audio_convert_free(AVAudioConvert *ctx); |
| 102 | 108 |
| 103 /** | 109 /** |
| 104 * Convert between audio sample formats | 110 * Convert between audio sample formats |
| 105 * @param[in] out array of output buffers for each channel. set to NULL to ignor
e processing of the given channel. | 111 * @param[in] out array of output buffers for each channel. set to NULL to ignor
e processing of the given channel. |
| 106 * @param[in] out_stride distance between consecutive output samples (measured i
n bytes) | 112 * @param[in] out_stride distance between consecutive output samples (measured i
n bytes) |
| 107 * @param[in] in array of input buffers for each channel | 113 * @param[in] in array of input buffers for each channel |
| 108 * @param[in] in_stride distance between consecutive input samples (measured in
bytes) | 114 * @param[in] in_stride distance between consecutive input samples (measured in
bytes) |
| 109 * @param len length of audio frame size (measured in samples) | 115 * @param len length of audio frame size (measured in samples) |
| 110 */ | 116 */ |
| 111 int av_audio_convert(AVAudioConvert *ctx, | 117 int av_audio_convert(AVAudioConvert *ctx, |
| 112 void * const out[6], const int out_stride[6], | 118 void * const out[6], const int out_stride[6], |
| 113 const void * const in[6], const int in_stride[6], int len
); | 119 const void * const in[6], const int in_stride[6], int len
); |
| 114 | 120 |
| 115 #endif /* AVCODEC_AUDIOCONVERT_H */ | 121 #endif /* AVCODEC_AUDIOCONVERT_H */ |
| OLD | NEW |