e97fc1ab6febd6b9219bc3851a32e70ad9d1099e
[platform/upstream/gstreamer.git] / gst-libs / gst / audio / audio.h
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  * Library       <2001> Thomas Vander Stichele <thomas@apestaart.org>
4  *               <2011> Wim Taymans <wim.taymans@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __GST_AUDIO_AUDIO_H__
23 #define __GST_AUDIO_AUDIO_H__
24
25 #include <gst/gst.h>
26 #include <gst/audio/audio-enumtypes.h>
27 #include <gst/audio/audio-format.h>
28 #include <gst/audio/audio-channels.h>
29 #include <gst/audio/audio-info.h>
30
31 G_BEGIN_DECLS
32
33 /* conversion macros */
34 /**
35  * GST_FRAMES_TO_CLOCK_TIME:
36  * @frames: sample frames
37  * @rate: sampling rate
38  *
39  * Calculate clocktime from sample @frames and @rate.
40  */
41 #define GST_FRAMES_TO_CLOCK_TIME(frames, rate) \
42   ((GstClockTime) gst_util_uint64_scale_round (frames, GST_SECOND, rate))
43
44 /**
45  * GST_CLOCK_TIME_TO_FRAMES:
46  * @clocktime: clock time
47  * @rate: sampling rate
48  *
49  * Calculate frames from @clocktime and sample @rate.
50  */
51 #define GST_CLOCK_TIME_TO_FRAMES(clocktime, rate) \
52   gst_util_uint64_scale_round (clocktime, rate, GST_SECOND)
53
54 /*
55  * this library defines and implements some helper functions for audio
56  * handling
57  */
58
59 GstBuffer *    gst_audio_buffer_clip     (GstBuffer *buffer, GstSegment *segment,
60                                           gint rate, gint bpf);
61
62
63 G_END_DECLS
64
65 #endif /* __GST_AUDIO_AUDIO_H__ */