1e39ad03d4f0f7e102860ee61e336e4ea5a9e12e
[platform/upstream/gstreamer.git] / ext / opus / gstopusenc.h
1 /* GStreamer Opus Encoder
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  * Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21
22 #ifndef __GST_OPUS_ENC_H__
23 #define __GST_OPUS_ENC_H__
24
25
26 #include <gst/gst.h>
27 #include <gst/audio/gstaudioencoder.h>
28
29 #include <opus/opus_multistream.h>
30
31 G_BEGIN_DECLS
32
33 #define GST_TYPE_OPUS_ENC \
34   (gst_opus_enc_get_type())
35 #define GST_OPUS_ENC(obj) \
36   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPUS_ENC,GstOpusEnc))
37 #define GST_OPUS_ENC_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPUS_ENC,GstOpusEncClass))
39 #define GST_IS_OPUS_ENC(obj) \
40   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPUS_ENC))
41 #define GST_IS_OPUS_ENC_CLASS(klass) \
42   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPUS_ENC))
43
44 #define MAX_FRAME_SIZE 2000*2
45 #define MAX_FRAME_BYTES 2000
46
47 typedef struct _GstOpusEnc GstOpusEnc;
48 typedef struct _GstOpusEncClass GstOpusEncClass;
49
50 struct _GstOpusEnc {
51   GstAudioEncoder       element;
52
53   OpusMSEncoder        *state;
54
55   /* Locks those properties which may be changed at play time */
56   GMutex               *property_lock;
57
58   /* properties */
59   gboolean              audio_or_voip;
60   gint                  bitrate;
61   gint                  bandwidth;
62   gint                  frame_size;
63   gboolean              cbr;
64   gboolean              constrained_vbr;
65   gint                  complexity;
66   gboolean              inband_fec;
67   gboolean              dtx;
68   gint                  packet_loss_percentage;
69   guint                 max_payload_size;
70
71   gint                  frame_samples;
72   gint                  n_channels;
73   gint                  sample_rate;
74
75   gboolean              header_sent;
76
77   GSList                *headers;
78
79   GstTagList            *tags;
80
81   guint8                channel_mapping_family;
82   guint8                encoding_channel_mapping[256];
83   guint8                decoding_channel_mapping[256];
84   guint8                n_stereo_streams;
85 };
86
87 struct _GstOpusEncClass {
88   GstAudioEncoderClass parent_class;
89
90   /* signals */
91   void (*frame_encoded) (GstElement *element);
92 };
93
94 GType gst_opus_enc_get_type (void);
95
96 G_END_DECLS
97
98 #endif /* __GST_OPUS_ENC_H__ */