opus: set author to myself, and update copyright notices
[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  * Copyright (C) <2011-2012> Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
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., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22
23 #ifndef __GST_OPUS_ENC_H__
24 #define __GST_OPUS_ENC_H__
25
26
27 #include <gst/gst.h>
28 #include <gst/audio/gstaudioencoder.h>
29
30 #include <opus/opus_multistream.h>
31
32 G_BEGIN_DECLS
33
34 #define GST_TYPE_OPUS_ENC \
35   (gst_opus_enc_get_type())
36 #define GST_OPUS_ENC(obj) \
37   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPUS_ENC,GstOpusEnc))
38 #define GST_OPUS_ENC_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPUS_ENC,GstOpusEncClass))
40 #define GST_IS_OPUS_ENC(obj) \
41   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPUS_ENC))
42 #define GST_IS_OPUS_ENC_CLASS(klass) \
43   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPUS_ENC))
44
45 #define MAX_FRAME_SIZE 2000*2
46 #define MAX_FRAME_BYTES 2000
47
48 typedef struct _GstOpusEnc GstOpusEnc;
49 typedef struct _GstOpusEncClass GstOpusEncClass;
50
51 struct _GstOpusEnc {
52   GstAudioEncoder       element;
53
54   OpusMSEncoder        *state;
55
56   /* Locks those properties which may be changed at play time */
57   GMutex               *property_lock;
58
59   /* properties */
60   gboolean              audio_or_voip;
61   gint                  bitrate;
62   gint                  bandwidth;
63   gint                  frame_size;
64   gboolean              cbr;
65   gboolean              constrained_vbr;
66   gint                  complexity;
67   gboolean              inband_fec;
68   gboolean              dtx;
69   gint                  packet_loss_percentage;
70   guint                 max_payload_size;
71
72   gint                  frame_samples;
73   gint                  n_channels;
74   gint                  sample_rate;
75
76   gboolean              header_sent;
77
78   GSList                *headers;
79
80   GstTagList            *tags;
81
82   guint8                channel_mapping_family;
83   guint8                encoding_channel_mapping[256];
84   guint8                decoding_channel_mapping[256];
85   guint8                n_stereo_streams;
86 };
87
88 struct _GstOpusEncClass {
89   GstAudioEncoderClass parent_class;
90
91   /* signals */
92   void (*frame_encoded) (GstElement *element);
93 };
94
95 GType gst_opus_enc_get_type (void);
96
97 G_END_DECLS
98
99 #endif /* __GST_OPUS_ENC_H__ */