2 * Copyright (C) 2011, Hewlett-Packard Development Company, L.P.
3 * Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>, Collabora Ltd.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation
8 * version 2.1 of the License.
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 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef __GST_OMX_VIDEO_ENC_H__
22 #define __GST_OMX_VIDEO_ENC_H__
25 #include <gst/video/video.h>
26 #include <gst/video/gstvideoencoder.h>
32 #define GST_TYPE_OMX_VIDEO_ENC \
33 (gst_omx_video_enc_get_type())
34 #define GST_OMX_VIDEO_ENC(obj) \
35 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_VIDEO_ENC,GstOMXVideoEnc))
36 #define GST_OMX_VIDEO_ENC_CLASS(klass) \
37 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_VIDEO_ENC,GstOMXVideoEncClass))
38 #define GST_OMX_VIDEO_ENC_GET_CLASS(obj) \
39 (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_VIDEO_ENC,GstOMXVideoEncClass))
40 #define GST_IS_OMX_VIDEO_ENC(obj) \
41 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_VIDEO_ENC))
42 #define GST_IS_OMX_VIDEO_ENC_CLASS(obj) \
43 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_VIDEO_ENC))
45 typedef struct _GstOMXVideoEnc GstOMXVideoEnc;
46 typedef struct _GstOMXVideoEncClass GstOMXVideoEncClass;
48 struct _GstOMXVideoEnc
50 GstVideoEncoder parent;
54 GstOMXPort *enc_in_port, *enc_out_port;
57 GstVideoCodecState *input_state;
58 /* TRUE if the component is configured and saw
61 /* TRUE if the ports where disabled after being activated the first time. */
64 GstClockTime last_upstream_ts;
69 /* TRUE if EOS buffers shouldn't be forwarded */
70 gboolean draining; /* protected by drain_lock */
74 guint32 target_bitrate; /* protected by object lock */
75 guint32 quant_i_frames;
76 guint32 quant_p_frames;
77 guint32 quant_b_frames;
78 #ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
84 guint32 initial_delay;
87 gboolean low_bandwidth;
93 gboolean dependent_slice;
94 gint default_roi_quality;
95 gboolean long_term_ref;
96 guint32 long_term_freq;
100 guint32 default_target_bitrate;
102 GstFlowReturn downstream_flow_ret;
104 GstOMXBufferAllocation input_allocation;
105 /* TRUE if encoder is passing dmabuf's fd directly to the OMX component */
106 gboolean input_dmabuf;
107 /* Number of buffers requested downstream */
108 guint nb_downstream_buffers;
110 /* TRUE if input buffers are from the pool we proposed to upstream */
111 gboolean in_pool_used;
113 #ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
114 GEnumClass *alg_roi_quality_enum_class;
118 struct _GstOMXVideoEncClass
120 GstVideoEncoderClass parent_class;
122 GstOMXClassData cdata;
124 gboolean (*set_format) (GstOMXVideoEnc * self, GstOMXPort * port, GstVideoCodecState * state);
125 GstCaps *(*get_caps) (GstOMXVideoEnc * self, GstOMXPort * port, GstVideoCodecState * state);
126 GstFlowReturn (*handle_output_frame) (GstOMXVideoEnc * self, GstOMXPort * port, GstOMXBuffer * buffer, GstVideoCodecFrame * frame);
129 GType gst_omx_video_enc_get_type (void);
133 #endif /* __GST_OMX_VIDEO_ENC_H__ */