1 /* 2 INTEL CONFIDENTIAL 3 Copyright 2009 Intel Corporation All Rights Reserved. 4 The source code contained or described herein and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and licensors. The Material contains trade secrets and proprietary and confidential information of Intel or its suppliers and licensors. The Material is protected by worldwide copyright and trade secret laws and treaty provisions. No part of the Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed, or disclosed in any way without Intel’s prior express written permission. 5 6 No license under any patent, copyright, trade secret or other intellectual property right is granted to or conferred upon you by disclosure or delivery of the Materials, either expressly, by implication, inducement, estoppel or otherwise. Any license under such intellectual property rights must be express and approved by Intel in writing. 7 */ 8 9 #ifndef __MIX_VIDEOFORMATENC_MPEG4_H__ 10 #define __MIX_VIDEOFORMATENC_MPEG4_H__ 11 12 #include "mixvideoformatenc.h" 13 #include "mixvideoframe_private.h" 14 15 #define MIX_VIDEO_ENC_MPEG4_SURFACE_NUM 20 16 17 #define min(X,Y) (((X) < (Y)) ? (X) : (Y)) 18 #define max(X,Y) (((X) > (Y)) ? (X) : (Y)) 19 20 /* 21 * Type macros. 22 */ 23 #define MIX_TYPE_VIDEOFORMATENC_MPEG4 (mix_videoformatenc_mpeg4_get_type ()) 24 #define MIX_VIDEOFORMATENC_MPEG4(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_VIDEOFORMATENC_MPEG4, MixVideoFormatEnc_MPEG4)) 25 #define MIX_IS_VIDEOFORMATENC_MPEG4(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_VIDEOFORMATENC_MPEG4)) 26 #define MIX_VIDEOFORMATENC_MPEG4_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_VIDEOFORMATENC_MPEG4, MixVideoFormatEnc_MPEG4Class)) 27 #define MIX_IS_VIDEOFORMATENC_MPEG4_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_VIDEOFORMATENC_MPEG4)) 28 #define MIX_VIDEOFORMATENC_MPEG4_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_VIDEOFORMATENC_MPEG4, MixVideoFormatEnc_MPEG4Class)) 29 30 typedef struct _MixVideoFormatEnc_MPEG4 MixVideoFormatEnc_MPEG4; 31 typedef struct _MixVideoFormatEnc_MPEG4Class MixVideoFormatEnc_MPEG4Class; 32 33 struct _MixVideoFormatEnc_MPEG4 { 34 /*< public > */ 35 MixVideoFormatEnc parent; 36 37 38 VABufferID coded_buf; 39 VABufferID seq_param_buf; 40 VABufferID pic_param_buf; 41 VABufferID slice_param_buf; 42 VASurfaceID * ci_shared_surfaces; 43 VASurfaceID * surfaces; 44 guint surface_num; 45 46 MixVideoFrame *cur_fame; //current input frame to be encoded; 47 MixVideoFrame *ref_fame; //reference frame 48 MixVideoFrame *rec_fame; //reconstructed frame; 49 50 guchar profile_and_level_indication; 51 guint fixed_vop_time_increment; 52 guint disable_deblocking_filter_idc; 53 54 guint va_rcmode; 55 56 guint encoded_frames; 57 gboolean pic_skipped; 58 59 gboolean is_intra; 60 61 guint coded_buf_size; 62 63 /*< public > */ 64 }; 65 66 /** 67 * MixVideoFormatEnc_MPEG4Class: 68 * 69 * MI-X Video object class 70 */ 71 struct _MixVideoFormatEnc_MPEG4Class { 72 /*< public > */ 73 MixVideoFormatEncClass parent_class; 74 75 /* class members */ 76 77 /*< public > */ 78 }; 79 80 /** 81 * mix_videoformatenc_mpeg4_get_type: 82 * @returns: type 83 * 84 * Get the type of object. 85 */ 86 GType mix_videoformatenc_mpeg4_get_type(void); 87 88 /** 89 * mix_videoformatenc_mpeg4_new: 90 * @returns: A newly allocated instance of #MixVideoFormatEnc_MPEG4 91 * 92 * Use this method to create new instance of #MixVideoFormatEnc_MPEG4 93 */ 94 MixVideoFormatEnc_MPEG4 *mix_videoformatenc_mpeg4_new(void); 95 96 /** 97 * mix_videoformatenc_mpeg4_ref: 98 * @mix: object to add reference 99 * @returns: the MixVideoFormatEnc_MPEG4 instance where reference count has been increased. 100 * 101 * Add reference count. 102 */ 103 MixVideoFormatEnc_MPEG4 *mix_videoformatenc_mpeg4_ref(MixVideoFormatEnc_MPEG4 * mix); 104 105 /** 106 * mix_videoformatenc_mpeg4_unref: 107 * @obj: object to unref. 108 * 109 * Decrement reference count of the object. 110 */ 111 #define mix_videoformatenc_mpeg4_unref(obj) g_object_unref (G_OBJECT(obj)) 112 113 /* Class Methods */ 114 115 /* MPEG-4:2 vmethods */ 116 MIX_RESULT mix_videofmtenc_mpeg4_getcaps(MixVideoFormatEnc *mix, GString *msg); 117 MIX_RESULT mix_videofmtenc_mpeg4_initialize(MixVideoFormatEnc *mix, 118 MixVideoConfigParamsEnc * config_params_enc, 119 MixFrameManager * frame_mgr, 120 MixBufferPool * input_buf_pool, 121 MixSurfacePool ** surface_pool, 122 VADisplay va_display); 123 MIX_RESULT mix_videofmtenc_mpeg4_encode(MixVideoFormatEnc *mix, MixBuffer * bufin[], 124 gint bufincnt, MixIOVec * iovout[], gint iovoutcnt, 125 MixVideoEncodeParams * encode_params); 126 MIX_RESULT mix_videofmtenc_mpeg4_flush(MixVideoFormatEnc *mix); 127 MIX_RESULT mix_videofmtenc_mpeg4_eos(MixVideoFormatEnc *mix); 128 MIX_RESULT mix_videofmtenc_mpeg4_deinitialize(MixVideoFormatEnc *mix); 129 MIX_RESULT mix_videofmtenc_mpeg4_get_max_encoded_buf_size (MixVideoFormatEnc *mix, guint * max_size); 130 131 /* Local Methods */ 132 133 MIX_RESULT mix_videofmtenc_mpeg4_process_encode (MixVideoFormatEnc_MPEG4 *mix, MixBuffer * bufin, 134 MixIOVec * iovout); 135 136 #endif /* __MIX_VIDEOFORMATENC_MPEG4_H__ */ 137 138