• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer pitch controller element
2  * Copyright (C) 2006 Wouter Paesen <wouter@blue-gate.be>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  */
19 
20 #ifndef __GST_PITCH_H__
21 #define __GST_PITCH_H__
22 
23 #include <gst/gst.h>
24 #include <gst/audio/audio.h>
25 
26 G_BEGIN_DECLS
27 
28 #define GST_TYPE_PITCH \
29   (gst_pitch_get_type())
30 #define GST_PITCH(obj) \
31   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PITCH,GstPitch))
32 #define GST_PITCH_CLASS(klass) \
33   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PITCH,GstPitchClass))
34 #define GST_IS_PITCH(obj) \
35   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PITCH))
36 #define GST_IS_PITCH_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PITCH))
38 
39 typedef struct _GstPitch            GstPitch;
40 typedef struct _GstPitchClass       GstPitchClass;
41 typedef struct _GstPitchPrivate     GstPitchPrivate;
42 
43 
44 struct _GstPitch
45 {
46   GstElement element;
47 
48   GstPad  *srcpad;
49   GstPad  *sinkpad;
50 
51   /* parameter values */
52   gfloat   tempo;               /* time stretch
53                                  * change the duration, without affecting the pitch
54                                  * > 1 makes the stream shorter
55                                  */
56 
57   gfloat   rate;                /* change playback rate
58                                  * resample
59                                  * > 1 makes the stream shorter
60                                  */
61 
62   gfloat   out_seg_rate;        /* change output segment rate
63                                  * Affects playback when input
64                                  * segments have rate != out_rate
65                                  */
66 
67   gfloat   pitch;               /* change pitch
68                                  * change the pitch without affecting the
69                                  * duration, stream length doesn't change
70                                  */
71 
72   gfloat  seg_arate;            /* Rate to apply from input segment */
73 
74   /* values extracted from caps */
75   GstAudioInfo  info;
76 
77   /* stream tracking */
78   GstClockTime  next_buffer_time;
79   gint64        next_buffer_offset;
80 
81   GstClockTimeDiff  min_latency, max_latency;
82 
83   GstPitchPrivate *priv;
84 };
85 
86 struct _GstPitchClass
87 {
88   GstElementClass parent_class;
89 };
90 
91 GType gst_pitch_get_type (void);
92 GST_ELEMENT_REGISTER_DECLARE (pitch);
93 
94 G_END_DECLS
95 
96 #endif /* __GST_PITCH_H__ */
97