1 #ifndef GST_VAAPI_BASE_ENCODER_H
2 #define GST_VAAPI_BASE_ENCODER_H
4 #include "gstvaapiencoder.h"
5 #include "gst/vaapi/gstvaapivideobuffer.h"
9 typedef struct _GstVaapiBaseEncoder GstVaapiBaseEncoder;
10 typedef struct _GstVaapiBaseEncoderPrivate GstVaapiBaseEncoderPrivate;
11 typedef struct _GstVaapiBaseEncoderClass GstVaapiBaseEncoderClass;
13 #define GST_TYPE_VAAPI_BASE_ENCODER (gst_vaapi_base_encoder_get_type())
14 #define GST_IS_VAAPI_BASE_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_BASE_ENCODER))
15 #define GST_IS_VAAPI_BASE_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VAAPI_BASE_ENCODER))
16 #define GST_VAAPI_BASE_ENCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VAAPI_BASE_ENCODER, GstVaapiBaseEncoderClass))
17 #define GST_VAAPI_BASE_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_BASE_ENCODER, GstVaapiBaseEncoder))
18 #define GST_VAAPI_BASE_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VAAPI_BASE_ENCODER, GstVaapiBaseEncoderClass))
19 #define GST_VAAPI_BASE_ENCODER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj),GST_TYPE_VAAPI_BASE_ENCODER, GstVaapiBaseEncoderPrivate))
22 struct _GstVaapiBaseEncoder {
23 GstVaapiEncoder parent;
26 struct _GstVaapiBaseEncoderClass {
27 GstVaapiEncoderClass parent_class;
29 /* in <open> function*/
30 gboolean (*validate_attributes) (GstVaapiBaseEncoder* encoder);
31 gboolean (*pre_alloc_resource) (GstVaapiBaseEncoder *base_encoder, GstVaapiDisplay *display, GstVaapiContext *context);
33 /* in <close> function */
34 gboolean (*release_resource) (GstVaapiBaseEncoder* encoder, GstVaapiDisplay *display, GstVaapiContext *context);
36 /* in <encode> function */
37 EncoderStatus (*prepare_next_input_buffer)(GstVaapiBaseEncoder* encoder, GstVaapiVideoBuffer *display_buf,
38 gboolean need_flush, GstVaapiVideoBuffer **out_buf);
39 EncoderStatus (*render_frame) (GstVaapiBaseEncoder *encoder, GstVaapiDisplay *display,
40 GstVaapiContext *context, GstVaapiSurface *surface,
41 guint frame_index, VABufferID coded_buf, gboolean *is_key);
42 void (*encode_frame_failed) (GstVaapiBaseEncoder *encoder, GstVaapiVideoBuffer* buffer);
43 void (*notify_frame) (GstVaapiBaseEncoder *encoder, guint8 *buf, guint32 size);
44 GstBuffer *(*copy_coded_frame) (GstVaapiBaseEncoder *encoder, guint8 *buf, guint32 size, VABufferID *coded_buf);
48 struct _GstVaapiBaseEncoderPrivate {
49 GstVaapiDisplay *display;
50 GstVaapiContext *context;
51 //VAAPI_Encode_State state;
55 GType gst_vaapi_base_encoder_get_type(void);
56 void gst_vaapi_base_encoder_set_frame_notify(GstVaapiBaseEncoder *encoder, gboolean flag);
57 gboolean gst_vaapi_base_encoder_set_va_profile(GstVaapiBaseEncoder *encoder, guint profile);
58 void gst_vaapi_base_encoder_set_input_format(GstVaapiBaseEncoder* encoder, guint32 format);