add Intel Copyright
[profile/ivi/gstreamer-vaapi.git] / gst / vaapiencode / gstvaapih264encoder.h
1 /*
2  *  gstvaapih264encoder.h -  H.264 encoder
3  *
4  *  Copyright (C) 2011 Intel Corporation
5  *
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.
10  *
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.
15  *
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
20  */
21
22 #ifndef _GST_H264_ENCODER_H_
23 #define _GST_H264_ENCODER_H_
24
25
26 #include "gst/vaapi/gstvaapisurfacepool.h"
27
28 #include "gstvaapibaseencoder.h"
29
30 G_BEGIN_DECLS
31
32 typedef struct _GstH264Encoder              GstH264Encoder;
33 typedef struct _GstH264EncoderPrivate       GstH264EncoderPrivate;
34 typedef struct _GstH264EncoderClass         GstH264EncoderClass;
35
36
37 #define GST_TYPE_H264_ENCODER             (gst_h264_encoder_get_type())
38 #define GST_IS_H264_ENCODER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_H264_ENCODER))
39 #define GST_IS_H264_ENCODER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_H264_ENCODER))
40 #define GST_H264_ENCODER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_H264_ENCODER, GstH264EncoderClass))
41 #define GST_H264_ENCODER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_H264_ENCODER, GstH264Encoder))
42 #define GST_H264_ENCODER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_H264_ENCODER, GstH264EncoderClass))
43 #define GST_H264_ENCODER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj),GST_TYPE_H264_ENCODER,GstH264EncoderPrivate))
44
45 typedef enum {
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,
54 } H264_Profile;
55
56 typedef enum {
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 */
72 } H264_Level;
73
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
81
82 struct _GstH264Encoder {
83   GstVaapiBaseEncoder parent;   /*based on gobject*/
84
85   guint32         profile;
86   guint32         level;
87   guint32         bitrate;
88   guint32         intra_period;
89   guint32         init_qp;  /*default 24*/
90   guint32         min_qp;   /*default 1*/
91   guint32         slice_num;
92   guint32         b_frame_num;
93 };
94
95 struct _GstH264EncoderClass {
96     GstVaapiBaseEncoderClass parent_class;
97 };
98
99
100 GType    gst_h264_encoder_get_type(void);
101
102 GstH264Encoder *gst_h264_encoder_new(void);
103 static inline void gst_h264_encoder_unref (GstH264Encoder * encoder)
104 {
105   g_object_unref (encoder);
106 }
107
108 void     gst_h264_encoder_set_es_flag(GstH264Encoder* encoder, gboolean es);
109
110
111 G_END_DECLS
112
113 #endif /*_GST_H264_ENCODER_H_ */
114