omxvideodec: support interlace-mode=interleaved input
[platform/upstream/gstreamer.git] / omx / gstomxaudiosink.h
1 /*
2  * Copyright (C) 2014, Fluendo, S.A.
3  * Copyright (C) 2014, Metrological Media Innovations B.V.
4  *   Author: Josep Torra <josep@fluendo.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation
9  * version 2.1 of the License.
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  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
19  *
20  */
21
22 #ifndef __GST_OMX_AUDIO_SINK_H__
23 #define __GST_OMX_AUDIO_SINK_H__
24
25 #ifdef HAVE_CONFIG_H
26 #include "config.h"
27 #endif
28
29 #include <gst/gst.h>
30 #include <gst/audio/audio.h>
31
32 #include "gstomx.h"
33
34 G_BEGIN_DECLS
35
36 #define GST_TYPE_OMX_AUDIO_SINK \
37   (gst_omx_audio_sink_get_type())
38 #define GST_OMX_AUDIO_SINK(obj) \
39   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_AUDIO_SINK,GstOMXAudioSink))
40 #define GST_OMX_AUDIO_SINK_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_AUDIO_SINK,GstOMXAudioSinkClass))
42 #define GST_OMX_AUDIO_SINK_GET_CLASS(obj) \
43   (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_AUDIO_SINK,GstOMXAudioSinkClass))
44 #define GST_IS_OMX_AUDIO_SINK(obj) \
45   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_AUDIO_SINK))
46 #define GST_IS_OMX_AUDIO_SINK_CLASS(obj) \
47   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_AUDIO_SINK))
48 #define GST_OMX_AUDIO_SINK_CAST(obj)      ((GstOMXAudioSink *) (obj))
49
50 #define GST_OMX_AUDIO_SINK_GET_LOCK(obj)        (&GST_OMX_AUDIO_SINK_CAST (obj)->lock)
51 #define GST_OMX_AUDIO_SINK_LOCK(obj)        (g_mutex_lock (GST_OMX_AUDIO_SINK_GET_LOCK (obj)))
52 #define GST_OMX_AUDIO_SINK_UNLOCK(obj)    (g_mutex_unlock (GST_OMX_AUDIO_SINK_GET_LOCK (obj)))
53
54 #define PASSTHROUGH_CAPS \
55     "audio/x-ac3, framed = (boolean) true;" \
56     "audio/x-eac3, framed = (boolean) true; " \
57     "audio/x-dts, framed = (boolean) true, " \
58       "block-size = (int) { 512, 1024, 2048 }; " \
59     "audio/mpeg, mpegversion = (int) 1, " \
60       "mpegaudioversion = (int) [ 1, 2 ], parsed = (boolean) true;"
61
62 typedef struct _GstOMXAudioSink GstOMXAudioSink;
63 typedef struct _GstOMXAudioSinkClass GstOMXAudioSinkClass;
64
65 struct _GstOMXAudioSink
66 {
67   GstAudioSink parent;
68
69   /* < protected > */
70   GstOMXComponent *comp;
71   GstOMXPort *in_port, *out_port;
72   
73   gboolean mute;
74   gdouble volume;
75
76   gboolean iec61937;
77   guint endianness;
78   guint rate;
79   guint channels;
80   guint width;
81   gboolean is_signed;
82   gboolean is_float;
83
84   guint buffer_size;
85   guint samples;
86
87   GMutex lock;
88 };
89
90 struct _GstOMXAudioSinkClass
91 {
92   GstAudioSinkClass parent_class;
93
94   GstOMXClassData cdata;
95   const gchar * destination;
96 };
97
98 GType gst_omx_audio_sink_get_type (void);
99
100 G_END_DECLS
101
102 #endif /* __GST_OMX_AUDIO_SINK_H__ */
103