1 /* GStreamer Speex Encoder
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 
21 #ifndef __GST_SPEEX_ENC_H__
22 #define __GST_SPEEX_ENC_H__
23 
24 
25 #include <gst/gst.h>
26 #include <gst/audio/gstaudioencoder.h>
27 
28 #include <speex/speex.h>
29 #include <speex/speex_header.h>
30 
31 G_BEGIN_DECLS
32 
33 #define GST_TYPE_SPEEX_ENC \
34   (gst_speex_enc_get_type())
35 #define GST_SPEEX_ENC(obj) \
36   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SPEEX_ENC,GstSpeexEnc))
37 #define GST_SPEEX_ENC_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SPEEX_ENC,GstSpeexEncClass))
39 #define GST_IS_SPEEX_ENC(obj) \
40   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SPEEX_ENC))
41 #define GST_IS_SPEEX_ENC_CLASS(klass) \
42   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SPEEX_ENC))
43 
44 typedef enum
45 {
46   GST_SPEEX_ENC_MODE_AUTO,
47   GST_SPEEX_ENC_MODE_UWB,
48   GST_SPEEX_ENC_MODE_WB,
49   GST_SPEEX_ENC_MODE_NB
50 } GstSpeexMode;
51 
52 typedef struct _GstSpeexEnc GstSpeexEnc;
53 typedef struct _GstSpeexEncClass GstSpeexEncClass;
54 
55 struct _GstSpeexEnc {
56   GstAudioEncoder   element;
57 
58   SpeexBits             bits;
59   SpeexHeader           header;
60   const SpeexMode       *speex_mode;
61   void                  *state;
62 
63   /* properties */
64   GstSpeexMode          mode;
65   gfloat                quality;
66   gint                  bitrate;
67   gboolean              vbr;
68   gint                  abr;
69   gboolean              vad;
70   gboolean              dtx;
71   gint                  complexity;
72   gint                  nframes;
73   gchar                 *last_message;
74 
75   gint                  channels;
76   gint                  rate;
77 
78   gboolean              header_sent;
79   guint64               encoded_samples;
80 
81   GstTagList            *tags;
82 
83   gint                  frame_size;
84   gint                  lookahead;
85 
86   guint8                *comments;
87   gint                  comment_len;
88 };
89 
90 struct _GstSpeexEncClass {
91   GstAudioEncoderClass parent_class;
92 };
93 
94 GType gst_speex_enc_get_type (void);
95 
96 G_END_DECLS
97 
98 #endif /* __GST_SPEEXENC_H__ */
99