omxvideodec: support interlace-mode=interleaved input
[platform/upstream/gstreamer.git] / omx / gstomxaudioenc.h
1 /*
2  * Copyright (C) 2011, Hewlett-Packard Development Company, L.P.
3  *   Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>, Collabora Ltd.
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_OMX_AUDIO_ENC_H__
22 #define __GST_OMX_AUDIO_ENC_H__
23
24 #include <gst/gst.h>
25 #include <gst/audio/audio.h>
26 #include <gst/audio/gstaudioencoder.h>
27
28 #include "gstomx.h"
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_OMX_AUDIO_ENC \
33   (gst_omx_audio_enc_get_type())
34 #define GST_OMX_AUDIO_ENC(obj) \
35   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_AUDIO_ENC,GstOMXAudioEnc))
36 #define GST_OMX_AUDIO_ENC_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_AUDIO_ENC,GstOMXAudioEncClass))
38 #define GST_OMX_AUDIO_ENC_GET_CLASS(obj) \
39   (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_AUDIO_ENC,GstOMXAudioEncClass))
40 #define GST_IS_OMX_AUDIO_ENC(obj) \
41   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_AUDIO_ENC))
42 #define GST_IS_OMX_AUDIO_ENC_CLASS(obj) \
43   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_AUDIO_ENC))
44
45 typedef struct _GstOMXAudioEnc GstOMXAudioEnc;
46 typedef struct _GstOMXAudioEncClass GstOMXAudioEncClass;
47
48 struct _GstOMXAudioEnc
49 {
50   GstAudioEncoder parent;
51
52   /* < protected > */
53   GstOMXComponent *enc;
54   GstOMXPort *enc_in_port, *enc_out_port;
55
56   /* < private > */
57   /* TRUE if the component is configured and saw
58    * the first buffer */
59   gboolean started;
60
61   GstClockTime last_upstream_ts;
62
63   /* Draining state */
64   GMutex drain_lock;
65   GCond drain_cond;
66   /* TRUE if EOS buffers shouldn't be forwarded */
67   gboolean draining;
68
69   GstFlowReturn downstream_flow_ret;
70 };
71
72 struct _GstOMXAudioEncClass
73 {
74   GstAudioEncoderClass parent_class;
75
76   GstOMXClassData cdata;
77
78   gboolean (*set_format)       (GstOMXAudioEnc * self, GstOMXPort * port, GstAudioInfo * info);
79   GstCaps *(*get_caps)         (GstOMXAudioEnc * self, GstOMXPort * port, GstAudioInfo * info);
80   guint    (*get_num_samples)  (GstOMXAudioEnc * self, GstOMXPort * port, GstAudioInfo * info, GstOMXBuffer * buffer);
81 };
82
83 GType gst_omx_audio_enc_get_type (void);
84
85 G_END_DECLS
86
87 #endif /* __GST_OMX_AUDIO_ENC_H__ */