2c5a588b67e58b9cad4a38bd6e6e029b0c4cc3c5
[platform/upstream/gstreamer.git] / ext / speex / gstspeexenc.h
1 /* GStreamer
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., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20
21 #ifndef __GST_SPEEXENC_H__
22 #define __GST_SPEEXENC_H__
23
24
25 #include <gst/gst.h>
26 #include <gst/base/gstadapter.h>
27
28 #include <speex/speex.h>
29 #include <speex/speex_header.h>
30
31 G_BEGIN_DECLS
32
33 #define GST_TYPE_SPEEXENC \
34   (gst_speexenc_get_type())
35 #define GST_SPEEXENC(obj) \
36   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SPEEXENC,GstSpeexEnc))
37 #define GST_SPEEXENC_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SPEEXENC,GstSpeexEnc))
39 #define GST_IS_SPEEXENC(obj) \
40   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SPEEXENC))
41 #define GST_IS_SPEEXENC_CLASS(obj) \
42   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SPEEXENC))
43
44 #define MAX_FRAME_SIZE 2000*2
45 #define MAX_FRAME_BYTES 2000
46
47 typedef enum
48 {
49   GST_SPEEXENC_MODE_AUTO,
50   GST_SPEEXENC_MODE_UWB,
51   GST_SPEEXENC_MODE_WB,
52   GST_SPEEXENC_MODE_NB,
53 } GstSpeexMode;
54
55 typedef struct _GstSpeexEnc GstSpeexEnc;
56 typedef struct _GstSpeexEncClass GstSpeexEncClass;
57
58 struct _GstSpeexEnc {
59   GstElement            element;
60
61   /* pads */
62   GstPad                *sinkpad,
63                         *srcpad;
64
65   gint                  packet_count;
66   gint                  n_packets;
67
68   SpeexBits             bits;
69   SpeexHeader           header;
70 #if SPEEX_1_0
71   SpeexMode             *speex_mode;
72 #else
73   const SpeexMode       *speex_mode;
74 #endif
75   void                  *state;
76   GstSpeexMode          mode;
77   GstAdapter            *adapter;
78
79   gfloat                quality;
80   gint                  bitrate;
81   gboolean              vbr;
82   gint                  abr;
83   gboolean              vad;
84   gboolean              dtx;
85   gint                  complexity;
86   gint                  nframes;
87
88   gint                  lookahead;
89
90   gint                  channels;
91   gint                  rate;
92
93   gboolean              setup;
94   gboolean              header_sent;
95   gboolean              eos;
96
97   guint64               samples_in;
98   guint64               bytes_out;
99
100   GstTagList            *tags;
101
102   gchar                 *last_message;
103
104   gint                  frame_size;
105   guint64               frameno;
106
107   guint8                *comments;
108   gint                  comment_len;
109
110   gfloat                input[MAX_FRAME_SIZE];
111 };
112
113 struct _GstSpeexEncClass {
114   GstElementClass parent_class;
115
116   /* signals */
117   void (*frame_encoded) (GstElement *element);
118 };
119
120 GType gst_speexenc_get_type(void);
121
122 G_END_DECLS
123
124 #endif /* __GST_SPEEXENC_H__ */