x264enc: Shift both PTS and DTS to ensure positive timestamp
[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., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef __GST_X264_ENC_H__
22 #define __GST_X264_ENC_H__
23
24 #include <gst/gst.h>
25 #include <gst/video/video.h>
26 #include <gst/video/gstvideoencoder.h>
27 #include "_stdint.h"
28 #include <x264.h>
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_X264_ENC \
33   (gst_x264_enc_get_type())
34 #define GST_X264_ENC(obj) \
35   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_X264_ENC,GstX264Enc))
36 #define GST_X264_ENC_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_X264_ENC,GstX264EncClass))
38 #define GST_IS_X264_ENC(obj) \
39   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_X264_ENC))
40 #define GST_IS_X264_ENC_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_X264_ENC))
42
43 typedef struct _GstX264Enc GstX264Enc;
44 typedef struct _GstX264EncClass GstX264EncClass;
45
46 struct _GstX264Enc
47 {
48   GstVideoEncoder element;
49
50   /*< private >*/
51   x264_t *x264enc;
52   x264_param_t x264param;
53   gint current_byte_stream;
54   gint64 ts_offset;
55
56   /* List of frame/buffer mapping structs for
57    * pending frames */
58   GList *pending_frames;
59
60   /* properties */
61   guint threads;
62   gboolean sliced_threads;
63   gint sync_lookahead;
64   gint pass;
65   guint quantizer;
66   gchar *mp_cache_file;
67   gboolean byte_stream;
68   guint bitrate;
69   gboolean intra_refresh;
70   gint me;
71   guint subme;
72   guint analyse;
73   gboolean dct8x8;
74   guint ref;
75   guint bframes;
76   gboolean b_adapt;
77   gboolean b_pyramid;
78   gboolean weightb;
79   guint sps_id;
80   gboolean au_nalu;
81   gboolean trellis;
82   guint vbv_buf_capacity;
83   guint keyint_max;
84   gboolean cabac;
85   gfloat ip_factor;
86   gfloat pb_factor;
87   guint qp_min;
88   guint qp_max;
89   guint qp_step;
90   gboolean mb_tree;
91   gint rc_lookahead;
92   guint noise_reduction;
93   gboolean interlaced;
94   gint speed_preset;
95   gint psy_tune;
96   guint tune;
97   GString *tunings;
98   GString *option_string_prop; /* option-string property */
99   GString *option_string; /* used by set prop */
100
101   /* input description */
102   GstVideoCodecState *input_state;
103
104   /* configuration changed  while playing */
105   gboolean reconfig;
106
107   /* from the downstream caps */
108   const gchar *peer_profile;
109   gboolean peer_intra_profile;
110   const x264_level_t *peer_level;
111 };
112
113 struct _GstX264EncClass
114 {
115   GstVideoEncoderClass parent_class;
116 };
117
118 GType gst_x264_enc_get_type (void);
119
120 G_END_DECLS
121
122 #endif /* __GST_X264_ENC_H__ */