2
* gstvaapidecoder_objects.h - VA decoder objects
4
* Copyright (C) 2010-2011 Splitted-Desktop Systems
5
* Copyright (C) 2011-2012 Intel Corporation
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public License
9
* as published by the Free Software Foundation; either version 2.1
10
* of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free
19
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
* Boston, MA 02110-1301 USA
23
#ifndef GST_VAAPI_DECODER_OBJECTS_H
24
#define GST_VAAPI_DECODER_OBJECTS_H
26
#include <gst/vaapi/gstvaapicodec_objects.h>
30
typedef enum _GstVaapiPictureType GstVaapiPictureType;
31
typedef struct _GstVaapiPicture GstVaapiPicture;
32
typedef struct _GstVaapiPictureClass GstVaapiPictureClass;
33
typedef struct _GstVaapiSlice GstVaapiSlice;
34
typedef struct _GstVaapiSliceClass GstVaapiSliceClass;
36
/* ------------------------------------------------------------------------- */
37
/* --- Pictures --- */
38
/* ------------------------------------------------------------------------- */
40
#define GST_VAAPI_TYPE_PICTURE \
41
(gst_vaapi_picture_get_type())
43
#define GST_VAAPI_PICTURE_CAST(obj) \
44
((GstVaapiPicture *)(obj))
46
#define GST_VAAPI_PICTURE(obj) \
47
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
48
GST_VAAPI_TYPE_PICTURE, \
51
#define GST_VAAPI_PICTURE_CLASS(klass) \
52
(G_TYPE_CHECK_CLASS_CAST((klass), \
53
GST_VAAPI_TYPE_PICTURE, \
54
GstVaapiPictureClass))
56
#define GST_VAAPI_IS_PICTURE(obj) \
57
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_PICTURE))
59
#define GST_VAAPI_IS_PICTURE_CLASS(klass) \
60
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_PICTURE))
62
#define GST_VAAPI_PICTURE_GET_CLASS(obj) \
63
(G_TYPE_INSTANCE_GET_CLASS((obj), \
64
GST_VAAPI_TYPE_PICTURE, \
65
GstVaapiPictureClass))
67
enum _GstVaapiPictureType {
68
GST_VAAPI_PICTURE_TYPE_NONE = 0, // Undefined
69
GST_VAAPI_PICTURE_TYPE_I, // Intra
70
GST_VAAPI_PICTURE_TYPE_P, // Predicted
71
GST_VAAPI_PICTURE_TYPE_B, // Bi-directional predicted
72
GST_VAAPI_PICTURE_TYPE_S, // S(GMC)-VOP (MPEG-4)
73
GST_VAAPI_PICTURE_TYPE_SI, // Switching Intra
74
GST_VAAPI_PICTURE_TYPE_SP, // Switching Predicted
75
GST_VAAPI_PICTURE_TYPE_BI, // BI type (VC-1)
80
* @GST_VAAPI_PICTURE_FLAG_SKIPPED: skipped frame
81
* @GST_VAAPI_PICTURE_FLAG_REFERENCE: reference frame
82
* @GST_VAAPI_PICTURE_FLAG_LAST: first flag that can be used by subclasses
84
* Enum values used for #GstVaapiPicture flags.
87
GST_VAAPI_PICTURE_FLAG_SKIPPED = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 0),
88
GST_VAAPI_PICTURE_FLAG_REFERENCE = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 1),
89
GST_VAAPI_PICTURE_FLAG_LAST = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 2),
92
#define GST_VAAPI_PICTURE_FLAG_IS_SET GST_MINI_OBJECT_FLAG_IS_SET
93
#define GST_VAAPI_PICTURE_FLAG_SET GST_MINI_OBJECT_FLAG_SET
94
#define GST_VAAPI_PICTURE_FLAG_UNSET GST_MINI_OBJECT_FLAG_UNSET
96
#define GST_VAAPI_PICTURE_IS_REFERENCE(picture) \
97
GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_REFERENCE)
102
* A #GstVaapiCodecObject holding a picture parameter.
104
struct _GstVaapiPicture {
106
GstVaapiCodecObject parent_instance;
107
GstVaapiSurface *surface;
108
GstVaapiSurfaceProxy *proxy;
112
GstVaapiPictureType type;
113
VASurfaceID surface_id;
116
GstVaapiIqMatrix *iq_matrix;
117
GstVaapiBitPlane *bitplane;
122
* GstVaapiPictureClass:
124
* The #GstVaapiPicture base class.
126
struct _GstVaapiPictureClass {
128
GstVaapiCodecObjectClass parent_class;
132
gst_vaapi_picture_get_type(void)
136
gst_vaapi_picture_new(
137
GstVaapiDecoder *decoder,
143
gst_vaapi_picture_add_slice(GstVaapiPicture *picture, GstVaapiSlice *slice)
147
gst_vaapi_picture_decode(GstVaapiPicture *picture)
151
gst_vaapi_picture_output(GstVaapiPicture *picture)
154
static inline gpointer
155
gst_vaapi_picture_ref(gpointer ptr)
157
return gst_mini_object_ref(GST_MINI_OBJECT(ptr));
161
gst_vaapi_picture_unref(gpointer ptr)
163
gst_mini_object_unref(GST_MINI_OBJECT(ptr));
166
#define gst_vaapi_picture_replace(old_picture_p, new_picture) \
167
gst_mini_object_replace((GstMiniObject **)(old_picture_p), \
168
(GstMiniObject *)(new_picture))
170
/* ------------------------------------------------------------------------- */
172
/* ------------------------------------------------------------------------- */
174
#define GST_VAAPI_TYPE_SLICE \
175
(gst_vaapi_slice_get_type())
177
#define GST_VAAPI_SLICE_CAST(obj) \
178
((GstVaapiSlice *)(obj))
180
#define GST_VAAPI_SLICE(obj) \
181
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
182
GST_VAAPI_TYPE_SLICE, \
185
#define GST_VAAPI_SLICE_CLASS(klass) \
186
(G_TYPE_CHECK_CLASS_CAST((klass), \
187
GST_VAAPI_TYPE_SLICE, \
190
#define GST_VAAPI_IS_SLICE(obj) \
191
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_SLICE))
193
#define GST_VAAPI_IS_SLICE_CLASS(klass) \
194
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_SLICE))
196
#define GST_VAAPI_SLICE_GET_CLASS(obj) \
197
(G_TYPE_INSTANCE_GET_CLASS((obj), \
198
GST_VAAPI_TYPE_SLICE, \
204
* A #GstVaapiCodecObject holding a slice parameter.
206
struct _GstVaapiSlice {
208
GstVaapiCodecObject parent_instance;
217
* GstVaapiSliceClass:
219
* The #GstVaapiSlice base class.
221
struct _GstVaapiSliceClass {
223
GstVaapiCodecObjectClass parent_class;
227
gst_vaapi_slice_get_type(void)
232
GstVaapiDecoder *decoder,
239
/* ------------------------------------------------------------------------- */
240
/* --- Helpers to create codec-dependent objects --- */
241
/* ------------------------------------------------------------------------- */
243
#define GST_VAAPI_PICTURE_NEW(codec, decoder) \
244
gst_vaapi_picture_new(GST_VAAPI_DECODER_CAST(decoder), \
245
NULL, sizeof(VAPictureParameterBuffer##codec))
247
#define GST_VAAPI_SLICE_NEW(codec, decoder, buf, buf_size) \
248
gst_vaapi_slice_new(GST_VAAPI_DECODER_CAST(decoder), \
249
NULL, sizeof(VASliceParameterBuffer##codec), \
254
#endif /* GST_VAAPI_DECODER_OBJECTS_H */