1 /* 2 * gstvaapiencode.h - VA-API video encoder 3 * 4 * Copyright (C) 2013-2014 Intel Corporation 5 * Author: Wind Yuan <feng.yuan@intel.com> 6 * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com> 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public License 10 * as published by the Free Software Foundation; either version 2.1 11 * of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free 20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * Boston, MA 02110-1301 USA 22 */ 23 24 #ifndef GST_VAAPIENCODE_H 25 #define GST_VAAPIENCODE_H 26 27 #include "gstvaapipluginbase.h" 28 #include <gst/vaapi/gstvaapiencoder.h> 29 30 #if USE_H264_FEI_ENCODER 31 #include <gst/vaapi/gstvaapisurface.h> 32 #include <gst/vaapi/gstvaapicodedbufferproxy.h> 33 #include "gstvaapifeivideometa.h" 34 #endif 35 36 G_BEGIN_DECLS 37 38 #define GST_TYPE_VAAPIENCODE \ 39 (gst_vaapiencode_get_type ()) 40 #define GST_VAAPIENCODE_CAST(obj) \ 41 ((GstVaapiEncode *)(obj)) 42 #define GST_VAAPIENCODE(obj) \ 43 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPIENCODE, GstVaapiEncode)) 44 #define GST_VAAPIENCODE_CLASS(klass) \ 45 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VAAPIENCODE, GstVaapiEncodeClass)) 46 #define GST_VAAPIENCODE_GET_CLASS(obj) \ 47 (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VAAPIENCODE, GstVaapiEncodeClass)) 48 #define GST_IS_VAAPIENCODE(obj) \ 49 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPIENCODE)) 50 #define GST_IS_VAAPIENCODE_CLASS(klass) \ 51 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VAAPIENCODE)) 52 53 typedef struct _GstVaapiEncode GstVaapiEncode; 54 typedef struct _GstVaapiEncodeClass GstVaapiEncodeClass; 55 56 struct _GstVaapiEncode 57 { 58 /*< private >*/ 59 GstVaapiPluginBase parent_instance; 60 61 GstVaapiEncoder *encoder; 62 GstVideoCodecState *input_state; 63 gboolean input_state_changed; 64 /* needs to be set by the subclass implementation */ 65 gboolean need_codec_data; 66 GstVideoCodecState *output_state; 67 GPtrArray *prop_values; 68 GstCaps *allowed_sinkpad_caps; 69 }; 70 71 struct _GstVaapiEncodeClass 72 { 73 /*< private >*/ 74 GstVaapiPluginBaseClass parent_class; 75 76 GPtrArray * (*get_properties) (void); 77 gboolean (*get_property) (GstVaapiEncode * encode, 78 guint prop_id, GValue * value); 79 gboolean (*set_property) (GstVaapiEncode * encode, 80 guint prop_id, const GValue * value); 81 82 gboolean (*set_config) (GstVaapiEncode * encode); 83 GstCaps * (*get_caps) (GstVaapiEncode * encode); 84 GstVaapiEncoder * (*alloc_encoder) (GstVaapiEncode * encode, 85 GstVaapiDisplay * display); 86 GstFlowReturn (*alloc_buffer) (GstVaapiEncode * encode, 87 GstVaapiCodedBuffer * coded_buf, 88 GstBuffer ** outbuf_ptr); 89 GstVaapiProfile (*get_profile) (GstCaps * caps); 90 91 #if USE_H264_FEI_ENCODER 92 93 gboolean (*load_control_data) (GstVaapiEncode *encoder, 94 GstVaapiFeiVideoMeta *feimeta, 95 GstVaapiSurfaceProxy *proxy); 96 97 GstVaapiFeiVideoMeta* (*save_stats_to_meta) (GstVaapiEncode *base_encode, 98 GstVaapiCodedBufferProxy *proxy); 99 100 #endif 101 102 }; 103 104 GType 105 gst_vaapiencode_get_type (void) G_GNUC_CONST; 106 107 G_GNUC_INTERNAL 108 gboolean 109 gst_vaapiencode_init_properties (GstVaapiEncode * encode); 110 111 G_GNUC_INTERNAL 112 gboolean 113 gst_vaapiencode_class_init_properties (GstVaapiEncodeClass * encode_class); 114 115 G_END_DECLS 116 117 #endif /* GST_VAAPIENCODE_H */ 118