On 04/12/2012 12:50 PM, Anton Khirnov wrote: > > On Mon, 9 Apr 2012 17:27:52 -0400, Justin Ruggles <[email protected]> > wrote: >> diff --git a/libavresample/avresample.h b/libavresample/avresample.h >> new file mode 100644 >> index 0000000..361cc8c >> --- /dev/null >> +++ b/libavresample/avresample.h [...] >> +/** >> + * Set compensation for resampling. >> + * >> + * This can be called anytime after avresample_open(). If resampling was not >> + * being done previously, the AVAudioResampleContext is closed and reopened >> + * with resampling enabled. In this case, any samples remaining in the >> output >> + * FIFO and the current channel mixing matrix will be restored after >> reopening >> + * the context. >> + * >> + * @param avr audio resample context >> + * @param sample_delta compensation delta, in samples >> + * @param compensation_distance compensation distance, in samples >> + * @return 0 on success, negative AVERROR code on >> failure >> + */ >> +int avresample_set_compensation(AVAudioResampleContext *avr, int >> sample_delta, >> + int compensation_distance); >> + >> +/** >> + * Convert input samples and write them to the output FIFO. >> + * >> + * The output data can be NULL or have fewer allocated samples than >> required. >> + * In this case, any remaining samples not written to the output will be >> added >> + * to an internal FIFO, to be returned in the next call to this function or >> to >> + * avresample_read(). >> + * >> + * @param avr audio resample context >> + * @param output output data pointers >> + * @param out_plane_size output plane size, in bytes. >> + * This can be 0 if unknown, but that will lead to >> + * optimized functions not being used directly on the >> + * output, which could slow down some conversions. >> + * @param out_samples maximum number of samples that the output buffer >> can hold >> + * @param input input data pointers >> + * @param in_plane_size input plane size, in bytes >> + * This can be 0 if unknown, but that will lead to >> + * optimized functions not being used directly on the >> + * input, which could slow down some conversions. >> + * @param in_samples number of input samples to convert >> + * @return number of samples written to the output buffer, >> + not including converted samples added to the >> internal >> + output FIFO >> + */ >> +int avresample_convert(AVAudioResampleContext *avr, void **output, >> + int out_plane_size, int out_samples, void **input, >> + int in_plane_size, int in_samples); >> + >> +/** >> + * Return the number of samples currently in the resampling delay buffer. >> + * >> + * @param avr audio resample context >> + * @return number of samples currently in the resampling delay buffer >> + */ >> +int avresample_get_delay(AVAudioResampleContext *avr); >> + >> +/** >> + * Return the number of available samples in the output FIFO. >> + * >> + * The samples in the FIFO can be read with avresample_read() or >> + * avresample_convert(). >> + * >> + * @param avr audio resample context >> + * @return number of samples available for reading >> + */ >> +int avresample_available(AVAudioResampleContext *avr); > > Those two doxies are talking about some buffers and FIFOs that aren't > public. Could you elaborate a bit about where is the data buffered and > what is the user expected to do to get it all out properly?
Ok, I'll explain it in more detail in the avresample_convert() documentation. You also pointed out on IRC that I forgot to include information about flushing internal buffers by passing NULL input, so I'll add that as well. >> + >> +/** >> + * Read samples from the output FIFO. >> + * >> + * @param avr audio resample context >> + * @param output output data pointers >> + * @param nb_sample number of samples to read from the FIFO >> + * @return the number of samples written to output >> + */ >> +int avresample_read(AVAudioResampleContext *avr, void **output, int >> nb_samples); >> + >> +/** >> + * Return the libavresample license. >> + */ >> +const char *avresample_license(void); > > Please move this one up to the version/configuration stuff. I rearranged several of these locally per Diego's review. > Also you're missing the versioning script (libavresample.v), so shared > builds don't work. Ah, I didn't even know that existed... > (I hope you don't mind those partial reviews too much, this patch is > just too huge to comment on all at once) That's fine. I'm glad it's getting some reviews. :) Just let me know when you think you've reviewed enough of it that I should send an updated patch. Thanks, Justin _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
