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_PREVIEW_H__ 10 #define __MIX_VIDEOFORMATENC_PREVIEW_H__ 11 12 #include "mixvideoformatenc.h" 13 #include "mixvideoframe_private.h" 14 15 #define MIX_VIDEO_ENC_PREVIEW_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_PREVIEW (mix_videoformatenc_preview_get_type ()) 24 #define MIX_VIDEOFORMATENC_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_VIDEOFORMATENC_PREVIEW, MixVideoFormatEnc_Preview)) 25 #define MIX_IS_VIDEOFORMATENC_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_VIDEOFORMATENC_PREVIEW)) 26 #define MIX_VIDEOFORMATENC_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_VIDEOFORMATENC_PREVIEW, MixVideoFormatEnc_PreviewClass)) 27 #define MIX_IS_VIDEOFORMATENC_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_VIDEOFORMATENC_PREVIEW)) 28 #define MIX_VIDEOFORMATENC_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_VIDEOFORMATENC_PREVIEW, MixVideoFormatEnc_PreviewClass)) 29 30 typedef struct _MixVideoFormatEnc_Preview MixVideoFormatEnc_Preview; 31 typedef struct _MixVideoFormatEnc_PreviewClass MixVideoFormatEnc_PreviewClass; 32 33 struct _MixVideoFormatEnc_Preview { 34 /*< public > */ 35 MixVideoFormatEnc parent; 36 37 VABufferID coded_buf; 38 VABufferID seq_param_buf; 39 VABufferID pic_param_buf; 40 VABufferID slice_param_buf; 41 VASurfaceID * ci_shared_surfaces; 42 VASurfaceID * surfaces; 43 guint surface_num; 44 45 MixVideoFrame *cur_fame; //current input frame to be encoded; 46 MixVideoFrame *ref_fame; //reference frame 47 MixVideoFrame *rec_fame; //reconstructed frame; 48 49 guint basic_unit_size; //for rate control 50 guint disable_deblocking_filter_idc; 51 guint slice_num; 52 guint va_rcmode; 53 54 55 guint encoded_frames; 56 gboolean pic_skipped; 57 58 gboolean is_intra; 59 60 guint coded_buf_size; 61 62 /*< public > */ 63 }; 64 65 /** 66 * MixVideoFormatEnc_PreviewClass: 67 * 68 * MI-X Video object class 69 */ 70 struct _MixVideoFormatEnc_PreviewClass { 71 /*< public > */ 72 MixVideoFormatEncClass parent_class; 73 74 /* class members */ 75 76 /*< public > */ 77 }; 78 79 /** 80 * mix_videoformatenc_preview_get_type: 81 * @returns: type 82 * 83 * Get the type of object. 84 */ 85 GType mix_videoformatenc_preview_get_type(void); 86 87 /** 88 * mix_videoformatenc_preview_new: 89 * @returns: A newly allocated instance of #MixVideoFormatEnc_Preview 90 * 91 * Use this method to create new instance of #MixVideoFormatEnc_Preview 92 */ 93 MixVideoFormatEnc_Preview *mix_videoformatenc_preview_new(void); 94 95 /** 96 * mix_videoformatenc_preview_ref: 97 * @mix: object to add reference 98 * @returns: the MixVideoFormatEnc_Preview instance where reference count has been increased. 99 * 100 * Add reference count. 101 */ 102 MixVideoFormatEnc_Preview *mix_videoformatenc_preview_ref(MixVideoFormatEnc_Preview * mix); 103 104 /** 105 * mix_videoformatenc_preview_unref: 106 * @obj: object to unref. 107 * 108 * Decrement reference count of the object. 109 */ 110 #define mix_videoformatenc_preview_unref(obj) g_object_unref (G_OBJECT(obj)) 111 112 /* Class Methods */ 113 114 /* Pure preview vmethods */ 115 MIX_RESULT mix_videofmtenc_preview_getcaps(MixVideoFormatEnc *mix, GString *msg); 116 MIX_RESULT mix_videofmtenc_preview_initialize(MixVideoFormatEnc *mix, 117 MixVideoConfigParamsEnc * config_params_enc, 118 MixFrameManager * frame_mgr, 119 MixBufferPool * input_buf_pool, 120 MixSurfacePool ** surface_pool, 121 VADisplay va_display); 122 MIX_RESULT mix_videofmtenc_preview_encode(MixVideoFormatEnc *mix, MixBuffer * bufin[], 123 gint bufincnt, MixIOVec * iovout[], gint iovoutcnt, 124 MixVideoEncodeParams * encode_params); 125 MIX_RESULT mix_videofmtenc_preview_flush(MixVideoFormatEnc *mix); 126 MIX_RESULT mix_videofmtenc_preview_eos(MixVideoFormatEnc *mix); 127 MIX_RESULT mix_videofmtenc_preview_deinitialize(MixVideoFormatEnc *mix); 128 129 /* Local Methods */ 130 MIX_RESULT mix_videofmtenc_preview_process_encode (MixVideoFormatEnc_Preview *mix, MixBuffer * bufin, 131 MixIOVec * iovout); 132 133 #endif /* __MIX_VIDEOFORMATENC_PREVIEW_H__ */ 134