1 /* 2 * Copyright (c) 2014, Ericsson AB. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without modification, 5 * are permitted provided that the following conditions are met: 6 * 7 * 1. Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * 10 * 2. Redistributions in binary form must reproduce the above copyright notice, this 11 * list of conditions and the following disclaimer in the documentation and/or other 12 * materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 23 * OF SUCH DAMAGE. 24 */ 25 26 /*/ 27 \*\ GstOpenh264Enc 28 /*/ 29 30 #ifndef _GST_OPENH264ENC_H_ 31 #define _GST_OPENH264ENC_H_ 32 33 #include <gst/video/video.h> 34 #include <gst/video/gstvideoencoder.h> 35 36 #include <wels/codec_api.h> 37 #include <wels/codec_app_def.h> 38 #include <wels/codec_def.h> 39 #include <wels/codec_ver.h> 40 41 G_BEGIN_DECLS 42 43 typedef enum _GstOpenh264encDeblockingMode 44 { 45 GST_OPENH264_DEBLOCKING_ON = 0, 46 GST_OPENH264_DEBLOCKING_OFF = 1, 47 GST_OPENH264_DEBLOCKING_NOT_SLICE_BOUNDARIES = 2 48 } GstOpenh264encDeblockingMode; 49 50 typedef enum 51 { 52 GST_OPENH264_SLICE_MODE_N_SLICES = 1, /* SM_FIXEDSLCNUM_SLICE */ 53 GST_OPENH264_SLICE_MODE_AUTO = 5 /* former SM_AUTO_SLICE */ 54 } GstOpenh264EncSliceMode; 55 56 #define GST_TYPE_OPENH264ENC (gst_openh264enc_get_type()) 57 #define GST_OPENH264ENC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPENH264ENC,GstOpenh264Enc)) 58 #define GST_OPENH264ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPENH264ENC,GstOpenh264EncClass)) 59 #define GST_IS_OPENH264ENC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPENH264ENC)) 60 #define GST_IS_OPENH264ENC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPENH264ENC)) 61 62 typedef struct _GstOpenh264Enc GstOpenh264Enc; 63 typedef struct _GstOpenh264EncClass GstOpenh264EncClass; 64 65 struct _GstOpenh264Enc 66 { 67 GstVideoEncoder base_openh264enc; 68 69 /*< private >*/ 70 ISVCEncoder *encoder; 71 EUsageType usage_type; 72 guint gop_size; 73 RC_MODES rate_control; 74 guint max_slice_size; 75 guint bitrate; 76 guint max_bitrate; 77 guint qp_min; 78 guint qp_max; 79 guint framerate; 80 guint multi_thread; 81 gboolean enable_denoise; 82 gboolean enable_frame_skip; 83 GstVideoCodecState *input_state; 84 guint64 time_per_frame; 85 guint64 frame_count; 86 guint64 previous_timestamp; 87 GstOpenh264encDeblockingMode deblocking_mode; 88 gboolean background_detection; 89 gboolean adaptive_quantization; 90 gboolean scene_change_detection; 91 GstOpenh264EncSliceMode slice_mode; 92 guint num_slices; 93 ECOMPLEXITY_MODE complexity; 94 gboolean bitrate_changed; 95 gboolean max_bitrate_changed; 96 }; 97 98 struct _GstOpenh264EncClass 99 { 100 GstVideoEncoderClass base_openh264enc_class; 101 }; 102 103 GType gst_openh264enc_get_type(void); 104 105 G_END_DECLS 106 #endif 107