After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 456656 - [API] Addition of audio buffer clipping function to gstaudio
[API] Addition of audio buffer clipping function to gstaudio
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.14
Other Linux
: Normal normal
: 0.10.14
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-07-13 17:04 UTC by Sebastian Dröge (slomo)
Modified: 2007-07-24 14:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
audio_buffer_clip.diff (3.44 KB, patch)
2007-07-13 17:04 UTC, Sebastian Dröge (slomo)
none Details | Review
audio_buffer_clip.diff (15.42 KB, patch)
2007-07-14 08:23 UTC, Sebastian Dröge (slomo)
none Details | Review
audio_buffer_clip.diff (18.28 KB, patch)
2007-07-14 18:24 UTC, Sebastian Dröge (slomo)
committed Details | Review
audio_buffer_clip-uint64_scale.diff (18.45 KB, patch)
2007-07-14 18:45 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Sebastian Dröge (slomo) 2007-07-13 17:04:06 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
Comment 1 Sebastian Dröge (slomo) 2007-07-13 17:04:33 UTC
Created attachment 91745 [details] [review]
audio_buffer_clip.diff
Comment 2 Sebastian Dröge (slomo) 2007-07-13 18:04:05 UTC
Later a new patch will come with a few suggestions by Tim and unit tests ;)
Comment 3 Sebastian Dröge (slomo) 2007-07-14 08:23:35 UTC
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.
Comment 4 Sebastian Dröge (slomo) 2007-07-14 18:24:59 UTC
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?
Comment 5 Sebastian Dröge (slomo) 2007-07-14 18:45:37 UTC
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? :)
Comment 6 Wim Taymans 2007-07-23 16:09:17 UTC
the second patch!
Comment 7 Sebastian Dröge (slomo) 2007-07-23 17:57:04 UTC
Ok, so shall I commit the last patch? :)

And do you know why GST_FRAMES_TO_CLOCK_TIME() uses double?
Comment 8 Sebastian Dröge (slomo) 2007-07-23 18:28:09 UTC
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.