~ubuntu-branches/ubuntu/quantal/gstreamer-vaapi/quantal

« back to all changes in this revision

Viewing changes to gst-libs/gst/vaapi/gstvaapidecoder_objects.h

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-02-10 14:35:09 UTC
  • Revision ID: package-import@ubuntu.com-20120210143509-wq9j8uqb5leu1iik
Tags: upstream-0.3.4
ImportĀ upstreamĀ versionĀ 0.3.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  gstvaapidecoder_objects.h - VA decoder objects
 
3
 *
 
4
 *  Copyright (C) 2010-2011 Splitted-Desktop Systems
 
5
 *  Copyright (C) 2011-2012 Intel Corporation
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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
 
21
 */
 
22
 
 
23
#ifndef GST_VAAPI_DECODER_OBJECTS_H
 
24
#define GST_VAAPI_DECODER_OBJECTS_H
 
25
 
 
26
#include <gst/vaapi/gstvaapicodec_objects.h>
 
27
 
 
28
G_BEGIN_DECLS
 
29
 
 
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;
 
35
 
 
36
/* ------------------------------------------------------------------------- */
 
37
/* --- Pictures                                                          --- */
 
38
/* ------------------------------------------------------------------------- */
 
39
 
 
40
#define GST_VAAPI_TYPE_PICTURE \
 
41
    (gst_vaapi_picture_get_type())
 
42
 
 
43
#define GST_VAAPI_PICTURE_CAST(obj) \
 
44
    ((GstVaapiPicture *)(obj))
 
45
 
 
46
#define GST_VAAPI_PICTURE(obj)                          \
 
47
    (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
 
48
                                GST_VAAPI_TYPE_PICTURE, \
 
49
                                GstVaapiPicture))
 
50
 
 
51
#define GST_VAAPI_PICTURE_CLASS(klass)                  \
 
52
    (G_TYPE_CHECK_CLASS_CAST((klass),                   \
 
53
                             GST_VAAPI_TYPE_PICTURE,    \
 
54
                             GstVaapiPictureClass))
 
55
 
 
56
#define GST_VAAPI_IS_PICTURE(obj) \
 
57
    (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_PICTURE))
 
58
 
 
59
#define GST_VAAPI_IS_PICTURE_CLASS(klass) \
 
60
    (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_PICTURE))
 
61
 
 
62
#define GST_VAAPI_PICTURE_GET_CLASS(obj)                \
 
63
    (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
 
64
                               GST_VAAPI_TYPE_PICTURE,  \
 
65
                               GstVaapiPictureClass))
 
66
 
 
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)
 
76
};
 
77
 
 
78
/**
 
79
 * Picture flags:
 
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
 
83
 *
 
84
 * Enum values used for #GstVaapiPicture flags.
 
85
 */
 
86
enum {
 
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),
 
90
};
 
91
 
 
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
 
95
 
 
96
#define GST_VAAPI_PICTURE_IS_REFERENCE(picture) \
 
97
    GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_REFERENCE)
 
98
 
 
99
/**
 
100
 * GstVaapiPicture:
 
101
 *
 
102
 * A #GstVaapiCodecObject holding a picture parameter.
 
103
 */
 
104
struct _GstVaapiPicture {
 
105
    /*< private >*/
 
106
    GstVaapiCodecObject         parent_instance;
 
107
    GstVaapiSurface            *surface;
 
108
    GstVaapiSurfaceProxy       *proxy;
 
109
    VABufferID                  param_id;
 
110
 
 
111
    /*< public >*/
 
112
    GstVaapiPictureType         type;
 
113
    VASurfaceID                 surface_id;
 
114
    gpointer                    param;
 
115
    GPtrArray                  *slices;
 
116
    GstVaapiIqMatrix           *iq_matrix;
 
117
    GstVaapiBitPlane           *bitplane;
 
118
    GstClockTime                pts;
 
119
};
 
120
 
 
121
/**
 
122
 * GstVaapiPictureClass:
 
123
 *
 
124
 * The #GstVaapiPicture base class.
 
125
 */
 
126
struct _GstVaapiPictureClass {
 
127
    /*< private >*/
 
128
    GstVaapiCodecObjectClass    parent_class;
 
129
};
 
130
 
 
131
GType
 
132
gst_vaapi_picture_get_type(void)
 
133
    attribute_hidden;
 
134
 
 
135
GstVaapiPicture *
 
136
gst_vaapi_picture_new(
 
137
    GstVaapiDecoder *decoder,
 
138
    gconstpointer    param,
 
139
    guint            param_size
 
140
) attribute_hidden;
 
141
 
 
142
void
 
143
gst_vaapi_picture_add_slice(GstVaapiPicture *picture, GstVaapiSlice *slice)
 
144
    attribute_hidden;
 
145
 
 
146
gboolean
 
147
gst_vaapi_picture_decode(GstVaapiPicture *picture)
 
148
    attribute_hidden;
 
149
 
 
150
gboolean
 
151
gst_vaapi_picture_output(GstVaapiPicture *picture)
 
152
    attribute_hidden;
 
153
 
 
154
static inline gpointer
 
155
gst_vaapi_picture_ref(gpointer ptr)
 
156
{
 
157
    return gst_mini_object_ref(GST_MINI_OBJECT(ptr));
 
158
}
 
159
 
 
160
static inline void
 
161
gst_vaapi_picture_unref(gpointer ptr)
 
162
{
 
163
    gst_mini_object_unref(GST_MINI_OBJECT(ptr));
 
164
}
 
165
 
 
166
#define gst_vaapi_picture_replace(old_picture_p, new_picture)   \
 
167
    gst_mini_object_replace((GstMiniObject **)(old_picture_p),  \
 
168
                            (GstMiniObject *)(new_picture))
 
169
 
 
170
/* ------------------------------------------------------------------------- */
 
171
/* --- Slices                                                            --- */
 
172
/* ------------------------------------------------------------------------- */
 
173
 
 
174
#define GST_VAAPI_TYPE_SLICE \
 
175
    (gst_vaapi_slice_get_type())
 
176
 
 
177
#define GST_VAAPI_SLICE_CAST(obj) \
 
178
    ((GstVaapiSlice *)(obj))
 
179
 
 
180
#define GST_VAAPI_SLICE(obj)                            \
 
181
    (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
 
182
                                GST_VAAPI_TYPE_SLICE,   \
 
183
                                GstVaapiSlice))
 
184
 
 
185
#define GST_VAAPI_SLICE_CLASS(klass)                    \
 
186
    (G_TYPE_CHECK_CLASS_CAST((klass),                   \
 
187
                             GST_VAAPI_TYPE_SLICE,      \
 
188
                             GstVaapiSliceClass))
 
189
 
 
190
#define GST_VAAPI_IS_SLICE(obj) \
 
191
    (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_SLICE))
 
192
 
 
193
#define GST_VAAPI_IS_SLICE_CLASS(klass) \
 
194
    (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_SLICE))
 
195
 
 
196
#define GST_VAAPI_SLICE_GET_CLASS(obj)                  \
 
197
    (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
 
198
                               GST_VAAPI_TYPE_SLICE,    \
 
199
                               GstVaapiSliceClass))
 
200
 
 
201
/**
 
202
 * GstVaapiSlice:
 
203
 *
 
204
 * A #GstVaapiCodecObject holding a slice parameter.
 
205
 */
 
206
struct _GstVaapiSlice {
 
207
    /*< private >*/
 
208
    GstVaapiCodecObject         parent_instance;
 
209
 
 
210
    /*< public >*/
 
211
    VABufferID                  param_id;
 
212
    VABufferID                  data_id;
 
213
    gpointer                    param;
 
214
};
 
215
 
 
216
/**
 
217
 * GstVaapiSliceClass:
 
218
 *
 
219
 * The #GstVaapiSlice base class.
 
220
 */
 
221
struct _GstVaapiSliceClass {
 
222
    /*< private >*/
 
223
    GstVaapiCodecObjectClass    parent_class;
 
224
};
 
225
 
 
226
GType
 
227
gst_vaapi_slice_get_type(void)
 
228
    attribute_hidden;
 
229
 
 
230
GstVaapiSlice *
 
231
gst_vaapi_slice_new(
 
232
    GstVaapiDecoder *decoder,
 
233
    gconstpointer    param,
 
234
    guint            param_size,
 
235
    const guchar    *data,
 
236
    guint            data_size
 
237
) attribute_hidden;
 
238
 
 
239
/* ------------------------------------------------------------------------- */
 
240
/* --- Helpers to create codec-dependent objects                         --- */
 
241
/* ------------------------------------------------------------------------- */
 
242
 
 
243
#define GST_VAAPI_PICTURE_NEW(codec, decoder)                           \
 
244
    gst_vaapi_picture_new(GST_VAAPI_DECODER_CAST(decoder),              \
 
245
                          NULL, sizeof(VAPictureParameterBuffer##codec))
 
246
 
 
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),    \
 
250
                        buf, buf_size)
 
251
 
 
252
G_END_DECLS
 
253
 
 
254
#endif /* GST_VAAPI_DECODER_OBJECTS_H */