GNOME Bugzilla – Bug 456656
[API] Addition of audio buffer clipping function to gstaudio
Last modified: 2007-07-24 14:23:29 UTC
Hi, the attached patch adds a gst_audio_buffer_clip() function to gstaudio that clips an audio buffer to a given GstSegment. This code or variations of it are currently used in many elements. Bye
Created attachment 91745 [details] [review] audio_buffer_clip.diff
Later a new patch will come with a few suggestions by Tim and unit tests ;)
Created attachment 91765 [details] [review] audio_buffer_clip.diff Hopefully final version with unit tests. This now handles default and time format segments, also changes offset and offset_end. And duration and offset_end are only changed if they were set before, offset and timestamp are assumed to be set already.
Created attachment 91782 [details] [review] audio_buffer_clip.diff some smaller improvements. Would it be better to get frame size and sampling rate from the buffer's caps instead of having parameters for it? That would require that each buffer given to the function has his caps set correctly though. Any oppinions?
Created attachment 91783 [details] [review] audio_buffer_clip-uint64_scale.diff now the same but with gst_util_uint64_scale() as GST_FRAMES_TO_CLOCK_TIME() and GST_CLOCK_TIME_TO_FRAMES() uses doubles... not sure which one is better. Oppinions please? :)
the second patch!
Ok, so shall I commit the last patch? :) And do you know why GST_FRAMES_TO_CLOCK_TIME() uses double?
2007-07-23 Sebastian Dröge <slomo@circular-chaos.org> * docs/libs/gst-plugins-base-libs-sections.txt: * gst-libs/gst/audio/audio.c: (gst_audio_buffer_clip): * gst-libs/gst/audio/audio.h: * tests/check/libs/audio.c: (GST_START_TEST), (audio_suite): API: Add buffer clipping function for raw audio buffers. Fixes #456656. Also add deprecation guards for gst_audio_structure_set_int() to the header.