2 * gstvaapibaseencoder.h - VA-API base encoder
4 * Copyright (C) 2011 Intel Corporation
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.
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.
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
22 #ifndef GST_VAAPI_BASE_ENCODER_H
23 #define GST_VAAPI_BASE_ENCODER_H
25 #include "gst/vaapi/gstvaapiencoder.h"
26 #include "gst/vaapi/gstvaapivideobuffer.h"
30 typedef struct _GstVaapiBaseEncoder GstVaapiBaseEncoder;
31 typedef struct _GstVaapiBaseEncoderPrivate GstVaapiBaseEncoderPrivate;
32 typedef struct _GstVaapiBaseEncoderClass GstVaapiBaseEncoderClass;
34 #define GST_TYPE_VAAPI_BASE_ENCODER \
35 (gst_vaapi_base_encoder_get_type())
37 #define GST_IS_VAAPI_BASE_ENCODER(obj) \
38 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_BASE_ENCODER))
40 #define GST_IS_VAAPI_BASE_ENCODER_CLASS(klass) \
41 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VAAPI_BASE_ENCODER))
43 #define GST_VAAPI_BASE_ENCODER_GET_CLASS(obj) \
44 (G_TYPE_INSTANCE_GET_CLASS ((obj), \
45 GST_TYPE_VAAPI_BASE_ENCODER, \
46 GstVaapiBaseEncoderClass))
48 #define GST_VAAPI_BASE_ENCODER(obj) \
49 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
50 GST_TYPE_VAAPI_BASE_ENCODER, \
53 #define GST_VAAPI_BASE_ENCODER_CLASS(klass) \
54 (G_TYPE_CHECK_CLASS_CAST ((klass), \
55 GST_TYPE_VAAPI_BASE_ENCODER, \
56 GstVaapiBaseEncoderClass))
58 #define GST_VAAPI_BASE_ENCODER_GET_PRIVATE(obj) \
59 (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
60 GST_TYPE_VAAPI_BASE_ENCODER, \
61 GstVaapiBaseEncoderPrivate))
63 /* return: if true, continue; else, stop*/
65 (*GstVaapiBaseEncoderNotifyStatus)(
66 GstVaapiBaseEncoder* encoder,
70 struct _GstVaapiBaseEncoder {
71 GstVaapiEncoder parent;
73 GstVaapiBaseEncoderPrivate *priv;
76 struct _GstVaapiBaseEncoderClass {
77 GstVaapiEncoderClass parent_class;
79 /* in <open> function*/
80 gboolean (*validate_attributes) (GstVaapiBaseEncoder* encoder);
81 gboolean (*pre_alloc_resource) (GstVaapiBaseEncoder *encoder,
82 GstVaapiContext* context);
84 /* in <close> function */
85 gboolean (*release_resource) (GstVaapiBaseEncoder* encoder);
87 /* in <encode> function */
88 EncoderStatus (*prepare_next_input_buffer)(GstVaapiBaseEncoder* encoder,
89 GstBuffer *display_buf,
93 EncoderStatus (*render_frame) (GstVaapiBaseEncoder *encoder,
94 GstVaapiSurface *surface,
99 void (*encode_frame_failed) (GstVaapiBaseEncoder *encoder,
100 GstVaapiVideoBuffer* buffer);
102 void (*notify_buffer) (GstVaapiBaseEncoder *encoder,
103 guint8 *buf, guint32 size);
105 GstBuffer *(*wrap_buffer) (GstVaapiBaseEncoder *encoder,
110 gst_vaapi_base_encoder_get_type(void);
113 gst_vaapi_base_encoder_set_frame_notify(
114 GstVaapiBaseEncoder *encoder,
119 gst_vaapi_base_encoder_set_va_profile(
120 GstVaapiBaseEncoder *encoder,
124 gst_vaapi_base_encoder_set_input_format(
125 GstVaapiBaseEncoder* encoder,
130 gst_vaapi_base_encoder_set_notify_status(
131 GstVaapiBaseEncoder *encoder,
132 GstVaapiBaseEncoderNotifyStatus func,
137 gst_vaapi_base_encoder_set_buffer_sharing(
138 GstVaapiBaseEncoder *encoder,
139 gboolean is_buffer_sharing
144 #endif /* GST_VAAPI_BASE_ENCODER_H */