Remove AVFilterBufferRefAudioProps.size, and use nb_samples in avfilter_get_audio_buffer() and avfilter_default_get_audio_buffer() in place of size. This is required as the size in the audio buffer may be aligned, so it may not contain a well defined number of samples.
Showing the changes to libavfilter/avfilter.h (1 of 4 files). Show all
Unified · Split
| @@ -26,7 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include "libavutil/samplefmt.h" |
| 27 | 27 | |
| 28 | 28 | #define LIBAVFILTER_VERSION_MAJOR 2 |
| 29 | −#define LIBAVFILTER_VERSION_MINOR 13 | |
| 29 | +#define LIBAVFILTER_VERSION_MINOR 14 | |
| 30 | 30 | #define LIBAVFILTER_VERSION_MICRO 0 |
| 31 | 31 | |
| 32 | 32 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
| @@ -98,8 +98,7 @@ typedef struct AVFilterBuffer { · 65 unmodified lines | ||
| 98 | 98 | */ |
| 99 | 99 | typedef struct AVFilterBufferRefAudioProps { |
| 100 | 100 | int64_t channel_layout; ///< channel layout of audio buffer |
| 101 | − int nb_samples; ///< number of audio samples | |
| 102 | − int size; ///< audio buffer size | |
| 101 | + int nb_samples; ///< number of audio samples per channel | |
| 103 | 102 | uint32_t sample_rate; ///< audio buffer sample rate |
| 104 | 103 | int planar; ///< audio buffer - planar or packed |
| 105 | 104 | } AVFilterBufferRefAudioProps; |
| @@ -372,7 +371,7 @@ struct AVFilterPad { · 266 unmodified lines | ||
| 372 | 371 | * Input audio pads only. |
| 373 | 372 | */ |
| 374 | 373 | AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms, |
| 375 | − enum AVSampleFormat sample_fmt, int size, | |
| 374 | + enum AVSampleFormat sample_fmt, int nb_samples, | |
| 376 | 375 | int64_t channel_layout, int planar); |
| 377 | 376 | |
| 378 | 377 | /** |
| @@ -461,7 +460,7 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, · 82 unmodified lines | ||
| 461 | 460 | |
| 462 | 461 | /** default handler for get_audio_buffer() for audio inputs */ |
| 463 | 462 | AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms, |
| 464 | − enum AVSampleFormat sample_fmt, int size, | |
| 463 | + enum AVSampleFormat sample_fmt, int nb_samples, | |
| 465 | 464 | int64_t channel_layout, int planar); |
| 466 | 465 | |
| 467 | 466 | /** |
| @@ -684,14 +683,14 @@ avfilter_get_video_buffer_ref_from_arrays(uint8_t * const data[4], const int lin · 216 unmodified lines | ||
| 684 | 683 | * be requested |
| 685 | 684 | * @param perms the required access permissions |
| 686 | 685 | * @param sample_fmt the format of each sample in the buffer to allocate |
| 687 | − * @param size the buffer size in bytes | |
| 686 | + * @param nb_samples the number of samples per channel | |
| 688 | 687 | * @param channel_layout the number and type of channels per sample in the buffer to allocate |
| 689 | 688 | * @param planar audio data layout - planar or packed |
| 690 | 689 | * @return A reference to the samples. This must be unreferenced with |
| 691 | 690 | * avfilter_unref_buffer when you are finished with it. |
| 692 | 691 | */ |
| 693 | 692 | AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, |
| 694 | − enum AVSampleFormat sample_fmt, int size, | |
| 693 | + enum AVSampleFormat sample_fmt, int nb_samples, | |
| 695 | 694 | int64_t channel_layout, int planar); |
| 696 | 695 | |
| 697 | 696 | /** |