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 "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 (gst_vaapi_base_encoder_get_type())
35 #define GST_IS_VAAPI_BASE_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_BASE_ENCODER))
36 #define GST_IS_VAAPI_BASE_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VAAPI_BASE_ENCODER))
37 #define GST_VAAPI_BASE_ENCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VAAPI_BASE_ENCODER, GstVaapiBaseEncoderClass))
38 #define GST_VAAPI_BASE_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_BASE_ENCODER, GstVaapiBaseEncoder))
39 #define GST_VAAPI_BASE_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VAAPI_BASE_ENCODER, GstVaapiBaseEncoderClass))
40 #define GST_VAAPI_BASE_ENCODER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj),GST_TYPE_VAAPI_BASE_ENCODER, GstVaapiBaseEncoderPrivate))
43 struct _GstVaapiBaseEncoder {
44 GstVaapiEncoder parent;
47 struct _GstVaapiBaseEncoderClass {
48 GstVaapiEncoderClass parent_class;
50 /* in <open> function*/
51 gboolean (*validate_attributes) (GstVaapiBaseEncoder* encoder);
52 gboolean (*pre_alloc_resource) (GstVaapiBaseEncoder *base_encoder, GstVaapiDisplay *display, GstVaapiContext *context);
54 /* in <close> function */
55 gboolean (*release_resource) (GstVaapiBaseEncoder* encoder, GstVaapiDisplay *display, GstVaapiContext *context);
57 /* in <encode> function */
58 EncoderStatus (*prepare_next_input_buffer)(GstVaapiBaseEncoder* encoder, GstVaapiVideoBuffer *display_buf,
59 gboolean need_flush, GstVaapiVideoBuffer **out_buf);
60 EncoderStatus (*render_frame) (GstVaapiBaseEncoder *encoder, GstVaapiDisplay *display,
61 GstVaapiContext *context, GstVaapiSurface *surface,
62 guint frame_index, VABufferID coded_buf, gboolean *is_key);
63 void (*encode_frame_failed) (GstVaapiBaseEncoder *encoder, GstVaapiVideoBuffer* buffer);
64 void (*notify_frame) (GstVaapiBaseEncoder *encoder, guint8 *buf, guint32 size);
65 GstBuffer *(*copy_coded_frame) (GstVaapiBaseEncoder *encoder, guint8 *buf, guint32 size, VABufferID *coded_buf);
69 struct _GstVaapiBaseEncoderPrivate {
70 GstVaapiDisplay *display;
71 GstVaapiContext *context;
72 //VAAPI_Encode_State state;
76 GType gst_vaapi_base_encoder_get_type(void);
77 void gst_vaapi_base_encoder_set_frame_notify(GstVaapiBaseEncoder *encoder, gboolean flag);
78 gboolean gst_vaapi_base_encoder_set_va_profile(GstVaapiBaseEncoder *encoder, guint profile);
79 void gst_vaapi_base_encoder_set_input_format(GstVaapiBaseEncoder* encoder, guint32 format);