1 /* 2 * Copyright (C) 2012, Collabora Ltd. 3 * Author: 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 Lesser General Public 7 * License as published by the Free Software Foundation 8 * version 2.1 of the License. 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 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 * 19 */ 20 21 #ifndef __GST_AMC_AUDIO_DEC_H__ 22 #define __GST_AMC_AUDIO_DEC_H__ 23 24 #include <gst/gst.h> 25 #include <gst/audio/audio.h> 26 #include <gst/audio/gstaudiodecoder.h> 27 28 #include "gstamc.h" 29 30 G_BEGIN_DECLS 31 32 #define GST_TYPE_AMC_AUDIO_DEC \ 33 (gst_amc_audio_dec_get_type()) 34 #define GST_AMC_AUDIO_DEC(obj) \ 35 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AMC_AUDIO_DEC,GstAmcAudioDec)) 36 #define GST_AMC_AUDIO_DEC_CLASS(klass) \ 37 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AMC_AUDIO_DEC,GstAmcAudioDecClass)) 38 #define GST_AMC_AUDIO_DEC_GET_CLASS(obj) \ 39 (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AMC_AUDIO_DEC,GstAmcAudioDecClass)) 40 #define GST_IS_AMC_AUDIO_DEC(obj) \ 41 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AMC_AUDIO_DEC)) 42 #define GST_IS_AMC_AUDIO_DEC_CLASS(obj) \ 43 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AMC_AUDIO_DEC)) 44 45 typedef struct _GstAmcAudioDec GstAmcAudioDec; 46 typedef struct _GstAmcAudioDecClass GstAmcAudioDecClass; 47 48 struct _GstAmcAudioDec 49 { 50 GstAudioDecoder parent; 51 52 /* < private > */ 53 GstAmcCodec *codec; 54 55 GstCaps *input_caps; 56 GList *codec_datas; 57 gboolean input_caps_changed; 58 gint spf; 59 60 /* For collecting complete frames for the output */ 61 GstAdapter *output_adapter; 62 63 /* Output format of the codec */ 64 GstAudioInfo info; 65 /* AMC positions, might need reordering */ 66 GstAudioChannelPosition positions[64]; 67 gboolean needs_reorder; 68 gint reorder_map[64]; 69 70 /* TRUE if the component is configured and saw 71 * the first buffer */ 72 gboolean started; 73 gboolean flushing; 74 75 GstClockTime last_upstream_ts; 76 77 /* Draining state */ 78 GMutex drain_lock; 79 GCond drain_cond; 80 /* TRUE if EOS buffers shouldn't be forwarded */ 81 gboolean draining; 82 /* TRUE if the component is drained currently */ 83 gboolean drained; 84 85 GstFlowReturn downstream_flow_ret; 86 }; 87 88 struct _GstAmcAudioDecClass 89 { 90 GstAudioDecoderClass parent_class; 91 92 const GstAmcCodecInfo *codec_info; 93 }; 94 95 GType gst_amc_audio_dec_get_type (void); 96 97 G_END_DECLS 98 99 #endif /* __GST_AMC_AUDIO_DEC_H__ */ 100