1 /* GStreamer 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., 51 Franklin St, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef __GST_OPUS_DEC_H__ 23 #define __GST_OPUS_DEC_H__ 24 25 #include <gst/gst.h> 26 #include <gst/audio/gstaudiodecoder.h> 27 #include <opus_multistream.h> 28 29 G_BEGIN_DECLS 30 31 #define GST_TYPE_OPUS_DEC \ 32 (gst_opus_dec_get_type()) 33 #define GST_OPUS_DEC(obj) \ 34 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPUS_DEC,GstOpusDec)) 35 #define GST_OPUS_DEC_CLASS(klass) \ 36 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPUS_DEC,GstOpusDecClass)) 37 #define GST_IS_OPUS_DEC(obj) \ 38 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPUS_DEC)) 39 #define GST_IS_OPUS_DEC_CLASS(klass) \ 40 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPUS_DEC)) 41 42 typedef struct _GstOpusDec GstOpusDec; 43 typedef struct _GstOpusDecClass GstOpusDecClass; 44 45 struct _GstOpusDec { 46 GstAudioDecoder element; 47 48 OpusMSDecoder *state; 49 50 guint64 packetno; 51 52 GstBuffer *streamheader; 53 GstBuffer *vorbiscomment; 54 55 guint32 sample_rate; 56 guint n_channels; 57 guint16 pre_skip; 58 gint16 r128_gain; 59 60 GstAudioChannelPosition opus_pos[64]; 61 GstAudioInfo info; 62 63 guint8 n_streams; 64 guint8 n_stereo_streams; 65 guint8 channel_mapping_family; 66 guint8 channel_mapping[256]; 67 68 gboolean apply_gain; 69 double r128_gain_volume; 70 71 gboolean use_inband_fec; 72 GstBuffer *last_buffer; 73 gboolean primed; 74 75 guint64 leftover_plc_duration; 76 77 GstClockTime last_known_buffer_duration; 78 79 gboolean phase_inversion; 80 81 /* Used to generate the 'stats' property. Protected by object lock */ 82 guint64 num_pushed; 83 guint64 num_gap; 84 guint64 plc_num_samples; 85 guint64 plc_duration; 86 }; 87 88 struct _GstOpusDecClass { 89 GstAudioDecoderClass parent_class; 90 }; 91 92 GType gst_opus_dec_get_type (void); 93 94 G_END_DECLS 95 96 #endif /* __GST_OPUS_DEC_H__ */ 97