1 /* GStreamer H264 encoder plugin
2 * Copyright (C) 2005 Michal Benes <michal.benes@itonis.tv>
3 * Copyright (C) 2005 Josef Zlomek <josef.zlomek@itonis.tv>
4 * Copyright (C) 2016 Sebastian Dröge <sebastian@centricular.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 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 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #ifndef __GST_X264_ENC_H__
23 #define __GST_X264_ENC_H__
26 #include <gst/video/video.h>
27 #include <gst/video/gstvideoencoder.h>
28 #include "gstencoderbitrateprofilemanager.h"
34 /* The x264.h header says this isn't needed with MinGW, but sometimes the
35 * compiler is unable to correctly do the pointer indirection for us, which
36 * leads to a segfault when you try to dereference any const values provided
37 * by x264.dll. See: https://bugzilla.gnome.org/show_bug.cgi?id=779249 */
38 #if defined(_WIN32) && !defined(X264_API_IMPORTS)
39 # define X264_API_IMPORTS
45 #define GST_TYPE_X264_ENC \
46 (gst_x264_enc_get_type())
47 #define GST_X264_ENC(obj) \
48 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_X264_ENC,GstX264Enc))
49 #define GST_X264_ENC_CLASS(klass) \
50 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_X264_ENC,GstX264EncClass))
51 #define GST_IS_X264_ENC(obj) \
52 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_X264_ENC))
53 #define GST_IS_X264_ENC_CLASS(klass) \
54 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_X264_ENC))
56 typedef struct _GstX264Enc GstX264Enc;
57 typedef struct _GstX264EncClass GstX264EncClass;
58 typedef struct _GstX264EncVTable GstX264EncVTable;
62 GstVideoEncoder element;
65 GstX264EncVTable *vtable;
67 x264_param_t x264param;
68 gint current_byte_stream;
70 /* List of frame/buffer mapping structs for
72 GList *pending_frames;
76 gboolean sliced_threads;
83 gboolean intra_refresh;
96 guint vbv_buf_capacity;
106 guint noise_reduction;
112 GString *option_string_prop; /* option-string property */
113 GString *option_string; /* used by set prop */
117 /* input description */
118 GstVideoCodecState *input_state;
120 /* configuration changed while playing */
123 /* from the downstream caps */
124 const gchar *peer_profile;
125 gboolean peer_intra_profile;
128 /* cached values to set x264_picture_t */
131 GstEncoderBitrateProfileManager *bitrate_manager;
134 struct _GstX264EncClass
136 GstVideoEncoderClass parent_class;
139 GType gst_x264_enc_get_type (void);
140 GST_ELEMENT_REGISTER_DECLARE (x264enc);
144 #endif /* __GST_X264_ENC_H__ */