[MOVED FROM BAD 01/28] Add libx264-based h264 encoder plugin (#421110). Probably...
[platform/upstream/gst-plugins-ugly.git] / ext / x264 / gstx264enc.h
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  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __GST_X264_ENC_H__
22 #define __GST_X264_ENC_H__
23
24 #include <gst/gst.h>
25 #include <_stdint.h>
26 #include <x264.h>
27
28 G_BEGIN_DECLS
29
30 #define GST_TYPE_X264_ENC \
31   (gst_x264_enc_get_type())
32 #define GST_X264_ENC(obj) \
33   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_X264_ENC,GstX264Enc))
34 #define GST_X264_ENC_CLASS(klass) \
35   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_X264_ENC,GstX264EncClass))
36 #define GST_IS_X264_ENC(obj) \
37   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_X264_ENC))
38 #define GST_IS_X264_ENC_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_X264_ENC))
40
41 typedef struct _GstX264Enc GstX264Enc;
42 typedef struct _GstX264EncClass GstX264EncClass;
43  
44 struct _GstX264Enc
45 {
46   GstElement element;
47
48   /*< private >*/
49   GstPad *sinkpad;
50   GstPad *srcpad;
51
52   x264_t *x264enc;
53   x264_param_t x264param;
54
55   guint threads;
56   guint pass;
57   gchar *stats_file;
58   gboolean byte_stream;
59   guint bitrate;
60   gint me;
61   guint subme;
62   guint analyse;
63   gboolean dct8x8;
64   guint ref;
65   guint bframes;
66   gboolean b_pyramid;
67   gboolean weightb;
68   guint sps_id;
69   gboolean trellis;
70   guint vbv_buf_capacity;
71   guint keyint_max;
72   gboolean cabac;
73
74   gint width, height;
75   guint stride, luma_plane_size;
76   gint framerate_num, framerate_den;
77   gint par_num, par_den;
78
79   GstClockTime last_timestamp;
80   GstClockTime *timestamp_queue;
81   GstClockTime *timestamp_queue_dur;
82   guint timestamp_queue_size;
83   guint timestamp_queue_head;
84   guint timestamp_queue_tail;
85
86   guint8 *buffer;
87   gulong buffer_size;
88 };
89
90 struct _GstX264EncClass
91 {
92   GstElementClass parent_class;
93 };
94
95 G_END_DECLS
96
97 #endif /* __GST_X264_ENC_H__ */