dpb: rename GstVaapiDpbMpeg2 to GstVaapiDpb2.
[platform/upstream/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapidecoder_dpb.h
1 /*
2  *  gstvaapidecoder_dpb.h - Decoded Picture Buffer
3  *
4  *  Copyright (C) 2012 Intel Corporation
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 License
8  *  as published by the Free Software Foundation; either version 2.1
9  *  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  *  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
18  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  *  Boston, MA 02110-1301 USA
20  */
21
22 #ifndef GST_VAAPI_DECODER_DPB_H
23 #define GST_VAAPI_DECODER_DPB_H
24
25 #include <gst/vaapi/gstvaapidecoder_objects.h>
26
27 G_BEGIN_DECLS
28
29 typedef struct _GstVaapiDpb             GstVaapiDpb;
30 typedef struct _GstVaapiDpbClass        GstVaapiDpbClass;
31 typedef struct _GstVaapiDpb2            GstVaapiDpb2;
32 typedef struct _GstVaapiDpb2Class       GstVaapiDpb2Class;
33
34 /* ------------------------------------------------------------------------- */
35 /* --- Base Decoded Picture Buffer                                       --- */
36 /* ------------------------------------------------------------------------- */
37
38 #define GST_VAAPI_TYPE_DPB \
39     (gst_vaapi_dpb_get_type())
40
41 #define GST_VAAPI_DPB_CAST(obj) \
42     ((GstVaapiDpb *)(obj))
43
44 #define GST_VAAPI_DPB(obj)                              \
45     (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
46                                 GST_VAAPI_TYPE_DPB,     \
47                                 GstVaapiDpb))
48
49 #define GST_VAAPI_DPB_CLASS(klass)                      \
50     (G_TYPE_CHECK_CLASS_CAST((klass),                   \
51                              GST_VAAPI_TYPE_DPB,        \
52                              GstVaapiDpbClass))
53
54 #define GST_VAAPI_IS_DPB(obj) \
55     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_DPB))
56
57 #define GST_VAAPI_IS_DPB_CLASS(klass) \
58     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_DPB))
59
60 #define GST_VAAPI_DPB_GET_CLASS(obj)                    \
61     (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
62                                GST_VAAPI_TYPE_DPB,      \
63                                GstVaapiDpbClass))
64
65 /**
66  * GstVaapiDpb:
67  *
68  * A decoded picture buffer (DPB) object.
69  */
70 struct _GstVaapiDpb {
71     /*< private >*/
72     GstMiniObject       parent_instance;
73
74     /*< protected >*/
75     GstVaapiPicture   **pictures;
76     guint               num_pictures;
77     guint               max_pictures;
78 };
79
80 /**
81  * GstVaapiDpbClass:
82  *
83  * The #GstVaapiDpb base class.
84  */
85 struct _GstVaapiDpbClass {
86     /*< private >*/
87     GstMiniObjectClass  parent_class;
88
89     /*< protected >*/
90     void              (*flush)  (GstVaapiDpb *dpb);
91     gboolean          (*add)    (GstVaapiDpb *dpb, GstVaapiPicture *picture);
92 };
93
94 G_GNUC_INTERNAL
95 GType
96 gst_vaapi_dpb_get_type(void) G_GNUC_CONST;
97
98 G_GNUC_INTERNAL
99 void
100 gst_vaapi_dpb_flush(GstVaapiDpb *dpb);
101
102 G_GNUC_INTERNAL
103 gboolean
104 gst_vaapi_dpb_add(GstVaapiDpb *dpb, GstVaapiPicture *picture);
105
106 G_GNUC_INTERNAL
107 guint
108 gst_vaapi_dpb_size(GstVaapiDpb *dpb);
109
110 static inline gpointer
111 gst_vaapi_dpb_ref(gpointer ptr)
112 {
113     return gst_mini_object_ref(GST_MINI_OBJECT(ptr));
114 }
115
116 static inline void
117 gst_vaapi_dpb_unref(gpointer ptr)
118 {
119     gst_mini_object_unref(GST_MINI_OBJECT(ptr));
120 }
121
122 /* ------------------------------------------------------------------------- */
123 /* --- Decoded Picture Buffer (optimized for 2 reference pictures)       --- */
124 /* ------------------------------------------------------------------------- */
125
126 #define GST_VAAPI_TYPE_DPB2 \
127     (gst_vaapi_dpb2_get_type())
128
129 #define GST_VAAPI_DPB2_CAST(obj) \
130     ((GstVaapiDpb2 *)(obj))
131
132 #define GST_VAAPI_DPB2(obj)                             \
133     (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
134                                 GST_VAAPI_TYPE_DPB2,    \
135                                 GstVaapiDpb2))
136
137 #define GST_VAAPI_DPB2_CLASS(klass)                     \
138     (G_TYPE_CHECK_CLASS_CAST((klass),                   \
139                              GST_VAAPI_TYPE_DPB2,       \
140                              GstVaapiDpb2Class))
141
142 #define GST_VAAPI_IS_DPB2(obj) \
143     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_DPB2))
144
145 #define GST_VAAPI_IS_DPB2_CLASS(klass) \
146     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_DPB2))
147
148 #define GST_VAAPI_DPB2_GET_CLASS(obj)                   \
149     (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
150                                GST_VAAPI_TYPE_DPB2,     \
151                                GstVaapiDpb2Class))
152
153 /**
154  * GstVaapiDpb2:
155  *
156  * A decoded picture buffer (DPB2) object.
157  */
158 struct _GstVaapiDpb2 {
159     /*< private >*/
160     GstVaapiDpb         parent_instance;
161 };
162
163 /**
164  * GstVaapiDpb2Class:
165  *
166  * The #GstVaapiDpb2 base class.
167  */
168 struct _GstVaapiDpb2Class {
169     /*< private >*/
170     GstVaapiDpbClass    parent_class;
171 };
172
173 G_GNUC_INTERNAL
174 GType
175 gst_vaapi_dpb2_get_type(void) G_GNUC_CONST;
176
177 G_GNUC_INTERNAL
178 GstVaapiDpb *
179 gst_vaapi_dpb2_new(void);
180
181 G_GNUC_INTERNAL
182 void
183 gst_vaapi_dpb2_get_references(
184     GstVaapiDpb        *dpb,
185     GstVaapiPicture    *picture,
186     GstVaapiPicture   **prev_picture_ptr,
187     GstVaapiPicture   **next_picture_ptr
188 );
189
190 G_END_DECLS
191
192 #endif /* GST_VAAPI_DECODER_DPB */