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_VIDEOFORMAT_H264_H__ 10 #define __MIX_VIDEOFORMAT_H264_H__ 11 12 #include "mixvideoformat.h" 13 #include "mixvideoframe_private.h" 14 15 #define MIX_VIDEO_H264_SURFACE_NUM 20 16 17 /* 18 * Type macros. 19 */ 20 #define MIX_TYPE_VIDEOFORMAT_H264 (mix_videoformat_h264_get_type ()) 21 #define MIX_VIDEOFORMAT_H264(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_VIDEOFORMAT_H264, MixVideoFormat_H264)) 22 #define MIX_IS_VIDEOFORMAT_H264(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_VIDEOFORMAT_H264)) 23 #define MIX_VIDEOFORMAT_H264_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_VIDEOFORMAT_H264, MixVideoFormat_H264Class)) 24 #define MIX_IS_VIDEOFORMAT_H264_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_VIDEOFORMAT_H264)) 25 #define MIX_VIDEOFORMAT_H264_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_VIDEOFORMAT_H264, MixVideoFormat_H264Class)) 26 27 typedef struct _MixVideoFormat_H264 MixVideoFormat_H264; 28 typedef struct _MixVideoFormat_H264Class MixVideoFormat_H264Class; 29 30 struct _MixVideoFormat_H264 { 31 /*< public > */ 32 MixVideoFormat parent; 33 34 /*< public > */ 35 36 /*< private > */ 37 GHashTable *dpb_surface_table; 38 }; 39 40 /** 41 * MixVideoFormat_H264Class: 42 * 43 * MI-X Video object class 44 */ 45 struct _MixVideoFormat_H264Class { 46 /*< public > */ 47 MixVideoFormatClass parent_class; 48 49 /* class members */ 50 51 /*< public > */ 52 }; 53 54 /** 55 * mix_videoformat_h264_get_type: 56 * @returns: type 57 * 58 * Get the type of object. 59 */ 60 GType mix_videoformat_h264_get_type(void); 61 62 /** 63 * mix_videoformat_h264_new: 64 * @returns: A newly allocated instance of #MixVideoFormat_H264 65 * 66 * Use this method to create new instance of #MixVideoFormat_H264 67 */ 68 MixVideoFormat_H264 *mix_videoformat_h264_new(void); 69 70 /** 71 * mix_videoformat_h264_ref: 72 * @mix: object to add reference 73 * @returns: the MixVideoFormat_H264 instance where reference count has been increased. 74 * 75 * Add reference count. 76 */ 77 MixVideoFormat_H264 *mix_videoformat_h264_ref(MixVideoFormat_H264 * mix); 78 79 /** 80 * mix_videoformat_h264_unref: 81 * @obj: object to unref. 82 * 83 * Decrement reference count of the object. 84 */ 85 #define mix_videoformat_h264_unref(obj) g_object_unref (G_OBJECT(obj)) 86 87 /* Class Methods */ 88 89 /* H.264 vmethods */ 90 MIX_RESULT mix_videofmt_h264_getcaps(MixVideoFormat *mix, GString *msg); 91 MIX_RESULT mix_videofmt_h264_initialize(MixVideoFormat *mix, 92 MixVideoConfigParamsDec * config_params, 93 MixFrameManager * frame_mgr, 94 MixBufferPool * input_buf_pool, 95 MixSurfacePool ** surface_pool, 96 VADisplay va_display); 97 MIX_RESULT mix_videofmt_h264_decode(MixVideoFormat *mix, MixBuffer * bufin[], 98 gint bufincnt, MixVideoDecodeParams * decode_params); 99 MIX_RESULT mix_videofmt_h264_flush(MixVideoFormat *mix); 100 MIX_RESULT mix_videofmt_h264_eos(MixVideoFormat *mix); 101 MIX_RESULT mix_videofmt_h264_deinitialize(MixVideoFormat *mix); 102 103 /* Local Methods */ 104 105 MIX_RESULT mix_videofmt_h264_handle_ref_frames(MixVideoFormat *mix, 106 VAPictureParameterBufferH264* pic_params, 107 MixVideoFrame * current_frame); 108 109 110 MIX_RESULT mix_videofmt_h264_process_decode(MixVideoFormat *mix, 111 vbp_data_h264 *data, 112 guint64 timestamp, 113 gboolean discontinuity); 114 115 116 MIX_RESULT mix_videofmt_h264_release_input_buffers(MixVideoFormat *mix, 117 guint64 timestamp); 118 119 120 /* Helper functions to manage the DPB table */ 121 gboolean mix_videofmt_h264_check_in_DPB(gpointer key, gpointer value, gpointer user_data); 122 void mix_videofmt_h264_destroy_DPB_key(gpointer data); 123 void mix_videofmt_h264_destroy_DPB_value(gpointer data); 124 guint mix_videofmt_h264_get_poc(VAPictureH264 *pic); 125 126 127 128 129 #endif /* __MIX_VIDEOFORMAT_H264_H__ */ 130