• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) 2016 Iskratel d.o.o.
3  *   Author: Okrslar Ales <okrslar@iskratel.si>
4  * Copyright (C) 2016 Sebastian Dröge <sebastian@centricular.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., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef __GST_TONE_GENERATE_SRC_H__
23 #define __GST_TONE_GENERATE_SRC_H__
24 
25 
26 #include <gst/gst.h>
27 #include <gst/base/gstbasesrc.h>
28 
29 #include <gst/audio/audio.h>
30 #include <spandsp.h>
31 
32 G_BEGIN_DECLS
33 
34 #define GST_TYPE_TONE_GENERATE_SRC \
35   (gst_tone_generate_src_get_type())
36 #define GST_TONE_GENERATE_SRC(obj) \
37   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TONE_GENERATE_SRC,GstToneGenerateSrc))
38 #define GST_TONE_GENERATE_SRC_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TONE_GENERATE_SRC,GstToneGenerateSrcClass))
40 #define GST_IS_TONE_GENERATE_SRC(obj) \
41   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TONE_GENERATE_SRC))
42 #define GST_IS_TONE_GENERATE_SRC_CLASS(klass) \
43   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TONE_GENERATE_SRC))
44 
45 typedef struct _GstToneGenerateSrc GstToneGenerateSrc;
46 typedef struct _GstToneGenerateSrcClass GstToneGenerateSrcClass;
47 
48 /**
49  * GstToneGenerateSrc:
50  *
51  * tonegeneratesrc object structure.
52  */
53 struct _GstToneGenerateSrc {
54   GstPushSrc parent;
55 
56   /* parameters */
57   gint volume;      /* The level of the first frequency, in dBm0 */
58   gint volume2;     /* The level of the second frequency, in dBm0, or the percentage modulation depth for an AM modulated tone. */
59   gint freq;        /* The first frequency, in Hz */
60   gint freq2;       /* 0 for no second frequency, a positive number for the second frequency, in Hz, or a negative number for an AM modulation frequency, in Hz */
61   gint on_time;         /* On time for the first presence of tone signal. */
62   gint off_time;        /* Off time between first and second presence of tone signal. */
63   gint on_time2;        /* On time for the second presence of tone signal. */
64   gint off_time2;       /* Off time after the second presence of tone signal. */
65   gboolean repeat;         /* 0/1 if the tone repeates itself or not. */
66 
67   /* audio parameters */
68   gint samples_per_buffer;
69 
70   /*< private >*/
71   GstClockTime next_time;               /* next timestamp */
72   gint64 next_sample;                   /* next sample to send */
73 
74   /* SpanDSP */
75   tone_gen_state_t *tone_state;
76   tone_gen_descriptor_t *tone_desc;
77   gboolean properties_changed;
78 };
79 
80 struct _GstToneGenerateSrcClass {
81   GstPushSrcClass parent_class;
82 };
83 
84 GType gst_tone_generate_src_get_type (void);
85 GST_ELEMENT_REGISTER_DECLARE (tonegeneratesrc);
86 
87 G_END_DECLS
88 
89 #endif /* __GST_TONE_GENERATE_SRC_H__ */
90