speex: Implement preset interface
[platform/upstream/gst-plugins-good.git] / ext / speex / gstspeexenc.h
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., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, 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/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_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 #define MAX_FRAME_SIZE 2000*2
45 #define MAX_FRAME_BYTES 2000
46
47 typedef enum
48 {
49   GST_SPEEX_ENC_MODE_AUTO,
50   GST_SPEEX_ENC_MODE_UWB,
51   GST_SPEEX_ENC_MODE_WB,
52   GST_SPEEX_ENC_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
96   guint64               samples_in;
97   guint64               bytes_out;
98
99   GstTagList            *tags;
100
101   gchar                 *last_message;
102
103   gint                  frame_size;
104   guint64               frameno;
105   guint64               frameno_out;
106
107   guint8                *comments;
108   gint                  comment_len;
109
110   /* Timestamp and granulepos tracking */
111   GstClockTime     start_ts;
112   GstClockTime     next_ts;
113   guint64          granulepos_offset;
114 };
115
116 struct _GstSpeexEncClass {
117   GstElementClass parent_class;
118
119   /* signals */
120   void (*frame_encoded) (GstElement *element);
121 };
122
123 GType gst_speex_enc_get_type (void);
124
125 G_END_DECLS
126
127 #endif /* __GST_SPEEXENC_H__ */