Drop excessive threading that over-complicates synchronisation.
[profile/ivi/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapidecoder_priv.h
1 /*
2  *  gstvaapidecoder_priv.h - VA decoder abstraction (private definitions)
3  *
4  *  gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program 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
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
19  */
20
21 #ifndef GST_VAAPI_DECODER_PRIV_H
22 #define GST_VAAPI_DECODER_PRIV_H
23
24 #include <glib.h>
25 #include <gst/gsttask.h>
26 #include <gst/vaapi/gstvaapidecoder.h>
27 #include <gst/vaapi/gstvaapicontext.h>
28
29 G_BEGIN_DECLS
30
31 #define GST_VAAPI_DECODER_CAST(decoder) ((GstVaapiDecoder *)(decoder))
32
33 /**
34  * GST_VAAPI_DECODER_DISPLAY:
35  * @decoder: a #GstVaapiDecoder
36  *
37  * Macro that evaluates to the #GstVaapiDisplay of @decoder.
38  * This is an internal macro that does not do any run-time type check.
39  */
40 #undef  GST_VAAPI_DECODER_DISPLAY
41 #define GST_VAAPI_DECODER_DISPLAY(decoder) \
42     GST_VAAPI_DECODER_CAST(decoder)->priv->display
43
44 /**
45  * GST_VAAPI_DECODER_CONTEXT:
46  * @decoder: a #GstVaapiDecoder
47  *
48  * Macro that evaluates to the #GstVaapiContext of @decoder.
49  * This is an internal macro that does not do any run-time type check.
50  */
51 #undef  GST_VAAPI_DECODER_CONTEXT
52 #define GST_VAAPI_DECODER_CONTEXT(decoder) \
53     GST_VAAPI_DECODER_CAST(decoder)->priv->context
54
55 /**
56  * GST_VAAPI_DECODER_CODEC:
57  * @decoder: a #GstVaapiDecoder
58  *
59  * Macro that evaluates to the #GstVaapiCodec of @decoder.
60  * This is an internal macro that does not do any run-time type check.
61  */
62 #undef  GST_VAAPI_DECODER_CODEC
63 #define GST_VAAPI_DECODER_CODEC(decoder) \
64     GST_VAAPI_DECODER_CAST(decoder)->priv->codec
65
66 /**
67  * GST_VAAPI_DECODER_CODEC_DATA:
68  * @decoder: a #GstVaapiDecoder
69  *
70  * Macro that evaluates to the #GstBuffer holding optional codec data
71  * for @decoder.
72  * This is an internal macro that does not do any run-time type check.
73  */
74 #undef  GST_VAAPI_DECODER_CODEC_DATA
75 #define GST_VAAPI_DECODER_CODEC_DATA(decoder) \
76     GST_VAAPI_DECODER_CAST(decoder)->priv->codec_data
77
78 /* End-of-Stream buffer */
79 #define GST_BUFFER_FLAG_EOS (GST_BUFFER_FLAG_LAST + 0)
80
81 #define GST_BUFFER_IS_EOS(buffer) \
82     GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_EOS)
83
84 #define GST_VAAPI_DECODER_GET_PRIVATE(obj)                      \
85     (G_TYPE_INSTANCE_GET_PRIVATE((obj),                         \
86                                  GST_VAAPI_TYPE_DECODER,        \
87                                  GstVaapiDecoderPrivate))
88
89 struct _GstVaapiDecoderPrivate {
90     GstVaapiDisplay    *display;
91     GstVaapiContext    *context;
92     GstVaapiCodec       codec;
93     GstBuffer          *codec_data;
94     guint               fps_n;
95     guint               fps_d;
96     GQueue             *buffers;
97     GQueue             *surfaces;
98     GstClockTime        surface_timestamp;
99     GstClockTime        surface_duration;
100 };
101
102 gboolean
103 gst_vaapi_decoder_ensure_context(
104     GstVaapiDecoder    *decoder,
105     GstVaapiProfile     profile,
106     GstVaapiEntrypoint  entrypoint,
107     guint               width,
108     guint               height
109 ) attribute_hidden;
110
111 gboolean
112 gst_vaapi_decoder_push_surface(
113     GstVaapiDecoder *decoder,
114     GstVaapiSurface *surface
115 ) attribute_hidden;
116
117 G_END_DECLS
118
119 #endif /* GST_VAAPI_DECODER_PRIV_H */
120