1 /* 2 * Copyright (C) 2012, Collabora Ltd. 3 * Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> 4 * 5 * Copyright (C) 2013, Lemote Ltd. 6 * Author: Chen Jie <chenj@lemote.com> 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation 11 * version 2.1 of the License. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 * 22 */ 23 24 #ifndef __GST_AMC_VIDEO_ENC_H__ 25 #define __GST_AMC_VIDEO_ENC_H__ 26 27 #include <gst/gst.h> 28 29 #include <gst/video/gstvideoencoder.h> 30 31 #include "gstamc.h" 32 33 G_BEGIN_DECLS 34 35 #define GST_TYPE_AMC_VIDEO_ENC \ 36 (gst_amc_video_enc_get_type()) 37 #define GST_AMC_VIDEO_ENC(obj) \ 38 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AMC_VIDEO_ENC,GstAmcVideoEnc)) 39 #define GST_AMC_VIDEO_ENC_CLASS(klass) \ 40 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AMC_VIDEO_ENC,GstAmcVideoEncClass)) 41 #define GST_AMC_VIDEO_ENC_GET_CLASS(obj) \ 42 (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AMC_VIDEO_ENC,GstAmcVideoEncClass)) 43 #define GST_IS_AMC_VIDEO_ENC(obj) \ 44 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AMC_VIDEO_ENC)) 45 #define GST_IS_AMC_VIDEO_ENC_CLASS(obj) \ 46 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AMC_VIDEO_ENC)) 47 typedef struct _GstAmcVideoEnc GstAmcVideoEnc; 48 typedef struct _GstAmcVideoEncClass GstAmcVideoEncClass; 49 50 struct _GstAmcVideoEnc 51 { 52 GstVideoEncoder parent; 53 54 /* < private > */ 55 GstAmcCodec *codec; 56 GstAmcFormat *amc_format; 57 58 GstVideoCodecState *input_state; 59 60 /* Input format of the codec */ 61 GstVideoFormat format; 62 GstAmcColorFormatInfo color_format_info; 63 64 guint bitrate; 65 guint i_frame_int; 66 67 /* TRUE if the component is configured and saw 68 * the first buffer */ 69 gboolean started; 70 gboolean flushing; 71 72 GstClockTime last_upstream_ts; 73 74 /* Draining state */ 75 GMutex drain_lock; 76 GCond drain_cond; 77 /* TRUE if EOS buffers shouldn't be forwarded */ 78 gboolean draining; 79 /* TRUE if the component is drained */ 80 gboolean drained; 81 82 GstFlowReturn downstream_flow_ret; 83 }; 84 85 struct _GstAmcVideoEncClass 86 { 87 GstVideoEncoderClass parent_class; 88 89 const GstAmcCodecInfo *codec_info; 90 }; 91 92 GType gst_amc_video_enc_get_type (void); 93 94 G_END_DECLS 95 96 #endif /* __GST_AMC_VIDEO_ENC_H__ */ 97