2 * gstvaapiencoder_h264.h - H.264 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_ENCODER_H264_H_
23 #define _GST_VAAPI_ENCODER_H264_H_
26 #include "gst/vaapi/gstvaapisurfacepool.h"
28 #include "gstvaapibaseencoder.h"
32 typedef struct _GstVaapiEncoderH264 GstVaapiEncoderH264;
33 typedef struct _GstVaapiEncoderH264Private GstVaapiEncoderH264Private;
34 typedef struct _GstVaapiEncoderH264Class GstVaapiEncoderH264Class;
37 #define GST_TYPE_VAAPI_ENCODER_H264 (gst_vaapi_encoder_h264_get_type())
38 #define GST_IS_VAAPI_ENCODER_H264(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_ENCODER_H264))
39 #define GST_IS_VAAPI_ENCODER_H264_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VAAPI_ENCODER_H264))
40 #define GST_VAAPI_ENCODER_H264_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VAAPI_ENCODER_H264, GstVaapiEncoderH264Class))
41 #define GST_VAAPI_ENCODER_H264(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_ENCODER_H264, GstVaapiEncoderH264))
42 #define GST_VAAPI_ENCODER_H264_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VAAPI_ENCODER_H264, GstVaapiEncoderH264Class))
43 #define GST_VAAPI_ENCODER_H264_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj),GST_TYPE_VAAPI_ENCODER_H264,GstVaapiEncoderH264Private))
46 H264_PROFILE_BASELINE = 66,
47 H264_PROFILE_MAIN = 77,
48 H264_PROFILE_EXTENDED = 88,
49 H264_PROFILE_HIGH = 100,
50 H264_PROFILE_HIGH10 = 110,
51 H264_PROFILE_HIGH422 = 122,
52 H264_PROFILE_HIGH444 = 144,
53 H264_PROFILE_HIGH444_PREDICTIVE = 244,
57 H264_LEVEL_10 = 10, /* QCIF format, < 380160 samples/sec */
58 H264_LEVEL_11 = 11, /* CIF format, < 768000 samples/sec */
59 H264_LEVEL_12 = 12, /* CIF format, < 1536000 samples/sec */
60 H264_LEVEL_13 = 13, /* CIF format, < 3041280 samples/sec */
61 H264_LEVEL_20 = 20, /* CIF format, < 3041280 samples/sec */
62 H264_LEVEL_21 = 21, /* HHR format, < 5068800 samples/sec */
63 H264_LEVEL_22 = 22, /* SD/4CIF format, < 5184000 samples/sec */
64 H264_LEVEL_30 = 30, /* SD/4CIF format, < 10368000 samples/sec */
65 H264_LEVEL_31 = 31, /* 720pHD format, < 27648000 samples/sec */
66 H264_LEVEL_32 = 32, /* SXGA format, < 55296000 samples/sec */
67 H264_LEVEL_40 = 40, /* 2Kx1K format, < 62914560 samples/sec */
68 H264_LEVEL_41 = 41, /* 2Kx1K format, < 62914560 samples/sec */
69 H264_LEVEL_42 = 42, /* 2Kx1K format, < 125829120 samples/sec */
70 H264_LEVEL_50 = 50, /* 3672x1536 format, < 150994944 samples/sec */
71 H264_LEVEL_51 = 51, /* 4096x2304 format, < 251658240 samples/sec */
74 #define H264_DEFAULT_PROFILE H264_PROFILE_BASELINE
75 #define H264_DEFAULT_LEVEL H264_LEVEL_30
76 #define H264_DEFAULT_INIT_QP 24
77 #define H264_DEFAULT_MIN_QP 1
78 #define H264_DEFAULT_INTRA_PERIOD 30
79 #define H264_DEFAULT_FPS 30
80 #define H264_DEFAULT_SLICE_NUM 1
82 struct _GstVaapiEncoderH264 {
83 GstVaapiBaseEncoder parent; /*based on gobject*/
85 GstVaapiEncoderH264Private *priv;
91 guint32 init_qp; /*default 24*/
92 guint32 min_qp; /*default 1*/
97 struct _GstVaapiEncoderH264Class {
98 GstVaapiBaseEncoderClass parent_class;
102 GType gst_vaapi_encoder_h264_get_type(void);
104 GstVaapiEncoderH264 *gst_vaapi_encoder_h264_new(void);
105 static inline void gst_vaapi_encoder_h264_unref (GstVaapiEncoderH264 * encoder)
107 g_object_unref (encoder);
110 void gst_vaapi_encoder_h264_set_avc_flag(GstVaapiEncoderH264* encoder, gboolean avc);
111 gboolean gst_vaapi_encoder_h264_get_avc_flag(GstVaapiEncoderH264* encoder);
117 #endif /*_GST_VAAPI_ENCODER_H264_H_ */